Copyright | (c) Karl Cronburg 2018 |
---|---|
License | BSD3 |
Maintainer | karl@cs.tufts.edu |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
:: (Eq i, Ord s, Eq s, Show s, Show i, Show n, Show v, Hashable i, Hashable s) | |
=> [(n, DFA s i)] | Association list of named DFAs. |
-> (Lexeme s -> n -> v) | Constructs the value of a token from lexeme matched. |
-> [s] | The input string. |
-> [Token n v] | The tokenized tokens. |
Entrypoint for tokenizing an input stream given a list of named DFAs that we can match on.
@dfaTuples@: converts from DFAs to the names associated with them in
the specification of the lexer.
@fncn@: function for constructing the value of a token from the lexeme
matched (e.g. varName
) and the associated token name (e.g. id
)
Token with names n
, values v
, and number of input symbols consumed to match
it.
Instances
tokenValue :: Token n v -> v Source #
Get the value of a token, ignoring its name.