futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Language.Futhark.Parser.Lexer.Tokens

Description

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
- readHexRealLit :: RealFloat a => Text -> a

# Documentation

data Token Source #

A lexical token. It does not itself contain position information, so in practice the parser will consume tokens tagged with a source position.

Constructors

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 |

#### Instances

Instances details

Show Token Source # |
Instance details Defined in Language.Futhark.Parser.Lexer.Tokens Methods showsPrec :: Int -> Token -> ShowS Source # show :: Token -> String Source # showList :: [Token] -> ShowS Source #
Eq Token Source # |
Instance details Defined in Language.Futhark.Parser.Lexer.Tokens Methods (==) :: Token -> Token -> Bool Source # (/=) :: Token -> Token -> Bool Source #
Ord Token Source # |
Instance details Defined in Language.Futhark.Parser.Lexer.Tokens Methods compare :: Token -> Token -> Ordering Source # (<) :: Token -> Token -> Bool Source # (<=) :: Token -> Token -> Bool Source # (>) :: Token -> Token -> Bool Source # (>=) :: Token -> Token -> Bool Source # max :: Token -> Token -> Token Source # min :: Token -> Token -> Token Source #

fromRoman :: Integral a => Text -> a Source #

symbol :: [Name] -> Name -> Token Source #

mkQualId :: Text -> ([Name], Name) Source #

tokenC :: a -> ByteString -> a Source #

tokenS :: (Text -> a) -> ByteString -> a Source #

suffZero :: Text -> Text Source #

Suffix a zero if the last character is dot.

tryRead :: Read a => String -> Text -> a Source #

decToken :: Integral a => (a -> Token) -> ByteString -> Token Source #

binToken :: Integral a => (a -> Token) -> ByteString -> Token Source #

hexToken :: Integral a => (a -> Token) -> ByteString -> Token Source #

romToken :: Integral a => (a -> Token) -> ByteString -> Token Source #

readHexRealLit :: RealFloat a => Text -> a Source #