From d2378f6c364e63df2214973325154d8c0b80fc05 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Fri, 1 Apr 2016 21:37:03 +0100 Subject: [PATCH] Explicitely handle empty string in lexer. (rather that hide it inside of a definition) --- re2c/bootstrap/src/parse/lex_conf.cc | 29 ++++++++++++++-------------- re2c/src/parse/lex_conf.re | 3 ++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/re2c/bootstrap/src/parse/lex_conf.cc b/re2c/bootstrap/src/parse/lex_conf.cc index 7ec1a7a4..408e65a5 100644 --- a/re2c/bootstrap/src/parse/lex_conf.cc +++ b/re2c/bootstrap/src/parse/lex_conf.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Fri Apr 1 16:43:33 2016 */ +/* Generated by re2c 0.16 on Fri Apr 1 21:34:44 2016 */ #line 1 "../src/parse/lex_conf.re" #include "src/util/c99_stdint.h" #include @@ -2461,20 +2461,16 @@ std::string Scanner::lex_conf_string () } } else { if (yych <= '\'') { - if (yych <= '"') goto yy535; + if (yych <= '"') goto yy536; if (yych <= '&') goto yy533; - goto yy535; + goto yy536; } else { if (yych != ';') goto yy533; } } -yy532: -#line 234 "../src/parse/lex_conf.re" - { - s = std::string(tok, tok_len()); - goto end; - } -#line 2478 "src/parse/lex_conf.cc" +#line 238 "../src/parse/lex_conf.re" + { goto end; } +#line 2474 "src/parse/lex_conf.cc" yy533: ++cur; if (lim <= cur) fill(1); @@ -2482,8 +2478,13 @@ yy533: if (yybm[0+yych] & 128) { goto yy533; } - goto yy532; -yy535: +#line 234 "../src/parse/lex_conf.re" + { + s = std::string(tok, tok_len()); + goto end; + } +#line 2487 "src/parse/lex_conf.cc" +yy536: ++cur; #line 220 "../src/parse/lex_conf.re" { @@ -2500,9 +2501,9 @@ yy535: } } } -#line 2504 "src/parse/lex_conf.cc" +#line 2505 "src/parse/lex_conf.cc" } -#line 238 "../src/parse/lex_conf.re" +#line 239 "../src/parse/lex_conf.re" end: lex_conf_semicolon (); diff --git a/re2c/src/parse/lex_conf.re b/re2c/src/parse/lex_conf.re index 779ea5c4..e93db55b 100644 --- a/re2c/src/parse/lex_conf.re +++ b/re2c/src/parse/lex_conf.re @@ -31,7 +31,7 @@ namespace re2c conf_assign = space* "=" space*; naked_char = . \ (space | [;]); - naked = "" | (naked_char \ ['"]) naked_char*; + naked = (naked_char \ ['"]) naked_char*; number = "0" | ("-"? [1-9] [0-9]*); */ @@ -235,6 +235,7 @@ std::string Scanner::lex_conf_string () s = std::string(tok, tok_len()); goto end; } + "" { goto end; } */ end: lex_conf_semicolon (); -- 2.40.0