Commit Graph

871 Commits

Author SHA1 Message Date
Paul Eggert
e9683cfd3d (yylineno, yyoutname): Remove static vars, replacing
them with auto vars.
Switch to new escape scheme, where @ is the escape character uniformly.
Abort if a stray escape character is found.  Avoid unbounded input
buffer when parsing non-escaped text.
2002-11-12 07:27:51 +00:00
Paul Eggert
ac060e78a3 (<SC_CHARACTER>): Don't worry about any backslash
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 ].
2002-11-12 07:27:04 +00:00
Paul Eggert
6c239755dc (prologue_augment, epilogue_set):
Quote filenames for C and M4.
2002-11-12 07:26:27 +00:00
Paul Eggert
3813e141f8 (escaped_file_name_output): New function.
(prepare_symbols): Quote tokens for M4.
(prepare): Don't insert output_infix, output_prefix,
output_parser_name, output_header_name; this is now down by scan-skel.
Insert skeleton as a C string.
(user_actions_output, symbol_destructors_output,
symbol_printers_output): Quote filenames for C and M4.
2002-11-12 07:25:36 +00:00
Paul Eggert
a027c30d42 (MUSCLE_GROW_STRING_PAIR): Remove; unused.
(MUSCLE_OBSTACK_SGROW, MUSCLE_INSERT_C_STRING): New macros.
2002-11-12 07:24:33 +00:00
Paul Eggert
4e956a7d9e Include quotearg.h, since we need to quote C strings now.
(muscle_init): Quote filename as a C string.
2002-11-12 07:23:52 +00:00
Paul Eggert
42481a1fd1 (output_infix): Remove; all uses removed. 2002-11-12 07:23:13 +00:00
Paul Eggert
345532d70b (unexpected_end_of_file): Fix bug: columns were counted in the token
inserted at end of file.  Now takes location_t *, not location_t, so
that the location can be adjusted.  All uses changed.
2002-11-10 05:17:56 +00:00
Paul Eggert
09d353a08f (scanner_last_string_free): Remove decl. 2002-11-08 06:14:29 +00:00
Paul Eggert
a706a1cc03 Remove stack option. We no longer use the stack, since the stack was
never deeper than 1; instead, use the new auto var c_context to record
the stacked value.

Remove nounput option.  At an unexpected end of file, we now unput
the minimal input necessary to end cleanly; this simplifies the
code.

Avoid unbounded token sizes where this is easy.

