Finish main task, start refactoring
This commit is contained in:
@@ -16,12 +16,13 @@ reserved = {
|
||||
'false': 'FALSE'
|
||||
}
|
||||
|
||||
# List of token names. This is always required
|
||||
# List of token names. This is always requiredy
|
||||
tokens = [
|
||||
'ID',
|
||||
'CONST',
|
||||
'AOP',
|
||||
'RELOP',
|
||||
'COMP',
|
||||
'EQOP',
|
||||
'LOP',
|
||||
'ASSIGN',
|
||||
'LPAREN', 'RPAREN',
|
||||
@@ -31,11 +32,11 @@ tokens = [
|
||||
] + list(reserved.values())
|
||||
|
||||
# Simple tokens
|
||||
t_LPAREN = r'\('
|
||||
t_RPAREN = r'\)'
|
||||
t_LBRACE = r'\{'
|
||||
t_RBRACE = r'\}'
|
||||
t_COMMA = r','
|
||||
t_LPAREN = r'\('
|
||||
t_RPAREN = r'\)'
|
||||
t_LBRACE = r'\{'
|
||||
t_RBRACE = r'\}'
|
||||
t_COMMA = r','
|
||||
t_SEMICOLON = r';'
|
||||
t_ASSIGN = r'='
|
||||
|
||||
@@ -43,10 +44,13 @@ t_ASSIGN = r'='
|
||||
t_AOP = r'\+|\-|\*|/'
|
||||
|
||||
# Comparison operators
|
||||
t_RELOP = r'<=|>=|==|!=|<|>'
|
||||
t_COMP = r'<=|>=|<|>'
|
||||
|
||||
# Equality operators
|
||||
t_EQOP = r'\|\||&&|==|!='
|
||||
|
||||
# Logical operators
|
||||
t_LOP = r'\|\||&&|==|!='
|
||||
t_LOP = r'\|\||&&'
|
||||
|
||||
# IDs
|
||||
def t_ID(t):
|
||||
|
||||
Reference in New Issue
Block a user