fix string to not include doublequotes in value

This commit is contained in:
Josh Holtrop 2011-08-30 13:35:39 -04:00
parent 905448378e
commit ba80f5d9f7

View File

@ -14,7 +14,6 @@ tokens = [
t_LPAREN = r'\(' t_LPAREN = r'\('
t_RPAREN = r'\)' t_RPAREN = r'\)'
t_SEMICOLON = r';' t_SEMICOLON = r';'
t_STRING = r'"([^"])*"'
t_ignore = ' \t\r' t_ignore = ' \t\r'
@ -23,6 +22,11 @@ def t_ID(t):
t.type = reserved.get(t.value, 'ID') t.type = reserved.get(t.value, 'ID')
return t return t
def t_STRING(t):
r'"([^"])*"'
t.value = t.value[1:-1]
return t
def t_newline(t): def t_newline(t):
r'\n+' r'\n+'
t.lexer.lineno += len(t.value) t.lexer.lineno += len(t.value)