X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fjsonpath.git;a=blobdiff_plain;f=lexer.l;h=18937e888355774c04e7d7883d8a017b19ad08a5;hp=a480ca7d1bb01ff035c00bf9d9984bd2fe0eb4e1;hb=baeded13085b9cd2f5d866fbcfaee63a52144f07;hpb=cd5db769d8b77dd540db44a095d09edb3153e2d8 diff --git a/lexer.l b/lexer.l index a480ca7..18937e8 100644 --- a/lexer.l +++ b/lexer.l @@ -101,17 +101,23 @@ WS [ \t\n]* %% -\" { +["'] { s->str_ptr = s->str_buf; + s->str_quote = *yytext; memset(s->str_buf, 0, sizeof(s->str_buf)); BEGIN(STRING); } { - \" { - BEGIN(INITIAL); - yylval.op = jp_alloc_op(T_STRING, 0, s->str_buf); - return T_STRING; + ["'] { + if (*yytext == s->str_quote) + { + BEGIN(INITIAL); + yylval.op = jp_alloc_op(T_STRING, 0, s->str_buf); + return T_STRING; + } + + str_put(s, *yytext); } \\([0-3][0-7]{1,2}|[0-7]{0,2}) { str_decode(s, yytext + 1, 8); } @@ -126,7 +132,7 @@ WS [ \t\n]* \\t { str_put(s, '\t'); } \\v { str_put(s, '\v'); } \\. { str_put(s, *yytext); } - [^\\"]+ { while (*yytext) str_put(s, *yytext++); } + [^\\"']+ { while (*yytext) str_put(s, *yytext++); } } {BOOL} {