/[bison]/bison/src/scan-gram.l
ViewVC logotype

Diff of /bison/src/scan-gram.l

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.30 by eggert, Sun Nov 3 08:42:32 2002 UTC revision 1.31 by akim, Mon Nov 4 08:28:01 2002 UTC
# Line 267  splice  (\\[ \f\t\v]*\n)* Line 267  splice  (\\[ \f\t\v]*\n)*
267      num = strtoul (yytext, 0, 10);      num = strtoul (yytext, 0, 10);
268      if (INT_MAX < num || errno)      if (INT_MAX < num || errno)
269        {        {
270          complain_at (*yylloc, _("%s is invalid"), yytext);          complain_at (*yylloc, _("invalid value: %s"), quote (yytext));
271          num = INT_MAX;          num = INT_MAX;
272        }        }
273      yylval->integer = num;      yylval->integer = num;
# Line 306  splice  (\\[ \f\t\v]*\n)* Line 306  splice  (\\[ \f\t\v]*\n)*
306    }    }
307    
308    .           {    .           {
309      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("invalid character: %s"), quote (yytext));
     fprintf (stderr, _(": invalid character: `%c'\n"), *yytext);  
310      YY_STEP;      YY_STEP;
311    }    }
312  }  }
# Line 340  splice  (\\[ \f\t\v]*\n)* Line 339  splice  (\\[ \f\t\v]*\n)*
339    [^*]+|"*"  ;    [^*]+|"*"  ;
340    
341    <<EOF>> {    <<EOF>> {
342      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a comment"));
     fprintf (stderr, _(": unexpected end of file in a comment\n"));  
343      BEGIN INITIAL;      BEGIN INITIAL;
344    }    }
345  }  }
# Line 357  splice  (\\[ \f\t\v]*\n)* Line 355  splice  (\\[ \f\t\v]*\n)*
355    [^*\[\]]+|"*"   YY_OBS_GROW;    [^*\[\]]+|"*"   YY_OBS_GROW;
356    
357    <<EOF>> {    <<EOF>> {
358      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a comment"));
     fprintf (stderr, _(": unexpected end of file in a comment\n"));  
359      yy_pop_state ();      yy_pop_state ();
360    }    }
361  }  }
# Line 396  splice  (\\[ \f\t\v]*\n)* Line 393  splice  (\\[ \f\t\v]*\n)*
393    [^\"\\]+  YY_OBS_GROW;    [^\"\\]+  YY_OBS_GROW;
394    
395    <<EOF>> {    <<EOF>> {
396      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a string"));
     fprintf (stderr, _(": unexpected end of file in a string\n"));  
397      assert (yy_top_state () == INITIAL);      assert (yy_top_state () == INITIAL);
398      YY_OBS_FINISH;      YY_OBS_FINISH;
399      yylval->string = last_string;      yylval->string = last_string;
# Line 429  splice  (\\[ \f\t\v]*\n)* Line 425  splice  (\\[ \f\t\v]*\n)*
425      }      }
426    }    }
427    
428    [^'\\]+  YY_OBS_GROW;    [^\'\\]+  YY_OBS_GROW;
429    
430    <<EOF>> {    <<EOF>> {
431      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a character"));
     fprintf (stderr, _(": unexpected end of file in a character\n"));  
432      assert (yy_top_state () == INITIAL);      assert (yy_top_state () == INITIAL);
433      YY_OBS_FINISH;      YY_OBS_FINISH;
434      yylval->string = last_string;      yylval->string = last_string;
# Line 453  splice  (\\[ \f\t\v]*\n)* Line 448  splice  (\\[ \f\t\v]*\n)*
448      unsigned long c = strtoul (yytext + 1, 0, 8);      unsigned long c = strtoul (yytext + 1, 0, 8);
449      if (UCHAR_MAX < c)      if (UCHAR_MAX < c)
450        {        {
451          LOCATION_PRINT (stderr, *yylloc);          complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
         fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));  
452          YY_STEP;          YY_STEP;
453        }        }
454      else      else
# Line 467  splice  (\\[ \f\t\v]*\n)* Line 461  splice  (\\[ \f\t\v]*\n)*
461      c = strtoul (yytext + 2, 0, 16);      c = strtoul (yytext + 2, 0, 16);
462      if (UCHAR_MAX < c || errno)      if (UCHAR_MAX < c || errno)
463        {        {
464          LOCATION_PRINT (stderr, *yylloc);          complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
         fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));  
465          YY_STEP;          YY_STEP;
466        }        }
467      else      else
# Line 482  splice  (\\[ \f\t\v]*\n)* Line 475  splice  (\\[ \f\t\v]*\n)*
475    \\r   obstack_1grow (&string_obstack, '\r');    \\r   obstack_1grow (&string_obstack, '\r');
476    \\t   obstack_1grow (&string_obstack, '\t');    \\t   obstack_1grow (&string_obstack, '\t');
477    \\v   obstack_1grow (&string_obstack, '\v');    \\v   obstack_1grow (&string_obstack, '\v');
478    \\[\"'?\\]  obstack_1grow (&string_obstack, yytext[1]);    \\[\"\'?\\]  obstack_1grow (&string_obstack, yytext[1]);
479    \\(u|U[0-9a-fA-F]{4})[0-9a-fA-F]{4} {    \\(u|U[0-9a-fA-F]{4})[0-9a-fA-F]{4} {
480      int c = convert_ucn_to_byte (yytext);      int c = convert_ucn_to_byte (yytext);
481      if (c < 0)      if (c < 0)
482        {        {
483          LOCATION_PRINT (stderr, *yylloc);          complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
         fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));  
484          YY_STEP;          YY_STEP;
485        }        }
486      else      else
487        obstack_1grow (&string_obstack, c);        obstack_1grow (&string_obstack, c);
488    }    }
489    \\(.|\n)      {    \\(.|\n)      {
490      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unrecognized escape: %s"), quote (yytext));
     fprintf (stderr, _(": unrecognized escape: %s\n"), quote (yytext));  
491      YY_OBS_GROW;      YY_OBS_GROW;
492    }    }
493    /* FLex wants this rule, in case of a `\<<EOF>>'. */    /* FLex wants this rule, in case of a `\<<EOF>>'. */
# Line 524  splice  (\\[ \f\t\v]*\n)* Line 515  splice  (\\[ \f\t\v]*\n)*
515    \\                   YY_OBS_GROW;    \\                   YY_OBS_GROW;
516    
517    <<EOF>> {    <<EOF>> {
518      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a character"));
     fprintf (stderr, _(": unexpected end of file in a character\n"));  
519      assert (yy_top_state () != INITIAL);      assert (yy_top_state () != INITIAL);
520      yy_pop_state ();      yy_pop_state ();
521    }    }
# Line 552  splice  (\\[ \f\t\v]*\n)* Line 542  splice  (\\[ \f\t\v]*\n)*
542    \\                   YY_OBS_GROW;    \\                   YY_OBS_GROW;
543    
544    <<EOF>> {    <<EOF>> {
545      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a string"));
     fprintf (stderr, _(": unexpected end of file in a string\n"));  
546      assert (yy_top_state () != INITIAL);      assert (yy_top_state () != INITIAL);
547      yy_pop_state ();      yy_pop_state ();
548    }    }
# Line 607  splice  (\\[ \f\t\v]*\n)* Line 596  splice  (\\[ \f\t\v]*\n)*
596    "@"(-?[0-9]+|"$")               { handle_at (current_braced_code,    "@"(-?[0-9]+|"$")               { handle_at (current_braced_code,
597                                                 yytext, *yylloc); }                                                 yytext, *yylloc); }
598    
599    [^$@\[\]/'\"\{\}]+    YY_OBS_GROW;    [^$@\[\]/\'\"\{\}]+   YY_OBS_GROW;
600    
601    /* A stray $, or /, or etc. */    /* A stray $, or /, or etc. */
602    .             YY_OBS_GROW;    .             YY_OBS_GROW;
603    
604    <<EOF>> {    <<EOF>> {
605      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a braced code"));
     fprintf (stderr, _(": unexpected end of file in a braced code\n"));  
606      yy_pop_state ();      yy_pop_state ();
607      YY_OBS_FINISH;      YY_OBS_FINISH;
608      yylval->string = last_string;      yylval->string = last_string;
# Line 637  splice  (\\[ \f\t\v]*\n)* Line 625  splice  (\\[ \f\t\v]*\n)*
625      return PROLOGUE;      return PROLOGUE;
626    }    }
627    
628    [^%\[\]/'\"]+      YY_OBS_GROW;    [^%\[\]/\'\"]+     YY_OBS_GROW;
629    "%"                YY_OBS_GROW;    "%"                YY_OBS_GROW;
630    
631    <<EOF>> {    <<EOF>> {
632      LOCATION_PRINT (stderr, *yylloc);      complain_at (*yylloc, _("unexpected end of file in a prologue"));
     fprintf (stderr, _(": unexpected end of file in a prologue\n"));  
633      yy_pop_state ();      yy_pop_state ();
634      YY_OBS_FINISH;      YY_OBS_FINISH;
635      yylval->string = last_string;      yylval->string = last_string;
# Line 729  handle_action_dollar (char *text, locati Line 716  handle_action_dollar (char *text, locati
716                            rule_length, n, type_name);                            rule_length, n, type_name);
717          }          }
718        else        else
719          complain_at (location, _("invalid value: %s"), text);          complain_at (location, _("invalid value: %s"), quote (text));
720      }      }
721  }  }
722    
# Line 746  handle_symbol_code_dollar (char *text, l Line 733  handle_symbol_code_dollar (char *text, l
733    if (*cp == '$')    if (*cp == '$')
734      obstack_sgrow (&string_obstack, "]b4_dollar_dollar[");      obstack_sgrow (&string_obstack, "]b4_dollar_dollar[");
735    else    else
736      complain_at (location, _("%s is invalid"), quote_n (1, text));      complain_at (location, _("invalid value: %s"), quote (text));
737  }  }
738    
739    
# Line 801  handle_action_at (char *text, location_t Line 788  handle_action_at (char *text, location_t
788                            rule_length, n);                            rule_length, n);
789          }          }
790        else        else
791          complain_at (location, _("invalid value: %s"), text);          complain_at (location, _("invalid value: %s"), quote (text));
792      }      }
793  }  }
794    
# Line 818  handle_symbol_code_at (char *text, locat Line 805  handle_symbol_code_at (char *text, locat
805    if (*cp == '$')    if (*cp == '$')
806      obstack_sgrow (&string_obstack, "]b4_at_dollar[");      obstack_sgrow (&string_obstack, "]b4_at_dollar[");
807    else    else
808      complain_at (location, _("%s is invalid"), quote_n (1, text));      complain_at (location, _("invalid value: %s"), quote (text));
809  }  }
810    
811    
# Line 896  convert_ucn_to_byte (char const *ucn) Line 883  convert_ucn_to_byte (char const *ucn)
883      code = code < sizeof table ? table[code] : -1;      code = code < sizeof table ? table[code] : -1;
884    }    }
885  #endif  #endif
886          
887    return code;    return code;
888  }  }
889    

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26