From 4a8841380e52cbad171997a1b70e45502f5e05e8 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 4 Feb 2013 17:24:43 +0000 Subject: Fix property list parsing QUOTEDSTRING (double quotes) is just not a thing in tikz. Also, allow keys to be {-quoted as well as values. --- tikzit/src/common/tikzlexer.lm | 6 ------ tikzit/src/common/tikzparser.ym | 9 ++++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/tikzit/src/common/tikzlexer.lm b/tikzit/src/common/tikzlexer.lm index 26cddd9..f0b6546 100644 --- a/tikzit/src/common/tikzlexer.lm +++ b/tikzit/src/common/tikzlexer.lm @@ -85,12 +85,6 @@ at { tokenpos += yyleng; return AT; } } -\"[^\"]*\" /* " */ { - tokenpos += yyleng; - yylval.nsstr=[NSString stringWithUTF8String:yytext]; - return QUOTEDSTRING; -} - \{ { NSMutableString *buf = [NSMutableString string]; unsigned int brace_depth = 1; diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym index 487cfd4..26f0e0d 100644 --- a/tikzit/src/common/tikzparser.ym +++ b/tikzit/src/common/tikzparser.ym @@ -1,4 +1,4 @@ -%expect 6 +// %expect 3 %{ // @@ -66,7 +66,6 @@ extern void yyerror(const char *str); %token REALNUMBER %token NATURALNUMBER %token LWORD -%token QUOTEDSTRING %token DELIMITEDSTRING %type nodename @@ -94,14 +93,14 @@ properties: property extraproperties; extraproperties: COMMA property extraproperties | property extraproperties | ; property: - propsyms EQUALS val + val EQUALS val { TikzGraphAssembler *a = [TikzGraphAssembler currentAssembler]; GraphElementProperty *p = [[GraphElementProperty alloc] initWithPropertyValue:$3 forKey:$1]; [[a data] addObject:p]; [p release]; } - | propsyms + | val { TikzGraphAssembler *a = [TikzGraphAssembler currentAssembler]; GraphElementProperty *p = [[GraphElementProperty alloc] initWithAtomName:$1]; @@ -109,7 +108,7 @@ property: [p release]; }; -val: propsyms { $$ = $1; } | QUOTEDSTRING { $$ = $1; } | DELIMITEDSTRING { $$ = $1; }; +val: propsyms { $$ = $1; } | DELIMITEDSTRING { $$ = $1; }; propsyms: propsym { $$ = $1; } | propsyms propsym -- cgit v1.2.3