Ply.lex Unspecified token error

1.2k Views Asked by At

Hello I am trying to make a simple lexer, to read KML(google maps). But I have a problem in several parts. And get an "unspecified token error"(ONLY included the part causing the error)

import ply.lex as lex
import re
tokens = (
'PLACEMARKER_1'
'ENTRYNAME',
'COORDINATES'
'PLACEMARKER_2',
)
t_PLACEMARKER_1  = r'<Placemark>'
t_ENTRYNAME      = r'<name>.*</name>'
t_COORDINATES    = r'<Point>\n<coordinates>[0-9]+(?:\.[0-9]+)*,[0-9]+(?:\.[0-9]+)*,0</coordinates>\n</Point>'
t_PLACEMARKER_2  = r'</Placemark>'
t_ignore         = ' t\v\r'
hl = lex.lex()
hl.input(Test_1)
while True:
    tok = hl.token()
    if not tok: break
    print tok

Please help, it will be appreciated... :D

1

There are 1 best solutions below

0
On BEST ANSWER

Remember to use commas... Always remember to use COMMAS!