MFV: r362513

Update byacc to 20200330.
This commit is contained in:
Jung-uk Kim 2020-07-14 01:54:24 +00:00
commit b53bb29fed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363170
272 changed files with 36416 additions and 4734 deletions

View file

@ -1,3 +1,423 @@
2020-03-30 Thomas E. Dickey <dickey@invisible-island.net>
* package/debian/copyright: bump
* test/yacc/grammar.tab.c, test/btyacc/grammar.tab.c, test/grammar.y, reader.c:
typo found with codespell
* yacc.1: fixes noted in the original report, overlooked in followup
2020-03-30 Bjarni.Ingi.Gislason
* yacc.1: typography/spelling fixes - Debian #955175
2020-03-30 Thomas E. Dickey <dickey@invisible-island.net>
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2020-03-10 Thomas E. Dickey <dickey@invisible-island.net>
* configure: regen
* aclocal.m4:
resync with my-autoconf, mostly fixes for compiler-warnings
* configure.in: use macro to suppress X-dependency from newer macros
2019-12-20 Thomas E. Dickey <dickey@invisible-island.net>
* config.guess: 2019-12-21
2019-11-25 Tom.Shields
* main.c:
fix an inconsistency between the getopt and non-getopt configuration.
In the former, getopt always used "yacc", not the name of the executable.
2019-11-25 Thomas E. Dickey <dickey@invisible-island.net>
* test/run_make.sh:
suppress bison's -Wyacc warning, which is not useful.
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2019-11-19 Thomas E. Dickey <dickey@invisible-island.net>
* yacc.1: new version of manpage
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
* yacc.1: document %code
* test/btyacc/calc_code_all.error, test/btyacc/calc_code_all.output, test/btyacc/calc_code_all.tab.c, test/btyacc/calc_code_all.tab.h, test/btyacc/calc_code_default.error, test/btyacc/calc_code_default.output, test/btyacc/calc_code_default.tab.c, test/btyacc/calc_code_default.tab.h, test/btyacc/calc_code_imports.error, test/btyacc/calc_code_imports.output, test/btyacc/calc_code_imports.tab.c, test/btyacc/calc_code_imports.tab.h, test/btyacc/calc_code_provides.error, test/btyacc/calc_code_provides.output, test/btyacc/calc_code_provides.tab.c, test/btyacc/calc_code_provides.tab.h, test/btyacc/calc_code_requires.error, test/btyacc/calc_code_requires.output, test/btyacc/calc_code_requires.tab.c, test/btyacc/calc_code_requires.tab.h, test/btyacc/calc_code_top.error, test/btyacc/calc_code_top.output, test/btyacc/calc_code_top.tab.c, test/btyacc/calc_code_top.tab.h, test/yacc/calc_code_all.tab.c, test/yacc/calc_code_all.tab.h, test/yacc/calc_code_default.tab.c, test/yacc/calc_code_provides.tab.c, test/yacc/calc_code_provides.tab.h, test/yacc/calc_code_requires.tab.c, test/yacc/calc_code_requires.tab.h, test/yacc/calc_code_top.tab.c:
RCS_BASE
* output.c:
amend updates for 'outline' when processing "%code" in code-file
* output.c:
modify output_code_lines() to show begin/end block comments which were in
reader.c, and to generate a #line for the code-file.
* reader.c:
modify copy_code() to allow for multiple %code directives for a given
section, recording the input line-number for each directive as a #line
in the resulting string. remove the block start/end comments, since those
will be done for a whole section in output.c
* mstring.c, defs.h: add msrenew()
* test/yacc/calc_code_all.error, test/yacc/calc_code_all.output, test/yacc/calc_code_default.error, test/yacc/calc_code_default.output, test/yacc/calc_code_default.tab.h, test/yacc/calc_code_imports.error, test/yacc/calc_code_imports.output, test/yacc/calc_code_imports.tab.c, test/yacc/calc_code_imports.tab.h, test/yacc/calc_code_provides.error, test/yacc/calc_code_provides.output, test/yacc/calc_code_requires.error, test/yacc/calc_code_requires.output, test/yacc/calc_code_top.error, test/yacc/calc_code_top.output, test/yacc/calc_code_top.tab.h:
RCS_BASE
2019-11-18 Thomas E. Dickey <dickey@invisible-island.net>
* test/calc_code_imports.y, test/calc_code_all.y, test/calc_code_default.y, test/calc_code_top.y, test/calc_code_provides.y, test/calc_code_requires.y:
RCS_BASE
2019-11-04 Michael.Forney
* defs.h: add missing "extern" for new variable "code_lines"
2019-11-03 Thomas E. Dickey <dickey@invisible-island.net>
* main.c: build-fix for MinGW cross-compiling
* output.c, reader.c: gcc-warnings
* output.c: check validity of text_file before rewind
remove redundant check of iflag
* main.c: fix memory-leak reported by clang
* mkpar.c: guard against a null-reference reported by clang (unlikely)
* reader.c: fix two coverity warnings:
a) resource leak on malloc-failure
b) possible null-pointer dereference on parse-error
* test/btyacc/err_inherit4.tab.h, test/btyacc/btyacc_demo.tab.h: regen
* defs.h: use enum's to simplify recent change
* mstring.c:
enable mstring() in regular byacc, since Zoulas' change relies upon it
2019-11-03 Christos.Zoulas
* defs.h, reader.c, output.c: add support for bison's "%code" feature
also fix a small bug: declare YYLTYPE externally when producing locations
2019-11-03 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/help.error, test/btyacc/no_b_opt.error, test/btyacc/no_output2.error, test/btyacc/no_p_opt.error, test/yacc/help.error, test/yacc/no_b_opt.error, test/yacc/no_output2.error, test/yacc/no_p_opt.error:
regen
* test/run_test.sh:
there's no standard wording for the options-errors from getopt;
filter that to "error message" in the test reference files.
* main.c:
provide for using getopt(), to accommodate a case where developers have
relied upon non-POSIX behavior.
* test/run_test.sh:
getopt's messages do not print the full pathname of yacc in some cases;
adjust the sed-script which changes those to "YACC"
* configure: regen
* config_h.in: regen, using autoheader-252
* configure.in: add configure check for getopt
* configure: regen
* aclocal.m4:
resync with my-autoconf adds a fix which accommodates a difference in
warning options between gcc/clang when --enable-warnings is not set.
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2019-09-11 Thomas E. Dickey <dickey@invisible-island.net>
* config.guess, config.sub: 2019-09-10
2019-06-17 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/big_b.error, test/btyacc/big_l.error, test/btyacc/help.error, test/btyacc/no_b_opt.error, test/btyacc/no_output2.error, test/btyacc/no_p_opt.error, test/btyacc/nostdin.error, test/yacc/big_b.error, test/yacc/big_l.error, test/yacc/help.error, test/yacc/no_b_opt.error, test/yacc/no_output2.error, test/yacc/no_p_opt.error, test/yacc/nostdin.error:
regen
* test/run_test.sh: test "-H" rather than "-D"
2019-06-16 Thomas E. Dickey <dickey@invisible-island.net>
* main.c, yacc.1:
change "-D" option to "-H" (discussion with Ethan Sommer)
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
* test/btyacc/defines1.calc.c, test/btyacc/defines2.calc.c, test/btyacc/defines3.calc.c:
RCS_BASE
* test/run_test.sh: in test_defines, save the ".c" file too
* test/yacc/defines3.calc.c, test/yacc/defines2.calc.c, test/yacc/defines1.calc.c:
RCS_BASE
* test/run_test.sh:
output of test_defines should be a header ".h", not ".c"
* test/btyacc/defines1.calc.h, test/btyacc/defines1.error, test/btyacc/defines1.output, test/btyacc/defines2.calc.h, test/btyacc/defines2.error, test/btyacc/defines2.output, test/btyacc/defines3.calc.h, test/btyacc/defines3.error, test/btyacc/defines3.output:
RCS_BASE
* main.c: however, a subsequent -d cancels -D
* test/yacc/defines1.calc.h, test/yacc/defines3.calc.h: RCS_BASE
* main.c: -D option implies -d
* test/yacc/defines1.error, test/yacc/defines1.output, test/yacc/defines2.calc.h, test/yacc/defines2.error, test/yacc/defines2.output, test/yacc/defines3.error, test/yacc/defines3.output:
RCS_BASE
* yacc.1: align macro definitions with my other manpages
* test/run_test.sh: add test for -D after -d or -b options
* test/btyacc/stdin1.calc.c, test/btyacc/stdin1.error, test/btyacc/stdin1.output, test/btyacc/stdin2.calc.c, test/btyacc/stdin2.error, test/btyacc/stdin2.output:
RCS_BASE
* test/btyacc/big_b.error, test/btyacc/big_b.output, test/btyacc/big_l.error, test/btyacc/big_l.output, test/btyacc/help.error, test/btyacc/help.output, test/btyacc/no_b_opt.error, test/btyacc/no_b_opt.output, test/btyacc/no_b_opt1.error, test/btyacc/no_b_opt1.output, test/btyacc/no_code_c.error, test/btyacc/no_code_c.output, test/btyacc/no_defines.error, test/btyacc/no_defines.output, test/btyacc/no_graph.error, test/btyacc/no_graph.output, test/btyacc/no_include.error, test/btyacc/no_include.output, test/btyacc/no_opts.error, test/btyacc/no_opts.output, test/btyacc/no_output.error, test/btyacc/no_output.output, test/btyacc/no_output1.error, test/btyacc/no_output1.output, test/btyacc/no_output2.error, test/btyacc/no_output2.output, test/btyacc/no_p_opt.error, test/btyacc/no_p_opt.output, test/btyacc/no_p_opt1.error, test/btyacc/no_p_opt1.output, test/btyacc/no_verbose.error, test/btyacc/no_verbose.output, test/btyacc/nostdin.error, test/btyacc/nostdin.output, test/yacc/big_b.error, test/yacc/big_b.output, test/yacc/big_l.error, test/yacc/big_l.output, test/yacc/help.error, test/yacc/help.output, test/yacc/no_b_opt.error, test/yacc/no_b_opt.output, test/yacc/no_b_opt1.error, test/yacc/no_b_opt1.output, test/yacc/no_code_c.error, test/yacc/no_code_c.output, test/yacc/no_defines.error, test/yacc/no_defines.output, test/yacc/no_graph.error, test/yacc/no_graph.output, test/yacc/no_include.error, test/yacc/no_include.output, test/yacc/no_opts.error, test/yacc/no_opts.output, test/yacc/no_output.error, test/yacc/no_output.output, test/yacc/no_output1.error, test/yacc/no_output1.output, test/yacc/no_output2.error, test/yacc/no_output2.output, test/yacc/no_p_opt.error, test/yacc/no_p_opt.output, test/yacc/no_p_opt1.error, test/yacc/no_p_opt1.output, test/yacc/no_verbose.error, test/yacc/no_verbose.output, test/yacc/nostdin.error, test/yacc/nostdin.output:
regen
* test/run_test.sh:
add a test for stdin "-" vs end-options "--", and correct a redirection
of stderr in test_flags
* test/yacc/stdin2.output, test/yacc/stdin2.calc.c, test/yacc/stdin1.calc.c, test/yacc/stdin1.error, test/yacc/stdin1.output, test/yacc/stdin2.error:
RCS_BASE
* test/btyacc/big_b.output, test/btyacc/big_l.output, test/btyacc/help.output, test/btyacc/no_b_opt.output, test/btyacc/no_output2.output, test/btyacc/no_p_opt.output, test/btyacc/nostdin.output, test/yacc/big_b.output, test/yacc/big_l.output, test/yacc/help.output, test/yacc/no_b_opt.output, test/yacc/no_output2.output, test/yacc/no_p_opt.output, test/yacc/nostdin.output:
regen
* main.c: add -D option, to specify filename vs y.tab.h for -d
* defs.h: add dflag2, for -D option
* yacc.1: document -D option
* config_h.in: updated with autoheader-252
* configure: regen
* package/debian/copyright: bump
* aclocal.m4: add CF_GETOPT_HEADER
* aclocal.m4: Improved autoconf macros:
+ CF_CC_ENV_FLAGS
putting preprocessor flags in CFLAGS also is a nuisance, which can be
addressed in the same way.
+ CF_GCC_WARNINGS
factor out workaround for XTSTRINGDEFINES as CF_CONST_X_STRING
+ CF_GNU_SOURCE
The check for _DEFAULT_SOURCE should apply to "recent" Cygwin (since early 2016),
and except for "NEWLIB" vs "GLIBC" in the test, acts the same if I pretend
that "newlib" is the GNU C library. Without this, the check falls through
to the _XOPEN_SOURCE test, which breaks the pseudoterminal checks for xterm.
+ CF_POSIX_C_SOURCE
add/use CF_POSIX_VISIBLE
+ CF_TRY_XOPEN_SOURCE
use CF_APPEND_TEXT
+ CF_WITH_MAN2HTML
use sed to work around non-POSIX tail utility
+ CF_XOPEN_SOURCE
use CF_APPEND_TEXT
add/use CF_POSIX_VISIBLE
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2019-06-10 Thomas E. Dickey <dickey@invisible-island.net>
* config.guess: 2019-06-10
2019-05-22 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: 2019-05-22
2018-06-09 Thomas E. Dickey <dickey@invisible-island.net>
* yacc.1: minor typographical fixes
* test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/rename_debug.c, btyaccpar.c:
regen
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2018-06-09 Tom.Shields
* btyaccpar.skel:
add casts to fix g++ (clang++) compile errors in the backtracking skeleton
due to assignment of void * to another pointer type.
2018-05-25 Thomas E. Dickey <dickey@invisible-island.net>
* test/run_make.sh:
check if this is bison 3+ before adding options to suppress warnings
* package/byacc.spec: build-fix for Mageia 6
* package/byacc.spec: add btyacc package
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
* package/debian/control: add a package for btyacc
* package/debian/rules: generate a package for btyacc
2018-05-24 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, btyaccpar.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/rename_debug.c:
regen
* btyaccpar.skel: fix typo
2018-05-21 Thomas E. Dickey <dickey@invisible-island.net>
* test/run_make.sh:
ignore case for "%" directives to skip with old-yacc, and add %token-table
to the list
* btyaccpar.c: regen
2018-05-21 Christos.Zoulas
* btyaccpar.skel:
improve compatibility with bison by changing the YYLLOC_DEFAULT macro to use
YYRHSLOC() macro, and adjusting the array indices of yyerror_loc_range[] for
consistency.
2018-05-10 Thomas E. Dickey <dickey@invisible-island.net>
* output.c:
add a fallback definition for YYDEBUG to the -i externs file.
* test/btyacc/rename_debug.i, test/yacc/rename_debug.i: regen
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2018-05-09 Thomas E. Dickey <dickey@invisible-island.net>
* configure: regen
* aclocal.m4: resync with my-autoconf
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
* test/btyacc/rename_debug.i, btyaccpar.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/rename_debug.c, test/btyacc/varsyntax_calc1.tab.c:
regen
* btyaccpar.skel: apply Guy Harris' changes here as well
* test/btyacc/rename_debug.i, test/yacc/rename_debug.i: regen
* output.c: correct/improve fallback prototype for yylex()
* test/btyacc/rename_debug.i, test/yacc/rename_debug.i: regen
2018-05-08 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/grammar.tab.c, test/yacc/grammar.tab.c: regen
* test/grammar.y:
quiet some warnings from gcc 7 when doing "make check_make"
* package/debian/watch, package/pkgsrc/Makefile: update ftp-url
* test/btyacc/ok_syntax1.tab.h, test/btyacc/btyacc_calc1.tab.h: regen
* output.c:
provide yylex() declaration for simple case (request by "Mutiny")
* test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/expr.oxout.tab.c, test/yacc/grammar.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/ok_syntax1.tab.h, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/rename_debug.c, test/yacc/rename_debug.i, yaccpar.c:
regen
* VERSION, package/byacc.spec, package/debian/changelog, package/debian/copyright, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2018-05-06 Guy.Harris
* yaccpar.skel: two fixes:
1) define yydebug only if YYDEBUG is defined and
2) make yynerrs a parser-local variable if the parser is reentrant.
2018-02-24 Guy.Harris
* output.c: do not emit "extern YYSTYPE yylval;" for pure parsers
2018-02-05 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: 2018-01-15
* config.guess: 2018-01-26
2017-12-04 erik.b.andersen
* main.c: A proper path for temporary files is needed by byacc under
Windows commandline, otherwise there's a risk of empty files.
The TEMP environment variable is always defined in Windows.
* defs.h: The noreturn attribute needs to be specified before function
to be portable among compilers (gcc, clang, msvc).
2017-12-04 Thomas E. Dickey <dickey@invisible-island.net>
* reader.c: adapted fix by Erik B:
a) increase the length of name[] to account for a trailing null
b) note that calling syntax_error() from get_number() does not return
2017-09-14 Tom.Shields
* yacc.1: fix typo
2017-07-09 Thomas E. Dickey <dickey@invisible-island.net>
* package/byacc.spec, package/mingw-byacc.spec:
use predefined "configure"
* reader.c: remove unused assignment
* package/debian/rules: use dpkg-buildflags
* configure: regen
* aclocal.m4: resync with my-autoconf
* reader.c, output.c, defs.h:
add/use IS_NAME1() and IS_NAME2() to reduce clutter
* reader.c, output.c, defs.h:
guard against sign-extension in ctype-macros
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
* reader.c: check for numeric overflow in get_number()
* reader.c:
correct limit-checks for input filename and line-number, in case no valid
filename and/or number was found.
2017-04-30 Thomas E. Dickey <dickey@invisible-island.net>
* test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/expr.oxout.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/rename_debug.c, btyaccpar.c, btyaccpar.skel:
@ -22,6 +442,10 @@
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
bump
2017-04-29 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: 2017-04-02
2017-03-18 Thomas E. Dickey <dickey@invisible-island.net>
* config.sub: 2017-02-07
@ -2558,7 +2982,7 @@
* vmsbuild.com: original version
2000-02-23 dickey@clark.net
2000-02-23 Thomas E. Dickey <dickey@clark.net>
* test/RCS, RCS: PERMIT FILE
@ -2597,7 +3021,7 @@
* test/ftp.output, test/ftp.tab.c, test/ftp.tab.h: RCS_BASE
1993-02-22 Thomas E. Dickey <dickey@software.org>
1993-02-22 dickey@software.org
* test/yacc/error.output, test/yacc/error.tab.h:
reference output for testing
@ -2637,7 +3061,7 @@
* symtab.c, lalr.c, error.c: original version
1990-01-16 Thomas E. Dickey <dickey@software.org>
1990-01-16 dickey@software.org
* test/code_error.y, test/pure_error.y: RCS_BASE

View file