(unexpected_end_of_file): New function.
Use it to systematize the error message on unexpected EOF.
(last-string): Now auto, not static.
(YY_OBS_FREE): Remove unnecessary do while (0) wrapper.
(scanner_last_string_free): Remove; not used.
(percent_percent_count): Move decl to just before use.
(SC_ESCAPED_CHARACTER): Return ID at unexpected end of file,
not the (never otherwised-used) CHARACTER.
2002-11-08 05:20:20 +00:00
Paul Eggert
87fbb0bffc (CHARACTER): Remove unused token. All uses removed. 2002-11-08 05:19:30 +00:00
Akim Demaille
0e25cad542 Regen. 2002-11-07 12:50:34 +00:00
Paul Eggert
8e6ef48342 (unexpected_end_of_file): New function.
Use it to systematize the error message on unexpected EOF.
2002-11-07 08:15:11 +00:00
Akim Demaille
6e40b4ebd4 #line should have quoted strings.
Ideally, this should be done by m4_quotearg.
* src/scan-skel.l: Include quotearg.h.
Quote __ofile__.
* src/output.c (symbol_printers_output)
(symbol_destructors_output): Quote the file name.
2002-11-06 16:22:04 +00:00
Akim Demaille
437c2d8000 Restore --no-lines.
Reported by Jim Kent.
* data/c.m4 (b4_syncline): New.
* data/glr.c, data/yacc.c, data/lalr1.cc: Use it.
* src/reader.c (prologue_augment, epilogue_set): Use b4_syncline.
* src/output.c (user_actions_output): Likewise.
(prepare): Define 'b4_synclines_flag'.
2002-11-06 14:11:47 +00:00
Akim Demaille
900c5db537 * src/main.c (main): Free `infile'.
* src/scan-gram.l (handle_syncline): New.
Recognize `#line'.
* src/output.c (user_actions_output, symbol_destructors_output)
(symbol_printers_output): Use the location's file name, not
infile.
* src/reader.c (prologue_augment, epilogue_set): Likewise.
2002-11-06 08:08:46 +00:00
Paul Eggert
98f2caaa5f Use more accurate diagnostics, e.g.
"integer out of range" rather than "invalid value".
2002-11-06 07:01:06 +00:00
Paul Hilfinger
51b4a04cd0 src/tables.c (matching_state): Don't allow states to match if
either has GLR conflict entries.
ChangeLog: update for this and Hilfinger's preceding test-suite	addition.
2002-11-06 02:46:08 +00:00
Paul Eggert
d04946c717 Regenerate. 2002-11-06 00:06:50 +00:00
Paul Eggert
1a9e39f116 (braces_level): Now auto, not static.
Initialize to zero if the compiler is being picky.
(INITIAL): Clear braces_level instead of incrementing it.
(SC_BRACED_CODE): Treat <% and %> as { and } when inside C code,
as POSIX 1003.1-2001 requires.
2002-11-05 23:50:11 +00:00
Paul Eggert
48e28efa9e (IF_LINT): New macro, taken from coreutils. 2002-11-05 23:42:51 +00:00
Akim Demaille
29c017256a * src/scan-gram.l: When it starts with `%', complain about the
whole directive, not just that `invalid character: %'.
2002-11-05 21:20:14 +00:00
Akim Demaille
c4d720cdbb * src/location.h (LOCATION_PRINT): Use quotearg slot 3 to avoid
clashes.
* src/scan-gram.l: Use ['] instead of ['] to pacify
font-lock-mode.
Use complain_at.
Use quote, not quote_n since LOCATION_PRINT no longer uses the
slot 0.
2002-11-04 08:28:01 +00:00
Paul Eggert
45a8a65dee (get_merge_function, grammar_current_rule_check):
Use consistent diagnostics for reporting type name clashes.
Quote the types with <>, for consistency with Yacc.
2002-11-04 06:06:44 +00:00
Akim Demaille
1a43c452ea Regen. 2002-11-03 12:14:47 +00:00
Paul Eggert
03cae905c6 Regen. 2002-11-03 08:53:56 +00:00
Paul Eggert
d8d3f94a99 Revamp to fix POSIX incompatibilities, to count columns correctly, and
to check for invalid inputs.

Use mbsnwidth to count columns correctly.  Account for tabs, too.
Include mbswidth.h.
(YY_USER_ACTION): Invoke extend_location rather than LOCATION_COLUMNS.
(extend_location): New function.
(YY_LINES): Remove.

Handle CRLF in C code rather than in Lex code.
(YY_INPUT): New macro.
(no_cr_read): New function.

Scan UCNs, even though we don't fully handle them yet.
(convert_ucn_to_byte): New function.

Handle backslash-newline correctly in C code.
(SC_LINE_COMMENT, SC_YACC_COMMENT): New states.
(eols, blanks): Remove.  YY_USER_ACTION now counts newlines etc.;
all uses changed.
(tag, splice): New EREs.  Do not allow NUL or newline in tags.
Use {splice} wherever C allows backslash-newline.
YY_STEP after space, newline, vertical-tab.
("/*"): BEGIN SC_YACC_COMMENT, not yy_push_state (SC_COMMENT).

(letter, id): Don't assume ASCII; e.g., spell out a-z.

({int}, handle_action_dollar, handle_action_at): Check for integer
overflow.

(YY_STEP): Omit trailing semicolon, so that it's more like C.

(<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>): Allow \0 and \00
as well as \000.  Check for UCHAR_MAX, not 255.
Allow \x with an arbitrary positive number of digits, as in C.
Check for overflow here.
Allow \? and UCNs, for compatibility with C.

