Detect brackets.
This commit is contained in:
parent
af7c9dd6e0
commit
26ee2483b5
|
@ -19,6 +19,8 @@ import ply.yacc as yacc
|
|||
|
||||
tokens = ['LPAREN',
|
||||
'RPAREN',
|
||||
'LBRACKET',
|
||||
'RBRACKET',
|
||||
'VARIABLE',
|
||||
'COMMENT',
|
||||
'EQUALS',
|
||||
|
@ -32,6 +34,8 @@ tokens = ['LPAREN',
|
|||
t_EQUALS = '='
|
||||
t_LPAREN = '\('
|
||||
t_RPAREN = '\)'
|
||||
t_LBRACKET = '\['
|
||||
t_RBRACKET = '\]'
|
||||
t_VARIABLE = '[a-zA-Z][_0-9a-zA-Z]*'
|
||||
t_COMMENT = '\#[^\n]*'
|
||||
t_COMMA = ','
|
||||
|
@ -48,6 +52,7 @@ def t_error(t):
|
|||
|
||||
def test_lexer():
|
||||
s = """hello = (something) # this = (that)
|
||||
two = ['file1', 'file2']
|
||||
function(h)
|
||||
obj.method(lll, \\
|
||||
'string')
|
||||
|
|
Loading…
Reference in New Issue