Detect brackets.

This commit is contained in:
Jussi Pakkanen 2012-12-23 17:19:26 +02:00
parent af7c9dd6e0
commit 26ee2483b5
1 changed files with 5 additions and 0 deletions

View File

@ -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')