@ -1,4 +1,4 @@
MANIFEST for byacc-20170430, version t20170430
MANIFEST for byacc-20200330, version t20200330
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGEMENTS original version of byacc - 1993
@ -77,10 +77,6 @@ test/btyacc/btyacc_demo.error reference output for testing
test/btyacc/btyacc_demo.output reference output for testing
test/btyacc/btyacc_demo.tab.c reference output for testing
test/btyacc/btyacc_demo.tab.h reference output for testing
test/btyacc/btyacc_demo2.error reference output for testing
test/btyacc/btyacc_demo2.output reference output for testing
test/btyacc/btyacc_demo2.tab.c reference output for testing
test/btyacc/btyacc_demo2.tab.h reference output for testing
test/btyacc/btyacc_destroy1.error reference output for testing
test/btyacc/btyacc_destroy1.output reference output for testing
test/btyacc/btyacc_destroy1.tab.c reference output for testing
@ -114,11 +110,6 @@ test/btyacc/code_calc.error reference output for testing
test/btyacc/code_calc.output reference output for testing
test/btyacc/code_calc.tab.c reference output for testing
test/btyacc/code_calc.tab.h reference output for testing
test/btyacc/code_debug.c reference for test-output
test/btyacc/code_debug.error reference for test-output
test/btyacc/code_debug.h reference for test-output
test/btyacc/code_debug.i reference for test-output
test/btyacc/code_debug.output reference for test-output
test/btyacc/code_error.code.c reference output for testing
test/btyacc/code_error.error reference output for testing
test/btyacc/code_error.output reference output for testing
@ -382,6 +373,7 @@ test/btyacc_demo.y testcase for btyacc
test/btyacc_destroy1.y btyacc test-case for %parse-param
test/btyacc_destroy2.y btyacc test-case for %parse-param
test/btyacc_destroy3.y btyacc test-case for %parse-param
test/calc.tab.c c-file for calc.y
test/calc.y example from VMS freeware version of byacc
test/calc1.y advanced example from Steve Johnson's paper.
test/calc2.y test-cases and reference files for %lex-param / %parse-param

View file

@ -1 +1 @@
20170430
20200330

View file

