[LEX] Token definition
This commit is contained in:
parent
d581a14459
commit
842c344ef1
1 changed files with 28 additions and 0 deletions
28
src/lexer.py
Normal file
28
src/lexer.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import ply.lex as lex
|
||||||
|
|
||||||
|
tokens = [
|
||||||
|
"ID",
|
||||||
|
"STR"
|
||||||
|
"DATE",
|
||||||
|
"TIME",
|
||||||
|
"DATETIME",
|
||||||
|
"INT",
|
||||||
|
"FLOAT", # need to implement exponents check https://toml.io/en/
|
||||||
|
"HEX",
|
||||||
|
"BIN",
|
||||||
|
"OCT",
|
||||||
|
"INF",
|
||||||
|
"NAN",
|
||||||
|
"COMMENT",
|
||||||
|
]
|
||||||
|
|
||||||
|
def t_COMMENT(t):
|
||||||
|
r"#.*"
|
||||||
|
pass
|
||||||
|
|
||||||
|
t_ignore = "\n\t "
|
||||||
|
|
||||||
|
literals = "[]{},="
|
||||||
|
|
||||||
|
|
||||||
|
lexer = lex.lex()
|
Loading…
Reference in a new issue