Modulo and assign shortcuts
This commit is contained in:
parent
883f3b426c
commit
30c2d0e6d4
16
lexer.py
16
lexer.py
|
@ -21,18 +21,28 @@ reserved = {
|
|||
'Or': 'OR',
|
||||
}
|
||||
|
||||
literals = "+-*/(){}[]=,"
|
||||
literals = '+-*/%(){}[]=,'
|
||||
# List of token names
|
||||
tokens = [
|
||||
'STRING',
|
||||
'NUMBER',
|
||||
'EQUAL',
|
||||
'ISEQUAL',
|
||||
'PLUSASSIGN',
|
||||
'MINUSASSIGN',
|
||||
'TIMESASSIGN',
|
||||
'DIVASSIGN',
|
||||
'MODASSIGN',
|
||||
'NEWLINE',
|
||||
'ID',
|
||||
] + list(reserved.values())
|
||||
|
||||
# common regex
|
||||
t_EQUAL = r'=='
|
||||
t_ISEQUAL = r'=='
|
||||
t_PLUSASSIGN = r'\+='
|
||||
t_MINUSASSIGN = r'\-='
|
||||
t_TIMESASSIGN = r'\*='
|
||||
t_DIVASSIGN = r'\/='
|
||||
t_MODASSIGN = r'\%='
|
||||
# Comments
|
||||
t_ignore_COMMENT = r'\//.*'
|
||||
|
||||
|
|
Loading…
Reference in New Issue