starter: Explicitly allow @# at the beginning of strings
authorTobias Brunner <tobias@strongswan.org>
Wed, 18 Jun 2014 13:11:32 +0000 (15:11 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 19 Jun 2014 12:00:49 +0000 (14:00 +0200)
Since we treat everything after # as comment identities of type
ID_KEY_ID couldn't be parsed otherwise, unless quoted.

src/starter/parser/lexer.l
src/starter/tests/suites/test_parser.c

index 22ad617..a88cbe8 100644 (file)
@@ -79,7 +79,7 @@ static void include_files(parser_helper_t *ctx);
        yy_push_state(str, yyscanner);
 }
 
-[^\"#= \t\n]+                  {
+(@#)?[^\"#= \t\n]+                     {
        yylval->s = strdup(yytext);
        return STRING;
 }
index 84b5eed..684bc2a 100644 (file)
@@ -224,6 +224,9 @@ static struct {
        { "conn foo # asdf\n\tkey=val", TRUE, "val" },
        { "conn foo # asdf\n#\tkey=val", TRUE, NULL },
        { "conn foo # asdf\n\t#key=val", TRUE, NULL },
+       { "conn foo # asdf\n\tkey=@#keyid", TRUE, "@#keyid" },
+       { "conn foo # asdf\n\tkey=\"@#keyid\"", TRUE, "@#keyid" },
+       { "conn foo # asdf\n\tkey=asdf@#keyid", TRUE, "asdf@" },
        { "conn foo # asdf\n\tkey=#val", TRUE, NULL },
        { "conn foo # asdf\n\tkey=val#asdf", TRUE, "val" },
        { "conn foo # asdf\n\tkey=\"val#asdf\"", TRUE, "val#asdf" },