@ -1,7 +1,7 @@
dnl $Id: aclocal.m4,v 1.42 2017/02/01 10:12:21 tom Exp $
dnl $Id: aclocal.m4,v 1.48 2020/03/10 22:53:47 tom Exp $
dnl Macros for byacc configure script (Thomas E. Dickey)
dnl ---------------------------------------------------------------------------
dnl Copyright 2004-2016,2017 Thomas E. Dickey
dnl Copyright 2004-2019,2020 Thomas E. Dickey
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the
@ -54,7 +54,7 @@ define([CF_ACVERSION_COMPARE],
[ifelse([$8], , ,[$8])],
[ifelse([$9], , ,[$9])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_CFLAGS version: 12 updated: 2015/04/12 15:39:00
dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
dnl -------------
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
dnl The second parameter if given makes this macro verbose.
@ -84,10 +84,10 @@ case $cf_fix_cppflags in
&& cf_fix_cppflags=yes
if test $cf_fix_cppflags = yes ; then
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
continue
elif test "${cf_tst_cflags}" = "\"'" ; then
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
continue
fi
;;
@ -102,17 +102,17 @@ case $cf_fix_cppflags in
CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
;;
esac
cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
;;
esac
;;
(*)
cf_new_cflags="$cf_new_cflags $cf_add_cflags"
CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
;;
esac
;;
(yes)
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
@ -125,21 +125,31 @@ done
if test -n "$cf_new_cflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
CFLAGS="$CFLAGS $cf_new_cflags"
CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
fi
if test -n "$cf_new_cppflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
fi
if test -n "$cf_new_extra_cppflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
fi
AC_SUBST(EXTRA_CPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
dnl --------------
dnl use this macro for appending text without introducing an extra blank at
dnl the beginning
define([CF_APPEND_TEXT],
[
test -n "[$]$1" && $1="[$]$1 "
$1="[$]{$1}$2"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
@ -171,7 +181,7 @@ ifelse([$3],,[ :]dnl
])dnl
])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00
dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26
dnl ---------------
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
dnl into CC. This will not help with broken scripts that wrap the compiler
@ -188,19 +198,37 @@ AC_DEFUN([CF_CC_ENV_FLAGS],
# This should have been defined by AC_PROG_CC
: ${CC:=cc}
AC_MSG_CHECKING(\$CFLAGS variable)
case "x$CFLAGS" in
(*-[[IUD]]*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
cf_flags="$CFLAGS"
CFLAGS=
for cf_arg in $cf_flags
do
CF_ADD_CFLAGS($cf_arg)
done
;;
(*)
AC_MSG_RESULT(ok)
;;
esac
AC_MSG_CHECKING(\$CC variable)
case "$CC" in
(*[[\ \ ]]-*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
# humor him...
cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'`
CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'`
cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
CC="$cf_prog"
for cf_arg in $cf_flags
do
case "x$cf_arg" in
(x-[[IUDfgOW]]*)
CF_ADD_CFLAGS($cf_flags)
CF_ADD_CFLAGS($cf_arg)
;;
(*)
CC="$CC $cf_arg"
@ -285,6 +313,66 @@ cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_CONST_X_STRING version: 4 updated: 2020/03/10 18:53:47
dnl -----------------
dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
dnl character-strings.
dnl
dnl It is ambiguous because the specification accommodated the pre-ANSI
dnl compilers bundled by more than one vendor in lieu of providing a standard C
dnl compiler other than by costly add-ons. Because of this, the specification
dnl did not take into account the use of const for telling the compiler that
dnl string literals would be in readonly memory.
dnl
dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
dnl let the compiler decide how to represent Xt's strings which were #define'd.
dnl That does not solve the problem of using the block of Xt's strings which
dnl are compiled into the library (and is less efficient than one might want).
dnl
dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
dnl when compiling the library and compiling using the library, to tell the
dnl compiler that String is const.
AC_DEFUN([CF_CONST_X_STRING],
[
AC_REQUIRE([AC_PATH_XTRA])
CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
AC_TRY_COMPILE(
[
#include <stdlib.h>
#include <X11/Intrinsic.h>
],
[String foo = malloc(1); (void)foo],[
AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
AC_TRY_COMPILE(
[
#define _CONST_X_STRING /* X11R7.8 (perhaps) */
#undef XTSTRINGDEFINES /* X11R5 and later */
#include <stdlib.h>
#include <X11/Intrinsic.h>
],[String foo = malloc(1); *foo = 0],[
cf_cv_const_x_string=no
],[
cf_cv_const_x_string=yes
])
])
CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
case $cf_cv_const_x_string in
(no)
CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
;;
(*)
CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
;;
esac
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
dnl ---------------
dnl You can always use "make -n" to see the actual options, but it's hard to
@ -345,7 +433,7 @@ if test "$with_no_leaks" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00
dnl CF_GCC_ATTRIBUTES version: 18 updated: 2020/03/10 18:53:47
dnl -----------------
dnl Test for availability of useful gcc __attribute__ directives to quiet
dnl compiler warnings. Though useful, not all are supported -- and contrary
@ -389,7 +477,7 @@ cat > conftest.$ac_ext <<EOF
extern void wow(char *,...) GCC_SCANFLIKE(1,2);
extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
extern void foo(void) GCC_NORETURN;
int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; }
EOF
cf_printf_attribute=no
cf_scanf_attribute=no
@ -455,9 +543,10 @@ rm -rf conftest*
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
dnl --------------
dnl Find version of gcc
dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
dnl compatible), attempt to determine if icc/clang is actually used.
AC_DEFUN([CF_GCC_VERSION],[
AC_REQUIRE([AC_PROG_CC])
GCC_VERSION=none
@ -467,14 +556,17 @@ if test "$GCC" = yes ; then
test -z "$GCC_VERSION" && GCC_VERSION=unknown
AC_MSG_RESULT($GCC_VERSION)
fi
CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00
dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12
dnl ---------------
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
dnl
dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
dnl -Winline (usually not worthwhile)
dnl -Wredundant-decls (system headers make this too noisy)
dnl -Wtraditional (combines too many unrelated messages, only a few useful)
dnl -Wwrite-strings (too noisy, but should review occasionally). This
@ -491,14 +583,11 @@ dnl
AC_DEFUN([CF_GCC_WARNINGS],
[
AC_REQUIRE([CF_GCC_VERSION])
CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
cat > conftest.$ac_ext <<EOF
#line __oline__ "${as_me:-configure}"
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
EOF
if test "$INTEL_COMPILER" = yes
then
# The "-wdXXX" options suppress warnings:
@ -533,8 +622,7 @@ then
fi
done
CFLAGS="$cf_save_CFLAGS"
elif test "$GCC" = yes
elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown"
then
AC_CHECKING([for $CC warning options])
cf_save_CFLAGS="$CFLAGS"
@ -556,15 +644,12 @@ then
Wpointer-arith \
Wshadow \
Wstrict-prototypes \
Wundef $cf_gcc_warnings $cf_warn_CONST $1
Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if AC_TRY_EVAL(ac_compile); then
test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
case $cf_opt in
(Wcast-qual)
CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
;;
(Winline)
case $GCC_VERSION in
([[34]].*)
@ -590,7 +675,33 @@ rm -rf conftest*
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37
dnl CF_GETOPT_HEADER version: 6 updated: 2014/07/22 14:45:54
dnl ----------------
dnl Check for getopt's variables which are commonly defined in stdlib.h,
dnl unistd.h or (nonstandard) in getopt.h
AC_DEFUN([CF_GETOPT_HEADER],
[
AC_HAVE_HEADERS(unistd.h getopt.h)
AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
cf_cv_getopt_header=none
for cf_header in stdio.h stdlib.h unistd.h getopt.h
do
AC_TRY_COMPILE([
#include <$cf_header>],
[int x = optind; char *y = optarg],
[cf_cv_getopt_header=$cf_header
break])
done
])
if test $cf_cv_getopt_header != none ; then
AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header])
fi
if test $cf_cv_getopt_header = getopt.h ; then
AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41
dnl -------------
dnl Check if we must define _GNU_SOURCE to get a reasonable value for
dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
@ -598,38 +709,106 @@ dnl (or misfeature) of glibc2, which breaks portability of many applications,
dnl since it is interwoven with GNU extensions.
dnl
dnl Well, yes we could work around it...
dnl
dnl Parameters:
dnl $1 is the nominal value for _XOPEN_SOURCE
AC_DEFUN([CF_GNU_SOURCE],
[
AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
cf_gnu_xopen_source=ifelse($1,,500,$1)
AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifndef _XOPEN_SOURCE
make an error
#endif],
[cf_cv_gnu_source=no],
[cf_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _XOPEN_SOURCE
make an error
#endif],
[cf_cv_gnu_source=no],
[cf_cv_gnu_source=yes])
CPPFLAGS="$cf_save"
])
#if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
return 0;
#elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0
return 0;
#else
# error not GNU C library
#endif],
[cf_cv_gnu_library=yes],
[cf_cv_gnu_library=no])
])
if test "$cf_cv_gnu_source" = yes
then
AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _DEFAULT_SOURCE
make an error
#endif],
[cf_cv_default_source=no],
[cf_cv_default_source=yes])
if test x$cf_cv_gnu_library = xyes; then
# With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
# was changed to help a little. newlib incorporated the change about 4
# years later.
AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
cf_save="$CPPFLAGS"
CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
AC_TRY_COMPILE([#include <sys/types.h>],[
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
return 0;
#elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3)
return 0;
#else
# error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
#endif],
[cf_cv_gnu_library_219=yes],
[cf_cv_gnu_library_219=no])
CPPFLAGS="$cf_save"
])
test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE"
if test "x$cf_cv_gnu_library_219" = xyes; then
cf_save="$CPPFLAGS"
AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
AC_TRY_COMPILE([
#include <limits.h>
#include <sys/types.h>
],[
#if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
return 0;
#else
# error GNU C library is too old
#endif],
[cf_cv_gnu_dftsrc_219=yes],
[cf_cv_gnu_dftsrc_219=no])
])
test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
else
cf_cv_gnu_dftsrc_219=maybe
fi
if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifndef _XOPEN_SOURCE
#error expected _XOPEN_SOURCE to be defined
#endif],
[cf_cv_gnu_source=no],
[cf_save="$CPPFLAGS"
CF_ADD_CFLAGS(-D_GNU_SOURCE)
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _XOPEN_SOURCE
#error expected _XOPEN_SOURCE to be undefined
#endif],
[cf_cv_gnu_source=no],
[cf_cv_gnu_source=yes])
CPPFLAGS="$cf_save"
])
])
if test "$cf_cv_gnu_source" = yes
then
AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _DEFAULT_SOURCE
#error expected _DEFAULT_SOURCE to be undefined
#endif],
[cf_cv_default_source=no],
[cf_cv_default_source=yes])
])
if test "$cf_cv_default_source" = yes
then
CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
fi
fi
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
@ -935,7 +1114,7 @@ case ".[$]$1" in
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00
dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17
dnl -----------------
dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
dnl
@ -950,7 +1129,10 @@ dnl
dnl Parameters:
dnl $1 is the nominal value for _POSIX_C_SOURCE
AC_DEFUN([CF_POSIX_C_SOURCE],
[
[AC_REQUIRE([CF_POSIX_VISIBLE])dnl
if test "$cf_cv_posix_visible" = no; then
cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
cf_save_CFLAGS="$CFLAGS"
@ -988,7 +1170,8 @@ make an error
fi
CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
CPPFLAGS="$cf_trim_CPPFLAGS"
CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
CF_MSG_LOG(if the second compile does not leave our definition intact error)
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifndef _POSIX_C_SOURCE
@ -1006,6 +1189,35 @@ if test "$cf_cv_posix_c_source" != no ; then
CF_ADD_CFLAGS($cf_cv_posix_c_source)
fi
fi # cf_cv_posix_visible
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17
dnl ----------------
dnl POSIX documents test-macros which an application may set before any system
dnl headers are included to make features available.
dnl
dnl Some BSD platforms (originally FreeBSD, but copied by a few others)
dnl diverged from POSIX in 2002 by setting symbols which make all of the most
dnl recent features visible in the system header files unless the application
dnl overrides the corresponding test-macros. Doing that introduces portability
dnl problems.
dnl
dnl This macro makes a special check for the symbols used for this, to avoid a
dnl conflicting definition.
AC_DEFUN([CF_POSIX_VISIBLE],
[
AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[
AC_TRY_COMPILE([#include <stdio.h>],[
#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \
&& defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \
&& defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \
&& defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0)
#error conflicting symbols found
#endif
],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes])
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
@ -1017,11 +1229,15 @@ AC_PROG_AWK
test -z "$AWK" && AC_MSG_ERROR(No awk program found)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54
dnl ----------
dnl standard check for CC, plus followup sanity checks
dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
AC_DEFUN([CF_PROG_CC],[
CF_ACVERSION_CHECK(2.53,
[AC_MSG_WARN(this will incorrectly handle gnatgcc choice)
AC_REQUIRE([AC_PROG_CC])],
[])
ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
CF_GCC_VERSION
CF_ACVERSION_CHECK(2.52,
@ -1030,13 +1246,14 @@ CF_ACVERSION_CHECK(2.52,
CF_CC_ENV_FLAGS
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_GROFF version: 2 updated: 2015/07/04 11:16:27
dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19
dnl -------------
dnl Check if groff is available, for cases (such as html output) where nroff
dnl is not enough.
AC_DEFUN([CF_PROG_GROFF],[
AC_PATH_PROG(GROFF_PATH,groff,no)
AC_PATH_PROG(NROFF_PATH,nroff,no)
AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no)
AC_PATH_PROG(TBL_PATH,tbl,cat)
if test "x$GROFF_PATH" = xno
then
NROFF_NOTE=
@ -1049,11 +1266,16 @@ AC_SUBST(GROFF_NOTE)
AC_SUBST(NROFF_NOTE)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37
dnl ------------
AC_DEFUN([CF_PROG_LINT],
[
AC_CHECK_PROGS(LINT, lint cppcheck splint)
case "x$LINT" in
(xcppcheck|x*/cppcheck)
test -z "$LINT_OPTS" && LINT_OPTS="--enable=all"
;;
esac
AC_SUBST(LINT_OPTS)
])dnl
dnl ---------------------------------------------------------------------------
@ -1074,7 +1296,7 @@ $1=`echo "$2" | \
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13
dnl -------------------
dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
dnl can define it successfully.
@ -1090,7 +1312,7 @@ make an error
#endif],
[cf_cv_xopen_source=no],
[cf_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
AC_TRY_COMPILE([
#include <stdlib.h>
#include <string.h>
@ -1130,6 +1352,14 @@ AC_DEFUN([CF_VERBOSE],
CF_MSG_LOG([$1])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITHOUT_X version: 1 updated: 2020/03/03 18:27:24
dnl ------------
dnl Use this to cancel the check for X headers/libraries which would be pulled
dnl in via CF_GCC_WARNINGS.
define([CF_WITHOUT_X],
AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl
[])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
dnl ----------------
dnl Configure-option for dbmalloc. The optional parameter is used to override
@ -1160,9 +1390,13 @@ if test "$with_dmalloc" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_MAN2HTML version: 5 updated: 2015/08/20 04:51:36
dnl CF_WITH_MAN2HTML version: 8 updated: 2018/06/27 18:44:03
dnl ----------------
dnl Check for man2html and groff. Optionally prefer man2html over groff.
dnl Check for man2html and groff. Prefer man2html over groff, but use groff
dnl as a fallback. See
dnl
dnl http://invisible-island.net/scripts/man2html.html
dnl
dnl Generate a shell script which hides the differences between the two.
dnl
dnl We name that "man2html.tmp".
@ -1171,11 +1405,35 @@ dnl The shell script can be removed later, e.g., using "make distclean".
AC_DEFUN([CF_WITH_MAN2HTML],[
AC_REQUIRE([CF_PROG_GROFF])
case "x${with_man2html}" in
(xno)
cf_man2html=no
;;
(x|xyes)
AC_PATH_PROG(cf_man2html,man2html,no)
case "x$cf_man2html" in
(x/*)
AC_MSG_CHECKING(for the modified Earl Hood script)
if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null )
then
cf_man2html_ok=yes
else
cf_man2html=no
cf_man2html_ok=no
fi
AC_MSG_RESULT($cf_man2html_ok)
;;
(*)
cf_man2html=no
;;
esac
esac
AC_MSG_CHECKING(for program to convert manpage to html)
AC_ARG_WITH(man2html,
[ --with-man2html=XXX use XXX rather than groff],
[cf_man2html=$withval],
[cf_man2html=$GROFF_PATH])
[cf_man2html=$cf_man2html])
cf_with_groff=no
@ -1223,7 +1481,7 @@ then
MAN2HTML_NOTE="$GROFF_NOTE"
MAN2HTML_PATH="$GROFF_PATH"
cat >>$MAN2HTML_TEMP <<CF_EOF
$SHELL -c "tbl \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}"
$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}"
CF_EOF
else
MAN2HTML_NOTE=""
@ -1238,7 +1496,7 @@ else
MARKER
CF_EOF
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C nroff -man conftest.in >conftest.out
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out
cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`
cf_man2html_top=`expr $cf_man2html_1st - 2`
@ -1266,8 +1524,8 @@ CF_EOF
CF_EOF
done
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C nroff -man conftest.in >conftest.out
cf_man2html_page=`fgrep -n HEAD1 conftest.out |tail -n 1 |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out
cf_man2html_page=`fgrep -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`
test -z "$cf_man2html_page" && cf_man2html_page=99999
test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999
@ -1279,10 +1537,10 @@ CF_EOF
MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title="\$ROOT\(\$TYPE\)" -compress -pgsize $cf_man2html_page"
case \${TYPE} in
(ms)
tbl \${ROOT}.\${TYPE} | nroff -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS
$TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS
;;
(*)
tbl \${ROOT}.\${TYPE} | nroff -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS
$TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS
;;
esac
CF_EOF
@ -1326,7 +1584,7 @@ fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42
dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
dnl or adapt to the vendor's definitions to get equivalent functionality,
@ -1337,6 +1595,9 @@ dnl $1 is the nominal value for _XOPEN_SOURCE
dnl $2 is the nominal value for _POSIX_C_SOURCE
AC_DEFUN([CF_XOPEN_SOURCE],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([CF_POSIX_VISIBLE])
if test "$cf_cv_posix_visible" = no; then
cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
@ -1356,7 +1617,7 @@ case $host_os in
cf_xopen_source="-D_DARWIN_C_SOURCE"
cf_XOPEN_SOURCE=
;;
(freebsd*|dragonfly*)
(freebsd*|dragonfly*|midnightbsd*)
# 5.x headers associate
# _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
# _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
@ -1375,7 +1636,7 @@ case $host_os in
cf_XOPEN_SOURCE=
;;
(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
CF_GNU_SOURCE
CF_GNU_SOURCE($cf_XOPEN_SOURCE)
;;
(minix*)
cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
@ -1451,4 +1712,5 @@ make an error
CF_TRY_XOPEN_SOURCE
fi
fi
fi # cf_cv_posix_visible
])

View file

@ -2,7 +2,7 @@
* @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @
*/
/* @Id: btyaccpar.skel,v 1.6 2017/04/30 23:40:34 tom Exp @ */
/* @Id: btyaccpar.skel,v 1.10 2018/05/25 01:03:46 tom Exp @ */
#include "defs.h"
@ -78,8 +78,9 @@ const char *const tables[] =
const char *const global_vars[] =
{
"",
"#if YYDEBUG",
"int yydebug;",
"int yynerrs;",
"#endif",
0
};
@ -90,6 +91,8 @@ const char *const impure_vars[] =
"int yychar;",
"YYSTYPE yyval;",
"YYSTYPE yylval;",
"int yynerrs;",
"",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
"YYLTYPE yyloc; /* position returned by actions */",
"YYLTYPE yylloc; /* position from the lexer */",
@ -107,17 +110,17 @@ const char *const hdr_defs[] =
"{ \\",
" if (n == 0) \\",
" { \\",
" (loc).first_line = ((rhs)[-1]).last_line; \\",
" (loc).first_column = ((rhs)[-1]).last_column; \\",
" (loc).last_line = ((rhs)[-1]).last_line; \\",
" (loc).last_column = ((rhs)[-1]).last_column; \\",
" (loc).first_line = YYRHSLOC(rhs, 0).last_line; \\",
" (loc).first_column = YYRHSLOC(rhs, 0).last_column; \\",
" (loc).last_line = YYRHSLOC(rhs, 0).last_line; \\",
" (loc).last_column = YYRHSLOC(rhs, 0).last_column; \\",
" } \\",
" else \\",
" { \\",
" (loc).first_line = ((rhs)[ 0 ]).first_line; \\",
" (loc).first_column = ((rhs)[ 0 ]).first_column; \\",
" (loc).last_line = ((rhs)[n-1]).last_line; \\",
" (loc).last_column = ((rhs)[n-1]).last_column; \\",
" (loc).first_line = YYRHSLOC(rhs, 1).first_line; \\",
" (loc).first_column = YYRHSLOC(rhs, 1).first_column; \\",
" (loc).last_line = YYRHSLOC(rhs, n).last_line; \\",
" (loc).last_column = YYRHSLOC(rhs, n).last_column; \\",
" } \\",
"} while (0)",
"#endif /* YYLLOC_DEFAULT */",
@ -232,6 +235,8 @@ const char *const body_vars[] =
" int yychar;",
" YYSTYPE yyval;",
" YYSTYPE yylval;",
" int yynerrs;",
"",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" YYLTYPE yyloc; /* position returned by actions */",
" YYLTYPE yylloc; /* position from the lexer */",
@ -436,7 +441,7 @@ const char *const body_2[] =
"#endif /* YYBTYACC */",
#endif /* defined(YYBTYACC) */
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" YYLTYPE yyerror_loc_range[2]; /* position of error start & end */",
" YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */",
"#endif",
"#if YYDEBUG",
" const char *yys;",
@ -525,10 +530,10 @@ const char *const body_3[] =
" size_t s = (size_t) (yylvlim - yylvals);",
"",
" s += YYLVQUEUEGROWTH;",
" if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;",
" if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
" if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;",
" if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
" if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
"#endif",
" yylvp = yylve = yylvals + p;",
" yylvlim = yylvals + s;",
@ -645,7 +650,7 @@ const char *const body_3[] =
" /* If this is a first conflict in the stack, start saving lexemes */",
" if (!yylexemes)",
" {",
" yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));",
" yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));",
" if (yylexemes == NULL) goto yyenomem;",
" yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));",
" if (yylvals == NULL) goto yyenomem;",
@ -858,7 +863,7 @@ const char *const body_3[] =
"",
" YYERROR_CALL(\"syntax error\");",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */",
" yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */",
"#endif",
"",
"#if !YYBTYACC",
@ -887,7 +892,7 @@ const char *const body_3[] =
" *++yystack.l_mark = yylval;",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" /* lookahead position is error end position */",
" yyerror_loc_range[1] = yylloc;",
" yyerror_loc_range[2] = yylloc;",
" YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */",
" *++yystack.p_mark = yyloc;",
"#endif",
@ -903,7 +908,7 @@ const char *const body_3[] =
" if (yystack.s_mark <= yystack.s_base) goto yyabort;",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" /* the current TOS position is the error start position */",
" yyerror_loc_range[0] = *yystack.p_mark;",
" yyerror_loc_range[1] = *yystack.p_mark;",
"#endif",
"#if defined(YYDESTRUCT_CALL)",
#if defined(YYBTYACC)
@ -997,10 +1002,10 @@ const char *const body_3[] =
"#endif /* YYBTYACC */",
#endif /* defined(YYBTYACC) */
" {",
" YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);",
" YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);",
" /* just in case YYERROR is invoked within the action, save",
" the start of the rhs as the error start position */",
" yyerror_loc_range[0] = yystack.p_mark[1-yym];",
" yyerror_loc_range[1] = yystack.p_mark[1-yym];",
" }",
"#endif",
"",
@ -1068,12 +1073,12 @@ const char *const trailer[] =
" size_t s = (size_t) (yylvlim - yylvals);",
"",
" s += YYLVQUEUEGROWTH;",
" if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)",
" if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)",
" goto yyenomem;",
" if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
" if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
" goto yyenomem;",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
" if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
" goto yyenomem;",
"#endif",
" yylvp = yylve = yylvals + p;",

View file

@ -1,4 +1,4 @@
/* $Id: btyaccpar.skel,v 1.7 2017/05/01 00:13:19 tom Exp $ */
/* $Id: btyaccpar.skel,v 1.11 2018/06/10 00:41:06 Tom.Shields Exp $ */
#include "defs.h"
@ -53,14 +53,17 @@ extern const char *const yyrule[];
#endif
%% global_vars
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
%% impure_vars
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -74,17 +77,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -185,6 +188,8 @@ static YYINT *yylexemes = 0;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -371,7 +376,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
%%endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -449,10 +454,10 @@ yyloop:
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -563,7 +568,7 @@ yyloop:
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -773,7 +778,7 @@ yyerrhandler:
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -802,7 +807,7 @@ yyinrecovery:
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -818,7 +823,7 @@ yyinrecovery:
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
%%ifdef YYBTYACC
@ -904,10 +909,10 @@ yyreduce:
if (!yytrial)
%%endif
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -968,12 +973,12 @@ yyreduce:
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

File diff suppressed because it is too large Load diff

2788
contrib/byacc/config.sub vendored

File diff suppressed because it is too large Load diff

View file

@ -21,16 +21,52 @@
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the `getopt' function. */
#undef HAVE_GETOPT
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if getopt variables are declared in header */
#undef HAVE_GETOPT_HEADER
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the `dbmalloc' library (-ldbmalloc). */
#undef HAVE_LIBDBMALLOC
/* Define if you have the `dmalloc' library (-ldmalloc). */
#undef HAVE_LIBDMALLOC
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if mkstemp() is available and working. */
#undef HAVE_MKSTEMP
/* Define to 1 if vsnprintf() is available and working. */
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to maximum table size (default: 32500) */
@ -39,9 +75,15 @@
/* Define to 1 if filesystem supports mixed-case filenames. */
#undef MIXEDCASE_FILENAMES
/* Define to 1 if we must include getopt.h */
#undef NEED_GETOPT_H
/* Define to 1 if you want to perform memory-leak testing. */
#undef NO_LEAKS
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to the system name. */
#undef SYSTEM_NAME
@ -59,3 +101,6 @@
/* Define to 1 if you want to perform memory-leak testing. */
#undef YY_NO_LEAKS
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t

2424
contrib/byacc/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
dnl Process this file with 'autoconf' to produce a 'configure' script
dnl $Id: configure.in,v 1.21 2015/07/05 22:07:36 tom Exp $
AC_PREREQ(2.52.20011201)
AC_REVISION($Revision: 1.21 $)
dnl $Id: configure.in,v 1.23 2020/03/10 22:53:47 tom Exp $
AC_PREREQ(2.52.20200111)
AC_REVISION($Revision: 1.23 $)
AC_INIT(main.c)
AC_CONFIG_HEADER(config.h:config_h.in)
@ -15,10 +15,13 @@ CF_MAKE_TAGS
CF_PROG_AWK
CF_PROG_LINT
CF_WITHOUT_X
CF_XOPEN_SOURCE
AC_CHECK_HEADERS(fcntl.h)
CF_MKSTEMP
AC_HAVE_FUNCS(vsnprintf)
CF_GETOPT_HEADER
AC_HAVE_FUNCS(getopt vsnprintf)
AC_MSG_CHECKING(for maximum table size)
AC_ARG_WITH([max-table-size],

View file

@ -1,4 +1,4 @@
/* $Id: defs.h,v 1.57 2017/04/30 23:29:11 tom Exp $ */
/* $Id: defs.h,v 1.65 2019/11/19 23:47:49 tom Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -101,39 +101,48 @@
/* keyword codes */
#define TOKEN 0
#define LEFT 1
#define RIGHT 2
#define NONASSOC 3
#define MARK 4
#define TEXT 5
#define TYPE 6
#define START 7
#define UNION 8
#define IDENT 9
#define EXPECT 10
#define EXPECT_RR 11
#define PURE_PARSER 12
#define PARSE_PARAM 13
#define LEX_PARAM 14
#define POSIX_YACC 15
#define TOKEN_TABLE 16
#define ERROR_VERBOSE 17
#define XXXDEBUG 18
typedef enum
{
TOKEN = 0
,LEFT
,RIGHT
,NONASSOC
,MARK
,TEXT
,TYPE
,START
,UNION
,IDENT
,EXPECT
,EXPECT_RR
,PURE_PARSER
,PARSE_PARAM
,LEX_PARAM
,POSIX_YACC
,TOKEN_TABLE
,ERROR_VERBOSE
,XXXDEBUG
,XCODE
#if defined(YYBTYACC)
#define LOCATIONS 19
#define DESTRUCTOR 20
#define INITIAL_ACTION 21
,LOCATIONS
,DESTRUCTOR
,INITIAL_ACTION
#endif
}
KEY_CASES;
/* symbol classes */
#define UNKNOWN 0
#define TERM 1
#define NONTERM 2
#define ACTION 3
#define ARGUMENT 4
typedef enum
{
UNKNOWN = 0
,TERM
,NONTERM
,ACTION
,ARGUMENT
}
SYM_CASES;
/* the undefined value */
@ -146,9 +155,10 @@
/* character macros */
#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$')
#define IS_NAME1(c) (isalpha(UCH(c)) || (c) == '_' || (c) == '$')
#define IS_NAME2(c) (isalnum(UCH(c)) || (c) == '_' || (c) == '$')
#define IS_IDENT(c) (isalnum(UCH(c)) || (c) == '_' || (c) == '.' || (c) == '$')
#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7')
#define NUMERIC_VALUE(c) ((c) - '0')
/* symbol macros */
@ -272,6 +282,7 @@ struct param
/* global variables */
extern char dflag2;
extern char dflag;
extern char gflag;
extern char iflag;
@ -411,6 +422,21 @@ extern param *parse_param;
#endif
#endif
#ifdef __GNUC__
#define ATTRIBUTE_NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define ATTRIBUTE_NORETURN __declspec(noreturn)
#else
#define ATTRIBUTE_NORETURN
#endif
#if defined(NDEBUG) && defined(_MSC_VER)
#define NODEFAULT __assume(0);
#else
#define NODEFAULT
#endif
#define NOTREACHED NODEFAULT
#ifndef GCC_UNUSED
#if defined(__unused)
#define GCC_UNUSED __unused
@ -438,20 +464,31 @@ struct ainfo
extern void arg_number_disagree_warning(int a_lineno, char *a_name);
extern void arg_type_disagree_warning(int a_lineno, int i, char *a_name);
ATTRIBUTE_NORETURN
extern void at_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
extern void at_warning(int a_lineno, int i);
ATTRIBUTE_NORETURN
extern void bad_formals(void) GCC_NORETURN;
extern void default_action_warning(char *s);
extern void destructor_redeclared_warning(const struct ainfo *);
ATTRIBUTE_NORETURN
extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
extern void dollar_warning(int a_lineno, int i);
ATTRIBUTE_NORETURN
extern void fatal(const char *msg) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void illegal_character(char *c_cptr) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void missing_brace(void) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void no_grammar(void) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void no_space(void) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void open_error(const char *filename) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void over_unionized(char *u_cptr) GCC_NORETURN;
extern void prec_redeclared(void);
extern void reprec_warning(char *s);
@ -459,25 +496,43 @@ extern void restarted_warning(void);
extern void retyped_warning(char *s);
extern void revalued_warning(char *s);
extern void start_requires_args(char *a_name);
ATTRIBUTE_NORETURN
extern void syntax_error(int st_lineno, char *st_line, char *st_cptr) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void terminal_lhs(int s_lineno) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void terminal_start(char *s) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void tokenized_start(char *s) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void undefined_goal(char *s) GCC_NORETURN;
extern void undefined_symbol_warning(char *s);
ATTRIBUTE_NORETURN
extern void unexpected_EOF(void) GCC_NORETURN;
extern void unknown_arg_warning(int d_lineno, const char *dlr_opt, const char *d_arg, const char *d_line, const char *d_cptr);
extern void unknown_arg_warning(int d_lineno, const char *dlr_opt,
const char *d_arg, const char *d_line,
const char *d_cptr);
ATTRIBUTE_NORETURN
extern void unknown_rhs(int i) GCC_NORETURN;
extern void unsupported_flag_warning(const char *flag, const char *details);
ATTRIBUTE_NORETURN
extern void unterminated_action(const struct ainfo *) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void unterminated_comment(const struct ainfo *) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void unterminated_string(const struct ainfo *) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void unterminated_text(const struct ainfo *) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void unterminated_union(const struct ainfo *) GCC_NORETURN;
extern void untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name);
ATTRIBUTE_NORETURN
extern void untyped_lhs(void) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void untyped_rhs(int i, char *s) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void used_reserved(char *s) GCC_NORETURN;
ATTRIBUTE_NORETURN
extern void unterminated_arglist(const struct ainfo *) GCC_NORETURN;
extern void wrong_number_args_warning(const char *which, const char *a_name);
extern void wrong_type_for_arg_warning(int i, char *a_name);
@ -497,6 +552,7 @@ extern void show_shifts(void);
/* main.c */
extern void *allocate(size_t n);
ATTRIBUTE_NORETURN
extern void done(int k) GCC_NORETURN;
/* mkpar.c */
@ -512,6 +568,7 @@ struct mstring
extern void msprintf(struct mstring *, const char *, ...) GCC_PRINTFLIKE(2,3);
extern int mputchar(struct mstring *, int);
extern struct mstring *msnew(void);
extern struct mstring *msrenew(char *);
extern char *msdone(struct mstring *);
extern int strnscmp(const char *, const char *);
extern unsigned int strnshash(const char *);
@ -526,6 +583,24 @@ extern void output(void);
/* reader.c */
extern void reader(void);
typedef enum
{
CODE_HEADER = 0
,CODE_REQUIRES
,CODE_PROVIDES
,CODE_TOP
,CODE_IMPORTS
,CODE_MAX /* this must be last */
}
CODE_CASES;
extern struct code_lines
{
const char *name;
char *lines;
size_t num;
}
code_lines[CODE_MAX];
/* skeleton.c (generated by skel2c) */
extern void write_section(FILE * fp, const char *const section[]);

View file

@ -1,7 +1,7 @@
/* $Id: main.c,v 1.60 2017/04/30 20:57:56 Julien.Ramseier Exp $ */
/* $Id: main.c,v 1.69 2019/11/25 23:24:36 Tom.Shields Exp $ */
#include <signal.h>
#ifndef _WIN32
#if !defined(_WIN32) || defined(__MINGW32__)
#include <unistd.h> /* for _exit() */
#else
#include <stdlib.h> /* for _exit() */
@ -33,6 +33,7 @@ static MY_TMPFILES *my_tmpfiles;
#endif /* USE_MKSTEMP */
char dflag;
char dflag2;
char gflag;
char iflag;
char lflag;
@ -150,7 +151,7 @@ done(int k)
if (rflag)
DO_FREE(code_file_name);
if (dflag)
if (dflag && !dflag2)
DO_FREE(defines_file_name);
if (iflag)
@ -210,6 +211,7 @@ usage(void)
," -b file_prefix set filename prefix (default \"y.\")"
," -B create a backtracking parser"
," -d write definitions (" DEFINES_SUFFIX ")"
," -H defines_file write definitions to defines_file"
," -i write interface (y.tab.i)"
," -g write a graphical description"
," -l suppress #line directives"
@ -230,7 +232,7 @@ usage(void)
for (n = 0; n < sizeof(msg) / sizeof(msg[0]); ++n)
fprintf(stderr, "%s\n", msg[n]);
exit(1);
exit(EXIT_FAILURE);
}
static void
@ -248,6 +250,7 @@ setflag(int ch)
case 'd':
dflag = 1;
dflag2 = 0;
break;
case 'g':
@ -308,6 +311,46 @@ static void
getargs(int argc, char *argv[])
{
int i;
#ifdef HAVE_GETOPT
int ch;
if (argc > 0)
myname = argv[0];
while ((ch = getopt(argc, argv, "Bb:dgH:ilLo:Pp:rstVvy")) != -1)
{
switch (ch)
{
case 'b':
file_prefix = optarg;
break;
case 'H':
dflag = dflag2 = 1;
defines_file_name = optarg;
break;
case 'o':
output_file_name = optarg;
break;
case 'p':
symbol_prefix = optarg;
break;
default:
setflag(ch);
break;
}
}
if ((i = optind) < argc)
{
/* getopt handles "--" specially, while we handle "-" specially */
if (!strcmp(argv[i], "-"))
{
if ((i + 1) < argc)
usage();
input_file = stdin;
return;
}
}
#else
char *s;
int ch;
@ -340,6 +383,16 @@ getargs(int argc, char *argv[])
usage();
continue;
case 'H':
dflag = dflag2 = 1;
if (*++s)
defines_file_name = s;
else if (++i < argc)
defines_file_name = argv[i];
else
usage();
continue;
case 'o':
if (*++s)
output_file_name = s;
@ -378,7 +431,9 @@ getargs(int argc, char *argv[])
end_of_option:;
}
no_more_options:;
no_more_options:
#endif /* HAVE_GETOPT */
if (i + 1 != argc)
usage();
input_file_name_len = strlen(argv[i]);
@ -476,7 +531,7 @@ create_file_names(void)
else
code_file_name = output_file_name;
if (dflag)
if (dflag && !dflag2)
{
CREATE_FILE_NAME(defines_file_name, defines_suffix);
}
@ -578,7 +633,8 @@ open_tmpfile(const char *label)
char *name;
const char *mark;
if ((tmpdir = getenv("TMPDIR")) == 0 || access(tmpdir, W_OK) != 0)
if (((tmpdir = getenv("TMPDIR")) == 0 || access(tmpdir, W_OK) != 0) ||
((tmpdir = getenv("TEMP")) == 0 || access(tmpdir, W_OK) != 0))
{
#ifdef P_tmpdir
tmpdir = P_tmpdir;
@ -605,27 +661,28 @@ open_tmpfile(const char *label)
sprintf(name, MY_FMT, tmpdir, (int)(mark - label), label);
fd = mkstemp(name);
if (fd >= 0)
if (fd >= 0
&& (result = fdopen(fd, "w+")) != 0)
{
result = fdopen(fd, "w+");
if (result != 0)
MY_TMPFILES *item;
if (my_tmpfiles == 0)
{
MY_TMPFILES *item;
if (my_tmpfiles == 0)
{
atexit(close_tmpfiles);
}
item = NEW(MY_TMPFILES);
NO_SPACE(item);
item->name = name;
NO_SPACE(item->name);
item->next = my_tmpfiles;
my_tmpfiles = item;
atexit(close_tmpfiles);
}
item = NEW(MY_TMPFILES);
NO_SPACE(item);
item->name = name;
NO_SPACE(item->name);
item->next = my_tmpfiles;
my_tmpfiles = item;
}
else
{
FREE(name);
}
(void)umask(save_umask);
}
@ -678,7 +735,7 @@ open_files(void)
fprintf(graph_file, "\t*/\n");
}
if (dflag)
if (dflag || dflag2)
{
defines_file = fopen(defines_file_name, "w");
if (defines_file == 0)

View file

@ -1,4 +1,4 @@
/* $Id: mkpar.c,v 1.15 2016/06/07 00:22:12 tom Exp $ */
/* $Id: mkpar.c,v 1.16 2019/11/04 01:23:02 tom Exp $ */
#include "defs.h"
@ -174,14 +174,16 @@ find_final_state(void)
Value_t *to_state2;
shifts *p;
p = shift_table[0];
to_state2 = p->shift;
goal = ritem[1];
for (i = p->nshifts - 1; i >= 0; --i)
if ((p = shift_table[0]) != 0)
{
final_state = to_state2[i];
if (accessing_symbol[final_state] == goal)
break;
to_state2 = p->shift;
goal = ritem[1];
for (i = p->nshifts - 1; i >= 0; --i)
{
final_state = to_state2[i];
if (accessing_symbol[final_state] == goal)
break;
}
}
}

View file

@ -1,4 +1,4 @@
/* $Id: mstring.c,v 1.7 2016/12/02 17:57:21 tom Exp $ */
/* $Id: mstring.c,v 1.9 2019/11/19 23:54:53 tom Exp $ */
#include <stdlib.h>
#include <stdio.h>
@ -12,13 +12,11 @@
#define HEAD 24
#define TAIL 8
#if defined(YYBTYACC)
static char *buf_ptr;
static size_t buf_len;
void
msprintf(struct mstring *s, const char *fmt,...)
msprintf(struct mstring *s, const char *fmt, ...)
{
va_list args;
size_t len;
@ -91,7 +89,6 @@ msprintf(struct mstring *s, const char *fmt,...)
memcpy(s->ptr, buf_ptr, len);
s->ptr += len;
}
#endif
int
mputchar(struct mstring *s, int ch)
@ -136,6 +133,20 @@ msnew(void)
return n;
}
struct mstring *
msrenew(char *value)
{
struct mstring *r = 0;
if (value != 0)
{
r = msnew();
r->base = value;
r->end = value + strlen(value);
r->ptr = r->end;
}
return r;
}
char *
msdone(struct mstring *s)
{
@ -198,10 +209,8 @@ strnshash(const char *s)
void
mstring_leaks(void)
{
#if defined(YYBTYACC)
free(buf_ptr);
buf_ptr = 0;
buf_len = 0;
#endif
}
#endif

View file

@ -1,4 +1,4 @@
/* $Id: output.c,v 1.81 2017/04/30 23:23:32 tom Exp $ */
/* $Id: output.c,v 1.92 2019/11/20 00:55:05 tom Exp $ */
#include "defs.h"
@ -185,6 +185,27 @@ output_prefix(FILE * fp)
fprintf(fp, "#define YYPREFIX \"%s\"\n", symbol_prefix);
}
static void
output_code_lines(FILE * fp, int cl)
{
if (code_lines[cl].lines != NULL)
{
if (fp == code_file)
{
outline += (int)code_lines[cl].num;
outline += 3;
fprintf(fp, "\n");
}
fprintf(fp, "/* %%code \"%s\" block start */\n", code_lines[cl].name);
fputs(code_lines[cl].lines, fp);
fprintf(fp, "/* %%code \"%s\" block end */\n", code_lines[cl].name);
if (fp == code_file)
{
write_code_lineno(fp);
}
}
}
static void
output_newline(void)
{
@ -1162,21 +1183,21 @@ is_C_identifier(char *name)
if (c == '"')
{
c = *++s;
if (!isalpha(c) && c != '_' && c != '$')
if (!IS_NAME1(c))
return (0);
while ((c = *++s) != '"')
{
if (!isalnum(c) && c != '_' && c != '$')
if (!IS_NAME2(c))
return (0);
}
return (1);
}
if (!isalpha(c) && c != '_' && c != '$')
if (!IS_NAME1(c))
return (0);
while ((c = *++s) != 0)
{
if (!isalnum(c) && c != '_' && c != '$')
if (!IS_NAME2(c))
return (0);
}
return (1);
@ -1206,6 +1227,11 @@ output_defines(FILE * fp)
int c, i;
char *s;
if (fp == defines_file)
{
output_code_lines(fp, CODE_REQUIRES);
}
for (i = 2; i < ntokens; ++i)
{
s = symbol_name[i];
@ -1239,6 +1265,11 @@ output_defines(FILE * fp)
if (fp != defines_file || iflag)
fprintf(fp, "#define YYERRCODE %d\n", symbol_value[1]);
if (fp == defines_file)
{
output_code_lines(fp, CODE_PROVIDES);
}
if (token_table && rflag && fp != externs_file)
{
if (fp == code_file)
@ -1259,11 +1290,15 @@ output_defines(FILE * fp)
while ((c = getc(union_file)) != EOF)
putc_code(fp, c);
}
fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix);
if (!pure_parser)
fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix);
}
#if defined(YYBTYACC)
if (locations)
{
output_ltype(fp);
fprintf(fp, "extern YYLTYPE %slloc;\n", symbol_prefix);
}
#endif
}
}
@ -1274,9 +1309,9 @@ output_stored_text(FILE * fp)
int c;
FILE *in;
rewind(text_file);
if (text_file == NULL)
open_error("text_file");
rewind(text_file);
in = text_file;
if ((c = getc(in)) == EOF)
return;
@ -1288,6 +1323,15 @@ output_stored_text(FILE * fp)
write_code_lineno(fp);
}
static int
output_yydebug(FILE * fp)
{
fprintf(fp, "#ifndef YYDEBUG\n");
fprintf(fp, "#define YYDEBUG %d\n", tflag);
fprintf(fp, "#endif\n");
return 3;
}
static void
output_debug(void)
{
@ -1298,16 +1342,11 @@ output_debug(void)
++outline;
fprintf(code_file, "#define YYFINAL %d\n", final_state);
putl_code(code_file, "#ifndef YYDEBUG\n");
++outline;
fprintf(code_file, "#define YYDEBUG %d\n", tflag);
putl_code(code_file, "#endif\n");
outline += output_yydebug(code_file);
if (rflag)
{
fprintf(output_file, "#ifndef YYDEBUG\n");
fprintf(output_file, "#define YYDEBUG %d\n", tflag);
fprintf(output_file, "#endif\n");
output_yydebug(output_file);
}
maxtok = 0;
@ -1793,6 +1832,23 @@ output_lex_decl(FILE * fp)
putl_code(fp, "# define YYLEX yylex()\n");
}
putl_code(fp, "#endif\n");
/*
* Provide a prototype for yylex for the simplest case. This is done for
* better compatibility with older yacc's, but can be a problem if someone
* uses "static int yylex(void);"
*/
if (!pure_parser
#if defined(YYBTYACC)
&& !backtrack
#endif
&& !strcmp(symbol_prefix, "yy"))
{
putl_code(fp, "\n");
putl_code(fp, "#if !(defined(yylex) || defined(YYSTATE))\n");
putl_code(fp, "int YYLEX_DECL();\n");
putl_code(fp, "#endif\n");
}
}
static void
@ -1980,6 +2036,7 @@ output(void)
free_shifts();
free_reductions();
output_code_lines(code_file, CODE_TOP);
#if defined(YYBTYACC)
output_backtracking_parser(output_file);
if (rflag)
@ -2021,13 +2078,11 @@ output(void)
if (iflag)
{
fprintf(externs_file, "\n");
output_yydebug(externs_file);
output_externs(externs_file, global_vars);
if (!pure_parser)
output_externs(externs_file, impure_vars);
}
if (iflag)
{
if (dflag)
{
++outline;
@ -2057,22 +2112,30 @@ output(void)
output_actions();
free_parser();
output_debug();
if (rflag)
{
write_section(code_file, xdecls);
output_YYINT_typedef(code_file);
write_section(code_file, tables);
}
write_section(code_file, global_vars);
if (!pure_parser)
{
write_section(code_file, impure_vars);
}
output_code_lines(code_file, CODE_REQUIRES);
write_section(code_file, hdr_defs);
if (!pure_parser)
{
write_section(code_file, hdr_vars);
}
output_code_lines(code_file, CODE_PROVIDES);
output_code_lines(code_file, CODE_HEADER);
output_trailing_text();
#if defined(YYBTYACC)
if (destructor)

View file

@ -1,8 +1,9 @@
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
%define AppVersion 20170430
%define AltProgram btyacc
%define AppVersion 20200330
%define UseProgram yacc
# $XTermId: byacc.spec,v 1.34 2017/04/30 20:55:15 tom Exp $
# $Id: byacc.spec,v 1.49 2020/03/30 23:31:42 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1
@ -10,7 +11,7 @@ License: Public Domain, MIT
Group: Applications/Development
URL: ftp://invisible-island.net/%{AppProgram}
Source0: %{AppProgram}-%{AppVersion}.tgz
Packager: Thomas Dickey <dickey@invisible-island.net>
Packager: Thomas E. Dickey <dickey@invisible-island.net>
%description
This package provides a parser generator utility that reads a grammar
@ -19,30 +20,69 @@ parsers consist of a set of LALR(1) parsing tables and a driver
routine written in the C programming language. It has a public domain
license which includes the generated C.
%package -n btyacc
Summary: Curses library with POSIX thread support.
%description -n btyacc
This package provides a parser generator utility that reads a grammar
specification from a file and generates an LR(1) parser for it. The
parsers consist of a set of LALR(1) parsing tables and a driver
routine written in the C programming language. It has a public domain
license which includes the generated C.
This package has the backtracking extension.
%prep
%define debug_package %{nil}
%setup -q -n %{AppProgram}-%{AppVersion}
%build
%define my_srcdir ..
%define CFG_OPTS \\\
--verbose \\\
--disable-echo \\\
--target %{_target_platform} \\\
--prefix=%{_prefix} \\\
--srcdir=%{my_srcdir} \\\
--bindir=%{_bindir} \\\
--libdir=%{_libdir} \\\
--mandir=%{_mandir}
INSTALL_PROGRAM='${INSTALL}' \
./configure \
--program-prefix=b \
--target %{_target_platform} \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--libdir=%{_libdir} \
--mandir=%{_mandir}
%global _configure ../configure
mkdir BUILD-byacc
pushd BUILD-byacc
CONFIGURE_TOP=%{my_srcdir} \
%configure %{CFG_OPTS} \
--program-prefix=b \
--program-transform-name='s,\^,b,'
make
popd
mkdir BUILD-btyacc
pushd BUILD-btyacc
CONFIGURE_TOP=%{my_srcdir} \
%configure %{CFG_OPTS} \
--enable-btyacc \
--program-prefix=bt \
--with-max-table-size=18000 \
--program-transform-name='s,\^,bt,'
make
popd
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
( cd $RPM_BUILD_ROOT%{_bindir} && ln -s %{AppProgram} %{UseProgram} )
pushd BUILD-byacc
make install DESTDIR=$RPM_BUILD_ROOT
( cd $RPM_BUILD_ROOT%{_bindir} && ln -vs %{AppProgram} %{UseProgram} )
popd
strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram}
pushd BUILD-btyacc
make install DESTDIR=$RPM_BUILD_ROOT
popd
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
@ -53,8 +93,19 @@ strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram}
%{_prefix}/bin/%{UseProgram}
%{_mandir}/man1/%{AppProgram}.*
%files -n btyacc
%defattr(-,root,root)
%{_prefix}/bin/%{AltProgram}
%{_mandir}/man1/%{AltProgram}.*
%changelog
# each patch should add its ChangeLog entries here
* Fri May 25 2018 Thomas Dickey
- add btyacc package
* Sun Jul 09 2017 Thomas Dickey
- use predefined "configure"
* Sun Jun 06 2010 Thomas Dickey
- initial version

View file

@ -1,3 +1,75 @@
byacc (20200330) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 30 Mar 2020 19:31:42 -0400
byacc (20191125) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 25 Nov 2019 18:13:14 -0500
byacc (20191119) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Tue, 19 Nov 2019 20:40:56 -0500
byacc (20191103) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 03 Nov 2019 16:42:41 -0500
byacc (20190617) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 16 Jun 2019 15:51:03 -0400
byacc (20190616) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 16 Jun 2019 08:55:03 -0400
byacc (20180609) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 09 Jun 2018 20:42:16 -0400
byacc (20180525) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 21 May 2018 18:50:44 -0400
byacc (20180510) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Thu, 10 May 2018 04:59:09 -0400
byacc (20180509) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 09 May 2018 21:13:51 -0400
byacc (20180508) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Tue, 08 May 2018 16:24:39 -0400
byacc (20170709) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 09 Jul 2017 13:49:13 -0400
byacc (20170430) unstable; urgency=low
* maintenance updates

View file

@ -1,7 +1,7 @@
Source: byacc
Maintainer: Dave Beckett <dajobe@debian.org>
Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
Section: devel
Priority: extra
Priority: optional
Standards-Version: 3.8.4
Build-Depends: debhelper (>= 5)
Homepage: http://invisible-island.net/byacc/
@ -15,3 +15,15 @@ Description: public domain Berkeley LALR Yacc parser generator
parsers consist of a set of LALR(1) parsing tables and a driver
routine written in the C programming language. It has a public domain
license which includes the generated C.
Package: btyacc
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: public domain Berkeley LALR Yacc parser generator
This package provides a parser generator utility that reads a grammar
specification from a file and generates an LR(1) parser for it. The
parsers consist of a set of LALR(1) parsing tables and a driver
routine written in the C programming language. It has a public domain
license which includes the generated C.
.
This package has the backtracking extension.

View file

@ -36,7 +36,7 @@ skeleton.c with the bug report. Do not expect rapid responses.
Files: aclocal.m4
Licence: other-BSD
Copyright: 2004-2016,2017 by Thomas E. Dickey
Copyright: 2004-2019,2020 by Thomas E. Dickey
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including

View file

@ -1,8 +1,6 @@
#!/usr/bin/make -f
# MAde with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.
# $Id: rules,v 1.3 2018/05/25 20:03:37 tom Exp $
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
@ -11,7 +9,11 @@
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS =
PACKAGES.arch = byacc btyacc
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
@ -22,12 +24,19 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
BYACC_DIR = $(CURDIR)/debian/byacc
BTYACC_DIR = $(CURDIR)/debian/btyacc
configure: configure-stamp
configure-stamp:
dh_testdir
BYACC_TMP = t/byacc
BTYACC_TMP = t/btyacc
CFLAGS="$(CFLAGS)" ./configure \
verbose = # -v
configure = \
CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
../../configure \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
@ -35,59 +44,96 @@ configure-stamp:
--sysconfdir=/etc \
--program-transform-name='s,^,b,'
touch configure-stamp
all: build
build: build-stamp
build-stamp: configure-stamp
config: config-arch
build: build-arch
install: install-arch
binary: binary-arch
config-arch: $(PACKAGES.arch:%=config-%-stamp)
build-arch: $(PACKAGES.arch:%=build-%-stamp)
install-arch: $(PACKAGES.arch:%=install-%-stamp)
config-byacc-stamp:
dh_testdir
$(MAKE)
rm -rf $(BYACC_TMP)
mkdir -p $(BYACC_TMP)
cd $(BYACC_TMP); $(configure)
touch build-stamp
touch $@
config-btyacc-stamp:
dh_testdir
rm -rf $(BTYACC_TMP)
mkdir -p $(BTYACC_TMP)
cd $(BTYACC_TMP); $(configure) \
--enable-btyacc \
--with-max-table-size=18000 \
--program-transform-name='s,^,bt,'
touch $@
build-byacc-stamp: config-byacc-stamp
dh_testdir
cd $(BYACC_TMP); $(MAKE)
touch $@
build-btyacc-stamp: config-btyacc-stamp
dh_testdir
cd $(BTYACC_TMP); $(MAKE)
touch $@
install-byacc-stamp: build-byacc-stamp
dh_testdir
dh_testroot
dh_installdirs
cd $(BYACC_TMP); $(MAKE) install DESTDIR=$(BYACC_DIR)
touch $@
install-btyacc-stamp: build-btyacc-stamp
dh_testdir
dh_testroot
dh_installdirs
cd $(BTYACC_TMP); $(MAKE) install DESTDIR=$(BTYACC_DIR)
touch $@
clean:
dh_testdir
dh_testroot
[ ! -f Makefile ] || $(MAKE) clean
dh_clean $(verbose)
rm -f configure-stamp build-stamp install-stamp \
config.cache config.h config.status config.log makefile
rm -f *.o yacc
dh_clean
install: install-stamp
install-stamp: build-stamp
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
$(MAKE) install DESTDIR=$(CURDIR)/debian/byacc
touch install-stamp
# Build architecture-independent files here.
binary-indep: build install
# No binary-indep target.
rm -rf t
# Build architecture-dependent files here.
binary-arch: build install
ifneq ($(PACKAGES.arch),)
rm -f $(PACKAGES.arch:%=install-%-stamp)
dh_testdir
dh_testroot
dh_installdocs
dh_installexamples
dh_installchangelogs CHANGES
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
dh_lintian $(verbose) $(PACKAGES.arch:%=-p%)
dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%)
dh_installexamples $(verbose) $(PACKAGES.arch:%=-p%)
dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) CHANGES
dh_strip $(verbose) $(PACKAGES.arch:%=-p%)
dh_compress $(verbose) $(PACKAGES.arch:%=-p%)
dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%)
dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%)
dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%)
dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%)
dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%)
dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%)
endif
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install install-stamp
.PHONY: build clean config config-arch binary binary-arch install install-arch

