Detect braces.

pull/15/head
Jussi Pakkanen 12 years ago
parent 26ee2483b5
commit 99298c8f72
  1. 6
      builder.py

@ -21,6 +21,8 @@ tokens = ['LPAREN',
'RPAREN', 'RPAREN',
'LBRACKET', 'LBRACKET',
'RBRACKET', 'RBRACKET',
'LBRACE',
'RBRACE',
'VARIABLE', 'VARIABLE',
'COMMENT', 'COMMENT',
'EQUALS', 'EQUALS',
@ -36,6 +38,8 @@ t_LPAREN = '\('
t_RPAREN = '\)' t_RPAREN = '\)'
t_LBRACKET = '\[' t_LBRACKET = '\['
t_RBRACKET = '\]' t_RBRACKET = '\]'
t_LBRACE = '\{'
t_RBRACE = '\}'
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 = ','
@ -53,7 +57,7 @@ def t_error(t):
def test_lexer(): def test_lexer():
s = """hello = (something) # this = (that) s = """hello = (something) # this = (that)
two = ['file1', 'file2'] two = ['file1', 'file2']
function(h) function(h) { stuff }
obj.method(lll, \\ obj.method(lll, \\
'string') 'string')
""" """

Loading…
Cancel
Save