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