View file

@ -1,4 +1,4 @@
version=3
opts=passive ftp://invisible-island.net/byacc/byacc-(\d+)\.tgz \
opts=passive ftp://ftp.invisible-island.net/byacc/byacc-(\d+)\.tgz \
debian uupdate

View file

@ -1,8 +1,8 @@
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
%define AppVersion 20170430
%define AppVersion 20200330
%define UseProgram yacc
# $XTermId: mingw-byacc.spec,v 1.16 2017/04/30 20:55:15 tom Exp $
# $Id: mingw-byacc.spec,v 1.29 2020/03/30 23:31:42 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1
@ -21,12 +21,12 @@ license which includes the generated C.
%prep
%define debug_package %{nil}
%setup -q -n %{AppProgram}-%{AppVersion}
%build
INSTALL_PROGRAM='${INSTALL}' \
./configure \
%configure --verbose \
--program-prefix=b \
--target %{_target_platform} \
--prefix=%{_prefix} \
@ -56,5 +56,8 @@ strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram}
%changelog
# each patch should add its ChangeLog entries here
* Sun Jul 09 2017 Thomas Dickey
- use predefined "configure"
* Wed Sep 25 2013 Thomas Dickey
- cloned from byacc.spec

View file

@ -1,10 +1,10 @@
# $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $
#
DISTNAME= byacc-20170430
DISTNAME= byacc-20200330
PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= ftp://invisible-island.net/byacc/
MASTER_SITES= ftp://ftp.invisible-island.net/byacc/
EXTRACT_SUFX= .tgz
MAINTAINER= pkgsrc-users@NetBSD.org

