From: Akim Demaille Date: Mon, 3 Apr 2006 13:50:10 +0000 (+0000) Subject: * src/scan-gram.l: Be robust to BRACED_CODE appearing before any X-Git-Tag: v2.3b~424 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/b2ddc3f337c31b622d2748408bec2aff5089e20c?ds=inline * src/scan-gram.l: Be robust to BRACED_CODE appearing before any rule. Reported by Mickael Labau. * tests/input.at (Torturing the Scanner): Test it. --- diff --git a/ChangeLog b/ChangeLog index 8215a9d1..0f6abc1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-03 Akim Demaille + + * src/scan-gram.l: Be robust to BRACED_CODE appearing before any + rule. + Reported by Mickael Labau. + * tests/input.at (Torturing the Scanner): Test it. + 2006-03-16 Paul Eggert * doc/bison.texinfo (Decl Summary): Don't mention yylloc twice. diff --git a/THANKS b/THANKS index 4a5492e2..0c795d7f 100644 --- a/THANKS +++ b/THANKS @@ -45,6 +45,7 @@ Martin Mokrejs mmokrejs@natur.cuni.cz Matt Kraai kraai@alumni.cmu.edu Matt Rosing rosing@peakfive.com Michael Hayes m.hayes@elec.canterbury.ac.nz +Mickael Labau labau_m@epita.fr Mike Castle dalgoda@ix.netcom.com Neil Booth NeilB@earthling.net Nelson H. F. Beebe beebe@math.utah.edu diff --git a/src/scan-gram.l b/src/scan-gram.l index 1aa5e077..cf704c77 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -292,7 +292,7 @@ splice (\\[ \f\t\v]*\n)* /* Code in between braces. */ "{" { - if (current_rule->action) + if (current_rule && current_rule->action) grammar_midrule_action (); STRING_GROW; token_type = BRACED_CODE; diff --git a/tests/input.at b/tests/input.at index ba45119c..82fbe063 100644 --- a/tests/input.at +++ b/tests/input.at @@ -204,6 +204,14 @@ AT_CHECK([bison input.y], [1], [], ]]) +AT_DATA([input.y], +[{} +]) +AT_CHECK([bison input.y], [1], [], +[[input.y:1.1-2: syntax error, unexpected {...} +]]) + + AT_DATA_GRAMMAR([input.y], [[%{ /* This is seen in GCC: a %{ and %} in middle of a comment. */