Commit Graph

1002 Commits

Author SHA1 Message Date
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
Paul Eggert
b4afb6bbe5 Use C99-style bool instead of our own style.
(reader): Use EXIT_FAILURE and EXIT_SUCCESS rather than 1 and 0.
2002-10-22 04:43:50 +00:00
Paul Eggert
637c4b283c se C99-style bool instead of our own style. 2002-10-22 04:41:25 +00:00
Paul Eggert
78b8881659 (bool, false, true): Use a definition consistent with ../lib/hash.c. 2002-10-22 04:40:09 +00:00
Paul Eggert
a3714bcedf (hash_compare_symbol_t): (a ? FALSE : TRUE) -> (! a) 2002-10-22 04:39:44 +00:00
Paul Eggert
5dd5fd4a56 (hash_compare_muscles): (a ? FALSE : TRUE) -> (! a) 2002-10-22 04:39:05 +00:00
Paul Eggert
a4b6efd473 (getargs): When there are too few operands, report the last one. When
there are too many, report the first extra one.  This is how diffutils
does it.
2002-10-21 18:15:13 +00:00
Paul Eggert
d33cb3ae09 Remove all uses of PARAMS, since we now assume C89 or better. 2002-10-21 05:30:50 +00:00
Paul Eggert
b8452344de (getargs, cli_present, cli_get_value): Prototype. 2002-10-21 05:29:50 +00:00
Paul Eggert
930393cf02 (PARAMS): Remove.
Include <limits.h> unconditionally, since it's guaranteeed even
for a freestanding C89 compiler.
(SHRT_MIN, SHRT_MAX): Remove, since C89 guarantees them.
2002-10-21 05:29:07 +00:00
Paul Eggert
49f801e6fe Assume prototypes. 2002-10-21 05:28:34 +00:00
Paul Eggert
2118414023 (VA_START): Remove. Assume prototypes.
(vfprintf) [! (HAVE_VPRINTF || defined vfprintf)]: New macro.
(private_strerror, warn_at, warn, complain_at, complain, fatal_at,
fatal): Assume prototypes.
2002-10-21 05:28:16 +00:00
Akim Demaille
e7cb57c0b8 * src/muscle_tab.c (muscle_grow): Remove trailing debugging code.
* data/glr.c (YY_USER_FORMALS, YY_USER_ARGS): New.
(yyuserAction, yydoAction, yyglrReduce, yyresolveValue)
(yyresolveStates, yyresolveAction, yyresolveStack)
(yyprocessOneStack): Use them.
(yy_reduce_print): New.
* tests/calc.at (_AT_DATA_CALC_Y): Exercise %parse-param.
2002-10-20 16:09:47 +00:00
Akim Demaille
39912f5263 * src/output.c (prepare): Move the definition of `tokens_number',
`nterms_number', `undef_token_number', `user_token_number_max'
to...
(prepare_tokens): Here.
(prepare_tokens): Rename as...
(prepare_symbols): this.
(prepare): Move the definition of `rules_number' to...
(prepare_rules): here.
(prepare): Move the definition of `last', `final_state_number',
`states_number' to...
(prepare_states): here.
* data/yacc.c, data/lalr1.cc, data/glr.c: Normalize `>' into `<'.
2002-10-20 11:20:15 +00:00
Akim Demaille
20c1e2ad98 * src/tables.h, src/tables.c, src/output.c: Comment changes. 2002-10-20 11:18:14 +00:00
Akim Demaille
66d30cd4eb * src/output.c (prepare): Use MUSCLE_INSERT_STRING.
* src/muscle_tab.c (muscle_pair_list_grow): Rename `val as
`pair'.
(muscle_init): Move the `b4_ltype', `b4_maxdepth', `b4_initdepth',
`name' to...
* data/glr.c, data/lalr1.cc, data/yacc.c (b4_location_type)
(b4_stack_depth_init, b4_stack_depth_max, b4_parser_class_name):
These.
2002-10-20 11:16:01 +00:00
Paul Eggert
2cdb2a7b05 (readpipe): Remove decl.
(scan_skel): New function, to be used in place of m4_invoke.
Read from stream rather than file.
2002-10-20 06:32:04 +00:00
Paul Eggert
573312acb6 Include "subpipe.h".
(m4_invoke): Remove decl.
(scan_skel): New decl.
(output_skeleton): Use pipe rather than temporary file for m4 input.
Check that m4sugar.m4 is readable, to avoid deadlock.
Check for pipe I/O error.
2002-10-20 06:31:23 +00:00
Paul Eggert
bb33f19a4b (prepare): Use xstrdup to convert char const * to char *, to avoid GCC
warning.
2002-10-20 06:01:07 +00:00
Paul Eggert
d9d363b172 (muscle_pair_list_grow): Rename local to avoid confusion with
similarly-named more-global.
2002-10-20 05:47:09 +00:00