View file

@ -1,11 +1,11 @@
/* $Id: reader.c,v 1.68 2017/02/02 01:05:36 tom Exp $ */
/* $Id: reader.c,v 1.79 2020/03/30 23:54:13 tom Exp $ */
#include "defs.h"
/* The line size must be a positive integer. One hundred was chosen */
/* because few lines in Yacc input grammars exceed 100 characters. */
/* Note that if a line exceeds LINESIZE characters, the line buffer */
/* will be expanded to accomodate it. */
/* will be expanded to accommodate it. */
#define LINESIZE 100
@ -62,6 +62,13 @@ char line_format[] = "#line %d \"%s\"\n";
param *lex_param;
param *parse_param;
static const char *code_keys[] =
{
"", "requires", "provides", "top", "imports",
};
struct code_lines code_lines[CODE_MAX];
#if defined(YYBTYACC)
int destructor = 0; /* =1 if at least one %destructor */
@ -144,7 +151,7 @@ line_directive(void)
switch (ld)
{
case ldSPC1:
if (isspace(ch))
if (isspace(UCH(ch)))
{
break;
}
@ -153,7 +160,7 @@ line_directive(void)
ld = ldSPC2;
break;
case ldSPC2:
if (isspace(ch))
if (isspace(UCH(ch)))
{
break;
}
@ -171,26 +178,26 @@ line_directive(void)
ld = ldSPC3;
break;
case ldSPC3:
if (isspace(ch))
if (isspace(UCH(ch)))
{
break;
}
else
UNLESS(!isdigit(ch));
UNLESS(!isdigit(UCH(ch)));
line_1st = n;
ld = ldNUM;
/* FALLTHRU */
case ldNUM:
if (isdigit(ch))
if (isdigit(UCH(ch)))
{
break;
}
else
UNLESS(!isspace(ch));
UNLESS(!isspace(UCH(ch)));
ld = ldSPC4;
break;
case ldSPC4:
if (isspace(ch))
if (isspace(UCH(ch)))
{
break;
}
@ -217,19 +224,33 @@ line_directive(void)
if (ld == ldOK)
{
size_t need = (size_t) (name_end - name_1st);
if (need > input_file_name_len)
if ((long)need > (long)input_file_name_len)
{
input_file_name_len = need;
input_file_name = TREALLOC(char, input_file_name, need + 1);
input_file_name_len = ((need + 1) * 3) / 2;
input_file_name = TREALLOC(char, input_file_name, input_file_name_len);
NO_SPACE(input_file_name);
}
memcpy(input_file_name, line + name_1st + 1, need - 1);
input_file_name[need - 1] = '\0';
if ((long)need > 0)
{
memcpy(input_file_name, line + name_1st + 1, need - 1);
input_file_name[need - 1] = '\0';
}
else
{
input_file_name[0] = '\0';
}
}
if (ld >= ldNUM && ld < ldERR)
{
lineno = (int)strtol(line + line_1st, NULL, 10) - 1;
if (line_1st >= 0)
{
lineno = (int)strtol(line + line_1st, NULL, 10) - 1;
}
else
{
lineno = 0;
}
}
return (ld == ldOK);
@ -423,11 +444,12 @@ nextc(void)
/* *INDENT-OFF* */
static struct keyword
{
char name[14];
char name[16];
int token;
}
keywords[] = {
{ "binary", NONASSOC },
{ "code", XCODE },
{ "debug", XXXDEBUG },
#if defined(YYBTYACC)
{ "destructor", DESTRUCTOR },
@ -435,7 +457,7 @@ keywords[] = {
{ "error-verbose",ERROR_VERBOSE },
{ "expect", EXPECT },
{ "expect-rr", EXPECT_RR },
{ "ident", IDENT },
{ "ident", IDENT },
#if defined(YYBTYACC)
{ "initial-action", INITIAL_ACTION },
#endif
@ -447,11 +469,11 @@ keywords[] = {
{ "nonassoc", NONASSOC },
{ "parse-param", PARSE_PARAM },
{ "pure-parser", PURE_PARSER },
{ "right", RIGHT },
{ "right", RIGHT },
{ "start", START },
{ "term", TOKEN },
{ "token", TOKEN },
{ "token-table", TOKEN_TABLE },
{ "token-table", TOKEN_TABLE },
{ "type", TYPE },
{ "union", UNION },
{ "yacc", POSIX_YACC },
@ -474,18 +496,18 @@ keyword(void)
struct keyword *key;
c = *++cptr;
if (isalpha(c))
if (isalpha(UCH(c)))
{
cinc = 0;
for (;;)
{
if (isalpha(c))
if (isalpha(UCH(c)))
{
if (isupper(c))
if (isupper(UCH(c)))
c = tolower(c);
cachec(c);
}
else if (isdigit(c)
else if (isdigit(UCH(c))
|| c == '-'
|| c == '.'
|| c == '$')
@ -646,6 +668,127 @@ copy_comment(void)
return msdone(temp);
}
static int
check_key(int pos)
{
const char *key = code_keys[pos];
while (*cptr && *key)
if (*key++ != *cptr++)
return 0;
if (*key || (!isspace(UCH(*cptr)) && *cptr != L_CURL))
return 0;
cptr--;
return 1;
}
static void
copy_code(void)
{
int c;
int curl;
int cline;
int on_line = 0;
int pos = CODE_HEADER;
struct mstring *code_mstr;
/* read %code <keyword> { */
for (;;)
{
c = *++cptr;
if (c == EOF)
unexpected_EOF();
if (isspace(UCH(c)))
continue;
if (c == L_CURL)
break;
if (pos == CODE_HEADER)
{
switch (UCH(c))
{
case 'r':
pos = CODE_REQUIRES;
break;
case 'p':
pos = CODE_PROVIDES;
break;
case 't':
pos = CODE_TOP;
break;
case 'i':
pos = CODE_IMPORTS;
break;
default:
break;
}
if (pos == -1 || !check_key(pos))
{
syntax_error(lineno, line, cptr);
return;
}
}
}
cptr++; /* skip initial curl */
while (*cptr && isspace(UCH(*cptr))) /* skip space */
cptr++;
curl = 1; /* nesting count */
/* gather text */
code_lines[pos].name = code_keys[pos];
if ((cline = (int)code_lines[pos].num) != 0)
{
code_mstr = msrenew(code_lines[pos].lines);
}
else
{
code_mstr = msnew();
}
cline++;
msprintf(code_mstr, line_format, lineno, input_file_name);
for (;;)
{
c = *cptr++;
switch (c)
{
case '\0':
get_line();
if (line == NULL)
{
unexpected_EOF();
return;
}
continue;
case '\n':
cline++;
on_line = 0;
break;
case L_CURL:
curl++;
break;
case R_CURL:
if (--curl == 0)
{
if (on_line > 1)
{
mputc(code_mstr, '\n');
cline++;
}
code_lines[pos].lines = msdone(code_mstr);
code_lines[pos].num = (size_t) cline;
return;
}
break;
default:
break;
}
mputc(code_mstr, c);
on_line++;
}
}
static void
copy_text(void)
{
@ -1235,7 +1378,7 @@ get_literal(void)
cachec('\\');
cachec(c);
}
else if (isprint(c))
else if (isprint(UCH(c)))
cachec(c);
else
{
@ -1329,13 +1472,21 @@ static Value_t
get_number(void)
{
int c;
Value_t n;
long n;
char *base = cptr;
n = 0;
for (c = *cptr; isdigit(c); c = *++cptr)
n = (Value_t)(10 * n + (c - '0'));
for (c = *cptr; isdigit(UCH(c)); c = *++cptr)
{
n = (10 * n + (c - '0'));
if (n > MAXYYINT)
{
syntax_error(lineno, line, base);
/*NOTREACHED */
}
}
return (n);
return (Value_t)(n);
}
static char *
@ -1382,7 +1533,7 @@ get_tag(void)
c = nextc();
if (c == EOF)
unexpected_EOF();
if (!isalpha(c) && c != '_' && c != '$')
if (!IS_NAME1(c))
illegal_tag(t_lineno, t_line, t_cptr);
cinc = 0;
@ -1412,7 +1563,7 @@ scan_id(void)
{
char *b = cptr;
while (isalnum(UCH(*cptr)) || *cptr == '_' || *cptr == '$')
while (IS_NAME2(UCH(*cptr)))
cptr++;
return cache_tag(b, (size_t) (cptr - b));
}
@ -1442,7 +1593,7 @@ declare_tokens(int assoc)
for (;;)
{
if (isalpha(c) || c == '_' || c == '.' || c == '$')
if (isalpha(UCH(c)) || c == '_' || c == '.' || c == '$')
bp = get_name();
else if (c == '\'' || c == '"')
bp = get_literal();
@ -1472,8 +1623,7 @@ declare_tokens(int assoc)
if (c == EOF)
unexpected_EOF();
value = UNDEFINED;
if (isdigit(c))
if (isdigit(UCH(c)))
{
value = get_number();
if (bp->value != UNDEFINED && value != bp->value)
@ -1509,7 +1659,7 @@ declare_expect(int assoc)
for (;;)
{
if (isdigit(c))
if (isdigit(UCH(c)))
{
if (assoc == EXPECT)
SRexpect = get_number();
@ -1522,7 +1672,7 @@ declare_expect(int assoc)
* Spaces, tabs, and numbers are ok,
* words, punc., etc. are syntax errors.
*/
else if (c == '\n' || isalpha(c) || !isspace(c))
else if (c == '\n' || isalpha(UCH(c)) || !isspace(UCH(c)))
{
syntax_error(lineno, line, cptr);
}
@ -1591,7 +1741,7 @@ declare_types(void)
c = nextc();
if (c == EOF)
unexpected_EOF();
if (isalpha(c) || c == '_' || c == '.' || c == '$')
if (isalpha(UCH(c)) || c == '_' || c == '.' || c == '$')
{
bp = get_name();
#if defined(YYBTYACC)
@ -1629,7 +1779,7 @@ declare_start(void)
c = nextc();
if (c == EOF)
unexpected_EOF();
if (!isalpha(c) && c != '_' && c != '.' && c != '$')
if (!isalpha(UCH(c)) && c != '_' && c != '.' && c != '$')
syntax_error(lineno, line, cptr);
bp = get_name();
if (bp->class == TERM)
@ -1664,6 +1814,10 @@ read_declarations(void)
copy_ident();
break;
case XCODE:
copy_code();
break;
case TEXT:
copy_text();
break;
@ -1871,7 +2025,7 @@ parse_id(char *p, char **save)
if (!isalpha(UCH(*p)) && *p != '_')
return NULL;
b = p;
while (isalnum(UCH(*p)) || *p == '_' || *p == '$')
while (IS_NAME2(UCH(*p)))
p++;
if (save)
{
@ -2129,7 +2283,10 @@ can_elide_arg(char **theptr, char *yyvaltag)
{
char *arg;
if (!(p = parse_id(p, &arg)))
{
FREE(offsets);
return 0;
}
for (i = plhs[nrules]->args - 1; i >= 0; i--)
if (arg == plhs[nrules]->argnames[i])
break;
@ -2149,7 +2306,7 @@ can_elide_arg(char **theptr, char *yyvaltag)
rv = 0;
if (maxoffset > 0)
FREE(offsets);
if (*p || rv <= 0)
if (p == 0 || *p || rv <= 0)
return 0;
*theptr = p + 1;
return rv;
@ -2228,6 +2385,10 @@ advance_to_start(void)
s_cptr = cptr;
switch (keyword())
{
case XCODE:
copy_code();
break;
case MARK:
no_grammar();
@ -2245,7 +2406,7 @@ advance_to_start(void)
}
c = nextc();
if (!isalpha(c) && c != '_' && c != '.' && c != '_')
if (!isalpha(UCH(c)) && c != '_' && c != '.' && c != '_')
syntax_error(lineno, line, cptr);
bp = get_name();
if (goal == 0)
@ -2572,7 +2733,7 @@ copy_action(void)
FREE(d_line);
goto loop;
}
else if (isdigit(c))
else if (isdigit(UCH(c)))
{
i = get_number();
if (i == 0)
@ -2596,7 +2757,7 @@ copy_action(void)
goto loop;
}
#if defined(YYBTYACC)
else if (isalpha(c) || c == '_')
else if (isalpha(UCH(c)) || c == '_')
{
char *arg = scan_id();
for (i = plhs[nrules]->args - 1; i >= 0; i--)
@ -2727,14 +2888,14 @@ copy_action(void)
}
}
#endif
if (isalpha(c) || c == '_' || c == '$')
if (IS_NAME1(c))
{
do
{
putc(c, f);
c = *++cptr;
}
while (isalnum(c) || c == '_' || c == '$');
while (IS_NAME2(c));
goto loop;
}
++cptr;
@ -2923,14 +3084,14 @@ get_code(struct ainfo *a, const char *loc)
cptr += 2;
goto loop;
}
if (isalpha(c) || c == '_' || c == '$')
if (IS_NAME1(c))
{
do
{
mputc(code_mstr, c);
c = *++cptr;
}
while (isalnum(c) || c == '_' || c == '$');
while (IS_NAME2(c));
goto loop;
}
++cptr;
@ -3049,7 +3210,7 @@ copy_destructor(void)
bp->destructor = process_destructor_XX(code_text, tag);
}
}
else if (isalpha(c) || c == '_' || c == '.' || c == '$')
else if (isalpha(UCH(c)) || c == '_' || c == '.' || c == '$')
{ /* "symbol" destructor */
bp = get_name();
if (bp->destructor != NULL)
@ -3090,14 +3251,14 @@ process_destructor_XX(char *code, char *tag)
msprintf(new_code, "(*val).%s", tag);
goto loop;
}
if (isalpha(c) || c == '_' || c == '$')
if (IS_NAME1(c))
{
do
{
mputc(new_code, c);
c = *++codeptr;
}
while (isalnum(c) || c == '_' || c == '$');
while (IS_NAME2(c));
goto loop;
}
++codeptr;
@ -3180,7 +3341,7 @@ mark_symbol(void)
syntax_error(lineno, line, cptr);
c = nextc();
if (isalpha(c) || c == '_' || c == '.' || c == '$')
if (isalpha(UCH(c)) || c == '_' || c == '.' || c == '$')
bp = get_name();
else if (c == '\'' || c == '"')
bp = get_literal();
@ -3211,7 +3372,7 @@ read_grammar(void)
c = nextc();
if (c == EOF)
break;
if (isalpha(c)
if (isalpha(UCH(c))
|| c == '_'
|| c == '.'
|| c == '$'

View file

@ -0,0 +1,19 @@
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-H defines_file write definitions to defines_file
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -1,18 +0,0 @@
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -0,0 +1,19 @@
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-H defines_file write definitions to defines_file
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -1,18 +0,0 @@
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -196,7 +196,7 @@ extern int YYPARSE_DECL();
#define CONST 259
#define UMINUS 260
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc1_lhs[] = { -1,
0, 0, 0, 3, 3, 3, 3, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
@ -389,8 +389,9 @@ static const char *const calc1_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
#ifndef YYLLOC_DEFAULT
@ -399,17 +400,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -615,7 +616,7 @@ vdiv(double a, double b, INTERVAL v)
{
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
}
#line 619 "btyacc_calc1.tab.c"
#line 620 "btyacc_calc1.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -752,6 +753,8 @@ YYPARSE_DECL()
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -804,7 +807,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -880,10 +883,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -994,7 +997,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1204,7 +1207,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1233,7 +1236,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1249,7 +1252,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1335,10 +1338,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1537,7 +1540,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 1541 "btyacc_calc1.tab.c"
#line 1544 "btyacc_calc1.tab.c"
default:
break;
}
@ -1592,12 +1595,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -18,6 +18,5 @@ typedef union
INTERVAL vval;
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE calc1_lval;
#endif /* _calc1__defines_h_ */

View file

@ -231,7 +231,7 @@ extern int YYPARSE_DECL();
#define ELSE 268
#define CLCL 269
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT demo_lhs[] = { -1,
15, 15, 15, 12, 18, 0, 4, 19, 4, 2,
20, 2, 10, 10, 13, 13, 11, 11, 11, 11,
@ -508,13 +508,16 @@ static const char *const demo_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -527,17 +530,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -660,7 +663,7 @@ extern Expr * var_expr(Scope *scope, char *id);
extern Code * build_expr_code(Expr *expr);
extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
extern Code * code_append(Code *stmt_list, Code *stmt);
#line 664 "btyacc_demo.tab.c"
#line 667 "btyacc_demo.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -677,7 +680,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 681 "btyacc_demo.tab.c"
#line 684 "btyacc_demo.tab.c"
case 45:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -686,7 +689,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 690 "btyacc_demo.tab.c"
#line 693 "btyacc_demo.tab.c"
case 42:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -695,7 +698,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 699 "btyacc_demo.tab.c"
#line 702 "btyacc_demo.tab.c"
case 47:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -704,7 +707,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 708 "btyacc_demo.tab.c"
#line 711 "btyacc_demo.tab.c"
case 37:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -713,7 +716,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 717 "btyacc_demo.tab.c"
#line 720 "btyacc_demo.tab.c"
case 257:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -722,7 +725,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 726 "btyacc_demo.tab.c"
#line 729 "btyacc_demo.tab.c"
case 258:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -731,7 +734,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 735 "btyacc_demo.tab.c"
#line 738 "btyacc_demo.tab.c"
case 40:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -740,7 +743,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 744 "btyacc_demo.tab.c"
#line 747 "btyacc_demo.tab.c"
case 91:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -749,7 +752,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 753 "btyacc_demo.tab.c"
#line 756 "btyacc_demo.tab.c"
case 46:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -758,7 +761,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 762 "btyacc_demo.tab.c"
#line 765 "btyacc_demo.tab.c"
case 259:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -767,7 +770,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).id); }
break;
#line 771 "btyacc_demo.tab.c"
#line 774 "btyacc_demo.tab.c"
case 260:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -776,7 +779,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).expr); }
break;
#line 780 "btyacc_demo.tab.c"
#line 783 "btyacc_demo.tab.c"
case 261:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -785,7 +788,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 789 "btyacc_demo.tab.c"
#line 792 "btyacc_demo.tab.c"
case 262:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -794,7 +797,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 798 "btyacc_demo.tab.c"
#line 801 "btyacc_demo.tab.c"
case 263:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -803,7 +806,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 807 "btyacc_demo.tab.c"
#line 810 "btyacc_demo.tab.c"
case 264:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -812,7 +815,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 816 "btyacc_demo.tab.c"
#line 819 "btyacc_demo.tab.c"
case 265:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -821,7 +824,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 825 "btyacc_demo.tab.c"
#line 828 "btyacc_demo.tab.c"
case 266:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -830,7 +833,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 834 "btyacc_demo.tab.c"
#line 837 "btyacc_demo.tab.c"
case 267:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -839,7 +842,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 843 "btyacc_demo.tab.c"
#line 846 "btyacc_demo.tab.c"
case 268:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -848,7 +851,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 852 "btyacc_demo.tab.c"
#line 855 "btyacc_demo.tab.c"
case 269:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -857,7 +860,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 861 "btyacc_demo.tab.c"
#line 864 "btyacc_demo.tab.c"
case 59:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -866,7 +869,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 870 "btyacc_demo.tab.c"
#line 873 "btyacc_demo.tab.c"
case 44:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -875,7 +878,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 879 "btyacc_demo.tab.c"
#line 882 "btyacc_demo.tab.c"
case 41:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -884,7 +887,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 888 "btyacc_demo.tab.c"
#line 891 "btyacc_demo.tab.c"
case 93:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -893,7 +896,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 897 "btyacc_demo.tab.c"
#line 900 "btyacc_demo.tab.c"
case 123:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -902,7 +905,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 906 "btyacc_demo.tab.c"
#line 909 "btyacc_demo.tab.c"
case 125:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -911,7 +914,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 915 "btyacc_demo.tab.c"
#line 918 "btyacc_demo.tab.c"
case 270:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -920,7 +923,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 924 "btyacc_demo.tab.c"
#line 927 "btyacc_demo.tab.c"
case 271:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -929,7 +932,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 933 "btyacc_demo.tab.c"
#line 936 "btyacc_demo.tab.c"
case 272:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -938,7 +941,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).expr); }
break;
#line 942 "btyacc_demo.tab.c"
#line 945 "btyacc_demo.tab.c"
case 273:
#line 67 "btyacc_demo.y"
{ /* 'msg' is a 'char *' indicating the context of destructor invocation*/
@ -948,7 +951,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).decl->scope); free((*val).decl->type); }
break;
#line 952 "btyacc_demo.tab.c"
#line 955 "btyacc_demo.tab.c"
case 274:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -957,7 +960,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 961 "btyacc_demo.tab.c"
#line 964 "btyacc_demo.tab.c"
case 275:
#line 83 "btyacc_demo.y"
{ printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
@ -966,7 +969,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
/* in this example, we don't know what to do here */ }
break;
#line 970 "btyacc_demo.tab.c"
#line 973 "btyacc_demo.tab.c"
case 276:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -975,7 +978,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).code); }
break;
#line 979 "btyacc_demo.tab.c"
#line 982 "btyacc_demo.tab.c"
case 277:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -984,7 +987,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).code); }
break;
#line 988 "btyacc_demo.tab.c"
#line 991 "btyacc_demo.tab.c"
case 278:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -993,7 +996,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).code); }
break;
#line 997 "btyacc_demo.tab.c"
#line 1000 "btyacc_demo.tab.c"
case 279:
#line 73 "btyacc_demo.y"
{ printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
@ -1002,7 +1005,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).decl); }
break;
#line 1006 "btyacc_demo.tab.c"
#line 1009 "btyacc_demo.tab.c"
case 280:
#line 73 "btyacc_demo.y"
{ printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
@ -1011,7 +1014,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).decl); }
break;
#line 1015 "btyacc_demo.tab.c"
#line 1018 "btyacc_demo.tab.c"
case 281:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1020,7 +1023,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1024 "btyacc_demo.tab.c"
#line 1027 "btyacc_demo.tab.c"
case 282:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1029,7 +1032,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1033 "btyacc_demo.tab.c"
#line 1036 "btyacc_demo.tab.c"
case 283:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1038,7 +1041,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1042 "btyacc_demo.tab.c"
#line 1045 "btyacc_demo.tab.c"
case 284:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1047,7 +1050,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1051 "btyacc_demo.tab.c"
#line 1054 "btyacc_demo.tab.c"
case 285:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1056,7 +1059,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1060 "btyacc_demo.tab.c"
#line 1063 "btyacc_demo.tab.c"
case 286:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1065,7 +1068,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1069 "btyacc_demo.tab.c"
#line 1072 "btyacc_demo.tab.c"
case 287:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1074,7 +1077,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).dlist); }
break;
#line 1078 "btyacc_demo.tab.c"
#line 1081 "btyacc_demo.tab.c"
case 288:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1083,7 +1086,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).dlist); }
break;
#line 1087 "btyacc_demo.tab.c"
#line 1090 "btyacc_demo.tab.c"
case 289:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1092,7 +1095,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1096 "btyacc_demo.tab.c"
#line 1099 "btyacc_demo.tab.c"
case 290:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1101,7 +1104,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1105 "btyacc_demo.tab.c"
#line 1108 "btyacc_demo.tab.c"
case 291:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1110,7 +1113,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1114 "btyacc_demo.tab.c"
#line 1117 "btyacc_demo.tab.c"
case 292:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1119,7 +1122,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1123 "btyacc_demo.tab.c"
#line 1126 "btyacc_demo.tab.c"
case 293:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1128,7 +1131,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1132 "btyacc_demo.tab.c"
#line 1135 "btyacc_demo.tab.c"
case 294:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1137,7 +1140,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1141 "btyacc_demo.tab.c"
#line 1144 "btyacc_demo.tab.c"
case 295:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1146,7 +1149,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).type); }
break;
#line 1150 "btyacc_demo.tab.c"
#line 1153 "btyacc_demo.tab.c"
case 296:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1155,7 +1158,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1159 "btyacc_demo.tab.c"
#line 1162 "btyacc_demo.tab.c"
case 297:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1164,7 +1167,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1168 "btyacc_demo.tab.c"
#line 1171 "btyacc_demo.tab.c"
case 298:
#line 78 "btyacc_demo.y"
{ printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
@ -1173,7 +1176,7 @@ YYDESTRUCT_DECL()
(*loc).last_line, (*loc).last_column);
free((*val).scope); }
break;
#line 1177 "btyacc_demo.tab.c"
#line 1180 "btyacc_demo.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -1316,7 +1319,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -1383,10 +1386,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -1497,7 +1500,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1707,7 +1710,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1736,7 +1739,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1752,7 +1755,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1838,10 +1841,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -2106,7 +2109,7 @@ case 59:
#line 197 "btyacc_demo.y"
{ yyval.code = yystack.l_mark[-1].code; }
break;
#line 2110 "btyacc_demo.tab.c"
#line 2113 "btyacc_demo.tab.c"
default:
break;
}
@ -2161,12 +2164,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -46,5 +46,6 @@ typedef struct YYLTYPE
#define YYLTYPE_IS_DECLARED 1
#endif
#define YYRHSLOC(rhs, k) ((rhs)[k])
extern YYLTYPE demo_lloc;
#endif /* _demo__defines_h_ */

