Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Definition of the tokens used in the lexer.
Also defines other useful building blocks for constructing tokens.
Synopsis
- data Token
- = ID Name
- | COMMENT Text
- | INDEXING
- | SYMBOL BinOp [Name] Name
- | CONSTRUCTOR Name
- | NATLIT Name Integer
- | 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
- | 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 Text
- | EOF
- | HOLE
- | ERROR Text
- fromRoman :: Integral a => Text -> a
- symbol :: [Name] -> Name -> Token
- mkQualId :: Text -> ([Name], Name)
- tokenC :: a -> ByteString -> a
- tokenS :: (Text -> a) -> ByteString -> a
- suffZero :: Text -> Text
- tryRead :: Read a => String -> Text -> a
- decToken :: Integral a => (a -> Token) -> ByteString -> Token
- binToken :: Integral a => (a -> Token) -> ByteString -> Token
- hexToken :: Integral a => (a -> Token) -> ByteString -> Token
- romToken :: Integral a => (a -> Token) -> ByteString -> Token
- advance :: Pos -> ByteString -> Pos
- readHexRealLit :: RealFloat a => Text -> 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.
tokenC :: a -> ByteString -> a Source #
tokenS :: (Text -> a) -> ByteString -> a Source #
readHexRealLit :: RealFloat a => Text -> a Source #