Safe Haskell | None |
---|---|
Language | Haskell2010 |
Definition of the tokens used in the lexer.
Also defines other useful building blocks for constructing tokens.
Synopsis
- data Token
- = ID Name
- | INDEXING Name
- | QUALINDEXING [Name] Name
- | QUALPAREN [Name] Name
- | SYMBOL BinOp [Name] Name
- | CONSTRUCTOR Name
- | PROJ_INTFIELD Name
- | INTLIT Integer
- | STRINGLIT Text
- | I8LIT Int8
- | I16LIT Int16
- | I32LIT Int32
- | I64LIT Int64
- | U8LIT Word8
- | U16LIT Word16
- | U32LIT Word32
- | U64LIT Word64
- | FLOATLIT Double
- | F16LIT Half
- | F32LIT Float
- | F64LIT Double
- | CHARLIT Char
- | COLON
- | COLON_GT
- | BACKSLASH
- | APOSTROPHE
- | APOSTROPHE_THEN_HAT
- | APOSTROPHE_THEN_TILDE
- | BACKTICK
- | HASH_LBRACKET
- | DOT
- | TWO_DOTS
- | TWO_DOTS_LT
- | TWO_DOTS_GT
- | THREE_DOTS
- | LPAR
- | RPAR
- | RPAR_THEN_LBRACKET
- | LBRACKET
- | RBRACKET
- | LCURLY
- | RCURLY
- | COMMA
- | UNDERSCORE
- | RIGHT_ARROW
- | QUESTION_MARK
- | EQU
- | ASTERISK
- | NEGATE
- | BANG
- | DOLLAR
- | LTH
- | HAT
- | TILDE
- | PIPE
- | IF
- | THEN
- | ELSE
- | DEF
- | LET
- | LOOP
- | IN
- | FOR
- | DO
- | WITH
- | ASSERT
- | TRUE
- | FALSE
- | WHILE
- | INCLUDE
- | IMPORT
- | ENTRY
- | TYPE
- | MODULE
- | VAL
- | OPEN
- | LOCAL
- | MATCH
- | CASE
- | DOC String
- | EOF
- | HOLE
- type Lexeme a = (Pos, Pos, a)
- fromRoman :: Integral a => Text -> a
- symbol :: [Name] -> Name -> Token
- mkQualId :: Text -> Alex ([Name], Name)
- tokenPosM :: ((Loc, Text) -> Alex a) -> (Pos, Char, ByteString, Int64) -> Int64 -> Alex (Lexeme a)
- tokenM :: (Text -> Alex a) -> (Pos, Char, ByteString, Int64) -> Int64 -> Alex (Lexeme a)
- tokenC :: a -> (Pos, Char, ByteString, Int64) -> Int64 -> Alex (Lexeme a)
- keyword :: Text -> Token
- tokenS :: (Text -> a) -> (Pos, Char, ByteString, Int64) -> Int64 -> Alex (Lexeme a)
- indexing :: (Loc, Text) -> Alex Name
- suffZero :: Text -> Text
- tryRead :: Read a => String -> Text -> Alex a
- readIntegral :: Integral a => Text -> a
- readHexRealLit :: RealFloat a => Text -> Alex a
Documentation
A lexical token. It does not itself contain position information, so in practice the parser will consume tokens tagged with a source position.
tokenPosM :: ((Loc, Text) -> Alex a) -> (Pos, Char, ByteString, Int64) -> Int64 -> Alex (Lexeme a) Source #
readIntegral :: Integral a => Text -> a Source #