]> git.saurik.com Git - bison.git/commitdiff
(<SC_CHARACTER>): Don't worry about any backslash
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2002 07:27:04 +0000 (07:27 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2002 07:27:04 +0000 (07:27 +0000)
escapes other than \\ and \'; this simplifies the code.
(<SC_STRING>): Likewise, for \\ and \".
(<SC_COMMENT,SC_LINE_COMMENT,SC_STRING,SC_CHARACTER,SC_BRACED_CODE,
SC_PROLOGUE,SC_EPILOGUE>): Escape $ and @, too.
Use new escapes @{ and @} for [ and ].

src/scan-gram.l

index b94423580d8f320c8dfd5faa54710b668ab56e8a..8f18c355f40a4301a8958dca5d985a6fbf7215ee 100644 (file)
@@ -469,10 +469,9 @@ splice      (\\[ \f\t\v]*\n)*
 
 <SC_CHARACTER>
 {
-  "'"                 YY_OBS_GROW; BEGIN c_context;
-  \\{splice}[^\[\]]    YY_OBS_GROW;
-  {splice}            YY_OBS_GROW;
-  <<EOF>>             unexpected_end_of_file (yylloc, "'");
+  "'"              YY_OBS_GROW; BEGIN c_context;
+  \\{splice}[\'\\]  YY_OBS_GROW;
+  <<EOF>>          unexpected_end_of_file (yylloc, "'");
 }
 
 
@@ -483,10 +482,9 @@ splice      (\\[ \f\t\v]*\n)*
 
 <SC_STRING>
 {
-  "\""                YY_OBS_GROW; BEGIN c_context;
-  \\{splice}[^\[\]]    YY_OBS_GROW;
-  {splice}            YY_OBS_GROW;
-  <<EOF>>             unexpected_end_of_file (yylloc, "\"");
+  "\""             YY_OBS_GROW; BEGIN c_context;
+  \\{splice}[\"\\]  YY_OBS_GROW;
+  <<EOF>>          unexpected_end_of_file (yylloc, "\"");
 }
 
 
@@ -578,8 +576,10 @@ splice      (\\[ \f\t\v]*\n)*
 
 <SC_COMMENT,SC_LINE_COMMENT,SC_STRING,SC_CHARACTER,SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE>
 {
-  \[   obstack_sgrow (&string_obstack, "@<:@");
-  \]   obstack_sgrow (&string_obstack, "@:>@");
+  \$   obstack_sgrow (&string_obstack, "$][");
+  \@   obstack_sgrow (&string_obstack, "@@");
+  \[   obstack_sgrow (&string_obstack, "@{");
+  \]   obstack_sgrow (&string_obstack, "@}");
   .|\n  YY_OBS_GROW;
 }