happy-lib-2.1.7: Happy is a parser generator for Haskell implemented using this library

Safe Haskell | None
Language | Haskell98

Happy.Frontend.AbsSyn

Synopsis

- data BookendedAbsSyn = BookendedAbsSyn (Maybe String) (Maybe String) (AbsSyn String) (Maybe String)
- data AbsSyn e = AbsSyn [Directive String] [Rule e]
- data Directive a
  - = TokenType String
  - | TokenSpec [(a, TokenSpec)]
  - | TokenName String (Maybe String) Bool
  - | TokenLexer String String
  - | TokenImportedIdentity
  - | TokenMonad String String String String
  - | TokenNonassoc [String]
  - | TokenRight [String]
  - | TokenLeft [String]
  - | TokenExpect Int
  - | TokenError String (Maybe String)
  - | TokenErrorExpected
  - | TokenErrorHandlerType String
  - | TokenAttributetype String
  - | TokenAttribute String String
- getTokenType :: [Directive t] -> String
- getTokenSpec :: [Directive t] -> [(t, TokenSpec)]
- getParserNames :: [Directive t] -> [Directive t]
- getLexer :: [Directive t] -> Maybe (String, String)
- getImportedIdentity :: [Directive t] -> Bool
- getMonad :: [Directive t] -> (Bool, String, String, String, String)
- data ErrorHandlerInfo
  - = DefaultErrorHandler
  - | CustomErrorHandler String
  - | ResumptiveErrorHandler String String
- getError :: [Directive t] -> ErrorHandlerInfo
- getPrios :: [Directive t] -> [Directive t]
- getPrioNames :: Directive t -> [String]
- getExpect :: [Directive t] -> Maybe Int
- getErrorExpectedMode :: Eq t => [Directive t] -> ErrorExpectedMode
- getAttributes :: [Directive t] -> [(String, String)]
- getAttributetype :: [Directive t] -> Maybe String
- getAttributeGrammarExtras :: [Directive t] -> Maybe AttributeGrammarExtras
- parseTokenSpec :: String -> TokenSpec
- data Rule e = Rule String [String] [Prod e] (Maybe String)
- data Prod e = Prod [Term] e Int Prec
- data Term = App String [Term]
- data Prec
  - = PrecNone
  - | PrecShift
  - | PrecId String
- data TokenSpec
  - = TokenFixed String
  - | TokenWithValue ExpressionWithHole

# Documentation

data BookendedAbsSyn #

Constructors

BookendedAbsSyn (Maybe String) (Maybe String) (AbsSyn String) (Maybe String) |

data AbsSyn e #

Constructors

AbsSyn [Directive String] [Rule e] |

data Directive a #

Constructors

TokenType String |
TokenSpec [(a, TokenSpec)] |
TokenName String (Maybe String) Bool |
TokenLexer String String |
TokenImportedIdentity |
TokenMonad String String String String |
TokenNonassoc [String] |
TokenRight [String] |
TokenLeft [String] |
TokenExpect Int |
TokenError String (Maybe String) |
TokenErrorExpected |
TokenErrorHandlerType String |
TokenAttributetype String |
TokenAttribute String String |

#### Instances

Instances details

Show a => Show (Directive a) # |
Instance details Defined in Happy.Frontend.AbsSyn Methods showsPrec :: Int -> Directive a -> ShowS # show :: Directive a -> String # showList :: [Directive a] -> ShowS #
Eq a => Eq (Directive a) # |
Instance details Defined in Happy.Frontend.AbsSyn Methods (==) :: Directive a -> Directive a -> Bool # (/=) :: Directive a -> Directive a -> Bool #

getTokenType :: [Directive t] -> String #

getTokenSpec :: [Directive t] -> [(t, TokenSpec)] #

getParserNames :: [Directive t] -> [Directive t] #

getLexer :: [Directive t] -> Maybe (String, String) #

getImportedIdentity :: [Directive t] -> Bool #

getMonad :: [Directive t] -> (Bool, String, String, String, String) #

data ErrorHandlerInfo #

Constructors

DefaultErrorHandler | Default handler `happyError`
CustomErrorHandler String | Call this handler on error.
ResumptiveErrorHandler String String | `ResumptiveErrorHandler abort report`: Upon encountering a parse error, call non-fatal function `report`. Then try to resume parsing by finding a catch production. If that ultimately fails, call `abort`.

getError :: [Directive t] -> ErrorHandlerInfo #

getPrios :: [Directive t] -> [Directive t] #

getPrioNames :: Directive t -> [String] #

getExpect :: [Directive t] -> Maybe Int #

getErrorExpectedMode :: Eq t => [Directive t] -> ErrorExpectedMode #

getAttributes :: [Directive t] -> [(String, String)] #

getAttributetype :: [Directive t] -> Maybe String #

getAttributeGrammarExtras :: [Directive t] -> Maybe AttributeGrammarExtras #

parseTokenSpec :: String -> TokenSpec #

Parse a token spec.

The first occurence of `$$` indicates an expression in which the `$$` will be substituted for the actual lexed token. `$$` in string or char literals ('".."' and '\'.'') however does not count.

data Rule e #

Constructors

Rule String [String] [Prod e] (Maybe String) |

data Prod e #

Constructors

Prod [Term] e Int Prec |

data Term #

Constructors

App String [Term] |

data Prec #

Constructors

PrecNone |
PrecShift |
PrecId String |

#### Instances

Instances details

Show Prec # |
Instance details Defined in Happy.Frontend.AbsSyn Methods showsPrec :: Int -> Prec -> ShowS # show :: Prec -> String # showList :: [Prec] -> ShowS #

data TokenSpec #

Constructors

TokenFixed String | The token is just a fixed value
TokenWithValue ExpressionWithHole | The token is an expression involving the value of the lexed token.

#### Instances

Instances details

Show TokenSpec |
Instance details Defined in Happy.Grammar Methods showsPrec :: Int -> TokenSpec -> ShowS # show :: TokenSpec -> String # showList :: [TokenSpec] -> ShowS #
Eq TokenSpec |
Instance details Defined in Happy.Grammar Methods (==) :: TokenSpec -> TokenSpec -> Bool # (/=) :: TokenSpec -> TokenSpec -> Bool #