(handle_symbol_code_dollar): Use quote_n slot 1 to avoid collision
with quote slot used by complain_at.
2002-11-03 08:42:32 +00:00
Paul Eggert
565a33db8f (LOCATION_COLUMNS, LOCATION_LINES): Remove; no longer used. 2002-11-03 08:41:08 +00:00
Paul Eggert
b9e0056255 Fix misspellings in comments. 2002-11-03 07:56:25 +00:00
Paul Eggert
397477b4e9 Don't include quote.h; not needed.
(get_merge_function): Reword warning to be consistent with type clash
diagnostic in grammar_current_rule_check.
2002-11-03 07:49:40 +00:00
Paul Eggert
01cfa69791 (prepare_symbols): When printing token names, escape "[" as "@<:@" and
likewise for "]".
2002-11-03 06:41:59 +00:00
Paul Eggert
3fbf949b82 (errno): Remove declaration, as we are now assuming C89 or better, and
C89 guarantees errno.
2002-11-03 06:16:55 +00:00
Akim Demaille
56100c60da * src/system.h: Don't use #ifdef/#ifndef on HAVE_ values, only
#if.
2002-10-30 08:31:24 +00:00
Paul Eggert
30ba05f239 (output_skeleton): Use xfclose rather than fclose and ferror. xfclose
now checks ferror.
2002-10-30 06:20:02 +00:00
Paul Eggert
e63ee1f16c (xfclose): Return void, not int, since it always returned zero.
Report I/O error if ferror indicates one.
2002-10-30 06:19:00 +00:00
Paul Eggert
760d7aa8fa (xfclose): Return void, not int, since it always returned zero. 2002-10-30 06:18:19 +00:00
Paul Eggert
5c16c6b13a Version 1.75a. 2002-10-25 06:05:50 +00:00
Akim Demaille
b526ee6116 * src/output.c (output_skeleton): Don't disable M4sugar comments
too soon: it results in comments being expanded.
* data/yacc.c, data/glr.c, data/lalr1.cc: Do it right before the
first output.
2002-10-24 11:40:27 +00:00
Paul Eggert
f6d0c2394c (main): With --trace=time, report times even if a non-fatal error
occurs.  Formerly, the times were reported in some such cases but not
in others.
2002-10-23 18:41:43 +00:00
Paul Eggert
f956c304c5 (reader): Just return if a complaint has been issued,
instead of exiting, so that 'main' can report times.
2002-10-23 18:41:04 +00:00
Akim Demaille
27b0ffea3e * src/system.h: Include sys/types.
Reported by Bert Deknuydt.
2002-10-23 16:30:50 +00:00
Paul Eggert
e0c74f0d34 (exit) [! (STDC_HEADERS || _LIBC)]: Remove exit decl; not needed any more. 2002-10-23 07:35:48 +00:00
Paul Eggert
e95aed631d (main): Use return to exit, undoing yesterday's change.
The last OS that we could find where this wouldn't work is
SunOS 3.5, and that's too old to worry about now.
2002-10-23 07:00:19 +00:00
Paul Eggert
ec88357a8c (fatal, fatal_at): Add __attribute__((__noreturn__)).
(warning_issued): Renamed from warn_message_count.  Now bool.
(complaint_issued): Renamed from complain_message_count.  Now bool.
2002-10-22 05:12:08 +00:00
Paul Eggert
5ca3209b44 (main): Use exit to exit with failure.
Use EXIT_FAILURE and EXIT_SUCCESS rather than 1 and 0.
2002-10-22 05:07:12 +00:00
Paul Eggert
0df27e8b2d (getargs): Use EXIT_FAILURE and EXIT_SUCCESS rather than 1 and 0.
Remove duplicate code for "Try `bison --help'".
(usage):  Add __attribute__((__noreturn__)).
2002-10-22 05:06:21 +00:00
Paul Eggert
901ec1537a (xfopen, xfclose): Use EXIT_FAILURE rathern than 2.
What was that "2" for?
2002-10-22 05:01:46 +00:00
Paul Eggert
0ae6073a18 (warning_issued): Renamed from warn_message_count,
so that we needn't worry about integer overflow (!).
Now of type bool.  All uses changed.
(complaint_issued): Renamed from complain_message_count; likewise.
(fatal_at, fatal): Use EXIT_FAILURE and EXIT_SUCCESS rather than 1 and 0.
2002-10-22 04:53:49 +00:00
Paul Eggert
8307162d58 Use C99-style bool instead of our own style. 2002-10-22 04:46:28 +00:00
Paul Eggert
738c69de37 Use C99-style bool instead of our own style.
(comment change only)
2002-10-22 04:45:51 +00:00