View file

@ -1 +0,0 @@
YACC: e - line 82 of "./btyacc_demo2.y", $$ is untyped

View file

@ -1,15 +0,0 @@
/* original parser id follows */
/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYCHECK "yyyymmdd"
#define YYEMPTY (-1)
#define yyclearin (yychar = YYEMPTY)
#define yyerrok (yyerrflag = 0)
#define YYRECOVERING() (yyerrflag != 0)
#define YYENOMEM (-2)
#define YYEOF 0

View file

@ -202,7 +202,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT destroy1_lhs[] = { -1,
0, 0, 2, 2, 3, 3, 4, 4, 1,
};
@ -357,13 +357,16 @@ static const char *const destroy1_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -376,17 +379,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -485,7 +488,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 489 "btyacc_destroy1.tab.c"
#line 492 "btyacc_destroy1.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -505,7 +508,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 509 "btyacc_destroy1.tab.c"
#line 512 "btyacc_destroy1.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -648,7 +651,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -715,10 +718,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -829,7 +832,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1039,7 +1042,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1068,7 +1071,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1084,7 +1087,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1170,10 +1173,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1228,7 +1231,7 @@ case 9:
#line 86 "btyacc_destroy1.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1232 "btyacc_destroy1.tab.c"
#line 1235 "btyacc_destroy1.tab.c"
default:
break;
}
@ -1283,12 +1286,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -202,7 +202,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT destroy2_lhs[] = { -1,
0, 0, 2, 2, 3, 3, 4, 4, 1,
};
@ -357,13 +357,16 @@ static const char *const destroy2_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -376,17 +379,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -485,7 +488,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 489 "btyacc_destroy2.tab.c"
#line 492 "btyacc_destroy2.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -505,7 +508,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 509 "btyacc_destroy2.tab.c"
#line 512 "btyacc_destroy2.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -648,7 +651,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -715,10 +718,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -829,7 +832,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1039,7 +1042,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1068,7 +1071,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1084,7 +1087,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1170,10 +1173,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1228,7 +1231,7 @@ case 9:
#line 86 "btyacc_destroy2.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1232 "btyacc_destroy2.tab.c"
#line 1235 "btyacc_destroy2.tab.c"
default:
break;
}
@ -1283,12 +1286,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -202,7 +202,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT destroy3_lhs[] = { -1,
0, 0, 2, 2, 3, 3, 4, 4, 1,
};
@ -357,13 +357,16 @@ static const char *const destroy3_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -376,17 +379,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -485,7 +488,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 489 "btyacc_destroy3.tab.c"
#line 492 "btyacc_destroy3.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -505,7 +508,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 509 "btyacc_destroy3.tab.c"
#line 512 "btyacc_destroy3.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -648,7 +651,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -715,10 +718,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -829,7 +832,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1039,7 +1042,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1068,7 +1071,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1084,7 +1087,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1170,10 +1173,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1228,7 +1231,7 @@ case 9:
#line 89 "btyacc_destroy3.y"
{ yyval.nlist = yystack.l_mark[-5].nlist; }
break;
#line 1232 "btyacc_destroy3.tab.c"
#line 1235 "btyacc_destroy3.tab.c"
default:
break;
}
@ -1283,12 +1286,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -170,7 +170,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,
@ -338,13 +338,16 @@ static const char *const calc_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -357,17 +360,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -504,7 +507,7 @@ yylex(void)
}
return( c );
}
#line 508 "calc.tab.c"
#line 511 "calc.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -643,7 +646,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -710,10 +713,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -824,7 +827,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1034,7 +1037,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1063,7 +1066,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1079,7 +1082,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1165,10 +1168,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1234,7 +1237,7 @@ case 18:
#line 63 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1238 "calc.tab.c"
#line 1241 "calc.tab.c"
default:
break;
}
@ -1289,12 +1292,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -195,7 +195,7 @@ extern int YYPARSE_DECL();
#define CONST 259
#define UMINUS 260
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc1_lhs[] = { -1,
3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
@ -393,13 +393,16 @@ static const char *const calc1_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -412,17 +415,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -648,7 +651,7 @@ vdiv(double a, double b, INTERVAL v)
{
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
}
#line 652 "calc1.tab.c"
#line 655 "calc1.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -787,7 +790,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -854,10 +857,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -968,7 +971,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1178,7 +1181,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1207,7 +1210,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1223,7 +1226,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1309,10 +1312,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1481,7 +1484,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 1485 "calc1.tab.c"
#line 1488 "calc1.tab.c"
default:
break;
}
@ -1536,12 +1539,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -172,7 +172,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc2_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,
@ -340,13 +340,16 @@ static const char *const calc2_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -359,17 +362,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -517,7 +520,7 @@ YYLEX_DECL()
}
return( c );
}
#line 521 "calc2.tab.c"
#line 524 "calc2.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -656,7 +659,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -723,10 +726,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -837,7 +840,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1047,7 +1050,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1076,7 +1079,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1092,7 +1095,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1178,10 +1181,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1247,7 +1250,7 @@ case 18:
#line 70 "calc2.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1251 "calc2.tab.c"
#line 1254 "calc2.tab.c"
default:
break;
}
@ -1302,12 +1305,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -177,7 +177,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc3_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,
@ -345,8 +345,9 @@ static const char *const calc3_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
#ifndef YYLLOC_DEFAULT
@ -355,17 +356,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -472,7 +473,7 @@ YYLEX_DECL()
}
return( c );
}
#line 476 "calc3.tab.c"
#line 477 "calc3.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -609,6 +610,8 @@ YYPARSE_DECL()
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -661,7 +664,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -737,10 +740,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -851,7 +854,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1061,7 +1064,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1090,7 +1093,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1106,7 +1109,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1192,10 +1195,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1261,7 +1264,7 @@ case 18:
#line 73 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1265 "calc3.tab.c"
#line 1268 "calc3.tab.c"
default:
break;
}
@ -1316,12 +1319,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,18 @@
#ifndef _calc_code_all__defines_h_
#define _calc_code_all__defines_h_
/* %code "requires" block start */
#line 3 "calc_code_all.y"
/* CODE-REQUIRES */
/* %code "requires" block end */
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
/* %code "provides" block start */
#line 4 "calc_code_all.y"
/* CODE-PROVIDES */
#line 6 "calc_code_all.y"
/* CODE-PROVIDES2 */
/* %code "provides" block end */
#endif /* _calc_code_all__defines_h_ */

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#ifndef _calc_code_default__defines_h_
#define _calc_code_default__defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _calc_code_default__defines_h_ */

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#ifndef _calc_code_imports__defines_h_
#define _calc_code_imports__defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _calc_code_imports__defines_h_ */

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
#ifndef _calc_code_provides__defines_h_
#define _calc_code_provides__defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
/* %code "provides" block start */
#line 1 "calc_code_provides.y"
/* CODE-PROVIDES */
#line 2 "calc_code_provides.y"
/* CODE-PROVIDES2 */
/* %code "provides" block end */
#endif /* _calc_code_provides__defines_h_ */

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
#ifndef _calc_code_requires__defines_h_
#define _calc_code_requires__defines_h_
/* %code "requires" block start */
#line 1 "calc_code_requires.y"
/* CODE-REQUIRES */
#line 2 "calc_code_requires.y"
/* CODE-REQUIRES2 */
/* %code "requires" block end */
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _calc_code_requires__defines_h_ */

View file

