BNFC-2.9.6.2: A compiler front-end generator.
Safe HaskellSafe-Inferred
LanguageHaskell2010

BNFC.Lex

Synopsis

Documentation

alex_accept :: Array Int (AlexAcc user) Source #

alex_actions :: Array Int (Posn -> String -> Token) Source #

alex_action_3 :: Posn -> String -> Token Source #

alex_action_4 :: Posn -> String -> Token Source #

alex_action_5 :: Posn -> String -> Token Source #

alex_action_6 :: Posn -> String -> Token Source #

alex_action_7 :: Posn -> String -> Token Source #

alex_action_8 :: Posn -> String -> Token Source #

alex_action_9 :: Posn -> String -> Token Source #

data AlexAddr Source #

Constructors

AlexA# Addr# 

quickIndex :: Array Int (AlexAcc (Any :: Type)) -> Int -> AlexAcc (Any :: Type) Source #

alexScan :: (Posn, Char, [Byte], String) -> Int -> AlexReturn (Posn -> String -> Token) Source #

alexScanUser :: t -> (Posn, Char, [Byte], String) -> Int -> AlexReturn (Posn -> String -> Token) Source #

alex_scan_tkn :: t -> t -> Int# -> AlexInput -> Int# -> AlexLastAcc -> (AlexLastAcc, (Posn, Char, [Byte], String)) Source #

data AlexAcc user Source #

Constructors

AlexAccNone 
AlexAcc Int 
AlexAccSkip 

tok :: (String -> Tok) -> Posn -> String -> Token Source #

Create a token with position.

data Tok Source #

Token without position.

Constructors

TK !TokSymbol

Reserved word or symbol.

TL !String

String literal.

TI !String

Integer literal.

TV !String

Identifier.

TD !String

Float literal.

TC !String

Character literal.

T_Identifier !String 

Instances

Instances details
Show Tok Source # 
Instance details

Defined in BNFC.Lex

Methods

showsPrec :: Int -> Tok -> ShowS

show :: Tok -> String

showList :: [Tok] -> ShowS

Eq Tok Source # 
Instance details

Defined in BNFC.Lex

Methods

(==) :: Tok -> Tok -> Bool

(/=) :: Tok -> Tok -> Bool

Ord Tok Source # 
Instance details

Defined in BNFC.Lex

Methods

compare :: Tok -> Tok -> Ordering

(<) :: Tok -> Tok -> Bool

(<=) :: Tok -> Tok -> Bool

(>) :: Tok -> Tok -> Bool

(>=) :: Tok -> Tok -> Bool

max :: Tok -> Tok -> Tok

min :: Tok -> Tok -> Tok

pattern TS :: String -> Int -> Tok Source #

Smart constructor for Tok for the sake of backwards compatibility.

data TokSymbol Source #

Keyword or symbol tokens have a unique ID.

Constructors

TokSymbol 

Fields

  • tsText :: String

    Keyword or symbol text.

  • tsID :: !Int

    Unique ID.

Instances

Instances details
Show TokSymbol Source # 
Instance details

Defined in BNFC.Lex

Methods

showsPrec :: Int -> TokSymbol -> ShowS

show :: TokSymbol -> String

showList :: [TokSymbol] -> ShowS

Eq TokSymbol Source #

Keyword/symbol equality is determined by the unique ID.

Instance details

Defined in BNFC.Lex

Methods

(==) :: TokSymbol -> TokSymbol -> Bool

(/=) :: TokSymbol -> TokSymbol -> Bool

Ord TokSymbol Source #

Keyword/symbol ordering is determined by the unique ID.

Instance details

Defined in BNFC.Lex

Methods

compare :: TokSymbol -> TokSymbol -> Ordering

(<) :: TokSymbol -> TokSymbol -> Bool

(<=) :: TokSymbol -> TokSymbol -> Bool

(>) :: TokSymbol -> TokSymbol -> Bool

(>=) :: TokSymbol -> TokSymbol -> Bool

max :: TokSymbol -> TokSymbol -> TokSymbol

min :: TokSymbol -> TokSymbol -> TokSymbol

data Token Source #

Token with position.

Constructors

PT Posn Tok 
Err Posn 

Instances

Instances details
Show Token Source # 
Instance details

Defined in BNFC.Lex

Methods

showsPrec :: Int -> Token -> ShowS

show :: Token -> String

showList :: [Token] -> ShowS

Eq Token Source # 
Instance details

Defined in BNFC.Lex

Methods

(==) :: Token -> Token -> Bool

(/=) :: Token -> Token -> Bool

Ord Token Source # 
Instance details

Defined in BNFC.Lex

Methods

compare :: Token -> Token -> Ordering

(<) :: Token -> Token -> Bool

(<=) :: Token -> Token -> Bool

(>) :: Token -> Token -> Bool

(>=) :: Token -> Token -> Bool

max :: Token -> Token -> Token

min :: Token -> Token -> Token

printPosn :: Posn -> String Source #

Pretty print a position.

tokenPos :: [Token] -> String Source #

Pretty print the position of the first token in the list.

tokenPosn :: Token -> Posn Source #

Get the position of a token.

tokenLineCol :: Token -> (Int, Int) Source #

Get line and column of a token.

posLineCol :: Posn -> (Int, Int) Source #

Get line and column of a position.

mkPosToken :: Token -> ((Int, Int), String) Source #

Convert a token into "position token" form.

tokenText :: Token -> String Source #

Convert a token to its text.

prToken :: Token -> String Source #

Convert a token to a string.

data BTree Source #

Finite map from text to token organized as binary search tree.

Constructors

N

Nil (leaf).

B String Tok BTree BTree

Binary node.

Instances

Instances details
Show BTree Source # 
Instance details

Defined in BNFC.Lex

Methods

showsPrec :: Int -> BTree -> ShowS

show :: BTree -> String

showList :: [BTree] -> ShowS

eitherResIdent :: (String -> Tok) -> String -> Tok Source #

Convert potential keyword into token or use fallback conversion.

resWords :: BTree Source #

The keywords and symbols of the language organized as binary search tree.

unescapeInitTail :: String -> String Source #

Unquote string literal.

data Posn Source #

Constructors

Pn !Int !Int !Int 

Instances

Instances details
Show Posn Source # 
Instance details

Defined in BNFC.Lex

Methods

showsPrec :: Int -> Posn -> ShowS

show :: Posn -> String

showList :: [Posn] -> ShowS

Eq Posn Source # 
Instance details

Defined in BNFC.Lex

Methods

(==) :: Posn -> Posn -> Bool

(/=) :: Posn -> Posn -> Bool

Ord Posn Source # 
Instance details

Defined in BNFC.Lex

Methods

compare :: Posn -> Posn -> Ordering

(<) :: Posn -> Posn -> Bool

(<=) :: Posn -> Posn -> Bool

(>) :: Posn -> Posn -> Bool

(>=) :: Posn -> Posn -> Bool

max :: Posn -> Posn -> Posn

min :: Posn -> Posn -> Posn

alexMove :: Posn -> Char -> Posn Source #

type Byte = Word8 Source #

type AlexInput = (Posn, Char, [Byte], String) Source #

tokens :: String -> [Token] Source #

utf8Encode :: Char -> [Word8] Source #

Encode a Haskell String to a list of Word8 values, in UTF8 format.