aboutsummaryrefslogtreecommitdiff
path: root/driver/lexer.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add lex modeRyo Nihei2021-05-041-36/+99
| | | | | | | | | | lex mode is a feature that separates transition tables per each mode. The lexer starts from an initial state indicated by `initial_state` field and transitions between modes according to `push` and `pop` fields. The initial state will always be `default`. Currently, maleeni doesn't provide the ability to change the initial state. You can specify the modes of each lex entry using `modes` field. When the mode isn't indicated explicitly, the entries have `default` mode.
* Generate an invalid token from incompleted input.Ryo Nihei2021-05-021-0/+5
| | | | When the lexer's buffer has unaccepted data and reads the EOF, the lexer treats the buffered data as an invalid token.
* Add validation of lexical specs and improve error messagesRyo Nihei2021-04-171-1/+1
|
* Print the result of the lex command in JSON formatRyo Nihei2021-04-061-20/+66
| | | | | * Print the result of the lex command in JSON format. * Print the EOF token.
* Add logging to lex commandRyo Nihei2021-02-161-3/+58
| | | | | lex command writes logs out to the maleeni-lex.log file. When you generate a lexer using driver.NewLexer(), you can choose whether the lexer writes logs or not.
* Add types of lexical specificationsRyo Nihei2021-02-161-14/+16
| | | | APIs of compiler and driver packages use these types. Because CompiledLexSpec struct a lexer takes has kind names of lexical specification entries, the lexer sets them to tokens.
* Add driverRyo Nihei2021-02-141-0/+162
The driver takes a DFA and an input text and generates a lexer. The lexer tokenizes the input text according to the lexical specification that the DFA expresses.