@ -0,0 +1,485 @@
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr '+' expr
8 | expr '-' expr
9 | expr '*' expr
10 | expr '/' expr
11 | expr '%' expr
12 | expr '&' expr
13 | expr '|' expr
14 | '-' expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
DIGIT shift 3
LETTER shift 4
'-' shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
number : DIGIT . (17)
. reduce 17
state 4
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 11
'|' reduce 15
'&' reduce 15
'+' reduce 15
'-' reduce 15
'*' reduce 15
'/' reduce 15
'%' reduce 15
'\n' reduce 15
state 5
expr : '-' . expr (14)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 13
number goto 9
state 6
expr : '(' . expr ')' (6)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
'|' reduce 16
'&' reduce 16
'+' reduce 16
'-' reduce 16
'*' reduce 16
'/' reduce 16
'%' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
stat : LETTER '=' . expr (5)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 24
number goto 9
state 12
expr : LETTER . (15)
. reduce 15
state 13
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : '-' expr . (14)
. reduce 14
state 14
expr : '(' expr . ')' (6)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr '|' . expr (13)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr '&' . expr (12)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr '+' . expr (7)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr '-' . expr (8)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr '*' . expr (9)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr '/' . expr (10)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '%' . expr (11)
DIGIT shift 3
LETTER shift 12
'-' shift 5
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'|' shift 16
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
state 26
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
'&' shift 17
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 13
'\n' reduce 13
')' reduce 13
state 27
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr '&' expr . (12)
expr : expr . '|' expr (13)
'+' shift 18
'-' shift 19
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 12
'&' reduce 12
'\n' reduce 12
')' reduce 12
state 28
expr : expr . '+' expr (7)
expr : expr '+' expr . (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 7
'&' reduce 7
'+' reduce 7
'-' reduce 7
'\n' reduce 7
')' reduce 7
state 29
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr '-' expr . (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
'*' shift 20
'/' shift 21
'%' shift 22
'|' reduce 8
'&' reduce 8
'+' reduce 8
'-' reduce 8
'\n' reduce 8
')' reduce 8
state 30
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr '*' expr . (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 9
state 31
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr '/' expr . (10)
expr : expr . '%' expr (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 10
state 32
expr : expr . '+' expr (7)
expr : expr . '-' expr (8)
expr : expr . '*' expr (9)
expr : expr . '/' expr (10)
expr : expr . '%' expr (11)
expr : expr '%' expr . (11)
expr : expr . '&' expr (12)
expr : expr . '|' expr (13)
. reduce 11
16 terminals, 5 nonterminals
19 grammar rules, 33 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 DIGIT
3 258 LETTER
4 124 '|'
5 38 '&'
6 43 '+'
7 45 '-'
8 42 '*'
9 47 '/'
10 37 '%'
11 259 UMINUS
12 10 '\n'
13 61 '='
14 40 '('
15 41 ')'
16 260 $accept
17 261 list
18 262 stat
19 263 expr
20 264 number

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#ifndef _calc_code_top__defines_h_
#define _calc_code_top__defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _calc_code_top__defines_h_ */

View file

@ -182,7 +182,7 @@ typedef int YYSTYPE;
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
extern int YYPARSE_DECL();
typedef short YYINT;
typedef int YYINT;
extern const YYINT yylhs[];
extern const YYINT yylen[];
extern const YYINT yydefred[];
@ -207,13 +207,16 @@ extern const char *const yyname[];
extern const char *const yyrule[];
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -226,17 +229,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -377,7 +380,7 @@ yylex(void)
}
return( c );
}
#line 381 "code_calc.code.c"
#line 384 "code_calc.code.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -516,7 +519,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -583,10 +586,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -697,7 +700,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -907,7 +910,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -936,7 +939,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -952,7 +955,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1038,10 +1041,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1107,7 +1110,7 @@ case 18:
#line 67 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1111 "code_calc.code.c"
#line 1114 "code_calc.code.c"
default:
break;
}
@ -1162,12 +1165,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -1,7 +1,7 @@
#undef YYBTYACC
#define YYBTYACC 0
#define YYDEBUGSTR YYPREFIX "debug"
typedef short YYINT;
typedef int YYINT;
const YYINT calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View file

@ -1,60 +0,0 @@
#define YYPREFIX "yy"
#define YYPURE 0
#line 2 "code_debug.y"
#ifdef YYBISON
int yylex(void);
static void yyerror(const char *);
#endif
#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
/* Default: YYSTYPE is the semantic value type. */
typedef int YYSTYPE;
# define YYSTYPE_IS_DECLARED 1
#endif
/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef YYPARSE_PARAM_TYPE
# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
# else
# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
# endif
#else
# define YYPARSE_DECL() yyparse(void)
#endif
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
# define YYLEX yylex(YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(void)
# define YYLEX yylex()
#endif
/* Parameters sent to yyerror. */
#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(const char *s)
#endif
#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(msg)
#endif
extern int YYPARSE_DECL();
extern int yydebug;
extern int yynerrs;
extern int yyerrflag;
extern int yychar;
extern YYSTYPE yyval;
extern YYSTYPE yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
extern YYLTYPE yyloc; /* position returned by actions */
extern YYLTYPE yylloc; /* position from the lexer */
#endif

View file

@ -1,34 +0,0 @@
0 $accept : S $end
1 S : error
state 0
$accept : . S $end (0)
error shift 1
. error
S goto 2
state 1
S : error . (1)
. reduce 1
state 2
$accept : S . $end (0)
$end accept
2 terminals, 2 nonterminals
2 grammar rules, 3 states
grammar parser grammar
symbol# value# symbol
0 0 $end
1 256 error
2 257 $accept
3 258 S

View file

@ -172,7 +172,7 @@ typedef int YYSTYPE;
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
extern int YYPARSE_DECL();
typedef short YYINT;
typedef int YYINT;
extern const YYINT yylhs[];
extern const YYINT yylen[];
extern const YYINT yydefred[];
@ -197,13 +197,16 @@ extern const char *const yyname[];
extern const char *const yyrule[];
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -216,17 +219,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -347,7 +350,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 351 "code_error.code.c"
#line 354 "code_error.code.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -486,7 +489,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -553,10 +556,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -667,7 +670,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -877,7 +880,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -906,7 +909,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -922,7 +925,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1008,10 +1011,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1071,12 +1074,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -1,7 +1,7 @@
#undef YYBTYACC
#define YYBTYACC 0
#define YYDEBUGSTR YYPREFIX "debug"
typedef short YYINT;
typedef int YYINT;
const YYINT error_lhs[] = { -1,
0,
};

View file

@ -16,78 +16,245 @@
#undef YYBTYACC
#define YYBTYACC 0
#define YYDEBUGSTR YYPREFIX "debug"
#line 20 "code_debug.c"
#include "rename_debug.i"
#include "rename_debug.h"
typedef short YYINT;
#define YYPREFIX "yy"
#define YYPURE 0
#line 2 "calc.y"
# include <stdio.h>
# include <ctype.h>
int regs[26];
int base;
extern int yylex(void);
static void yyerror(const char *s);
#line 34 "y.tab.c"
#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
/* Default: YYSTYPE is the semantic value type. */
typedef int YYSTYPE;
# define YYSTYPE_IS_DECLARED 1
#endif
/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef YYPARSE_PARAM_TYPE
# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
# else
# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
# endif
#else
# define YYPARSE_DECL() yyparse(void)
#endif
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
# define YYLEX yylex(YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(void)
# define YYLEX yylex()
#endif
#if !(defined(yylex) || defined(YYSTATE))
int YYLEX_DECL();
#endif
/* Parameters sent to yyerror. */
#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(const char *s)
#endif
#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(msg)
#endif
extern int YYPARSE_DECL();
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef int YYINT;
static const YYINT yylhs[] = { -1,
0,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,
};
static const YYINT yylen[] = { 2,
1,
0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
3, 3, 3, 2, 1, 1, 1, 2,
};
static const YYINT yydefred[] = { 0,
1, 0,
static const YYINT yydefred[] = { 1,
0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
10, 11,
};
#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
static const YYINT yystos[] = { 0,
256, 258,
261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
263, 263,
};
static const YYINT yydgoto[] = { 2,
#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
static const YYINT yydgoto[] = { 1,
7, 8, 9,
};
static const YYINT yysindex[] = { -256,
static const YYINT yysindex[] = { 0,
-40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
-38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
-38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
0, 0,
};
static const YYINT yyrindex[] = { 0,
0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
0, 0,
};
#if YYBTYACC
static const YYINT yycindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
#endif
static const YYINT yygindex[] = { 0,
0, 65, 0,
};
#define YYTABLESIZE 0
static const YYINT yytable[] = { 1,
#define YYTABLESIZE 220
static const YYINT yytable[] = { 6,
16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
};
static const YYINT yycheck[] = { 256,
static const YYINT yycheck[] = { 40,
10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
-1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
-1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
-1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
-1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
-1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
-1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
-1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
-1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
-1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
-1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
};
#if YYBTYACC
static const YYINT yyctable[] = { 0,
static const YYINT yyctable[] = { -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1,
};
#endif
#define YYFINAL 2
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 1
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 256
#define YYUNDFTOKEN 259
#define YYMAXTOKEN 259
#define YYUNDFTOKEN 265
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
#if YYDEBUG
static const char *const yyname[] = {
"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
"illegal-symbol",
};
static const char *const yyrule[] = {
"$accept : S",
"S : error",
"$accept : list",
"list :",
"list : list stat '\\n'",
"list : list error '\\n'",
"stat : expr",
"stat : LETTER '=' expr",
"expr : '(' expr ')'",
"expr : expr '+' expr",
"expr : expr '-' expr",
"expr : expr '*' expr",
"expr : expr '/' expr",
"expr : expr '%' expr",
"expr : expr '&' expr",
"expr : expr '|' expr",
"expr : '-' expr",
"expr : LETTER",
"expr : number",
"number : DIGIT",
"number : number DIGIT",
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -100,17 +267,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -141,9 +308,9 @@ do \
typedef struct {
unsigned stacksize;
short *s_base;
short *s_mark;
short *s_last;
YYINT *s_base;
YYINT *s_mark;
YYINT *s_last;
YYSTYPE *l_base;
YYSTYPE *l_mark;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@ -201,37 +368,53 @@ static YYLTYPE *yylplim = 0;
#endif
/* Current position at lexical token queue */
static short *yylexp = 0;
static YYINT *yylexp = 0;
static short *yylexemes = 0;
static YYINT *yylexemes = 0;
#endif /* YYBTYACC */
#line 12 "code_debug.y"
#include <stdio.h>
#ifdef YYBYACC
extern int YYLEX_DECL();
#endif
#line 66 "calc.y"
/* start of programs */
int
main(void)
main (void)
{
printf("yyparse() = %d\n", yyparse());
while(!feof(stdin)) {
yyparse();
}
return 0;
}
static void
yyerror(const char *s)
{
fprintf(stderr, "%s\n", s);
}
int
yylex(void)
{
return -1;
}
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
/* return DIGIT for a digit, yylval = 0 through 9 */
/* all other characters are returned immediately */
static void
yyerror(const char* s)
{
printf("%s\n", s);
int c;
while( (c=getchar()) == ' ' ) { /* skip blanks */ }
/* c is now nonblank */
if( islower( c )) {
yylval = c - 'a';
return ( LETTER );
}
if( isdigit( c )) {
yylval = c - '0';
return ( DIGIT );
}
return( c );
}
#line 236 "code_debug.c"
#line 418 "y.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -240,7 +423,7 @@ yyerror(const char* s)
#endif /* YYBTYACC */
#if YYDEBUG
#include <stdio.h> /* needed for printf */
#include <stdio.h> /* needed for printf */
#endif
#include <stdlib.h> /* needed for malloc, etc */
@ -251,7 +434,7 @@ static int yygrowstack(YYSTACKDATA *data)
{
int i;
unsigned newsize;
short *newss;
YYINT *newss;
YYSTYPE *newvs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE *newps;
@ -265,7 +448,7 @@ static int yygrowstack(YYSTACKDATA *data)
newsize = YYMAXDEPTH;
i = (int) (data->s_mark - data->s_base);
newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return YYENOMEM;
@ -329,7 +512,7 @@ yyNewState(unsigned size)
#endif
return p;
}
p->yystack.s_base = (short *) malloc(size * sizeof(short));
p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
if (p->yystack.s_base == NULL) return NULL;
p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
if (p->yystack.l_base == NULL) return NULL;
@ -370,7 +553,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -384,11 +567,16 @@ YYPARSE_DECL()
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
yyps->save = 0;
#endif /* YYBTYACC */
yym = 0;
yyn = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
@ -428,14 +616,14 @@ YYPARSE_DECL()
/* in trial mode; save scanner results for future parse attempts */
if (yylvp == yylvlim)
{ /* Enlarge lexical value queue */
int p = yylvp - yylvals;
int s = yylvlim - yylvals;
size_t p = (size_t) (yylvp - yylvals);
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -445,7 +633,7 @@ YYPARSE_DECL()
#endif
yylexp = yylexemes + p;
}
*yylexp = (short) YYLEX;
*yylexp = (YYINT) YYLEX;
*yylvp++ = yylval;
yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@ -462,11 +650,10 @@ YYPARSE_DECL()
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
/* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
if (yydebug)
{
yys = yyname[YYTRANSLATE(yychar)];
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
#ifdef YYSTYPE_TOSTRING
@ -525,12 +712,12 @@ YYPARSE_DECL()
save->state = yystate;
save->errflag = yyerrflag;
save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
ctry = yytable[yyn];
if (yyctable[ctry] == -1)
@ -547,7 +734,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -571,7 +758,7 @@ YYPARSE_DECL()
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*yylpe++ = yylloc;
#endif
*yylexp = (short) yychar;
*yylexp = (YYINT) yychar;
yychar = YYEMPTY;
}
}
@ -585,7 +772,7 @@ YYPARSE_DECL()
yylexp--;
yychar = YYEMPTY;
}
save->lexeme = yylvp - yylvals;
save->lexeme = (int) (yylvp - yylvals);
yyps->save = save;
}
if (yytable[yyn] == ctry)
@ -606,7 +793,7 @@ YYPARSE_DECL()
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
goto yyoverflow;
yystate = yyctable[ctry];
*++yystack.s_mark = (short) yystate;
*++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yylloc;
@ -652,9 +839,18 @@ YYPARSE_DECL()
yynewerrflag = 1;
goto yyerrhandler;
goto yyerrlab;
goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
/* explicit YYERROR from an action -- pop the rhs of the rule reduced
* before looking for error recovery */
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
yystack.l_mark -= yym;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark -= yym;
#endif
yynewerrflag = 0;
yyerrhandler:
while (yyps->save)
@ -679,14 +875,14 @@ YYPARSE_DECL()
yyerrctx->state = yystate;
yyerrctx->errflag = yyerrflag;
yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yyerrctx->lexeme = yylvp - yylvals;
yyerrctx->lexeme = (int) (yylvp - yylvals);
}
yylvp = yylvals + save->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@ -695,12 +891,12 @@ YYPARSE_DECL()
yylexp = yylexemes + save->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
ctry = ++save->ctry;
yystate = save->state;
@ -730,12 +926,12 @@ YYPARSE_DECL()
yylloc = yylpp[-1];
#endif
yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yystate = yyerrctx->state;
yyFreeState(yyerrctx);
@ -748,11 +944,11 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
goto yyerrlab;
goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
#endif
++yynerrs;
@ -777,7 +973,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -793,7 +989,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -821,7 +1017,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = yyname[YYTRANSLATE(yychar)];
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
}
@ -879,15 +1075,76 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
switch (yyn)
{
case 3:
#line 28 "calc.y"
{ yyerrok ; }
break;
case 4:
#line 32 "calc.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
#line 34 "calc.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
#line 38 "calc.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
#line 40 "calc.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
#line 42 "calc.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
#line 44 "calc.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
#line 46 "calc.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
#line 48 "calc.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
#line 50 "calc.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
#line 52 "calc.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
#line 54 "calc.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
#line 56 "calc.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
#line 61 "calc.y"
{ yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
#line 63 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 1148 "y.tab.c"
default:
break;
}
@ -938,16 +1195,16 @@ YYPARSE_DECL()
/* in trial mode; save scanner results for future parse attempts */
if (yylvp == yylvlim)
{ /* Enlarge lexical value queue */
int p = yylvp - yylvals;
int s = yylvlim - yylvals;
size_t p = (size_t) (yylvp - yylvals);
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
@ -958,7 +1215,7 @@ YYPARSE_DECL()
#endif
yylexp = yylexemes + p;
}
*yylexp = (short) YYLEX;
*yylexp = (YYINT) YYLEX;
*yylvp++ = yylval;
yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@ -975,12 +1232,11 @@ YYPARSE_DECL()
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
/* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
if (yydebug)
{
yys = yyname[YYTRANSLATE(yychar)];
fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
}
#endif
@ -1007,7 +1263,7 @@ YYPARSE_DECL()
}
#endif
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
*++yystack.s_mark = (short) yystate;
*++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yyloc;
@ -1042,12 +1298,12 @@ YYPARSE_DECL()
yylexp = yylexemes + yypath->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yystate = yypath->state;
goto yyloop;

View file

@ -1,6 +1,8 @@
#ifndef _yy_defines_h_
#define _yy_defines_h_
#define YYERRCODE 256
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _yy_defines_h_ */

View file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#ifndef _yy_defines_h_
#define _yy_defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _yy_defines_h_ */

View file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
#ifndef _yy_defines_h_
#define _yy_defines_h_
#define DIGIT 257
#define LETTER 258
#define UMINUS 259
#endif /* _yy_defines_h_ */

View file

View file

@ -164,7 +164,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT empty_lhs[] = { -1,
0,
};
@ -229,13 +229,16 @@ static const char *const empty_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -248,17 +251,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -366,7 +369,7 @@ static void
YYERROR_DECL() {
printf("%s\n",s);
}
#line 370 "empty.tab.c"
#line 373 "empty.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -505,7 +508,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -572,10 +575,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -686,7 +689,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -896,7 +899,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -925,7 +928,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -941,7 +944,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1027,10 +1030,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1090,12 +1093,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -197,7 +197,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_inherit3_lhs[] = { -1,
5, 6, 0, 0, 3, 3, 4, 4, 7, 1,
1, 8, 2,
@ -290,13 +290,16 @@ static const char *const err_inherit3_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -309,17 +312,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -418,7 +421,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 422 "err_inherit3.tab.c"
#line 425 "err_inherit3.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -438,7 +441,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 442 "err_inherit3.tab.c"
#line 445 "err_inherit3.tab.c"
case 264:
#line 30 "err_inherit3.y"
{
@ -450,7 +453,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 454 "err_inherit3.tab.c"
#line 457 "err_inherit3.tab.c"
case 265:
#line 30 "err_inherit3.y"
{
@ -462,7 +465,7 @@ YYDESTRUCT_DECL()
}
}
break;
#line 466 "err_inherit3.tab.c"
#line 469 "err_inherit3.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -605,7 +608,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -672,10 +675,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -786,7 +789,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -996,7 +999,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1025,7 +1028,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1041,7 +1044,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1127,10 +1130,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1192,7 +1195,7 @@ case 13:
#line 75 "err_inherit3.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
#line 1196 "err_inherit3.tab.c"
#line 1199 "err_inherit3.tab.c"
default:
break;
}
@ -1247,12 +1250,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -219,7 +219,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_inherit4_lhs[] = { -1,
5, 6, 0, 0, 3, 3, 4, 4, 1, 1,
2,
@ -309,13 +309,16 @@ static const char *const err_inherit4_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -328,17 +331,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -437,7 +440,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 441 "err_inherit4.tab.c"
#line 444 "err_inherit4.tab.c"
/* Release memory associated with symbol. */
#if ! defined YYDESTRUCT_IS_DECLARED
@ -450,17 +453,17 @@ YYDESTRUCT_DECL()
#line 28 "err_inherit4.y"
{ }
break;
#line 454 "err_inherit4.tab.c"
#line 457 "err_inherit4.tab.c"
case 264:
#line 28 "err_inherit4.y"
{ }
break;
#line 459 "err_inherit4.tab.c"
#line 462 "err_inherit4.tab.c"
case 265:
#line 28 "err_inherit4.y"
{ }
break;
#line 464 "err_inherit4.tab.c"
#line 467 "err_inherit4.tab.c"
}
}
#define YYDESTRUCT_IS_DECLARED 1
@ -603,7 +606,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -670,10 +673,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -784,7 +787,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -994,7 +997,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1023,7 +1026,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1039,7 +1042,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1125,10 +1128,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1182,7 +1185,7 @@ case 11:
#line 77 "err_inherit4.y"
{ yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
break;
#line 1186 "err_inherit4.tab.c"
#line 1189 "err_inherit4.tab.c"
default:
break;
}
@ -1237,12 +1240,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -35,5 +35,6 @@ typedef struct YYLTYPE
#define YYLTYPE_IS_DECLARED 1
#endif
#define YYRHSLOC(rhs, k) ((rhs)[k])
extern YYLTYPE err_inherit4_lloc;
#endif /* _err_inherit4__defines_h_ */

View file

@ -154,7 +154,7 @@ static void yyerror(const char *);
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax10_lhs[] = { -1,
0,
};
@ -219,13 +219,16 @@ static const char *const err_syntax10_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -238,17 +241,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -365,7 +368,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 369 "err_syntax10.tab.c"
#line 372 "err_syntax10.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -504,7 +507,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -571,10 +574,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -685,7 +688,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -895,7 +898,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -924,7 +927,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -940,7 +943,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1026,10 +1029,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1089,12 +1092,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -160,7 +160,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax11_lhs[] = { -1,
0,
};
@ -225,13 +225,16 @@ static const char *const err_syntax11_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -244,17 +247,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -371,7 +374,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 375 "err_syntax11.tab.c"
#line 378 "err_syntax11.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -510,7 +513,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -577,10 +580,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -691,7 +694,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -901,7 +904,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -930,7 +933,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -946,7 +949,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1032,10 +1035,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1095,12 +1098,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -161,7 +161,7 @@ extern int YYPARSE_DECL();
#define text 456
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax12_lhs[] = { -1,
0,
};
@ -231,13 +231,16 @@ static const char *const err_syntax12_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -250,17 +253,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -377,7 +380,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 381 "err_syntax12.tab.c"
#line 384 "err_syntax12.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -516,7 +519,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -583,10 +586,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -697,7 +700,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -907,7 +910,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -936,7 +939,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -952,7 +955,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1038,10 +1041,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1101,12 +1104,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -160,7 +160,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax18_lhs[] = { -1,
0,
};
@ -228,13 +228,16 @@ static const char *const err_syntax18_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -247,17 +250,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -374,7 +377,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 378 "err_syntax18.tab.c"
#line 381 "err_syntax18.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -513,7 +516,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -580,10 +583,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -694,7 +697,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -904,7 +907,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -933,7 +936,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -949,7 +952,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1035,10 +1038,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1048,7 +1051,7 @@ case 1:
#line 9 "err_syntax18.y"
{ yyval = yystack.l_mark[1]; }
break;
#line 1052 "err_syntax18.tab.c"
#line 1055 "err_syntax18.tab.c"
default:
break;
}
@ -1103,12 +1106,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -155,7 +155,7 @@ extern int YYPARSE_DECL();
#define recur 257
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax20_lhs[] = { -1,
0,
};
@ -223,13 +223,16 @@ static const char *const err_syntax20_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -242,17 +245,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -369,7 +372,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 373 "err_syntax20.tab.c"
#line 376 "err_syntax20.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -508,7 +511,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -575,10 +578,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -689,7 +692,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -899,7 +902,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -928,7 +931,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -944,7 +947,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1030,10 +1033,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1043,7 +1046,7 @@ case 1:
#line 12 "err_syntax20.y"
{ yystack.l_mark[-1].rechk = 3; }
break;
#line 1047 "err_syntax20.tab.c"
#line 1050 "err_syntax20.tab.c"
default:
break;
}
@ -1098,12 +1101,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -160,7 +160,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT error_lhs[] = { -1,
0,
};
@ -224,13 +224,16 @@ static const char *const error_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -243,17 +246,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -370,7 +373,7 @@ yyerror(const char* s)
{
printf("%s\n", s);
}
#line 374 "error.tab.c"
#line 377 "error.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -509,7 +512,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -576,10 +579,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -690,7 +693,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -900,7 +903,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -929,7 +932,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -945,7 +948,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1031,10 +1034,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1094,12 +1097,12 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -198,7 +198,7 @@ extern int YYPARSE_DECL();
#define ID 257
#define CONST 258
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT expr.oxout_lhs[] = { -1,
2, 0, 1, 3, 3, 3, 3, 3, 3, 3,
};
@ -345,13 +345,16 @@ static const char *const expr.oxout_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -364,17 +367,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -1790,7 +1793,7 @@ void yyyUnsolvedInstSearchTrav(yyyGNT *pNode)
#line 1794 "expr.oxout.tab.c"
#line 1797 "expr.oxout.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -1929,7 +1932,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -1996,10 +1999,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -2110,7 +2113,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -2320,7 +2323,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -2349,7 +2352,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -2365,7 +2368,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -2451,10 +2454,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -2518,7 +2521,7 @@ case 10:
yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
break;
#line 2522 "expr.oxout.tab.c"
#line 2525 "expr.oxout.tab.c"
default:
break;
}
@ -2573,12 +2576,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -144,6 +144,7 @@ static void yyerror(const char *s);
/* #include "cproto.h" */
#define MAX_TEXT_SIZE 1024
#define TEXT_LEN (MAX_TEXT_SIZE / 2 - 3)
/* Prototype styles */
#if OPT_LINTLIBRARY
@ -404,7 +405,7 @@ haveAnsiParam (void)
}
return FALSE;
}
#line 408 "grammar.tab.c"
#line 409 "grammar.tab.c"
/* compatibility with bison */
#ifdef YYPARSE_PARAM
@ -473,7 +474,7 @@ extern int YYPARSE_DECL();
#define T_ASMARG 290
#define T_VA_DCL 291
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT grammar_lhs[] = { -1,
0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
@ -1048,13 +1049,16 @@ static const char *const grammar_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -1067,17 +1071,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -1172,7 +1176,7 @@ static YYINT *yylexp = 0;
static YYINT *yylexemes = 0;
#endif /* YYBTYACC */
#line 1014 "grammar.y"
#line 1015 "grammar.y"
/* lex.yy.c */
#define BEGIN yy_start = 1 + 2 *
@ -1189,7 +1193,7 @@ extern char *yytext;
extern FILE *yyin, *yyout;
static int curly; /* number of curly brace nesting levels */
static int ly_count; /* number of occurances of %% */
static int ly_count; /* number of occurrences of %% */
static int inc_depth; /* include nesting level */
static SymbolTable *included_files; /* files already included */
static int yy_start = 0; /* start state number */
@ -1343,7 +1347,7 @@ free_parser(void)
#endif
}
#endif
#line 1347 "grammar.tab.c"
#line 1351 "grammar.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -1482,7 +1486,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -1549,10 +1553,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -1663,7 +1667,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -1873,7 +1877,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -1902,7 +1906,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -1918,7 +1922,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -2004,29 +2008,29 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
switch (yyn)
{
case 10:
#line 377 "grammar.y"
#line 378 "grammar.y"
{
yyerrok;
}
break;
case 11:
#line 381 "grammar.y"
#line 382 "grammar.y"
{
yyerrok;
}
break;
case 13:
#line 392 "grammar.y"
#line 393 "grammar.y"
{
/* Provide an empty action here so bison will not complain about
* incompatible types in the default action it normally would
@ -2035,13 +2039,13 @@ case 13:
}
break;
case 14:
#line 399 "grammar.y"
#line 400 "grammar.y"
{
/* empty */
}
break;
case 15:
#line 406 "grammar.y"
#line 407 "grammar.y"
{
#if OPT_LINTLIBRARY
if (types_out && want_typedef()) {
@ -2054,7 +2058,7 @@ case 15:
}
break;
case 16:
#line 417 "grammar.y"
#line 418 "grammar.y"
{
if (func_params != NULL) {
set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
@ -2070,32 +2074,32 @@ case 16:
}
break;
case 17:
#line 431 "grammar.y"
#line 432 "grammar.y"
{
cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
free_decl_spec(&yystack.l_mark[0].decl_spec);
}
break;
case 18:
#line 436 "grammar.y"
#line 437 "grammar.y"
{
end_typedef();
}
break;
case 19:
#line 443 "grammar.y"
#line 444 "grammar.y"
{
begin_typedef();
}
break;
case 20:
#line 447 "grammar.y"
#line 448 "grammar.y"
{
begin_typedef();
}
break;
case 23:
#line 459 "grammar.y"
#line 460 "grammar.y"
{
int flags = cur_decl_spec_flags;
@ -2109,7 +2113,7 @@ case 23:
}
break;
case 24:
#line 471 "grammar.y"
#line 472 "grammar.y"
{
int flags = cur_decl_spec_flags;
@ -2120,7 +2124,7 @@ case 24:
}
break;
case 25:
#line 483 "grammar.y"
#line 484 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
@ -2133,7 +2137,7 @@ case 25:
}
break;
case 26:
#line 494 "grammar.y"
#line 495 "grammar.y"
{
/* If we're converting to K&R and we've got a nominally K&R
* function which has a parameter which is ANSI (i.e., a prototyped
@ -2159,7 +2163,7 @@ case 26:
}
break;
case 28:
#line 519 "grammar.y"
#line 520 "grammar.y"
{
if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
yyerror("syntax error");
@ -2171,7 +2175,7 @@ case 28:
}
break;
case 29:
#line 529 "grammar.y"
#line 530 "grammar.y"
{
DeclSpec decl_spec;
@ -2189,7 +2193,7 @@ case 29:
}
break;
case 36:
#line 560 "grammar.y"
#line 561 "grammar.y"
{
join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
free(yystack.l_mark[-1].decl_spec.text);
@ -2197,115 +2201,115 @@ case 36:
}
break;
case 40:
#line 575 "grammar.y"
#line 576 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 41:
#line 579 "grammar.y"
#line 580 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
}
break;
case 42:
#line 583 "grammar.y"
#line 584 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 43:
#line 587 "grammar.y"
#line 588 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
}
break;
case 44:
#line 591 "grammar.y"
#line 592 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
}
break;
case 45:
#line 595 "grammar.y"
#line 596 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
}
break;
case 46:
#line 602 "grammar.y"
#line 603 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
}
break;
case 47:
#line 606 "grammar.y"
#line 607 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 48:
#line 610 "grammar.y"
#line 611 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
}
break;
case 49:
#line 614 "grammar.y"
#line 615 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 50:
#line 618 "grammar.y"
#line 619 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 51:
#line 622 "grammar.y"
#line 623 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
}
break;
case 52:
#line 626 "grammar.y"
#line 627 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 53:
#line 630 "grammar.y"
#line 631 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 54:
#line 634 "grammar.y"
#line 635 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 55:
#line 638 "grammar.y"
#line 639 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
}
break;
case 56:
#line 642 "grammar.y"
#line 643 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 57:
#line 646 "grammar.y"
#line 647 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 58:
#line 650 "grammar.y"
#line 651 "grammar.y"
{
Symbol *s;
s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
@ -2314,13 +2318,13 @@ case 58:
}
break;
case 61:
#line 662 "grammar.y"
#line 663 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 62:
#line 666 "grammar.y"
#line 667 "grammar.y"
{
/* This rule allows the <pointer> nonterminal to scan #define
* names as if they were type modifiers.
@ -2332,56 +2336,56 @@ case 62:
}
break;
case 63:
#line 679 "grammar.y"
#line 680 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
(void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
(void)sprintf(s = buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-2].text.text, TEXT_LEN, yystack.l_mark[-1].text.text);
new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
}
break;
case 64:
#line 686 "grammar.y"
#line 687 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
(void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
(void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text);
new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 65:
#line 693 "grammar.y"
#line 694 "grammar.y"
{
(void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
(void)sprintf(buf, "%.*s %.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text);
new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 66:
#line 701 "grammar.y"
#line 702 "grammar.y"
{
imply_typedef(yyval.text.text);
}
break;
case 67:
#line 705 "grammar.y"
#line 706 "grammar.y"
{
imply_typedef(yyval.text.text);
}
break;
case 68:
#line 712 "grammar.y"
#line 713 "grammar.y"
{
new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
}
break;
case 69:
#line 716 "grammar.y"
#line 717 "grammar.y"
{
add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
}
break;
case 70:
#line 723 "grammar.y"
#line 724 "grammar.y"
{
if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
func_style == FUNC_TRADITIONAL && cur_file->convert) {
@ -2392,7 +2396,7 @@ case 70:
}
break;
case 71:
#line 732 "grammar.y"
#line 733 "grammar.y"
{
if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
func_style == FUNC_TRADITIONAL && cur_file->convert) {
@ -2402,42 +2406,42 @@ case 71:
}
break;
case 73:
#line 744 "grammar.y"
#line 745 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
(void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
(void)sprintf(s = buf, "enum %.*s", TEXT_LEN, yystack.l_mark[-1].text.text);
new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
}
break;
case 74:
#line 751 "grammar.y"
#line 752 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
(void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
(void)sprintf(s = buf, "%.*s {}", TEXT_LEN, yystack.l_mark[-1].text.text);
new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 75:
#line 758 "grammar.y"
#line 759 "grammar.y"
{
(void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
(void)sprintf(buf, "enum %.*s", TEXT_LEN, yystack.l_mark[0].text.text);
new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 76:
#line 766 "grammar.y"
#line 767 "grammar.y"
{
imply_typedef("enum");
yyval.text = yystack.l_mark[0].text;
}
break;
case 79:
#line 779 "grammar.y"
#line 780 "grammar.y"
{
yyval.declarator = yystack.l_mark[0].declarator;
(void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
(void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
yyval.declarator->begin = yystack.l_mark[-1].text.begin;
@ -2445,32 +2449,32 @@ case 79:
}
break;
case 81:
#line 792 "grammar.y"
#line 793 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
}
break;
case 82:
#line 796 "grammar.y"
#line 797 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "(%s)", yyval.declarator->text);
(void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
yyval.declarator->begin = yystack.l_mark[-2].text.begin;
}
break;
case 83:
#line 804 "grammar.y"
#line 805 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
(void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
}
break;
case 84:
#line 811 "grammar.y"
#line 812 "grammar.y"
{
yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
@ -2480,7 +2484,7 @@ case 84:
}
break;
case 85:
#line 819 "grammar.y"
#line 820 "grammar.y"
{
yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
@ -2490,28 +2494,28 @@ case 85:
}
break;
case 86:
#line 830 "grammar.y"
#line 831 "grammar.y"
{
(void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
(void)sprintf(yyval.text.text, "*%.*s", TEXT_LEN, yystack.l_mark[0].text.text);
yyval.text.begin = yystack.l_mark[-1].text.begin;
}
break;
case 87:
#line 835 "grammar.y"
#line 836 "grammar.y"
{
(void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
(void)sprintf(yyval.text.text, "*%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].text.text);
yyval.text.begin = yystack.l_mark[-2].text.begin;
}
break;
case 88:
#line 843 "grammar.y"
#line 844 "grammar.y"
{
strcpy(yyval.text.text, "");
yyval.text.begin = 0L;
}
break;
case 90:
#line 852 "grammar.y"
#line 853 "grammar.y"
{
(void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
@ -2519,132 +2523,132 @@ case 90:
}
break;
case 91:
#line 858 "grammar.y"
#line 859 "grammar.y"
{
(void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
(void)sprintf(yyval.text.text, "%.*s%.*s ", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yystack.l_mark[0].decl_spec.text);
yyval.text.begin = yystack.l_mark[-1].text.begin;
free(yystack.l_mark[0].decl_spec.text);
}
break;
case 93:
#line 868 "grammar.y"
#line 869 "grammar.y"
{
add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
}
break;
case 94:
#line 875 "grammar.y"
#line 876 "grammar.y"
{
new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
}
break;
case 95:
#line 879 "grammar.y"
#line 880 "grammar.y"
{
add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
}
break;
case 96:
#line 886 "grammar.y"
#line 887 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
}
break;
case 97:
#line 891 "grammar.y"
#line 892 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
}
break;
case 98:
#line 896 "grammar.y"
#line 897 "grammar.y"
{
check_untagged(&yystack.l_mark[0].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
}
break;
case 99:
#line 904 "grammar.y"
#line 905 "grammar.y"
{
new_ident_list(&yyval.param_list);
}
break;
case 101:
#line 912 "grammar.y"
#line 913 "grammar.y"
{
new_ident_list(&yyval.param_list);
add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
}
break;
case 102:
#line 917 "grammar.y"
#line 918 "grammar.y"
{
add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
}
break;
case 103:
#line 924 "grammar.y"
#line 925 "grammar.y"
{
yyval.text = yystack.l_mark[0].text;
}
break;
case 104:
#line 928 "grammar.y"
#line 929 "grammar.y"
{
#if OPT_LINTLIBRARY
if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
yyval.text = yystack.l_mark[0].text;
} else
#endif
(void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
(void)sprintf(yyval.text.text, "&%.*s", TEXT_LEN, yystack.l_mark[0].text.text);
yyval.text.begin = yystack.l_mark[-1].text.begin;
}
break;
case 105:
#line 941 "grammar.y"
#line 942 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
}
break;
case 106:
#line 945 "grammar.y"
#line 946 "grammar.y"
{
yyval.declarator = yystack.l_mark[0].declarator;
(void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
(void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yystack.l_mark[-1].text.text, TEXT_LEN, yyval.declarator->text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
yyval.declarator->begin = yystack.l_mark[-1].text.begin;
}
break;
case 108:
#line 957 "grammar.y"
#line 958 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "(%s)", yyval.declarator->text);
(void)sprintf(buf, "(%.*s)", TEXT_LEN, yyval.declarator->text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
yyval.declarator->begin = yystack.l_mark[-2].text.begin;
}
break;
case 109:
#line 965 "grammar.y"
#line 966 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
(void)sprintf(buf, "%.*s%.*s", TEXT_LEN, yyval.declarator->text, TEXT_LEN, yystack.l_mark[0].text.text);
free(yyval.declarator->text);
yyval.declarator->text = xstrdup(buf);
}
break;
case 110:
#line 972 "grammar.y"
#line 973 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
}
break;
case 111:
#line 976 "grammar.y"
#line 977 "grammar.y"
{
yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
@ -2654,7 +2658,7 @@ case 111:
}
break;
case 112:
#line 984 "grammar.y"
#line 985 "grammar.y"
{
yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
@ -2663,7 +2667,7 @@ case 112:
}
break;
case 113:
#line 991 "grammar.y"
#line 992 "grammar.y"
{
Declarator *d;
@ -2676,7 +2680,7 @@ case 113:
}
break;
case 114:
#line 1002 "grammar.y"
#line 1003 "grammar.y"
{
Declarator *d;
@ -2687,7 +2691,7 @@ case 114:
yyval.declarator->func_def = FUNC_ANSI;
}
break;
#line 2691 "grammar.tab.c"
#line 2695 "grammar.tab.c"
default:
break;
}
@ -2742,12 +2746,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -0,0 +1,20 @@
YACC: error message
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-H defines_file write definitions to defines_file
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -1,18 +0,0 @@
Usage: YACC [options] filename
Options:
-b file_prefix set filename prefix (default "y.")
-B create a backtracking parser
-d write definitions (.tab.h)
-i write interface (y.tab.i)
-g write a graphical description
-l suppress #line directives
-L enable position processing, e.g., "%locations"
-o output_file (default ".tab.c")
-p symbol_prefix set symbol prefix (default "yy")
-P create a reentrant parser, e.g., "%pure-parser"
-r produce separate code and table files (y.code.c)
-s suppress #define's for quoted names in %token lines
-t add debugging support
-v write description (y.output)
-V show version information and exit

View file

@ -171,7 +171,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT inherit0_lhs[] = { -1,
0, 0, 1, 1, 2, 2, 3, 3, 5, 6,
4,
@ -261,13 +261,16 @@ static const char *const inherit0_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -280,17 +283,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -389,7 +392,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 393 "inherit0.tab.c"
#line 396 "inherit0.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -528,7 +531,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -595,10 +598,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -709,7 +712,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -919,7 +922,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -948,7 +951,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -964,7 +967,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1050,10 +1053,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1103,7 +1106,7 @@ case 11:
#line 43 "inherit0.y"
{ yyval = yystack.l_mark[0]; }
break;
#line 1107 "inherit0.tab.c"
#line 1110 "inherit0.tab.c"
default:
break;
}
@ -1158,12 +1161,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

View file

@ -192,7 +192,7 @@ extern int YYPARSE_DECL();
#define INTEGER 260
#define NAME 261
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT inherit1_lhs[] = { -1,
0, 0, 3, 3, 4, 4, 1, 1, 5, 6,
2,
@ -282,13 +282,16 @@ static const char *const inherit1_rule[] = {
};
#endif
#if YYDEBUG
int yydebug;
int yynerrs;
#endif
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
int yynerrs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
@ -301,17 +304,17 @@ do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 0).last_line; \
(loc).first_column = YYRHSLOC(rhs, 0).last_column; \
(loc).last_line = YYRHSLOC(rhs, 0).last_line; \
(loc).last_column = YYRHSLOC(rhs, 0).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
(loc).first_line = YYRHSLOC(rhs, 1).first_line; \
(loc).first_column = YYRHSLOC(rhs, 1).first_column; \
(loc).last_line = YYRHSLOC(rhs, n).last_line; \
(loc).last_column = YYRHSLOC(rhs, n).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
@ -410,7 +413,7 @@ static YYINT *yylexemes = 0;
extern int YYLEX_DECL();
extern void YYERROR_DECL();
#line 414 "inherit1.tab.c"
#line 417 "inherit1.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
@ -549,7 +552,7 @@ YYPARSE_DECL()
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
#endif
#if YYDEBUG
const char *yys;
@ -616,10 +619,10 @@ YYPARSE_DECL()
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
@ -730,7 +733,7 @@ YYPARSE_DECL()
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
@ -940,7 +943,7 @@ YYPARSE_DECL()
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
@ -969,7 +972,7 @@ YYPARSE_DECL()
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
yyerror_loc_range[2] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
@ -985,7 +988,7 @@ YYPARSE_DECL()
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
yyerror_loc_range[1] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
@ -1071,10 +1074,10 @@ YYPARSE_DECL()
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
yyerror_loc_range[1] = yystack.p_mark[1-yym];
}
#endif
@ -1128,7 +1131,7 @@ case 11:
#line 71 "inherit1.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
#line 1132 "inherit1.tab.c"
#line 1135 "inherit1.tab.c"
default:
break;
}
@ -1183,12 +1186,12 @@ break;
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;

Some files were not shown because too many files have changed in this diff Show more