From 38f526d04415adb7b5e6bca228fc26409833f5c3 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Fri, 8 May 2015 23:09:00 +0100 Subject: [PATCH] Updated build system. Major changes: - Moved all re2c source files to a separate directory. Top source directory should only contain autotools source files and a few other files like README. - Enabled out-of-source builds (and wrote a simple script build.sh that makes out-of-source build). - Improved portable variant of header (src/c99_stdint.h): now it relies only on some few defines in configure-generated src/config.h (instead of checking for MSVC version and relying on MSVC-defined stuff). Implementation follows C99 standard closely. - Removed all windows-related build stuff. It was no use keeping it: it's been broken for a long time and I can't maintain it. - Removed all RPM stuff: distro-maintainers use their own hacks anyway. Makefile.am is definetely the wrong place to keep such things. A separete script and .spec file is a better idea, but again, nobody uses it. - added make target 'bootstrap' to make mainteiners' job easier. - Merged lessons and examples into one. - Updated README and doc/index.html. - Run tests in parallel by default. Changes concerning particular files: - configure.ac: - removed autoconf version check: developers will need the right version anyway (otherwize autoconf will reject to work); users should use configure script provided by package distribution - removed GCC version (3 or above) check: it's pretty ancient and I don't know which features are missing anyway - removed some useless checks (which resulted in defines in src/config,h used by no one) - introduced some new checks (used by src/c99_stdint.h) - followed the advices of autoupdate Makefile.am: - explicitly prefixed all file names with $(srcdir) or $(builddir) - removed windows and RPM related rules and targets - added target 'bootstrap' - sorted out automake variables --- add-release.txt | 0 re2c/.gitignore | 31 +- re2c/Makefile.am | 257 +- re2c/README | 144 + re2c/README.in | 204 - re2c/autogen.sh | 10 +- re2c/bootstrap/manual.html | 2296 ++++++ re2c/bootstrap/parser.cc | 252 +- re2c/bootstrap/re2c.1 | 10 +- re2c/bootstrap/scanner.cc | 13 +- re2c/bootstrap/y.tab.h | 19 +- re2c/bug2102138-test.sh | 15 - re2c/build.sh | 10 + re2c/c99_stdint.h | 237 - re2c/config_w32.h | 102 - re2c/config_w32.h.in | 102 - re2c/configure.ac | 105 +- re2c/{htdocs => doc}/index.html | 55 +- re2c/{ => doc}/re2c.ad.in | 6 +- .../001_upn_calculator/README} | 0 .../001_upn_calculator/calc_001.re | 0 .../001_upn_calculator/calc_002.re | 0 .../001_upn_calculator/calc_003.re | 0 .../001_upn_calculator/calc_004.re | 0 .../001_upn_calculator/calc_005.re | 0 .../001_upn_calculator/calc_006.s.re | 0 .../001_upn_calculator/calc_007.b.re | 0 .../001_upn_calculator/calc_008.b.re | 0 .../001_upn_calculator/windows/HiResTimer.h | 0 .../001_upn_calculator/windows/main.b.re | 0 .../002_strip_comments/README} | 0 .../002_strip_comments/strip_001.s.re | 0 .../002_strip_comments/strip_002.s.re | 0 .../002_strip_comments/strip_003.b.re | 0 re2c/examples/basemmap.c | 26 - re2c/examples/cmmap.re | 267 - re2c/examples/cnokw.re | 239 - re2c/examples/cunroll.re | 258 - re2c/examples/{ => langs}/c.re | 0 re2c/examples/{ => langs}/modula.re | 3 +- re2c/examples/{rexx/rexx.l => langs/rexx.re} | 0 re2c/examples/pp-c.re | 295 - re2c/examples/{ => push_model}/push.re | 6 +- re2c/examples/repeater.re | 44 - re2c/examples/rexx/README | 1 - re2c/examples/rexx/scanio.c | 41 - re2c/examples/sample.re | 7 - re2c/examples/simple.re | 13 - re2c/htdocs/.gitignore | 1 - re2c/lessons/.gitignore | 4 - re2c/lessons/001_upn_calculator/.gitignore | 4 - .../001_upn_calculator/windows/.gitignore | 11 - .../windows/BuildAndRun.bat | 48 - .../windows/TestRe2c-2005.sln | 19 - .../windows/TestRe2c-2005.vcproj | 252 - .../001_upn_calculator/windows/TestRe2c.dsp | 124 - .../001_upn_calculator/windows/TestRe2c.dsw | 29 - .../001_upn_calculator/windows/TestRe2c.sln | 21 - .../windows/TestRe2c.vcproj | 138 - re2c/lessons/002_strip_comments/.gitignore | 5 - re2c/lessons/readme.txt | 20 - re2c/logo.pspimage | Bin 7241 -> 0 bytes re2c/makerpm.in | 45 - re2c/re2c.rules | 152 - re2c/re2c.spec.in | 52 - re2c/release.sh | 71 +- re2c/run_tests.sh.in | 46 +- re2c/{ => src}/actions.cc | 14 +- re2c/src/c99_stdint.h | 259 + re2c/{ => src}/code.cc | 20 +- re2c/{ => src}/code.h | 2 +- re2c/{ => src}/code_names.cc | 4 +- re2c/{ => src}/code_names.h | 0 re2c/{ => src}/dfa.cc | 9 +- re2c/{ => src}/dfa.h | 4 +- re2c/{ => src}/enc.cc | 2 +- re2c/{ => src}/enc.h | 4 +- re2c/{ => src}/free_list.h | 0 re2c/{ => src}/globals.h | 8 +- re2c/{ => src}/go.h | 4 +- re2c/{ => src}/go_construct.cc | 4 +- re2c/{ => src}/go_destruct.cc | 4 +- re2c/{ => src}/go_emit.cc | 8 +- re2c/{ => src}/go_used_labels.cc | 4 +- re2c/{ => src}/indent.h | 3 +- re2c/{ => src}/input.cc | 2 +- re2c/{ => src}/input.h | 2 +- re2c/{ => src}/input_api.cc | 6 +- re2c/{ => src}/input_api.h | 2 +- re2c/{ => src}/ins.h | 2 +- re2c/{ => src}/main.cc | 16 +- re2c/{ => src}/mbo_getopt.cc | 4 +- re2c/{ => src}/mbo_getopt.h | 0 re2c/{ => src}/output.cc | 6 +- re2c/{ => src}/output.h | 2 +- re2c/{ => src}/parser.h | 6 +- re2c/{parser.y => src/parser.ypp} | 15 +- re2c/{ => src}/print.cc | 4 +- re2c/{ => src}/print.h | 2 +- re2c/{ => src}/range.cc | 4 +- re2c/{ => src}/range.h | 4 +- re2c/{ => src}/range_suffix.cc | 4 +- re2c/{ => src}/range_suffix.h | 4 +- re2c/{ => src}/re.h | 14 +- re2c/{ => src}/scanner.h | 10 +- re2c/{ => src}/scanner.re | 11 +- re2c/{ => src}/skeleton.cc | 6 +- re2c/{ => src}/skeleton.h | 4 +- re2c/{ => src}/smart_ptr.h | 0 re2c/{ => src}/substr.cc | 5 +- re2c/{ => src}/substr.h | 7 +- re2c/{ => src}/token.h | 2 +- re2c/{ => src}/translate.cc | 2 +- re2c/{ => src}/utf16.cc | 2 +- re2c/{ => src}/utf16.h | 2 +- re2c/{ => src}/utf16_range.cc | 4 +- re2c/{ => src}/utf16_range.h | 4 +- re2c/{ => src}/utf16_regexp.cc | 6 +- re2c/{ => src}/utf16_regexp.h | 2 +- re2c/{ => src}/utf8.cc | 2 +- re2c/{ => src}/utf8.h | 2 +- re2c/{ => src}/utf8_range.cc | 4 +- re2c/{ => src}/utf8_range.h | 4 +- re2c/{ => src}/utf8_regexp.cc | 6 +- re2c/{ => src}/utf8_regexp.h | 2 +- re2c/test/.gitignore | 3 - re2c/test/bug1054496.c | 0 re2c/test/bug1054496.re | 0 re2c/test/bug1163046.c | 0 re2c/test/bug1163046.re | 0 re2c/test/bug1187785.c | 0 re2c/test/bug1187785.re | 0 re2c/test/bug1297658.re | 0 re2c/test/bug1390174.c | 0 re2c/test/bug1390174.re | 0 re2c/test/bug1454253.c | 0 re2c/test/bug1454253.re | 0 re2c/test/bug1454253.s.c | 0 re2c/test/bug1454253.s.re | 0 re2c/test/bug1454253b.s.c | 0 re2c/test/bug1454253b.s.re | 0 re2c/test/bug1472770.b.c | 0 re2c/test/bug1472770.b.re | 0 re2c/test/bug1472770.c | 0 re2c/test/bug1472770.f.c | 0 re2c/test/bug1472770.f.re | 0 re2c/test/bug1472770.re | 0 re2c/test/bug1472770.s.c | 0 re2c/test/bug1472770.s.re | 0 re2c/test/bug1479044.b.re | 0 re2c/test/bug1479044.c | 0 re2c/test/bug1479044.re | 0 re2c/test/bug1479044.s.c | 0 re2c/test/bug1479044.s.re | 0 re2c/test/bug1528269.c | 0 re2c/test/bug1528269.re | 0 re2c/test/bug1529351.c | 0 re2c/test/bug1682718.c | 0 re2c/test/bug1682718.is.c | 0 re2c/test/bug1682718.is.re | 0 re2c/test/bug1682718.re | 0 re2c/test/bug1708378.ib.c | 0 re2c/test/bug1708378.ib.re | 0 re2c/test/bug1711240.ei.re | 0 re2c/test/bug2102138.i.c | 0 re2c/test/bug2102138.i.re | 0 re2c/test/bug2102138.i.txt | 19 - re2c/test/bug2102138a.ei.c | 0 re2c/test/bug2102138a.ei.re | 0 re2c/test/bug2102138a.ei.txt | 19 - re2c/test/bug2102138b.ei.c | 0 re2c/test/bug2102138b.ei.re | 0 re2c/test/bug2102138b.ei.txt | 19 - re2c/test/bug2102138c.ei.c | 0 re2c/test/bug2102138c.ei.re | 0 re2c/test/bug2102138c.ei.txt | 19 - re2c/test/bug2462777.ci.re | 0 re2c/test/bug2462777.i.re | 0 .../001_upn_calculator => test}/calc_001.c | 0 re2c/test/calc_001.dei.re | 0 re2c/test/calc_001.ei.re | 0 re2c/test/calc_001.re | 84 + .../001_upn_calculator => test}/calc_002.c | 0 re2c/test/calc_002.re | 69 + .../001_upn_calculator => test}/calc_003.c | 0 re2c/test/calc_003.re | 61 + .../001_upn_calculator => test}/calc_004.c | 0 re2c/test/calc_004.re | 78 + .../001_upn_calculator => test}/calc_005.c | 0 re2c/test/calc_005.re | 144 + .../001_upn_calculator => test}/calc_006.s.c | 0 re2c/test/calc_006.s.re | 162 + .../001_upn_calculator => test}/calc_007.b.c | 0 re2c/test/calc_007.b.re | 135 + .../001_upn_calculator => test}/calc_008.b.c | 0 re2c/test/calc_008.b.re | 158 + re2c/test/casing-flags.i--case-insensitive.c | 0 re2c/test/casing-flags.i--case-insensitive.re | 0 re2c/test/casing-flags.i--case-inverted.c | 0 re2c/test/casing-flags.i--case-inverted.re | 0 re2c/test/casing-flags.i.c | 0 re2c/test/casing-flags.i.re | 0 re2c/test/cond_error_00.c | 0 re2c/test/cond_error_00.re | 0 re2c/test/cond_error_01.c.c | 0 re2c/test/cond_error_01.c.re | 0 re2c/test/cond_error_02.c.c | 0 re2c/test/cond_error_02.c.re | 0 re2c/test/cond_error_03.c.c | 0 re2c/test/cond_error_03.c.re | 0 re2c/test/cond_error_04.c.c | 0 re2c/test/cond_error_04.c.re | 0 re2c/test/cond_error_05.c.c | 0 re2c/test/cond_error_05.c.re | 0 re2c/test/cond_error_06.c.c | 0 re2c/test/cond_error_06.c.re | 0 re2c/test/cond_error_07.c.c | 0 re2c/test/cond_error_07.c.re | 0 re2c/test/cond_error_08.c.c | 0 re2c/test/cond_error_08.c.re | 0 re2c/test/cond_error_09.c.c | 0 re2c/test/cond_error_09.c.re | 0 re2c/test/cond_error_10.c.c | 0 re2c/test/cond_error_10.c.re | 0 re2c/test/cond_error_11.c.c | 0 re2c/test/cond_error_11.c.re | 0 re2c/test/condition_01.c.c | 0 re2c/test/condition_01.c.re | 0 re2c/test/condition_01a.c.c | 0 re2c/test/condition_01a.c.re | 0 re2c/test/condition_01b.c.c | 0 re2c/test/condition_01b.c.re | 0 re2c/test/condition_02.c.c | 0 re2c/test/condition_02.c.re | 0 re2c/test/condition_02.cg.c | 0 re2c/test/condition_02.cg.re | 0 re2c/test/condition_03.cg.c | 0 re2c/test/condition_03.cg.re | 0 re2c/test/condition_04.cg.c | 0 re2c/test/condition_04.cg.re | 0 re2c/test/condition_05.cg.c | 0 re2c/test/condition_05.cg.re | 0 .../condition_05.cgitcondition_05.cgit.h.c | 0 .../condition_05.cgitcondition_05.cgit.h.h | 0 .../condition_05.cgitcondition_05.cgit.h.re | 0 .../test/condition_05.cgtcondition_05.cgt.h.c | 0 .../test/condition_05.cgtcondition_05.cgt.h.h | 0 .../condition_05.cgtcondition_05.cgt.h.re | 0 re2c/test/condition_05.cs.c | 0 re2c/test/condition_05.cs.re | 0 re2c/test/condition_06.cs.c | 0 re2c/test/condition_06.cs.re | 0 re2c/test/condition_07.cbi.c | 0 re2c/test/condition_07.cbi.re | 0 re2c/test/condition_08.cbi.re | 0 re2c/test/condition_08.cbif.re | 0 re2c/test/condition_09.cbif.re | 0 re2c/test/condition_09.cgif.c | 0 re2c/test/condition_09.cgif.re | 0 re2c/test/condition_10.cgif.c | 0 re2c/test/condition_10.cgif.re | 0 re2c/test/condition_11.cg.c | 0 re2c/test/condition_11.cg.re | 0 re2c/test/condition_12.cgif.c | 0 re2c/test/condition_12.cgif.re | 0 re2c/test/condition_13.cg.c | 0 re2c/test/condition_13.cg.re | 0 re2c/test/condition_14.cbif.re | 0 re2c/test/condition_14.cgif.c | 0 re2c/test/condition_14.cgif.re | 0 re2c/test/condition_14.cif.re | 0 re2c/test/condition_14.csif.re | 0 re2c/test/condition_15.csif.re | 0 re2c/test/config1.c | 0 re2c/test/config1.re | 0 re2c/test/config10.c | 0 re2c/test/config10.re | 0 re2c/test/config11.ei.c | 0 re2c/test/config11.ei.re | 0 re2c/test/config2.s.c | 0 re2c/test/config2.s.re | 0 re2c/test/config3.c | 0 re2c/test/config3.re | 0 re2c/test/config4a.f.c | 0 re2c/test/config4a.f.re | 0 re2c/test/config4b.f.c | 0 re2c/test/config4b.f.re | 0 re2c/test/config4c.f.c | 0 re2c/test/config4c.f.re | 0 re2c/test/config4d.f.c | 0 re2c/test/config4d.f.re | 0 re2c/test/config4e.f.c | 0 re2c/test/config4e.f.re | 0 re2c/test/config4f.f.c | 0 re2c/test/config4f.f.re | 0 re2c/test/config4g.ifs.c | 0 re2c/test/config4g.ifs.re | 0 re2c/test/config5.c | 0 re2c/test/config5.re | 0 re2c/test/config6.c | 0 re2c/test/config6.re | 0 re2c/test/config7a.g.c | 0 re2c/test/config7a.g.re | 0 re2c/test/config7b.g.c | 0 re2c/test/config7b.g.re | 0 re2c/test/config8.c | 0 re2c/test/config8.re | 0 re2c/test/config9.b.c | 0 re2c/test/config9.b.re | 0 re2c/test/ctx.b.c | 0 re2c/test/ctx.b.re | 0 re2c/test/ctx.c | 0 re2c/test/ctx.re | 0 re2c/test/ctx.s.c | 0 re2c/test/ctx.s.re | 0 re2c/test/cvsignore.b.re | 0 re2c/test/cvsignore.c | 0 re2c/test/cvsignore.re | 0 re2c/test/cvsignore.s.re | 0 re2c/test/cvsignore.u.re | 0 re2c/test/cvsignore.ub.re | 0 re2c/test/cvsignore.w.re | 0 re2c/test/cvsignore.wb.re | 0 re2c/test/error1.c | 0 re2c/test/error1.re | 0 re2c/test/error10.c | 0 re2c/test/error10.re | 0 re2c/test/error11.c | 0 re2c/test/error11.re | 0 re2c/test/error12.c | 0 re2c/test/error12.re | 0 re2c/test/error13.1.c | 0 re2c/test/error13.1.re | 0 re2c/test/error13.c | 0 re2c/test/error13.re | 0 re2c/test/error14.1.c | 0 re2c/test/error14.1.re | 0 re2c/test/error14.c | 0 re2c/test/error14.re | 0 re2c/test/error2.c | 0 re2c/test/error2.re | 0 re2c/test/error3.c | 0 re2c/test/error3.re | 0 re2c/test/error4.c | 0 re2c/test/error4.re | 0 re2c/test/error5.c | 0 re2c/test/error5.re | 0 re2c/test/error6.c | 0 re2c/test/error6.re | 0 re2c/test/error7.c | 0 re2c/test/error7.re | 0 re2c/test/error8.c | 0 re2c/test/error8.re | 0 re2c/test/error9.c | 0 re2c/test/error9.re | 0 re2c/test/flex-01.i.c | 0 re2c/test/flex-01.i.re | 0 re2c/test/flex-01.iF.c | 0 re2c/test/flex-01.iF.re | 0 re2c/test/input10.b.c | 0 re2c/test/input10.b.re | 0 re2c/test/input10.c | 0 re2c/test/input10.re | 0 re2c/test/input10.s.c | 0 re2c/test/input10.s.re | 0 re2c/test/input11.b.c | 0 re2c/test/input11.b.re | 0 re2c/test/input11.c | 0 re2c/test/input11.i.c | 0 re2c/test/input11.i.re | 0 re2c/test/input11.re | 0 re2c/test/input11.s.c | 0 re2c/test/input11.s.re | 0 re2c/test/input12.boinput12.c.c | 0 re2c/test/input12.boinput12.c.re | 0 re2c/test/input12.oinput12.c.c | 0 re2c/test/input12.oinput12.c.re | 0 re2c/test/input13.c | 0 re2c/test/input13.re | 0 re2c/test/input4.c | 0 re2c/test/input4.re | 0 re2c/test/input5.c | 0 re2c/test/input5.re | 0 re2c/test/input6.c | 0 re2c/test/input6.re | 0 re2c/test/input7.c | 0 re2c/test/input7.re | 0 re2c/test/input8.b.c | 0 re2c/test/input8.b.re | 0 re2c/test/input8.c | 0 re2c/test/input8.g.c | 0 re2c/test/input8.g.re | 0 re2c/test/input8.re | 0 re2c/test/input9.c | 0 re2c/test/input9.re | 0 re2c/test/line-01.c | 0 re2c/test/line-01.re | 0 .../windows => test}/main.b.c | 0 re2c/test/main.b.re | 291 + re2c/test/overflow-1.c | 0 re2c/test/overflow-1.re | 0 re2c/test/overflow-2.c | 0 re2c/test/overflow-2.re | 0 re2c/test/overflow-3.c | 0 re2c/test/overflow-3.re | 0 re2c/test/overflow-4.c | 0 re2c/test/overflow-4.re | 0 re2c/test/parse_date.b.re | 0 re2c/test/parse_date.c | 0 re2c/test/parse_date.db.re | 0 re2c/test/parse_date.g.c | 0 re2c/test/parse_date.g.re | 0 re2c/test/parse_date.re | 0 re2c/test/parse_date.s.re | 0 re2c/test/parse_date_1_78.db.re | 0 re2c/test/push.c | 0 re2c/test/push.f.c | 0 re2c/test/push.f.re | 0 re2c/test/push.fb.c | 0 re2c/test/push.fb.re | 0 re2c/test/push.fg.c | 0 re2c/test/push.fg.re | 0 re2c/test/push.fs.c | 0 re2c/test/push.fs.re | 0 re2c/test/push.re | 0 re2c/test/repeat-00.cgi.c | 0 re2c/test/repeat-00.cgi.re | 0 re2c/test/repeat-01.cgir.c | 0 re2c/test/repeat-01.cgir.re | 0 re2c/test/repeat-02.cgir.c | 0 re2c/test/repeat-02.cgir.re | 0 re2c/test/repeat-03.cgir.c | 0 re2c/test/repeat-03.cgir.re | 0 re2c/test/repeat-04.cgir.c | 0 re2c/test/repeat-04.cgir.re | 0 re2c/test/repeat-05.cgir.c | 0 re2c/test/repeat-05.cgir.re | 0 re2c/test/repeat-06.gir.c | 0 re2c/test/repeat-06.gir.re | 0 re2c/test/repeat-07.gir.c | 0 re2c/test/repeat-07.gir.re | 0 re2c/test/repeat-07_error.gir.re | 0 re2c/test/reuse_conds_default_0.cgir.re | 0 re2c/test/reuse_conds_default_1.cgir.re | 0 re2c/test/reuse_conds_setup_0.cgir.re | 0 re2c/test/reuse_conds_setup_1.cgir.re | 0 re2c/test/rexx.c | 6979 +++++++++++++++++ re2c/test/rexx.re | 319 + re2c/test/scanner.fs.c | 0 re2c/test/scanner.fs.re | 0 re2c/test/scanner.s.c | 0 re2c/test/scanner.s.re | 0 .../002_strip_comments => test}/strip_001.s.c | 0 re2c/test/strip_001.s.re | 147 + .../002_strip_comments => test}/strip_002.s.c | 0 re2c/test/strip_002.s.re | 162 + .../002_strip_comments => test}/strip_003.b.c | 0 re2c/test/strip_003.b.re | 179 + re2c/test/yyaccept_missing.bci.c | 0 re2c/test/yyaccept_missing.bci.re | 0 460 files changed, 12330 insertions(+), 3366 deletions(-) mode change 100755 => 100644 add-release.txt mode change 100755 => 100644 re2c/Makefile.am create mode 100644 re2c/README delete mode 100644 re2c/README.in create mode 100644 re2c/bootstrap/manual.html delete mode 100755 re2c/bug2102138-test.sh create mode 100755 re2c/build.sh delete mode 100644 re2c/c99_stdint.h delete mode 100644 re2c/config_w32.h delete mode 100755 re2c/config_w32.h.in rename re2c/{htdocs => doc}/index.html (92%) mode change 100755 => 100644 rename re2c/{ => doc}/re2c.ad.in (99%) rename re2c/{lessons/001_upn_calculator/readme.txt => examples/001_upn_calculator/README} (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_001.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_002.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_003.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_004.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_005.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_006.s.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_007.b.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/calc_008.b.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/windows/HiResTimer.h (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/001_upn_calculator/windows/main.b.re (100%) mode change 100755 => 100644 rename re2c/{lessons/002_strip_comments/readme.txt => examples/002_strip_comments/README} (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/002_strip_comments/strip_001.s.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/002_strip_comments/strip_002.s.re (100%) mode change 100755 => 100644 rename re2c/{lessons => examples}/002_strip_comments/strip_003.b.re (100%) mode change 100755 => 100644 delete mode 100644 re2c/examples/basemmap.c delete mode 100644 re2c/examples/cmmap.re delete mode 100644 re2c/examples/cnokw.re delete mode 100644 re2c/examples/cunroll.re rename re2c/examples/{ => langs}/c.re (100%) rename re2c/examples/{ => langs}/modula.re (98%) rename re2c/examples/{rexx/rexx.l => langs/rexx.re} (100%) delete mode 100755 re2c/examples/pp-c.re rename re2c/examples/{ => push_model}/push.re (99%) delete mode 100755 re2c/examples/repeater.re delete mode 100644 re2c/examples/rexx/README delete mode 100644 re2c/examples/rexx/scanio.c delete mode 100644 re2c/examples/sample.re delete mode 100644 re2c/examples/simple.re delete mode 100644 re2c/htdocs/.gitignore delete mode 100755 re2c/lessons/.gitignore delete mode 100755 re2c/lessons/001_upn_calculator/.gitignore delete mode 100755 re2c/lessons/001_upn_calculator/windows/.gitignore delete mode 100755 re2c/lessons/001_upn_calculator/windows/BuildAndRun.bat delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.sln delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.vcproj delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c.dsp delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c.dsw delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c.sln delete mode 100755 re2c/lessons/001_upn_calculator/windows/TestRe2c.vcproj delete mode 100755 re2c/lessons/002_strip_comments/.gitignore delete mode 100755 re2c/lessons/readme.txt delete mode 100755 re2c/logo.pspimage delete mode 100644 re2c/makerpm.in delete mode 100755 re2c/re2c.rules delete mode 100644 re2c/re2c.spec.in rename re2c/{ => src}/actions.cc (99%) create mode 100644 re2c/src/c99_stdint.h rename re2c/{ => src}/code.cc (99%) rename re2c/{ => src}/code.h (97%) mode change 100755 => 100644 rename re2c/{ => src}/code_names.cc (85%) rename re2c/{ => src}/code_names.h (100%) rename re2c/{ => src}/dfa.cc (97%) rename re2c/{ => src}/dfa.h (99%) rename re2c/{ => src}/enc.cc (99%) rename re2c/{ => src}/enc.h (98%) rename re2c/{ => src}/free_list.h (100%) rename re2c/{ => src}/globals.h (95%) rename re2c/{ => src}/go.h (98%) rename re2c/{ => src}/go_construct.cc (99%) rename re2c/{ => src}/go_destruct.cc (95%) rename re2c/{ => src}/go_emit.cc (98%) rename re2c/{ => src}/go_used_labels.cc (97%) rename re2c/{ => src}/indent.h (90%) rename re2c/{ => src}/input.cc (93%) rename re2c/{ => src}/input.h (92%) rename re2c/{ => src}/input_api.cc (97%) rename re2c/{ => src}/input_api.h (96%) rename re2c/{ => src}/ins.h (95%) rename re2c/{ => src}/main.cc (98%) rename re2c/{ => src}/mbo_getopt.cc (99%) mode change 100755 => 100644 rename re2c/{ => src}/mbo_getopt.h (100%) mode change 100755 => 100644 rename re2c/{ => src}/output.cc (98%) rename re2c/{ => src}/output.h (98%) rename re2c/{ => src}/parser.h (90%) rename re2c/{parser.y => src/parser.ypp} (99%) rename re2c/{ => src}/print.cc (98%) rename re2c/{ => src}/print.h (90%) rename re2c/{ => src}/range.cc (97%) rename re2c/{ => src}/range.h (93%) rename re2c/{ => src}/range_suffix.cc (89%) rename re2c/{ => src}/range_suffix.h (90%) rename re2c/{ => src}/re.h (97%) rename re2c/{ => src}/scanner.h (95%) rename re2c/{ => src}/scanner.re (98%) rename re2c/{ => src}/skeleton.cc (99%) rename re2c/{ => src}/skeleton.h (98%) rename re2c/{ => src}/smart_ptr.h (100%) rename re2c/{ => src}/substr.cc (93%) rename re2c/{ => src}/substr.h (94%) rename re2c/{ => src}/token.h (97%) rename re2c/{ => src}/translate.cc (89%) rename re2c/{ => src}/utf16.cc (90%) rename re2c/{ => src}/utf16.h (96%) rename re2c/{ => src}/utf16_range.cc (98%) rename re2c/{ => src}/utf16_range.h (90%) rename re2c/{ => src}/utf16_regexp.cc (90%) rename re2c/{ => src}/utf16_regexp.h (90%) rename re2c/{ => src}/utf8.cc (98%) rename re2c/{ => src}/utf8.h (97%) rename re2c/{ => src}/utf8_range.cc (98%) rename re2c/{ => src}/utf8_range.h (87%) rename re2c/{ => src}/utf8_regexp.cc (91%) rename re2c/{ => src}/utf8_regexp.h (90%) delete mode 100644 re2c/test/.gitignore mode change 100755 => 100644 re2c/test/bug1054496.c mode change 100755 => 100644 re2c/test/bug1054496.re mode change 100755 => 100644 re2c/test/bug1163046.c mode change 100755 => 100644 re2c/test/bug1163046.re mode change 100755 => 100644 re2c/test/bug1187785.c mode change 100755 => 100644 re2c/test/bug1187785.re mode change 100755 => 100644 re2c/test/bug1297658.re mode change 100755 => 100644 re2c/test/bug1390174.c mode change 100755 => 100644 re2c/test/bug1390174.re mode change 100755 => 100644 re2c/test/bug1454253.c mode change 100755 => 100644 re2c/test/bug1454253.re mode change 100755 => 100644 re2c/test/bug1454253.s.c mode change 100755 => 100644 re2c/test/bug1454253.s.re mode change 100755 => 100644 re2c/test/bug1454253b.s.c mode change 100755 => 100644 re2c/test/bug1454253b.s.re mode change 100755 => 100644 re2c/test/bug1472770.b.c mode change 100755 => 100644 re2c/test/bug1472770.b.re mode change 100755 => 100644 re2c/test/bug1472770.c mode change 100755 => 100644 re2c/test/bug1472770.f.c mode change 100755 => 100644 re2c/test/bug1472770.f.re mode change 100755 => 100644 re2c/test/bug1472770.re mode change 100755 => 100644 re2c/test/bug1472770.s.c mode change 100755 => 100644 re2c/test/bug1472770.s.re mode change 100755 => 100644 re2c/test/bug1479044.b.re mode change 100755 => 100644 re2c/test/bug1479044.c mode change 100755 => 100644 re2c/test/bug1479044.re mode change 100755 => 100644 re2c/test/bug1479044.s.c mode change 100755 => 100644 re2c/test/bug1479044.s.re mode change 100755 => 100644 re2c/test/bug1528269.c mode change 100755 => 100644 re2c/test/bug1528269.re mode change 100755 => 100644 re2c/test/bug1529351.c mode change 100755 => 100644 re2c/test/bug1682718.c mode change 100755 => 100644 re2c/test/bug1682718.is.c mode change 100755 => 100644 re2c/test/bug1682718.is.re mode change 100755 => 100644 re2c/test/bug1682718.re mode change 100755 => 100644 re2c/test/bug1708378.ib.c mode change 100755 => 100644 re2c/test/bug1708378.ib.re mode change 100755 => 100644 re2c/test/bug1711240.ei.re mode change 100755 => 100644 re2c/test/bug2102138.i.c mode change 100755 => 100644 re2c/test/bug2102138.i.re delete mode 100644 re2c/test/bug2102138.i.txt mode change 100755 => 100644 re2c/test/bug2102138a.ei.c mode change 100755 => 100644 re2c/test/bug2102138a.ei.re delete mode 100644 re2c/test/bug2102138a.ei.txt mode change 100755 => 100644 re2c/test/bug2102138b.ei.c mode change 100755 => 100644 re2c/test/bug2102138b.ei.re delete mode 100644 re2c/test/bug2102138b.ei.txt mode change 100755 => 100644 re2c/test/bug2102138c.ei.c mode change 100755 => 100644 re2c/test/bug2102138c.ei.re delete mode 100755 re2c/test/bug2102138c.ei.txt mode change 100755 => 100644 re2c/test/bug2462777.ci.re mode change 100755 => 100644 re2c/test/bug2462777.i.re rename re2c/{lessons/001_upn_calculator => test}/calc_001.c (100%) mode change 100755 => 100644 mode change 100755 => 100644 re2c/test/calc_001.dei.re mode change 100755 => 100644 re2c/test/calc_001.ei.re create mode 100644 re2c/test/calc_001.re rename re2c/{lessons/001_upn_calculator => test}/calc_002.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_002.re rename re2c/{lessons/001_upn_calculator => test}/calc_003.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_003.re rename re2c/{lessons/001_upn_calculator => test}/calc_004.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_004.re rename re2c/{lessons/001_upn_calculator => test}/calc_005.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_005.re rename re2c/{lessons/001_upn_calculator => test}/calc_006.s.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_006.s.re rename re2c/{lessons/001_upn_calculator => test}/calc_007.b.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_007.b.re rename re2c/{lessons/001_upn_calculator => test}/calc_008.b.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/calc_008.b.re mode change 100755 => 100644 re2c/test/casing-flags.i--case-insensitive.c mode change 100755 => 100644 re2c/test/casing-flags.i--case-insensitive.re mode change 100755 => 100644 re2c/test/casing-flags.i--case-inverted.c mode change 100755 => 100644 re2c/test/casing-flags.i--case-inverted.re mode change 100755 => 100644 re2c/test/casing-flags.i.c mode change 100755 => 100644 re2c/test/casing-flags.i.re mode change 100755 => 100644 re2c/test/cond_error_00.c mode change 100755 => 100644 re2c/test/cond_error_00.re mode change 100755 => 100644 re2c/test/cond_error_01.c.c mode change 100755 => 100644 re2c/test/cond_error_01.c.re mode change 100755 => 100644 re2c/test/cond_error_02.c.c mode change 100755 => 100644 re2c/test/cond_error_02.c.re mode change 100755 => 100644 re2c/test/cond_error_03.c.c mode change 100755 => 100644 re2c/test/cond_error_03.c.re mode change 100755 => 100644 re2c/test/cond_error_04.c.c mode change 100755 => 100644 re2c/test/cond_error_04.c.re mode change 100755 => 100644 re2c/test/cond_error_05.c.c mode change 100755 => 100644 re2c/test/cond_error_05.c.re mode change 100755 => 100644 re2c/test/cond_error_06.c.c mode change 100755 => 100644 re2c/test/cond_error_06.c.re mode change 100755 => 100644 re2c/test/cond_error_07.c.c mode change 100755 => 100644 re2c/test/cond_error_07.c.re mode change 100755 => 100644 re2c/test/cond_error_08.c.c mode change 100755 => 100644 re2c/test/cond_error_08.c.re mode change 100755 => 100644 re2c/test/cond_error_09.c.c mode change 100755 => 100644 re2c/test/cond_error_09.c.re mode change 100755 => 100644 re2c/test/cond_error_10.c.c mode change 100755 => 100644 re2c/test/cond_error_10.c.re mode change 100755 => 100644 re2c/test/cond_error_11.c.c mode change 100755 => 100644 re2c/test/cond_error_11.c.re mode change 100755 => 100644 re2c/test/condition_01.c.c mode change 100755 => 100644 re2c/test/condition_01.c.re mode change 100755 => 100644 re2c/test/condition_01a.c.c mode change 100755 => 100644 re2c/test/condition_01a.c.re mode change 100755 => 100644 re2c/test/condition_01b.c.c mode change 100755 => 100644 re2c/test/condition_01b.c.re mode change 100755 => 100644 re2c/test/condition_02.c.c mode change 100755 => 100644 re2c/test/condition_02.c.re mode change 100755 => 100644 re2c/test/condition_02.cg.c mode change 100755 => 100644 re2c/test/condition_02.cg.re mode change 100755 => 100644 re2c/test/condition_03.cg.c mode change 100755 => 100644 re2c/test/condition_03.cg.re mode change 100755 => 100644 re2c/test/condition_04.cg.c mode change 100755 => 100644 re2c/test/condition_04.cg.re mode change 100755 => 100644 re2c/test/condition_05.cg.c mode change 100755 => 100644 re2c/test/condition_05.cg.re mode change 100755 => 100644 re2c/test/condition_05.cgitcondition_05.cgit.h.c mode change 100755 => 100644 re2c/test/condition_05.cgitcondition_05.cgit.h.h mode change 100755 => 100644 re2c/test/condition_05.cgitcondition_05.cgit.h.re mode change 100755 => 100644 re2c/test/condition_05.cgtcondition_05.cgt.h.c mode change 100755 => 100644 re2c/test/condition_05.cgtcondition_05.cgt.h.h mode change 100755 => 100644 re2c/test/condition_05.cgtcondition_05.cgt.h.re mode change 100755 => 100644 re2c/test/condition_05.cs.c mode change 100755 => 100644 re2c/test/condition_05.cs.re mode change 100755 => 100644 re2c/test/condition_06.cs.c mode change 100755 => 100644 re2c/test/condition_06.cs.re mode change 100755 => 100644 re2c/test/condition_07.cbi.c mode change 100755 => 100644 re2c/test/condition_07.cbi.re mode change 100755 => 100644 re2c/test/condition_08.cbi.re mode change 100755 => 100644 re2c/test/condition_08.cbif.re mode change 100755 => 100644 re2c/test/condition_09.cbif.re mode change 100755 => 100644 re2c/test/condition_09.cgif.c mode change 100755 => 100644 re2c/test/condition_09.cgif.re mode change 100755 => 100644 re2c/test/condition_10.cgif.c mode change 100755 => 100644 re2c/test/condition_10.cgif.re mode change 100755 => 100644 re2c/test/condition_11.cg.c mode change 100755 => 100644 re2c/test/condition_11.cg.re mode change 100755 => 100644 re2c/test/condition_12.cgif.c mode change 100755 => 100644 re2c/test/condition_12.cgif.re mode change 100755 => 100644 re2c/test/condition_13.cg.c mode change 100755 => 100644 re2c/test/condition_13.cg.re mode change 100755 => 100644 re2c/test/condition_14.cbif.re mode change 100755 => 100644 re2c/test/condition_14.cgif.c mode change 100755 => 100644 re2c/test/condition_14.cgif.re mode change 100755 => 100644 re2c/test/condition_14.cif.re mode change 100755 => 100644 re2c/test/condition_14.csif.re mode change 100755 => 100644 re2c/test/condition_15.csif.re mode change 100755 => 100644 re2c/test/config1.c mode change 100755 => 100644 re2c/test/config1.re mode change 100755 => 100644 re2c/test/config10.c mode change 100755 => 100644 re2c/test/config10.re mode change 100755 => 100644 re2c/test/config11.ei.c mode change 100755 => 100644 re2c/test/config11.ei.re mode change 100755 => 100644 re2c/test/config2.s.c mode change 100755 => 100644 re2c/test/config2.s.re mode change 100755 => 100644 re2c/test/config3.c mode change 100755 => 100644 re2c/test/config3.re mode change 100755 => 100644 re2c/test/config4a.f.c mode change 100755 => 100644 re2c/test/config4a.f.re mode change 100755 => 100644 re2c/test/config4b.f.c mode change 100755 => 100644 re2c/test/config4b.f.re mode change 100755 => 100644 re2c/test/config4c.f.c mode change 100755 => 100644 re2c/test/config4c.f.re mode change 100755 => 100644 re2c/test/config4d.f.c mode change 100755 => 100644 re2c/test/config4d.f.re mode change 100755 => 100644 re2c/test/config4e.f.c mode change 100755 => 100644 re2c/test/config4e.f.re mode change 100755 => 100644 re2c/test/config4f.f.c mode change 100755 => 100644 re2c/test/config4f.f.re mode change 100755 => 100644 re2c/test/config4g.ifs.c mode change 100755 => 100644 re2c/test/config4g.ifs.re mode change 100755 => 100644 re2c/test/config5.c mode change 100755 => 100644 re2c/test/config5.re mode change 100755 => 100644 re2c/test/config6.c mode change 100755 => 100644 re2c/test/config6.re mode change 100755 => 100644 re2c/test/config7a.g.c mode change 100755 => 100644 re2c/test/config7a.g.re mode change 100755 => 100644 re2c/test/config7b.g.c mode change 100755 => 100644 re2c/test/config7b.g.re mode change 100755 => 100644 re2c/test/config8.c mode change 100755 => 100644 re2c/test/config8.re mode change 100755 => 100644 re2c/test/config9.b.c mode change 100755 => 100644 re2c/test/config9.b.re mode change 100755 => 100644 re2c/test/ctx.b.c mode change 100755 => 100644 re2c/test/ctx.b.re mode change 100755 => 100644 re2c/test/ctx.c mode change 100755 => 100644 re2c/test/ctx.re mode change 100755 => 100644 re2c/test/ctx.s.c mode change 100755 => 100644 re2c/test/ctx.s.re mode change 100755 => 100644 re2c/test/cvsignore.b.re mode change 100755 => 100644 re2c/test/cvsignore.c mode change 100755 => 100644 re2c/test/cvsignore.re mode change 100755 => 100644 re2c/test/cvsignore.s.re mode change 100755 => 100644 re2c/test/cvsignore.u.re mode change 100755 => 100644 re2c/test/cvsignore.ub.re mode change 100755 => 100644 re2c/test/cvsignore.w.re mode change 100755 => 100644 re2c/test/cvsignore.wb.re mode change 100755 => 100644 re2c/test/error1.c mode change 100755 => 100644 re2c/test/error1.re mode change 100755 => 100644 re2c/test/error10.c mode change 100755 => 100644 re2c/test/error10.re mode change 100755 => 100644 re2c/test/error11.c mode change 100755 => 100644 re2c/test/error11.re mode change 100755 => 100644 re2c/test/error12.c mode change 100755 => 100644 re2c/test/error12.re mode change 100755 => 100644 re2c/test/error13.1.c mode change 100755 => 100644 re2c/test/error13.1.re mode change 100755 => 100644 re2c/test/error13.c mode change 100755 => 100644 re2c/test/error13.re mode change 100755 => 100644 re2c/test/error14.1.c mode change 100755 => 100644 re2c/test/error14.1.re mode change 100755 => 100644 re2c/test/error14.c mode change 100755 => 100644 re2c/test/error14.re mode change 100755 => 100644 re2c/test/error2.c mode change 100755 => 100644 re2c/test/error2.re mode change 100755 => 100644 re2c/test/error3.c mode change 100755 => 100644 re2c/test/error3.re mode change 100755 => 100644 re2c/test/error4.c mode change 100755 => 100644 re2c/test/error4.re mode change 100755 => 100644 re2c/test/error5.c mode change 100755 => 100644 re2c/test/error5.re mode change 100755 => 100644 re2c/test/error6.c mode change 100755 => 100644 re2c/test/error6.re mode change 100755 => 100644 re2c/test/error7.c mode change 100755 => 100644 re2c/test/error7.re mode change 100755 => 100644 re2c/test/error8.c mode change 100755 => 100644 re2c/test/error8.re mode change 100755 => 100644 re2c/test/error9.c mode change 100755 => 100644 re2c/test/error9.re mode change 100755 => 100644 re2c/test/flex-01.i.c mode change 100755 => 100644 re2c/test/flex-01.i.re mode change 100755 => 100644 re2c/test/flex-01.iF.c mode change 100755 => 100644 re2c/test/flex-01.iF.re mode change 100755 => 100644 re2c/test/input10.b.c mode change 100755 => 100644 re2c/test/input10.b.re mode change 100755 => 100644 re2c/test/input10.c mode change 100755 => 100644 re2c/test/input10.re mode change 100755 => 100644 re2c/test/input10.s.c mode change 100755 => 100644 re2c/test/input10.s.re mode change 100755 => 100644 re2c/test/input11.b.c mode change 100755 => 100644 re2c/test/input11.b.re mode change 100755 => 100644 re2c/test/input11.c mode change 100755 => 100644 re2c/test/input11.i.c mode change 100755 => 100644 re2c/test/input11.i.re mode change 100755 => 100644 re2c/test/input11.re mode change 100755 => 100644 re2c/test/input11.s.c mode change 100755 => 100644 re2c/test/input11.s.re mode change 100755 => 100644 re2c/test/input12.boinput12.c.c mode change 100755 => 100644 re2c/test/input12.boinput12.c.re mode change 100755 => 100644 re2c/test/input12.oinput12.c.c mode change 100755 => 100644 re2c/test/input12.oinput12.c.re mode change 100755 => 100644 re2c/test/input13.c mode change 100755 => 100644 re2c/test/input13.re mode change 100755 => 100644 re2c/test/input4.c mode change 100755 => 100644 re2c/test/input4.re mode change 100755 => 100644 re2c/test/input5.c mode change 100755 => 100644 re2c/test/input5.re mode change 100755 => 100644 re2c/test/input6.c mode change 100755 => 100644 re2c/test/input6.re mode change 100755 => 100644 re2c/test/input7.c mode change 100755 => 100644 re2c/test/input7.re mode change 100755 => 100644 re2c/test/input8.b.c mode change 100755 => 100644 re2c/test/input8.b.re mode change 100755 => 100644 re2c/test/input8.c mode change 100755 => 100644 re2c/test/input8.g.c mode change 100755 => 100644 re2c/test/input8.g.re mode change 100755 => 100644 re2c/test/input8.re mode change 100755 => 100644 re2c/test/input9.c mode change 100755 => 100644 re2c/test/input9.re mode change 100755 => 100644 re2c/test/line-01.c mode change 100755 => 100644 re2c/test/line-01.re rename re2c/{lessons/001_upn_calculator/windows => test}/main.b.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/main.b.re mode change 100755 => 100644 re2c/test/overflow-1.c mode change 100755 => 100644 re2c/test/overflow-1.re mode change 100755 => 100644 re2c/test/overflow-2.c mode change 100755 => 100644 re2c/test/overflow-2.re mode change 100755 => 100644 re2c/test/overflow-3.c mode change 100755 => 100644 re2c/test/overflow-3.re mode change 100755 => 100644 re2c/test/overflow-4.c mode change 100755 => 100644 re2c/test/overflow-4.re mode change 100755 => 100644 re2c/test/parse_date.b.re mode change 100755 => 100644 re2c/test/parse_date.c mode change 100755 => 100644 re2c/test/parse_date.db.re mode change 100755 => 100644 re2c/test/parse_date.g.c mode change 100755 => 100644 re2c/test/parse_date.g.re mode change 100755 => 100644 re2c/test/parse_date.re mode change 100755 => 100644 re2c/test/parse_date.s.re mode change 100755 => 100644 re2c/test/parse_date_1_78.db.re mode change 100755 => 100644 re2c/test/push.c mode change 100755 => 100644 re2c/test/push.f.c mode change 100755 => 100644 re2c/test/push.f.re mode change 100755 => 100644 re2c/test/push.fb.c mode change 100755 => 100644 re2c/test/push.fb.re mode change 100755 => 100644 re2c/test/push.fg.c mode change 100755 => 100644 re2c/test/push.fg.re mode change 100755 => 100644 re2c/test/push.fs.c mode change 100755 => 100644 re2c/test/push.fs.re mode change 100755 => 100644 re2c/test/push.re mode change 100755 => 100644 re2c/test/repeat-00.cgi.c mode change 100755 => 100644 re2c/test/repeat-00.cgi.re mode change 100755 => 100644 re2c/test/repeat-01.cgir.c mode change 100755 => 100644 re2c/test/repeat-01.cgir.re mode change 100755 => 100644 re2c/test/repeat-02.cgir.c mode change 100755 => 100644 re2c/test/repeat-02.cgir.re mode change 100755 => 100644 re2c/test/repeat-03.cgir.c mode change 100755 => 100644 re2c/test/repeat-03.cgir.re mode change 100755 => 100644 re2c/test/repeat-04.cgir.c mode change 100755 => 100644 re2c/test/repeat-04.cgir.re mode change 100755 => 100644 re2c/test/repeat-05.cgir.c mode change 100755 => 100644 re2c/test/repeat-05.cgir.re mode change 100755 => 100644 re2c/test/repeat-06.gir.c mode change 100755 => 100644 re2c/test/repeat-06.gir.re mode change 100755 => 100644 re2c/test/repeat-07.gir.c mode change 100755 => 100644 re2c/test/repeat-07.gir.re mode change 100755 => 100644 re2c/test/repeat-07_error.gir.re mode change 100755 => 100644 re2c/test/reuse_conds_default_0.cgir.re mode change 100755 => 100644 re2c/test/reuse_conds_default_1.cgir.re mode change 100755 => 100644 re2c/test/reuse_conds_setup_0.cgir.re mode change 100755 => 100644 re2c/test/reuse_conds_setup_1.cgir.re create mode 100644 re2c/test/rexx.c create mode 100644 re2c/test/rexx.re mode change 100755 => 100644 re2c/test/scanner.fs.c mode change 100755 => 100644 re2c/test/scanner.fs.re mode change 100755 => 100644 re2c/test/scanner.s.c mode change 100755 => 100644 re2c/test/scanner.s.re rename re2c/{lessons/002_strip_comments => test}/strip_001.s.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/strip_001.s.re rename re2c/{lessons/002_strip_comments => test}/strip_002.s.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/strip_002.s.re rename re2c/{lessons/002_strip_comments => test}/strip_003.b.c (100%) mode change 100755 => 100644 create mode 100644 re2c/test/strip_003.b.re mode change 100755 => 100644 re2c/test/yyaccept_missing.bci.c mode change 100755 => 100644 re2c/test/yyaccept_missing.bci.re diff --git a/add-release.txt b/add-release.txt old mode 100755 new mode 100644 diff --git a/re2c/.gitignore b/re2c/.gitignore index d6c5ade0..f570fad9 100644 --- a/re2c/.gitignore +++ b/re2c/.gitignore @@ -1,32 +1,9 @@ -*.o -re2c -re2c.1 -re2c.ad -re2c.spec -.deps -autom4te.cache +autom4te.cache/ +Makefile.in +aclocal.m4 configure install-sh -/README -aclocal.m4 -Makefile -Makefile.in config.h.in -config.status -config.log -config.sub -config.guess -config_w32.h -config.h depcomp -compile -makerpm missing -mkinstalldirs -stamp-h -stamp-h1 -stamp-h.in -parser.cc -scanner.cc -y.tab.h -run_tests.sh +test-driver diff --git a/re2c/Makefile.am b/re2c/Makefile.am old mode 100755 new mode 100644 index fa5facbe..bdbc23d5 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -1,110 +1,185 @@ # $Id$ +AM_CXXFLAGS = -W -Wall -Wextra -pedantic -Wredundant-decls -DPEDANTIC -O2 +AM_YFLAGS = -y -d --no-lines +RE2CFLAGS = -bi + bin_PROGRAMS = re2c -win_BINARIES = $(WINBUILDDIR)/re2c.exe -re2c_SOURCES = code.cc code_names.cc dfa.cc go_construct.cc go_destruct.cc go_emit.cc go_used_labels.cc \ - main.cc parser.cc actions.cc scanner.re substr.cc range.cc \ - translate.cc scanner.cc skeleton.cc mbo_getopt.cc print.cc input.cc input_api.cc output.cc \ - enc.cc utf8.cc utf8_range.cc utf8_regexp.cc utf16.cc utf16_range.cc utf16_regexp.cc range_suffix.cc \ - code.h code_names.h dfa.h go.h enc.h indent.h input.h input_api.h free_list.h globals.h ins.h \ - mbo_getopt.h parser.h print.h range.h range_suffix.h re.h \ - scanner.h skeleton.h smart_ptr.h substr.h token.h output.h \ - utf16.h utf16_range.h utf16_regexp.h utf8.h utf8_range.h utf8_regexp.h -BUILT_SOURCES = parser.cc scanner.cc - -#CXXFLAGS = -O2 -Wall -Wno-unused -Wno-parentheses -Wno-deprecated -#CXXFLAGS = -ggdb -fno-inline -O2 -Wall -Wextra -pedantic -Wconversion -Wpointer-arith -Wwrite-strings -Wredundant-decls -Werror -Wunused-function -DPEDANTIC -CXXFLAGS += -O2 -CXXFLAGS += -W -Wall -Wextra -pedantic -Wredundant-decls -DPEDANTIC -YFLAGS = -y -d --no-lines - -RE2C = re2c$(EXEEXT) -RE2CFLAGS = -bi - -CLEANFILES = parser.cc y.tab.c y.tab.h scanner.cc .version - -DISTCLEANFILES = makerpm re2c.spec README scanner.cc re2c$(EXEEXT) - -man_MANS = re2c.1 -DOCS = $(man_MANS) htdocs/manual.html - -EXTRA_SRC = README parser.y scanner.re y.tab.h CHANGELOG NO_WARRANTY \ - doc examples test bootstrap/*.cc bootstrap/*.h bootstrap/re2c.1 lessons \ - $(DOCS) -EXTRA_DIST = $(EXTRA_SRC) makerpm.in re2c.spec.in re2c.spec README.in config_w32.h.in -EXTRA_ZIP = $(EXTRA_SRC) config_w32.h re2c.rules - -dist-hook: re2c.spec - rm -rf `find $(distdir)/doc -name .git` - rm -rf `find $(distdir)/examples -name .git` - rm -rf `find $(distdir)/test -name .git -o -name .gitignore` - rm -rf `find $(distdir)/lessons -name .git -o -name .gitignore` - -rpm-files: $(bin_PROGRAMS) $(EXTRA_DIST) - -rpm: dist - cp -f re2c-$(PACKAGE_VERSION).tar.gz `rpm --eval "%{_sourcedir}"` - cp -f re2c.spec `rpm --eval "%{_specdir}"` - rpmbuild -ba re2c.spec - -src-rpm: dist - cp -f re2c-$(PACKAGE_VERSION).tar.gz `rpm --eval "%{_sourcedir}"` - cp -f re2c.spec `rpm --eval "%{_specdir}"` - rpmbuild -bs re2c.spec - cp -f `rpm --eval "%{_srcrpmdir}"`/re2c-$(PACKAGE_VERSION)-$(PACKAGE_RELEASE).src.rpm . - -zip: $(bin_PROGRAMS) $(EXTRA_ZIP) - if test -f re2c-$(PACKAGE_VERSION)-src.zip; then rm -f re2c-$(PACKAGE_VERSION)-src.zip; fi - zip -q -o -9 -r re2c-$(PACKAGE_VERSION)-src.zip $(re2c_SOURCES) $(EXTRA_ZIP) - zipinfo -1 re2c-$(PACKAGE_VERSION)-src.zip | grep .git | xargs zip -d re2c-$(PACKAGE_VERSION)-src.zip >/dev/null - if test -f re2c-$(PACKAGE_VERSION)-bin.zip; then rm -f re2c-$(PACKAGE_VERSION)-bin.zip; fi - if test -f $(WINBUILDDIR)/re2c.exe; then \ - zip -q -o -9 -j re2c-$(PACKAGE_VERSION)-bin.zip $(win_BINARIES); \ - fi; - -release: dist zip src-rpm - -parser.cc: $(top_srcdir)/parser.y - @if test $(BISON) = "yes"; then \ - bison $(YFLAGS) --output=$(top_srcdir)/parser.cc --defines=$(top_srcdir)/y.tab.h $(top_srcdir)/parser.y && \ - cp -f $(top_srcdir)/parser.cc $(top_srcdir)/bootstrap/parser.cc; \ - cp -f $(top_srcdir)/y.tab.h $(top_srcdir)/bootstrap/y.tab.h; \ +RE2C = $(builddir)/re2c$(EXEEXT) + +# scanner +SRC_SCANNER = $(srcdir)/src/scanner.re +AUTOGEN_SCANNER = $(builddir)/scanner.cc +BOOTSTRAP_SCANNER = $(srcdir)/bootstrap/scanner.cc + +# parser +SRC_PARSER = $(srcdir)/src/parser.ypp +AUTOGEN_PARSER = $(builddir)/parser.cc +AUTOGEN_PARSER_HDR = $(builddir)/y.tab.h +BOOTSTRAP_PARSER = $(srcdir)/bootstrap/parser.cc +BOOTSTRAP_PARSER_HDR = $(srcdir)/bootstrap/y.tab.h + +# docs +DOC_MAN = $(builddir)/doc/re2c.1 +DOC_HTML = $(builddir)/doc/manual.html +SRC_DOC = $(builddir)/doc/re2c.ad +BOOTSTRAP_DOC_MAN = $(srcdir)/bootstrap/re2c.1 +BOOTSTRAP_DOC_HTML = $(srcdir)/bootstrap/manual.html + +SRC_HDR = \ + $(srcdir)/src/c99_stdint.h \ + $(srcdir)/src/code.h \ + $(srcdir)/src/code_names.h \ + $(srcdir)/src/dfa.h \ + $(srcdir)/src/enc.h \ + $(srcdir)/src/globals.h \ + $(srcdir)/src/go.h \ + $(srcdir)/src/indent.h \ + $(srcdir)/src/input.h \ + $(srcdir)/src/input_api.h \ + $(srcdir)/src/ins.h \ + $(srcdir)/src/free_list.h \ + $(srcdir)/src/mbo_getopt.h \ + $(srcdir)/src/output.h \ + $(srcdir)/src/parser.h \ + $(srcdir)/src/print.h \ + $(srcdir)/src/range.h \ + $(srcdir)/src/range_suffix.h \ + $(srcdir)/src/re.h \ + $(srcdir)/src/scanner.h \ + $(srcdir)/src/skeleton.h \ + $(srcdir)/src/smart_ptr.h \ + $(srcdir)/src/substr.h \ + $(srcdir)/src/token.h \ + $(srcdir)/src/utf16.h \ + $(srcdir)/src/utf16_range.h \ + $(srcdir)/src/utf16_regexp.h \ + $(srcdir)/src/utf8.h \ + $(srcdir)/src/utf8_range.h \ + $(srcdir)/src/utf8_regexp.h + +SRC = \ + $(SRC_SCANNER) \ + $(srcdir)/src/actions.cc \ + $(srcdir)/src/code.cc \ + $(srcdir)/src/code_names.cc \ + $(srcdir)/src/dfa.cc \ + $(srcdir)/src/enc.cc \ + $(srcdir)/src/go_construct.cc \ + $(srcdir)/src/go_destruct.cc \ + $(srcdir)/src/go_emit.cc \ + $(srcdir)/src/go_used_labels.cc \ + $(srcdir)/src/input.cc \ + $(srcdir)/src/input_api.cc \ + $(srcdir)/src/main.cc \ + $(srcdir)/src/mbo_getopt.cc \ + $(srcdir)/src/output.cc \ + $(srcdir)/src/print.cc \ + $(srcdir)/src/range.cc \ + $(srcdir)/src/range_suffix.cc \ + $(srcdir)/src/skeleton.cc \ + $(srcdir)/src/substr.cc \ + $(srcdir)/src/translate.cc \ + $(srcdir)/src/utf8.cc \ + $(srcdir)/src/utf8_range.cc \ + $(srcdir)/src/utf8_regexp.cc \ + $(srcdir)/src/utf16.cc \ + $(srcdir)/src/utf16_range.cc \ + $(srcdir)/src/utf16_regexp.cc +# omit SRC_PARSER here; include it in EXTRA_DIST instead +# (automake generates standard build rules for all YACC-ish +# sources, they will conflict with our custom build rule). + +AUTOGEN = \ + $(AUTOGEN_PARSER) \ + $(AUTOGEN_PARSER_HDR) \ + $(AUTOGEN_SCANNER) + +BOOTSTRAP = \ + $(BOOTSTRAP_DOC_HTML) \ + $(BOOTSTRAP_DOC_MAN) \ + $(BOOTSTRAP_PARSER) \ + $(BOOTSTRAP_PARSER_HDR) \ + $(BOOTSTRAP_SCANNER) + +re2c_SOURCES = \ + $(SRC_HDR) \ + $(SRC) +nodist_re2c_SOURCES = $(AUTOGEN) + +EXTRA_DIST = \ + $(BOOTSTRAP) \ + $(SRC_PARSER) \ + $(srcdir)/CHANGELOG \ + $(srcdir)/NO_WARRANTY \ + $(srcdir)/README \ + $(srcdir)/autogen.sh \ + $(srcdir)/doc/index.html \ + $(srcdir)/doc/loplas.ps \ + $(srcdir)/doc/sample.bib \ + $(srcdir)/examples \ + $(srcdir)/test + +CLEANFILES = \ + $(AUTOGEN) \ + $(DOC_HTML) \ + $(DOC_MAN) + +TESTS = $(builddir)/run_tests.sh + +man_MANS = $(DOC_MAN) + +$(AUTOGEN_PARSER): $(SRC_PARSER) + @if test $(BISON) = "yes"; \ + then \ + bison $(YFLAGS) --output=$(AUTOGEN_PARSER) --defines=$(AUTOGEN_PARSER_HDR) $(SRC_PARSER) && \ + cp $(AUTOGEN_PARSER) $(BOOTSTRAP_PARSER) && \ + cp $(AUTOGEN_PARSER_HDR) $(BOOTSTRAP_PARSER_HDR); \ else \ - cp -f $(top_srcdir)/bootstrap/parser.cc $(top_srcdir)/parser.cc; \ - cp -f $(top_srcdir)/bootstrap/y.tab.h $(top_srcdir)/y.tab.h; \ + cp $(BOOTSTRAP_PARSER) $(AUTOGEN_PARSER) && \ + cp $(BOOTSTRAP_PARSER_HDR) $(AUTOGEN_PARSER_HDR); \ fi -scanner.cc: $(top_srcdir)/scanner.re - @if test -x ./re2c$(EXEEXT); then \ - echo "re2c $(RE2CFLAGS) -o $@ $(top_srcdir)/scanner.re"; \ - ./re2c $(RE2CFLAGS) -o $@ $(top_srcdir)/scanner.re && cp $@ $(top_srcdir)/bootstrap/; \ +$(AUTOGEN_SCANNER): $(SRC_SCANNER) + @if test -x $(RE2C); \ + then \ + $(RE2C) $(RE2CFLAGS) -o $(AUTOGEN_SCANNER) $(SRC_SCANNER) && \ + cp $(AUTOGEN_SCANNER) $(BOOTSTRAP_SCANNER); \ else \ - echo "cp -f $(top_srcdir)/bootstrap/$@ $@"; \ - cp -f $(top_srcdir)/bootstrap/$@ $@; \ + cp $(BOOTSTRAP_SCANNER) $(AUTOGEN_SCANNER); \ fi -.version: - echo $(PACKAGE_VERSION) > .version - -TESTS = run_tests.sh +# rebuild lexer (just in case it was bootstrapped) and rebuild re2c +.PHONY: bootstrap +bootstrap: all + rm $(AUTOGEN_SCANNER) + $(RE2C) $(RE2CFLAGS) -o $(AUTOGEN_SCANNER) $(SRC_SCANNER) + cp $(AUTOGEN_SCANNER) $(BOOTSTRAP_SCANNER) + make all +.PHONY: tests tests: all $(TESTS) - test -x $(TESTS) || chmod +x $(TESTS) ./$(TESTS) - +.PHONY: vtests vtests: all $(TESTS) - test -x $(TESTS) || chmod +x $(TESTS) ./$(TESTS) --valgrind +.PHONY: docs if REBUILD_DOCS -docs: $(DOCS) -$(DOCS): re2c.ad - a2x -f manpage re2c.ad - mkdir -p htdocs - asciidoc -o htdocs/manual.html re2c.ad +docs: $(DOC_MAN) $(DOC_HTML) +$(DOC_MAN): $(SRC_DOC) + a2x -f manpage $(SRC_DOC) + cp $(DOC_MAN) $(BOOTSTRAP_DOC_MAN) +$(DOC_HTML): $(SRC_DOC) + asciidoc -o $(DOC_HTML) $(SRC_DOC) + cp $(DOC_HTML) $(BOOTSTRAP_DOC_HTML) else -docs: $(DOCS) -$(DOCS): $(top_srcdir)/bootstrap/re2c.1 +docs: $(DOC_MAN) $(DOC_HTML) @echo "Reconfigure to rebuild docs: ./configure --enable-docs" - cp $(top_srcdir)/bootstrap/re2c.1 $(top_srcdir)/re2c.1 +$(DOC_MAN): $(BOOTSTRAP_DOC_MAN) + cp $(BOOTSTRAP_DOC_MAN) $(DOC_MAN) +$(DOC_HTML): $(BOOTSTRAP_DOC_HTML) + cp $(BOOTSTRAP_DOC_HTML) $(DOC_HTML) endif + +all-local: docs diff --git a/re2c/README b/re2c/README new file mode 100644 index 00000000..be2a0db0 --- /dev/null +++ b/re2c/README @@ -0,0 +1,144 @@ +re2c +-------------------------------------------------------------------------------- + + +DESCRIPTION +-------------------------------------------------------------------------------- +re2c is a tool for generating C-based recognizers from regular expressions. +re2c-based scanners are efficient: for programming languages, given similar +specifications, a re2c-based scanner is typically almost twice as fast as a +flex-based scanner with little or no increase in size (possibly a decrease +on cisc architectures). Indeed, re2c-based scanners are quite competitive with +hand-crafted ones. + +Unlike flex, re2c does not generate complete scanners: the user must supply some +interface code. While this code is not bulky (about 50-100 lines for a +flex-like scanner; see the man page and examples in the distribution) careful +coding is required for efficiency (and correctness). One advantage of this +arrangement is that the generated code is not tied to any particular input +model. +-------------------------------------------------------------------------------- + + +DOWNLOAD +-------------------------------------------------------------------------------- +The re2c distribution can be found at: + https://sourceforge.net/projects/re2c/ + +Download the latest tarball: + https://sourceforge.net/projects/re2c/files/latest/download + +Clone git repo: + git clone git://git.code.sf.net/p/re2c/code-git +-------------------------------------------------------------------------------- + + +BUILD +-------------------------------------------------------------------------------- +Simplest possible build: + $ ./configure [--prefix=] + $ make + $ make install +This will build re2c and install it (binary and man page) to (defaults +to /usr/local). + +Bootstrap and rebuild: + $ ./configure [--prefix=] + $ make bootstrap + $ make install +Usual bootstrap procedure: re2c uses re2c to compile its lexer. +1. build lexer (if make finds re2c binary in build directory, it will build lexer + from source, otherwize it will use prebuilt lexer 'bootstrap/scanner.cc') +2. build re2c +3. build lexer from source using re2c binary in build directory +4. rebuild re2c + +Out-of-source build: + $ mkdir + $ cd + $ /configure [--prefix=] + $ make + $ make install + +Testing: + $ make check +This will redirect test script output to file. If you want to see progress: + $ make tests +Testing under valgrind (takes a long time): + $ make vtests + +Rebuild documentation (requires asciidoc and a2x): + $ ./configure --enable-docs [--prefix=] + $ make docs + $ make install + +If you want to build from git, you'll first need to generate autotools files: + $ ./autogen.sh +-------------------------------------------------------------------------------- + + +INFO +-------------------------------------------------------------------------------- + $ man re2c + +re2c home page: + re2c.org + +re2c manual: + re2c.org/manual.html + +Ulya Trofimovich's blog on re2c: + skvadrik.github.io/aleph_null/re2c.html + +Original paper on re2c: "RE2C: a More Versatile Parser Generator" (1994, Peter +Bumbulis and Donald D. Cowan). + +Examples can be found in 'examples' directory. +-------------------------------------------------------------------------------- + + +MAILING LISTS +-------------------------------------------------------------------------------- +re2c-general: + re2c-general@lists.sourceforge.net +re2c-devel: + re2c-devel@lists.sourceforge.net + +You are welcome to ask for help or share your thoughts and ideas about re2c :) +-------------------------------------------------------------------------------- + + +BUGS +-------------------------------------------------------------------------------- +Please report any bugs and send feature requests to: + https://sourceforge.net/p/re2c/_list/tickets +-------------------------------------------------------------------------------- + + +AUTHORS +-------------------------------------------------------------------------------- +Originally written by Peter Bumbulis (peter@csg.uwaterloo.ca) +Currently maintained by: + Ulya Trofimovich + Dan Nuffer + Marcus Boerger + Hartmut Kaiser +-------------------------------------------------------------------------------- + + +LICENSE +-------------------------------------------------------------------------------- +re2c is distributed with no warranty whatever. The code is certain to contain +errors. Neither the author nor any contributor takes responsibility for any +consequences of its use. + +re2c is in the public domain. The data structures and algorithms used in re2c +are all either taken from documents available to the general public or are +inventions of the authors. Programs generated by re2c may be distributed freely. +re2c itself may be distributed freely, in source or binary, unchanged or +modified. Distributors may charge whatever fees they can obtain for re2c. + +If you do make use of re2c, or incorporate it into a larger project an +acknowledgement somewhere (documentation, research report, etc.) would be +appreciated. +-------------------------------------------------------------------------------- diff --git a/re2c/README.in b/re2c/README.in deleted file mode 100644 index 386e747f..00000000 --- a/re2c/README.in +++ /dev/null @@ -1,204 +0,0 @@ -re2c Version @PACKAGE_VERSION@ ------------------- - -Originally written by Peter Bumbulis (peter@csg.uwaterloo.ca) - -Currently maintained by: - Dan Nuffer - Marcus Boerger - Hartmut Kaiser - -The re2c distribution can be found at: - - http://sourceforge.net/projects/re2c/ - -re2c has been developed and tested with the following compilers on various -platforms in 32 bit and 64 bit mode: -- GCC 3.3 ... 4.1 -- Microsoft VC 7, 7.1, 8 -- Intel 9.0 -- Sun C++ 5.8 (CXXFLAGS='-library=stlport4') -- MIPSpro Compilers: Version 7.4.4m - -GCC 2.x and Microsoft VC 6 are not capable of compiling re2c. - -Building re2c on unix like platforms requires autoconf 2.57 and bison (tested -with 1.875 and later). Under windows you don't need autoconf or bison -and can use the pregenerated files. - -You can build this software by simply typing the following commands: - ./configure - make - -The above version will be based on the pregenerated scanner.cc file. -If you want to build that file yourself (recommended when installing -re2c) you need the following steps: - ./configure - make - rm -f scanner.cc - make install - -Or you can create a rpm package and install it by the following commands: - ./configure - make rpm - rpm -Uhv /re2c-@PACKAGE_VERSION@-@PACKAGE_RELEASE@.rpm - -If you want to build from CVS then the first thing you should do is -regenerating all build files using the following command: - ./autogen.sh -and then continue with one of the above described build methods. Or if you -need to generate RPM packages for cvs builds use these commands: - ./autogen.sh - ./configure - ./makerpm - rpm -Uhv /re2c-@PACKAGE_VERSION@-.rpm - -Here should be a number like 1. And must equal -the directory where the makerpm step has written the generated rpm to. - -If you are on a debian system you can use the tool 'alien' to convert rpms -to debian packages. - -When building with native SUN compilers you need to set the following compiler -flags: CXXFLAGS='-g -compat5 -library=stlport4'. - -If you want to build re2c on a windows system you can either use cygwin and one -of the methods described above or use Microsoft Visual C .NET 2002 or later -with the solution files provided (re2c.sln for 2002/2003 and re2c-2005.sln for -version 2005). re2c cannot be built with Microsoft Visual C 6.0 or earlier. - -Using Visual Studio 2005 you can automate handling of .re files by adding the -custom build rules file (re2c.rules) to your project. Just load your Visual -C++ project in Visual Studio, select "Custom Build Rules..." from its context -menu, and add re2c.rules to the list with the "Find Existing..." button. -Activate the check mark, and you are done! Any .re files you add to the project -will now automatically be built with re2c. Of course, re2c.exe also has to be -available in your environment for this to work. With the rules active Visual -Studio will automatically recognize .re files and compile then with re2c. The -output file has the same name as the input file but with the .cpp extension. -This, and all other re2c compiler settings, are fully configurable from within -the Visual Studio IDE. Just right-click on the .re file in Visual Studio, go -to the properties dialog, and pick your options. - -To build documentation you'll need 'asciidoc': - make docs - -re2c is a great tool for writing fast and flexible lexers. It has -served many people well for many years. re2c is on the order of 2-3 -times faster than a flex based scanner, and its input model is much -more flexible. - -For an introduction to re2c refer to the lessons sub directory. - -Peter's original version 0.5 ANNOUNCE and README follows. - --- - -re2c is a tool for generating C-based recognizers from regular -expressions. re2c-based scanners are efficient: for programming -languages, given similar specifications, an re2c-based scanner is -typically almost twice as fast as a flex-based scanner with little or no -increase in size (possibly a decrease on cisc architectures). Indeed, -re2c-based scanners are quite competitive with hand-crafted ones. - -Unlike flex, re2c does not generate complete scanners: the user must -supply some interface code. While this code is not bulky (about 50-100 -lines for a flex-like scanner; see the man page and examples in the -distribution) careful coding is required for efficiency (and -correctness). One advantage of this arrangement is that the generated -code is not tied to any particular input model. For example, re2c -generated code can be used to scan data from a null-byte terminated -buffer as illustrated below. - -Given the following source - - #define NULL ((char*) 0) - char *scan(char *p) - { - #define YYCTYPE char - #define YYCURSOR p - #define YYLIMIT p - #define YYFILL(n) - /*!re2c - [0-9]+ {return YYCURSOR;} - [\000-\377] {return NULL;} - */ - } - -re2c will generate - - /* Generated by re2c on Sat Apr 16 11:40:58 1994 */ - #line 1 "simple.re" - #define NULL ((char*) 0) - char *scan(char *p) - { - #define YYCTYPE char - #define YYCURSOR p - #define YYLIMIT p - #define YYFILL(n) - { - YYCTYPE yych; - unsigned int yyaccept; - - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - if(yych <= '/') goto yy4; - if(yych >= ':') goto yy4; - yy2: yych = *++YYCURSOR; - goto yy7; - yy3: - #line 9 - {return YYCURSOR;} - yy4: yych = *++YYCURSOR; - yy5: - #line 10 - {return NULL;} - yy6: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - yy7: if(yych <= '/') goto yy3; - if(yych <= '9') goto yy6; - goto yy3; - } - #line 11 - - } - -Note that most compilers will perform dead-code elimination to remove -all YYCURSOR, YYLIMIT comparisions. - -re2c was developed for a particular project (constructing a fast REXX -scanner of all things!) and so while it has some rough edges, it should -be quite usable. More information about re2c can be found in the -(admittedly skimpy) man page; the algorithms and heuristics used are -described in an upcoming LOPLAS article (included in the distribution). -Probably the best way to find out more about re2c is to try the supplied -examples. re2c is written in C++, and is currently being developed -under Linux using gcc 2.5.8. - -Peter - --- - -re2c is distributed with no warranty whatever. The code is certain to -contain errors. Neither the author nor any contributor takes -responsibility for any consequences of its use. - -re2c is in the public domain. The data structures and algorithms used -in re2c are all either taken from documents available to the general -public or are inventions of the author. Programs generated by re2c may -be distributed freely. re2c itself may be distributed freely, in source -or binary, unchanged or modified. Distributors may charge whatever fees -they can obtain for re2c. - -If you do make use of re2c, or incorporate it into a larger project an -acknowledgement somewhere (documentation, research report, etc.) would -be appreciated. - -Please send bug reports and feedback (including suggestions for -improving the distribution) to - - peter@csg.uwaterloo.ca - -Include a small example and the banner from parser.y with bug reports. - diff --git a/re2c/autogen.sh b/re2c/autogen.sh index 120a2561..7211d3f1 100755 --- a/re2c/autogen.sh +++ b/re2c/autogen.sh @@ -1,6 +1,8 @@ #!/bin/sh + git clean -fXd -aclocal -autoheader -automake -a -c --foreign -autoconf + +aclocal -W all +autoheader -W all +automake -W all -a -c --foreign +autoconf -W all diff --git a/re2c/bootstrap/manual.html b/re2c/bootstrap/manual.html new file mode 100644 index 00000000..9e576758 --- /dev/null +++ b/re2c/bootstrap/manual.html @@ -0,0 +1,2296 @@ + + + + + +RE2C (1) + + + + + +
+
+

SYNOPSIS

+
+

re2c [OPTIONS] FILE

+
+
+
+

DESCRIPTION

+
+

re2c is a lexer generator for C/C++. +It finds regular expression specifications inside of C/C++ comments and replaces them with a hard-coded DFA. +The user must supply some interface code in order to control and customize the generated DFA.

+
+
+
+

EXAMPLE

+
+

Given the following code:

+
+
+
unsigned int stou (const char * s)
+{
+#   define YYCTYPE char
+    const YYCTYPE * YYCURSOR = s;
+    unsigned int result = 0;
+
+    for (;;)
+    {
+        /*!re2c
+            re2c:yyfill:enable = 0;
+
+            "\x00" { return result; }
+            [0-9]  { result = result * 10 + c; continue; }
+        */
+    }
+}
+

re2c -is will generate:

+
+
+
/* Generated by re2c 0.13.7.dev on Mon Jul 14 13:37:46 2014 */
+unsigned int stou (const char * s)
+{
+#   define YYCTYPE char
+    const YYCTYPE * YYCURSOR = s;
+    unsigned int result = 0;
+
+    for (;;)
+    {
+
+{
+        YYCTYPE yych;
+
+        yych = *YYCURSOR;
+        if (yych <= 0x00) goto yy3;
+        if (yych <= '/') goto yy2;
+        if (yych <= '9') goto yy5;
+yy2:
+yy3:
+        ++YYCURSOR;
+        { return result; }
+yy5:
+        ++YYCURSOR;
+        { result = result * 10 + c; continue; }
+}
+
+    }
+}
+
+
+
+

OPTIONS

+
+
+
+-?, -h +
+
+

+ Invoke a short help. +

+
+
+-b +
+
+

+ Implies -s. Use bit vectors as well in the attempt to coax better + code out of the compiler. Most useful for specifications with more than a + few keywords (e.g. for most programming languages). +

+
+
+-c +
+
+

+ Used to support (f)lex-like condition support. +

+
+
+-d +
+
+

+ Creates a parser that dumps information about the current position and in + which state the parser is while parsing the input. This is useful to debug + parser issues and states. If you use this switch you need to define a macro + YYDEBUG that is called like a function with two parameters: + void YYDEBUG (int state, char current). The first parameter receives the + state or -1 and the second parameter receives the input at the current cursor. +

+
+
+-D +
+
+

+ Emit Graphviz dot data. It can then be processed with e.g. + dot -Tpng input.dot > output.png. Please note that scanners with many states + may crash dot. +

+
+
+-e +
+
+

+ Generate a parser that supports EBCDIC. The generated code can deal with any + character up to 0xFF. In this mode re2c assumes that input character size is + 1 byte. This switch is incompatible with -w, -x, -u and -8. +

+
+
+-f +
+
+

+ Generate a scanner with support for storable state. + For details see below at SCANNER WITH STORABLE STATES. +

+
+
+-F +
+
+

+ Partial support for flex syntax. When this flag is active then named + definitions must be surrounded by curly braces and can be defined without an + equal sign and the terminating semi colon. Instead names are treated as direct + double quoted strings. +

+
+
+-g +
+
+

+ Generate a scanner that utilizes GCC’s computed goto feature. That is re2c + generates jump tables whenever a decision is of a certain complexity (e.g. a + lot of if conditions are otherwise necessary). This is only useable with GCC + and produces output that cannot be compiled with any other compiler. Note that + this implies -b and that the complexity threshold can be configured using the + inplace configuration cgoto:threshold. +

+
+
+-i +
+
+

+ Do not output #line information. This is usefull when you want use a CMS tool + with the re2c output which you might want if you do not require your users to + have re2c themselves when building from your source. +

+
+
+-o OUTPUT +
+
+

+ Specify the output file. +

+
+
+-r +
+
+

+ Allows reuse of scanner definitions with /*!use:re2c after + /*!rules:re2c. In this mode no /*!re2c block and exactly one + /*!rules:re2c must be present. The rules are being saved and used by + every /*!use:re2c block that follows. These blocks can contain + inplace configurations, especially re2c:flags:e, re2c:flags:w, + re2c:flags:x, re2c:flags:u and re2c:flags:8. + That way it is possible to create the same scanner multiple times for different + character types, different input mechanisms or different output mechanisms. + The /*!use:re2c blocks can also contain additional rules that will be + appended to the set of rules in /*!rules:re2c. +

+
+
+-s +
+
+

+ Generate nested ifs for some switches. Many compilers need this + assist to generate better code. +

+
+
+-t +
+
+

+ Create a header file that contains types for the (f)lex-like condition support. + This can only be activated when -c is in use. +

+
+
+-u +
+
+

+ Generate a parser that supports UTF-32. The generated code can deal with any + valid Unicode character up to 0x10FFFF. In this mode re2c assumes that input + character size is 4 bytes. This switch is incompatible with -e, -w, -x + and -8. This implies -s. +

+
+
+-v +
+
+

+ Show version information. +

+
+
+-V +
+
+

+ Show the version as a number XXYYZZ. +

+
+
+-w +
+
+

+ Generate a parser that supports UCS-2. The generated code can deal with any + valid Unicode character up to 0xFFFF. In this mode re2c assumes that input + character size is 2 bytes. This switch is incompatible with -e, -x, -u + and -8. This implies -s. +

+
+
+-x +
+
+

+ Generate a parser that supports UTF-16. The generated code can deal with any + valid Unicode character up to 0x10FFFF. In this mode re2c assumes that input + character size is 2 bytes. This switch is incompatible with -e, -w, -u + and -8. This implies -s. +

+
+
+-1 +
+
+

+ Force single pass generation, this cannot be combined with -f and disables + YYMAXFILL generation prior to last re2c block. +

+
+
+-8 +
+
+

+ Generate a parser that supports UTF-8. The generated code can deal with any + valid Unicode character up to 0x10FFFF. In this mode re2c assumes that input + character size is 1 byte. This switch is incompatible with -e, -w, -x + and -u. +

+
+
+--case-insensitive +
+
+

+ All strings are case insensitive, so all "-expressions are treated + in the same way '-expressions are. +

+
+
+--case-inverted +
+
+

+ Invert the meaning of single and double quoted strings. + With this switch single quotes are case sensitive and + double quotes are case insensitive. +

+
+
+--no-generation-date +
+
+

+ Suppress date output in the generated output so that it only shows the re2c + version. +

+
+
+--encoding-policy POLICY +
+
+

+ Specify how re2c must treat Unicode surrogates. POLICY can be one of the following: + fail (abort with error when surrogate encountered), + substitute (silently substitute surrogate with error code point 0xFFFD), + ignore (treat surrogates as normal code points). + By default re2c ignores surrogates (for backward compatibility). + Unicode standard says that standalone surrogates are invalid code points, + but different libraries and programs treat them differently. +

+
+
+
+
+
+

INTERFACE CODE

+
+

The user must supply interface code either in the form of C/C++ code +(macros, functions, variables, etc.) or in the form of inplace configurations. +Which symbols must be defined and which are optional depends on a particular use case.

+
+
+YYCONDTYPE +
+
+

+ In -c mode you can use -t to generate a file that contains the + enumeration used as conditions. Each of the values refers to a condition of + a rule set. +

+
+
+YYCTXMARKER +
+
+

+ l-value of type * YYCTYPE. + The generated code saves trailing context backtracking information in YYCTXMARKER. + The user only needs to define this macro if a scanner specification uses trailing + context in one or more of its regular expressions. +

+
+
+YYCTYPE +
+
+

+ Type used to hold an input symbol (code unit). + Usually char or unsigned char for ASCII, EBCDIC and UTF-8, unsigned short for UTF-16 or UCS-2 and unsigned int for UTF-32. +

+
+
+YYCURSOR +
+
+

+ l-value of type * YYCTYPE that points to the current input symbol. + The generated code advances YYCURSOR as symbols are matched. + On entry, YYCURSOR is assumed to point to the first character of the + current token. On exit, YYCURSOR will point to the first character of + the following token. +

+
+
+YYDEBUG (state, current) +
+
+

+ This is only needed if the -d flag was specified. It allows to easily debug + the generated parser by calling a user defined function for every state. The function + should have the following signature: void YYDEBUG (int state, char current). + The first parameter receives the state or -1 and the second parameter receives the + input at the current cursor. +

+
+
+YYFILL (n) +
+
+

+ The generated code “calls” YYFILL (n) when the buffer needs + (re)filling: at least n additional characters should + be provided. YYFILL (n) should adjust YYCURSOR, YYLIMIT, + YYMARKER and YYCTXMARKER as needed. Note that for typical + programming languages n will be the length of the longest keyword plus one. + The user can place a comment of the form /*!max:re2c*/ once to insert + a YYMAXFILL (n) definition that is set to the maximum length value. If -1 + switch is used then YYMAXFILL can be triggered only once after the + last /*!re2c ... */ block. +

+
+
+YYGETCONDITION () +
+
+

+ This define is used to get the condition prior to entering the scanner code + when using -c switch. The value must be initialized with a value from + the enumeration YYCONDTYPE type. +

+
+
+YYGETSTATE () +
+
+

+ The user only needs to define this macro if the -f flag was specified. + In that case, the generated code “calls” YYGETSTATE () at the very beginning + of the scanner in order to obtain the saved state. YYGETSTATE () must return a signed + integer. The value must be either -1, indicating that the scanner is entered for the + first time, or a value previously saved by YYSETSTATE (s). In the second case, the + scanner will resume operations right after where the last YYFILL (n) was called. +

+
+
+YYLIMIT +
+
+

+ Expression of type * YYCTYPE that marks the end of the buffer + (YYLIMIT[-1] is the last character in the buffer). + The generated code repeatedly compares YYCURSOR to YYLIMIT + to determine when the buffer needs (re)filling. +

+
+
+YYMARKER +
+
+

+ l-value of type * YYCTYPE. + The generated code saves backtracking information in YYMARKER. Some easy + scanners might not use this. +

+
+
+YYMAXFILL +
+
+

+ This will be automatically defined by /*!max:re2c*/ blocks as explained above. +

+
+
+YYSETCONDITION (c) +
+
+

+ This define is used to set the condition in transition rules. This is only + being used when -c is active and transition rules are being used. +

+
+
+YYSETSTATE (s) +
+
+

+ The user only needs to define this macro if the -f flag was specified. + In that case, the generated code “calls” YYSETSTATE just before calling + YYFILL (n). The parameter to YYSETSTATE is a signed integer that uniquely + identifies the specific instance of YYFILL (n) that is about to be called. + Should the user wish to save the state of the scanner and have YYFILL (n) return + to the caller, all he has to do is store that unique identifer in a variable. + Later, when the scannered is called again, it will call YYGETSTATE () and + resume execution right where it left off. The generated code will contain + both YYSETSTATE (s) and YYGETSTATE even if YYFILL (n) is being disabled. +

+
+
+
+
+
+

SYNTAX

+
+

Code for re2c consists of a set of rules, named definitions and inplace configurations.

+

rules consist of a regular-expressions along with a block of C/C++ code that +is to be executed when the associated regular-expression is matched. You can either +start the code with an opening curly brace or the sequence :=. When +the code with a curly brace then re2c counts the brace depth and stops looking +for code automatically. Otherwise curly braces are not allowed and re2c stops +looking for code at the first line that does not begin with whitespace. If two +or more rules overlap, the first rule is preferred.

+
+
+

regular-expression { C/C++ code }

+

regular-expression := C/C++ code

+
+

There is one special rule: default rule *:

+
+
+

* { C/C++ code }

+

* := C/C++ code

+
+
+ + + +
+
Note
+
+

[^] differs from *: +* has the lowest priority, matches any code unit (either valid or invalid) and always consumes one character; +[^] matches any valid code point (not code unit) and can consume multiple characters. +In fact, when variable-length encoding is used, * is the only possible way to match invalid input character.

+
+
+

If -c is active then each regular-expression is preceeded by a list of +comma separated condition names. Besides normal naming rules there are two +special cases. A rule may contain the single condition name * and no contition +name at all. In the latter case the rule cannot have a regular-expression. Non +empty rules may further more specify the new condition. In that case re2c will +generated the necessary code to change the condition automatically. Just as above +code can be started with a curly brace of the sequence :=. Further more +rules can use :=> as a shortcut to automatically generate code that not only +sets the new condition state but also continues execution with the new state. A +shortcut rule should not be used in a loop where there is code between the start +of the loop and the re2c block unless re2c:cond:goto is changed +to continue. If code is necessary before all rule (though not simple +jumps) you can doso by using <! pseudo-rules.

+
+
+

<condition-list> regular-expression { C/C++ code }

+

<condition-list> regular-expression := C/C++ code

+

<condition-list> * { C/C++ code }

+

<condition-list> * := C/C++ code

+

<condition-list> regular-expression => condition { C/C++ code }

+

<condition-list> regular-expression => condition := C/C++ code

+

<condition-list> regular-expression :=> condition

+

<*> regular-expression { C/C++ code }

+

<*> regular-expression := C/C++ code

+

<*> * { C/C++ code }

+

<*> * := C/C++ code

+

<*> regular-expression => condition { C/C++ code }

+

<*> regular-expression => condition := C/C++ code

+

<*> regular-expression :=> condition

+

<> { C/C++ code }

+

<> := C/C++ code

+

<> => condition { C/C++ code }

+

<> => condition := C/C++ code

+

<> :=> condition

+

<!condition-list> { C/C++ code }

+

<!condition-list> := C/C++ code

+

<!*> { C/C++ code }

+

<!*> := C/C++ code

+
+

named definitions are of the form:

+
+
+

name = regular-expression;

+
+

If -F is active, then named definitions are also of the form:

+
+
+

name regular-expression

+
+

inplace configurations are of the form:

+
+
+

re2c:name = value;

+

re2c:name = “_value_”;

+
+
+
+
+

REGULAR EXPRESSIONS

+
+
+
+“foo” +
+
+

+ literal string “foo”. ANSI-C escape sequences can be used. +

+
+
+‘foo’ +
+
+

+ literal string “foo” (characters [a-zA-Z] treated case-insensitive). ANSI-C escape sequences can be used. +

+
+
+[xyz] +
+
+

+ character class; in this case, regular-expression matches either ‘x’, ‘y’, or ‘z’. +

+
+
+[abj-oZ] +
+
+

+ character class with a range in it; matches ‘a’, ‘b’, any letter from ‘j’ through ‘o’ or ‘Z’. +

+
+
+[^class] +
+
+

+ inverted character class. +

+
+
+r \ s +
+
+

+ match any r which isn’t s. r and s must be regular-expressions which can be expressed as character classes. +

+
+
+r * +
+
+

+ zero or more r's, where r is any regular-expression. +

+
+
+r + +
+
+

+ one or more r's. +

+
+
+r ? +
+
+

+ zero or one r's (that is, an optional r). +

+
+
+name +
+
+

+ the expansion of the named definition. +

+
+
+( r ) +
+
+

+ r; parentheses are used to override precedence. +

+
+
+r s +
+
+

+ r followed by s (concatenation). +

+
+
+r | s +
+
+

+ either r or s (alternative). +

+
+
+r / s +
+
+

+ r but only if it is followed by s. Note that s is not part of the matched text. + This type of regular-expression is called “trailing context”. + Trailing context can only be the end of a rule and not part of a named definition. +

+
+
+r { n } +
+
+

+ matches r exactly n times. +

+
+
+r { n , } +
+
+

+ matches r at least n times. +

+
+
+r { n , m } +
+
+

+ matches r at least n times, but not more than m times. +

+
+
+. +
+
+

+ match any character except newline. +

+
+
+def +
+
+

+ matches named definition as specified by def only if -F is off. + If -F is active then this behaves like it was enclosed in double quotes and matches the string “def”. +

+
+
+

Character classes and string literals may contain octal or hexadecimal +character definitions and the following set of escape sequences: +\a, \b, \f, \n, \r, \t, \v, \\. +An octal character is defined by a backslash followed by its three octal digits (e.g. \377). +Hexadecimal characters from 0 to 0xFF are defined by backslash, a lower cased ‘x’ and two hexadecimal digits (e.g. \x12). +Hexadecimal characters from 0x100 to 0xFFFF are defined by backslash, a lower cased ‘u’ (or an upper cased ‘X’) and four hexadecimal digits (e.g. \u1234). +Hexadecimal characters from 0x10000 to 0xFFFFffff are defined by backslash, an upper cased ‘U’ and eight hexadecimal digits (e.g. \U12345678).

+

The only portable “any” rule is the default rule *.

+
+
+
+

INPLACE CONFIGURATIONS

+
+

It is possible to configure code generation inside re2c blocks. The following lists the available configurations:

+
+
+re2c:condprefix = yyc_; +
+
+

+Allows to specify the prefix used for condition labels. That is this text is +prepended to any condition label in the generated output file. +

+
+
+re2c:condenumprefix = yyc; +
+
+

+Allows to specify the prefix used for condition values. That is this text is +prepended to any condition enum value in the generated output file. +

+
+
+re2c:cond:divider = “/* *********************************** */”; +
+
+

+Allows to customize the devider for condition blocks. You can use ‘@@’ to +put the name of the condition or ustomize the placeholder +using re2c:cond:divider@cond. +

+
+
+re2c:cond:divider@cond = @@; +
+
+

+Specifies the placeholder that will be replaced with the condition name +in re2c:cond:divider. +

+
+
+re2c:cond:goto = “goto @@;”; +
+
+

+Allows to customize the condition goto statements used with :=> style rules. +You can use ‘@@’ to put the name of the condition or ustomize the placeholder +using re2c:cond:goto@cond. You can also change this to ‘continue;’, +which would allow you to continue with the next loop cycle including any code +between loop start and re2c block. +

+
+
+re2c:cond:goto@cond = @@; +
+
+

+Spcifies the placeholder that will be replaced with the condition label +in re2c:cond:goto. +

+
+
+re2c:indent:top = 0; +
+
+

+Specifies the minimum number of indendation to use. Requires a numeric value +greater than or equal zero. +

+
+
+re2c:indent:string = “\t”; +
+
+

+Specifies the string to use for indendation. Requires a string that should +contain only whitespace unless you need this for external tools. The easiest +way to specify spaces is to enclude them in single or double quotes. If you do +not want any indendation at all you can simply set this to “”. +

+
+
+re2c:yych:conversion = 0; +
+
+

+When this setting is non zero, then re2c automatically generates conversion +code whenever yych gets read. In this case the type must be defined using +re2c:define:YYCTYPE. +

+
+
+re2c:yych:emit = 1; +
+
+

+Generation of yych can be suppressed by setting this to 0. +

+
+
+re2c:yybm:hex = 0; +
+
+

+If set to zero then a decimal table is being used else a hexadecimal table +will be generated. +

+
+
+re2c:yyfill:enable = 1; +
+
+

+Set this to zero to suppress generation of YYFILL (n). When using this be sure +to verify that the generated scanner does not read behind input. Allowing +this behavior might introduce sever security issues to you programs. +

+
+
+re2c:yyfill:check = 1; +
+
+

+This can be set 0 to suppress output of the pre condition using YYCURSOR and +YYLIMIT which becomes usefull when YYLIMIT + max (YYFILL) is always accessible. +

+
+
+re2c:yyfill:parameter = 1; +
+
+

+Allows to suppress parameter passing to YYFILL calls. If set to zero +then no parameter is passed to YYFILL. However define:YYFILL@LEN +allows to specify a replacement string for the actual length value. If set to +a non zero value then YYFILL usage will be followed by the number of +requested characters in braces unless re2c:define:YYFILL:naked is set. +Also look at re2c:define:YYFILL:naked and re2c:define:YYFILL@LEN. +

+
+
+re2c:startlabel = 0; +
+
+

+If set to a non zero integer then the start label of the next scanner blocks +will be generated even if not used by the scanner itself. Otherwise the normal +yy0 like start label is only being generated if needed. If set to a text +value then a label with that text will be generated regardless of whether the +normal start label is being used or not. This setting is being reset to 0 +after a start label has been generated. +

+
+
+re2c:labelprefix = yy; +
+
+

+Allows to change the prefix of numbered labels. The default is yy and +can be set any string that is a valid label. +

+
+
+re2c:state:abort = 0; +
+
+

+When not zero and switch -f is active then the YYGETSTATE block will +contain a default case that aborts and a -1 case is used for initialization. +

+
+
+re2c:state:nextlabel = 0; +
+
+

+Used when -f is active to control whether the YYGETSTATE block is +followed by a yyNext: label line. Instead of using yyNext you can +usually also use configuration startlabel to force a specific start label +or default to yy0 as start label. Instead of using a dedicated label it +is often better to separate the YYGETSTATE code from the actual scanner code by +placing a /*!getstate:re2c*/ comment. +

+
+
+re2c:cgoto:threshold = 9; +
+
+

+When -g is active this value specifies the complexity threshold that triggers +generation of jump tables rather than using nested if’s and decision bitfields. +The threshold is compared against a calculated estimation of if-s needed where +every used bitmap divides the threshold by 2. +

+
+
+re2c:yych:conversion = 0; +
+
+

+When the input uses signed characters and -s or -b switches are +in effect re2c allows to automatically convert to the unsigned character type +that is then necessary for its internal single character. When this setting +is zero or an empty string the conversion is disabled. Using a non zero number +the conversion is taken from YYCTYPE. If that is given by an inplace +configuration that value is being used. Otherwise it will be (YYCTYPE) +and changes to that configuration are no longer possible. When this setting is +a string the braces must be specified. Now assuming your input is a char * +buffer and you are using above mentioned switches you can set YYCTYPE to +unsigned char and this setting to either 1 or (unsigned char). +

+
+
+re2c:define:YYCONDTYPE = YYCONDTYPE; +
+
+

+Enumeration used for condition support with -c mode. +

+
+
+re2c:define:YYCTXMARKER = YYCTXMARKER; +
+
+

+Allows to overwrite the define YYCTXMARKER and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYCTYPE = YYCTYPE; +
+
+

+Allows to overwrite the define YYCTYPE and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYCURSOR = YYCURSOR; +
+
+

+Allows to overwrite the define YYCURSOR and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYDEBUG = YYDEBUG; +
+
+

+Allows to overwrite the define YYDEBUG and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYFILL = YYFILL; +
+
+

+Allows to overwrite the define YYFILL and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYFILL:naked = 0; +
+
+

+When set to 1 neither braces, parameter nor semicolon gets emitted. +

+
+
+re2c:define:YYFILL@len = @@; +
+
+

+When using re2c:define:YYFILL and re2c:yyfill:parameter is 0 then +any occurence of this text inside YYFILL will be replaced with the actual +length value. +

+
+
+re2c:define:YYGETCONDITION = YYGETCONDITION; +
+
+

+Allows to overwrite the define YYGETCONDITION. +

+
+
+re2c:define:YYGETCONDITION:naked = 0; +
+
+

+When set to 1 neither braces, parameter nor semicolon gets emitted. +

+
+
+re2c:define:YYGETSTATE = YYGETSTATE; +
+
+

+Allows to overwrite the define YYGETSTATE and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYGETSTATE:naked = 0; +
+
+

+When set to 1 neither braces, parameter nor semicolon gets emitted. +

+
+
+re2c:define:YYLIMIT = YYLIMIT; +
+
+

+Allows to overwrite the define YYLIMIT and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYMARKER = YYMARKER; +
+
+

+Allows to overwrite the define YYMARKER and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYSETCONDITION = YYSETCONDITION; +
+
+

+Allows to overwrite the define YYSETCONDITION. +

+
+
+re2c:define:YYSETCONDITION@cond = @@; +
+
+

+When using re2c:define:YYSETCONDITION then any occurence of this text +inside YYSETCONDITION will be replaced with the actual new condition value. +

+
+
+re2c:define:YYSETSTATE = YYSETSTATE; +
+
+

+Allows to overwrite the define YYSETSTATE and thus avoiding it by setting the +value to the actual code needed. +

+
+
+re2c:define:YYSETSTATE:naked = 0; +
+
+

+When set to 1 neither braces, parameter nor semicolon gets emitted. +

+
+
+re2c:define:YYSETSTATE@state = @@; +
+
+

+When using re2c:define:YYSETSTATE then any occurence of this text +inside YYSETSTATE will be replaced with the actual new state value. +

+
+
+re2c:label:yyFillLabel = yyFillLabel; +
+
+

+Allows to overwrite the name of the label yyFillLabel. +

+
+
+re2c:label:yyNext = yyNext; +
+
+

+Allows to overwrite the name of the label yyNext. +

+
+
+re2c:variable:yyaccept = yyaccept; +
+
+

+Allows to overwrite the name of the variable yyaccept. +

+
+
+re2c:variable:yybm = yybm; +
+
+

+Allows to overwrite the name of the variable yybm. +

+
+
+re2c:variable:yych = yych; +
+
+

+Allows to overwrite the name of the variable yych. +

+
+
+re2c:variable:yyctable = yyctable; +
+
+

+When both -c and -g are active then re2c uses this variable to +generate a static jump table for YYGETCONDITION. +

+
+
+re2c:variable:yystable = yystable; +
+
+

+When both -f and -g are active then re2c uses this variable to +generate a static jump table for YYGETSTATE. +

+
+
+re2c:variable:yytarget = yytarget; +
+
+

+Allows to overwrite the name of the variable yytarget. +

+
+
+
+
+
+

SCANNER WITH STORABLE STATES

+
+

When the -f flag is specified, re2c generates a scanner that +can store its current state, return to the caller, and later resume +operations exactly where it left off.

+

The default operation of re2c is a “pull” model, where the scanner asks +for extra input whenever it needs it. However, this mode of operation +assumes that the scanner is the “owner” the parsing loop, and that may +not always be convenient.

+

Typically, if there is a preprocessor ahead of the scanner in the stream, +or for that matter any other procedural source of data, the scanner cannot +“ask” for more data unless both scanner and source live in a separate threads.

+

The -f flag is useful for just this situation: it lets users design +scanners that work in a “push” model, i.e. where data is fed to the scanner +chunk by chunk. When the scanner runs out of data to consume, it just stores +its state, and return to the caller. When more input data is fed to the scanner, +it resumes operations exactly where it left off.

+

When using the -f option re2c does not accept stdin because it has to do the +full generation process twice which means it has to read the input twice. That +means re2c would fail in case it cannot open the input twice or reading the +input for the first time influences the second read attempt.

+

Changes needed compared to the “pull” model:

+
    +
  1. +

    +User has to supply macros YYSETSTATE () and YYGETSTATE (state). +

    +
  2. +
  3. +

    +The -f option inhibits declaration of yych and +yyaccept. So the user has to declare these. Also the user has +to save and restore these. In the example examples/push.re these +are declared as fields of the (C\++) class of which the scanner is a +method, so they do not need to be saved/restored explicitly. For C +they could e.g. be made macros that select fields from a structure +passed in as parameter. Alternatively, they could be declared as local +variables, saved with YYFILL (n) when it decides to return and restored +at entry to the function. Also, it could be more efficient to save the +state from YYFILL (n) because YYSETSTATE (state) is called +unconditionally. YYFILL (n) however does not get state as +parameter, so we would have to store state in a local variable by +YYSETSTATE (state). +

    +
  4. +
  5. +

    +Modify YYFILL (n) to return (from the function calling it) if more input is needed. +

    +
  6. +
  7. +

    +Modify caller to recognise “more input is needed” and respond appropriately. +

    +
  8. +
  9. +

    +The generated code will contain a switch block that is used to restores +the last state by jumping behind the corrspoding YYFILL (n) call. This code is +automatically generated in the epilog of the first /*!re2c */ block. +It is possible to trigger generation of the YYGETSTATE () block earlier by +placing a /*!getstate:re2c*/ comment. This is especially useful when +the scanner code should be wrapped inside a loop. +

    +
  10. +
+

Please see examples/push.re for push-model scanner. The generated code can be +tweaked using inplace configurations state:abort and state:nextlabel.

+
+
+
+

SCANNER WITH CONDITION SUPPORT

+
+

You can preceed regular expressions with a list of condition names when using the -c +switch. In this case re2c generates scanner blocks for each conditon. Where each of the +generated blocks has its own precondition. The precondition is given by the +interface define YYGETCONDITON() and must be of type YYCONDTYPE.

+

There are two special rule types. First, the rules of the condition * are +merged to all conditions. And second the empty condition list allows to +provide a code block that does not have a scanner part. Meaning it does not +allow any regular expression. The condition value referring to this special +block is always the one with the enumeration value 0. This way the code of this +special rule can be used to initialize a scanner. It is in no way necessary to +have these rules: but sometimes it is helpful to have a dedicated uninitialized +condition state.

+

Non empty rules allow to specify the new condition, which makes them +transition rules. Besides generating calls for the define YYSETCONDTITION +no other special code is generated.

+

There is another kind of special rules that allow to prepend code to any code +block of all rules of a certain set of conditions or to all code blocks to all +rules. This can be helpful when some operation is common among rules. For +instance this can be used to store the length of the scanned string. These +special setup rules start with an exclamation mark followed by either a list +of conditions <! condition, ... > or a star <!*>. +When re2c generates the code for a rule whose state does not have a +setup rule and a star’d setup rule is present, than that code will be used +as setup code.

+
+
+
+

ENCODINGS

+
+

re2c supports the following encodings: ASCII (default), EBCDIC (-e), UCS-2 (-w), +UTF-16 (-x), UTF-32 (-u) and UTF-8 (-8). ASCII is default. You can +either pass cmd flag or use inplace configuration in the form re2c:flags.

+

The following concepts should be clarified when talking about encoding. Code point +is an abstract number, which represents single encoding symbol. Code unit is the +smallest unit of memory, which is used in the encoded text (it corresponds to one +character in the input stream). One or more code units can be needed to represent +a single code point, depending on the encoding. In fixed-length encoding, each +code point is represented with equal number of code units. In variable-length +encoding, different code points can be represented with different number of code units.

+
+
+ASCII +
+
+

+is a fixed-length encoding. Its code space includes 0x100 code points, from 0 +to 0xFF (note that this is re2c-specific understanding of ASCII). One code point +is represented with exactly one 1-byte code unit, which has the same value as the +code point. Size of YYCTYPE must be 1 byte. +

+
+
+EBCDIC +
+
+

+is a fixed-length encoding. Its code space includes 0x100 code points, from 0 +to 0xFF. One code point is represented with exactly one 1-byte code unit, which has +the same value as the code point. Size of YYCTYPE must be 1 byte. +

+
+
+UCS-2 +
+
+

+is a fixed-length encoding. Its code space includes 0x10000 code points, from 0 +to 0xFFFF. One code point is represented with exactly one 2-byte code unit, which has +the same value as the code point. Size of YYCTYPE must be 2 bytes. +

+
+
+UTF-16 +
+
+

+is a variable-length encoding. Its code space includes all Unicode code points, +from 0 to 0xD7FF and from 0xE000 to 0x10FFFF. One code point is represented with one or +two 2-byte code units. Size of YYCTYPE must be 2 bytes. +

+
+
+UTF-32 +
+
+

+is a fixed-length encoding. Its code space includes all Unicode code points, +from 0 to 0xD7FF and from 0xE000 to 0x10FFFF. One code point is represented with exactly +one 4-byte code unit. Size of YYCTYPE must be 4 bytes. +

+
+
+UTF-8 +
+
+

+is a variable-length encoding. Its code space includes all +Unicode code points, from 0 to 0xD7FF and from 0xE000 to 0x10FFFF. One code point +is represented with sequence of one, two, three or four 1-byte code units. Size of +YYCTYPE must be 1 bytes. +

+
+
+

In Unicode, values from range 0xD800 to 0xDFFF (surrogates) are not valid Unicode +code points, any encoded sequence of code units, that would map to Unicode code points +in the range 0xD800-0xDFFF, is ill-formed. +The user can control how re2c treats such ill-formed sequences with --encoding-policy policy +flag (see OPTIONS section for full explanation).

+

For some encodings, there are code units, that never occur in valid encoded stream +(e.g. 0xFF byte in UTF-8). If the generated scanner must check for invalid input, +the only true way to do so is to use default rule *. +Note, that full range rule [^] won’t catch invalid code units when variable-length encoding is used +([^] means “all valid code points”, while default rule * means “all possible code units”: +see Note about default rule in SYNTAX section).

+
+
+
+

GENERIC INPUT API

+
+

re2c usually operates on input using pointer-like primitives YYCURSOR, YYMARKER, YYCTXMARKER and YYLIMIT.

+

Generic input API (enabled with --input custom switch) allows to customize input operations. +In this mode, re2c will express all operations on input in terms of the following primitives:

+
    +
  1. +

    +YYPEEK () --- get current input character +

    +
  2. +
  3. +

    +YYSKIP () --- advance to the next character +

    +
  4. +
  5. +

    +YYBACKUP () --- backup current input position +

    +
  6. +
  7. +

    +YYBACKUPCTX () --- backup current input position for trailing context +

    +
  8. +
  9. +

    +YYRESTORE () --- restore current input position +

    +
  10. +
  11. +

    +YYRESTORECTX () --- restore current input position for trailing context +

    +
  12. +
  13. +

    +YYLESSTHAN (n) --- check if less than n input characters are left +

    +
  14. +
+ +
+
+
+

UNDERSTANDING RE2C

+
+

The subdirectory examples of the re2c distribution contains a few step by step +examples to get you started with re2c. All examples in the lessons subdirectory +can be compiled and actually work.

+
+
+
+

BUGS

+
+
    +
  1. +

    +Difference only works for character sets, and not in UTF-8 mode. +

    +
  2. +
  3. +

    +The generated DFA is not minimal. +

    +
  4. +
  5. +

    +Features, that are naturally orthogonal (such as reusable rules, conditions, +setup rules and default rules), cannot always be combined. E.g., one cannot set +setup/default rule for condition in scanner with reusable rules. +

    +
  6. +
  7. +

    +re2c does too much unnecessary work: e.g., if /*!use:re2c ... */ block has +additional rules, these rules are parsed 4 times, while they should be parsed only once. +

    +
  8. +
  9. +

    +The re2c internal algorithms need documentation. +

    +
  10. +
+
+
+
+

SEE ALSO

+
+

flex(1), lex(1), quex (http://quex.sourceforge.net)

+

More information on re2c can be found here: http://re2c.org/.

+
+
+
+

AUTHORS

+
+
    +
  1. +

    +Peter Bumbulis peter@csg.uwaterloo.ca +

    +
  2. +
  3. +

    +Brian Young bayoung@acm.org +

    +
  4. +
  5. +

    +Dan Nuffer nuffer@users.sourceforge.net +

    +
  6. +
  7. +

    +Marcus Boerger helly@users.sourceforge.net +

    +
  8. +
  9. +

    +Hartmut Kaiser hkaiser@users.sourceforge.net +

    +
  10. +
  11. +

    +Emmanuel Mogenet mgix@mgix.com (added storable state) +

    +
  12. +
  13. +

    +Ulya Trofimovich skvadrik@gmail.com +

    +
  14. +
+
+
+
+

VERSION INFORMATION

+
+

This manpage describes re2c, version 0.14.1.dev, package date 08 May 2015.

+
+
+
+

+ + + diff --git a/re2c/bootstrap/parser.cc b/re2c/bootstrap/parser.cc index bba1a4cf..6840f565 100644 --- a/re2c/bootstrap/parser.cc +++ b/re2c/bootstrap/parser.cc @@ -66,14 +66,12 @@ /* Copy the first part of user declarations. */ +/* Line 189 of yacc.c */ +#line 1 "../src/parser.ypp" /* $Id$ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include @@ -81,11 +79,12 @@ #include #include -#include "globals.h" -#include "parser.h" -#include "c99_stdint.h" -#include "dfa.h" -#include "smart_ptr.h" +#include "config.h" +#include "src/c99_stdint.h" +#include "src/dfa.h" +#include "src/globals.h" +#include "src/parser.h" +#include "src/smart_ptr.h" #define YYMALLOC malloc #define YYFREE free @@ -215,6 +214,8 @@ void default_rule(CondList *clist, Token *code) +/* Line 189 of yacc.c */ +#line 219 "./parser.cc" /* Enabling traces. */ #ifndef YYDEBUG @@ -256,21 +257,6 @@ void default_rule(CondList *clist, Token *code) FID = 270 }; #endif -/* Tokens. */ -#define CLOSESIZE 258 -#define CLOSE 259 -#define STAR 260 -#define NOCOND 261 -#define ID 262 -#define CODE 263 -#define RANGE 264 -#define STRING 265 -#define CONFIG 266 -#define VALUE 267 -#define NUMBER 268 -#define SETUP 269 -#define FID 270 - @@ -278,6 +264,8 @@ void default_rule(CondList *clist, Token *code) typedef union YYSTYPE { +/* Line 214 of yacc.c */ +#line 149 "../src/parser.ypp" re2c::Symbol *symbol; re2c::RegExp *regexp; @@ -290,6 +278,8 @@ typedef union YYSTYPE +/* Line 214 of yacc.c */ +#line 283 "./parser.cc" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -300,6 +290,8 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ +/* Line 264 of yacc.c */ +#line 295 "./parser.cc" #ifdef short # undef short @@ -606,12 +598,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 181, 181, 183, 187, 191, 200, 209, 213, 217, - 223, 231, 240, 249, 253, 258, 263, 269, 273, 281, - 289, 294, 300, 306, 318, 330, 336, 344, 347, 354, - 359, 368, 371, 379, 382, 389, 393, 400, 404, 415, - 419, 426, 430, 445, 452, 456, 460, 464, 471, 479, - 483, 487 + 0, 178, 178, 180, 184, 188, 197, 206, 210, 214, + 220, 228, 237, 246, 250, 255, 260, 266, 270, 278, + 286, 291, 297, 303, 315, 327, 333, 341, 344, 351, + 356, 365, 368, 376, 379, 386, 390, 397, 401, 412, + 416, 423, 427, 442, 449, 453, 457, 461, 468, 476, + 480, 484 }; #endif @@ -1579,19 +1571,25 @@ yyreduce: { case 2: +/* Line 1464 of yacc.c */ +#line 178 "../src/parser.ypp" { - } + ;} break; case 3: +/* Line 1464 of yacc.c */ +#line 181 "../src/parser.ypp" { foundRules = true; - } + ;} break; case 5: +/* Line 1464 of yacc.c */ +#line 189 "../src/parser.ypp" { if ((yyvsp[(1) - (4)].symbol)->re) { @@ -1599,11 +1597,13 @@ yyreduce: } (yyvsp[(3) - (4)].regexp)->ins_access = RegExp::PRIVATE; (yyvsp[(1) - (4)].symbol)->re = (yyvsp[(3) - (4)].regexp); - } + ;} break; case 6: +/* Line 1464 of yacc.c */ +#line 198 "../src/parser.ypp" { if ((yyvsp[(1) - (2)].symbol)->re) { @@ -1611,42 +1611,52 @@ yyreduce: } (yyvsp[(2) - (2)].regexp)->ins_access = RegExp::PRIVATE; (yyvsp[(1) - (2)].symbol)->re = (yyvsp[(2) - (2)].regexp); - } + ;} break; case 7: +/* Line 1464 of yacc.c */ +#line 207 "../src/parser.ypp" { in->fatal("trailing contexts are not allowed in named definitions"); - } + ;} break; case 8: +/* Line 1464 of yacc.c */ +#line 211 "../src/parser.ypp" { in->fatal("trailing contexts are not allowed in named definitions"); - } + ;} break; case 9: +/* Line 1464 of yacc.c */ +#line 215 "../src/parser.ypp" { in->config(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].str)); delete (yyvsp[(1) - (4)].str); delete (yyvsp[(3) - (4)].str); - } + ;} break; case 10: +/* Line 1464 of yacc.c */ +#line 221 "../src/parser.ypp" { in->config(*(yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].number)); delete (yyvsp[(1) - (4)].str); - } + ;} break; case 11: +/* Line 1464 of yacc.c */ +#line 229 "../src/parser.ypp" { if (cFlag) { @@ -1654,11 +1664,13 @@ yyreduce: } (yyval.regexp) = new RuleOp((yyvsp[(1) - (3)].regexp), (yyvsp[(2) - (3)].regexp), (yyvsp[(3) - (3)].token), accept++, RegExp::SHARED); spec = spec? mkAlt(spec, (yyval.regexp)) : (yyval.regexp); - } + ;} break; case 12: +/* Line 1464 of yacc.c */ +#line 238 "../src/parser.ypp" { if (cFlag) in->fatal("condition or '<*>' required when using -c switch"); @@ -1666,98 +1678,120 @@ yyreduce: in->fatal("code to default rule is already defined"); else ruleDefault = (yyvsp[(2) - (2)].token); - } + ;} break; case 13: +/* Line 1464 of yacc.c */ +#line 247 "../src/parser.ypp" { context_rule((yyvsp[(2) - (7)].clist), (yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), (yyvsp[(6) - (7)].str), (yyvsp[(7) - (7)].token)); - } + ;} break; case 14: +/* Line 1464 of yacc.c */ +#line 251 "../src/parser.ypp" { assert((yyvsp[(7) - (7)].str)); context_rule((yyvsp[(2) - (7)].clist), (yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), (yyvsp[(7) - (7)].str), NULL); - } + ;} break; case 15: +/* Line 1464 of yacc.c */ +#line 256 "../src/parser.ypp" { context_none((yyvsp[(2) - (6)].clist)); delete (yyvsp[(5) - (6)].str); - } + ;} break; case 16: +/* Line 1464 of yacc.c */ +#line 261 "../src/parser.ypp" { assert((yyvsp[(6) - (6)].str)); context_none((yyvsp[(2) - (6)].clist)); delete (yyvsp[(6) - (6)].str); - } + ;} break; case 17: +/* Line 1464 of yacc.c */ +#line 267 "../src/parser.ypp" { default_rule((yyvsp[(2) - (5)].clist), (yyvsp[(5) - (5)].token)); - } + ;} break; case 18: +/* Line 1464 of yacc.c */ +#line 271 "../src/parser.ypp" { context_check(NULL); Token *token = new Token((yyvsp[(7) - (7)].token), (yyvsp[(7) - (7)].token)->source, (yyvsp[(7) - (7)].token)->line, (yyvsp[(6) - (7)].str)); delete (yyvsp[(7) - (7)].token); delete (yyvsp[(6) - (7)].str); specStar.push_back(new RuleOp((yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), token, accept++, RegExp::PRIVATE)); - } + ;} break; case 19: +/* Line 1464 of yacc.c */ +#line 279 "../src/parser.ypp" { assert((yyvsp[(7) - (7)].str)); context_check(NULL); Token *token = new Token(NULL, in->get_fname (), in->get_cline (), (yyvsp[(7) - (7)].str)); delete (yyvsp[(7) - (7)].str); specStar.push_back(new RuleOp((yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), token, accept++, RegExp::PRIVATE)); - } + ;} break; case 20: +/* Line 1464 of yacc.c */ +#line 287 "../src/parser.ypp" { context_none(NULL); delete (yyvsp[(5) - (6)].str); - } + ;} break; case 21: +/* Line 1464 of yacc.c */ +#line 292 "../src/parser.ypp" { assert((yyvsp[(6) - (6)].str)); context_none(NULL); delete (yyvsp[(6) - (6)].str); - } + ;} break; case 22: +/* Line 1464 of yacc.c */ +#line 298 "../src/parser.ypp" { CondList *clist = new CondList(); clist->insert("*"); default_rule(clist, (yyvsp[(5) - (5)].token)); - } + ;} break; case 23: +/* Line 1464 of yacc.c */ +#line 304 "../src/parser.ypp" { context_check(NULL); if (specNone) @@ -1768,11 +1802,13 @@ yyreduce: delete (yyvsp[(2) - (3)].str); delete (yyvsp[(3) - (3)].token); (yyval.regexp) = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++, RegExp::SHARED); - } + ;} break; case 24: +/* Line 1464 of yacc.c */ +#line 316 "../src/parser.ypp" { assert((yyvsp[(3) - (3)].str)); context_check(NULL); @@ -1783,138 +1819,174 @@ yyreduce: Token *token = new Token(NULL, in->get_fname (), in->get_cline (), (yyvsp[(3) - (3)].str)); delete (yyvsp[(3) - (3)].str); (yyval.regexp) = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++, RegExp::SHARED); - } + ;} break; case 25: +/* Line 1464 of yacc.c */ +#line 328 "../src/parser.ypp" { CondList *clist = new CondList(); clist->insert("*"); setup_rule(clist, (yyvsp[(4) - (4)].token)); - } + ;} break; case 26: +/* Line 1464 of yacc.c */ +#line 334 "../src/parser.ypp" { setup_rule((yyvsp[(2) - (4)].clist), (yyvsp[(4) - (4)].token)); - } + ;} break; case 27: +/* Line 1464 of yacc.c */ +#line 341 "../src/parser.ypp" { in->fatal("unnamed condition not supported"); - } + ;} break; case 28: +/* Line 1464 of yacc.c */ +#line 345 "../src/parser.ypp" { (yyval.clist) = (yyvsp[(1) - (1)].clist); - } + ;} break; case 29: +/* Line 1464 of yacc.c */ +#line 352 "../src/parser.ypp" { (yyval.clist) = new CondList(); (yyval.clist)->insert((yyvsp[(1) - (1)].symbol)->GetName().to_string()); - } + ;} break; case 30: +/* Line 1464 of yacc.c */ +#line 357 "../src/parser.ypp" { (yyvsp[(1) - (3)].clist)->insert((yyvsp[(3) - (3)].symbol)->GetName().to_string()); (yyval.clist) = (yyvsp[(1) - (3)].clist); - } + ;} break; case 31: +/* Line 1464 of yacc.c */ +#line 365 "../src/parser.ypp" { (yyval.str) = NULL; - } + ;} break; case 32: +/* Line 1464 of yacc.c */ +#line 369 "../src/parser.ypp" { (yyval.str) = new Str((yyvsp[(3) - (3)].symbol)->GetName().to_string().c_str()); - } + ;} break; case 33: +/* Line 1464 of yacc.c */ +#line 376 "../src/parser.ypp" { (yyval.regexp) = new NullOp; - } + ;} break; case 34: +/* Line 1464 of yacc.c */ +#line 380 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(2) - (2)].regexp); - } + ;} break; case 35: +/* Line 1464 of yacc.c */ +#line 387 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 36: +/* Line 1464 of yacc.c */ +#line 391 "../src/parser.ypp" { (yyval.regexp) = mkAlt((yyvsp[(1) - (3)].regexp), (yyvsp[(3) - (3)].regexp)); - } + ;} break; case 37: +/* Line 1464 of yacc.c */ +#line 398 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 38: +/* Line 1464 of yacc.c */ +#line 402 "../src/parser.ypp" { (yyval.regexp) = mkDiff((yyvsp[(1) - (3)].regexp), (yyvsp[(3) - (3)].regexp)); if(!(yyval.regexp)) { in->fatal("can only difference char sets"); } - } + ;} break; case 39: +/* Line 1464 of yacc.c */ +#line 413 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 40: +/* Line 1464 of yacc.c */ +#line 417 "../src/parser.ypp" { (yyval.regexp) = new CatOp((yyvsp[(1) - (2)].regexp), (yyvsp[(2) - (2)].regexp)); - } + ;} break; case 41: +/* Line 1464 of yacc.c */ +#line 424 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 42: +/* Line 1464 of yacc.c */ +#line 428 "../src/parser.ypp" { switch((yyvsp[(2) - (2)].op)) { @@ -1928,78 +2000,98 @@ yyreduce: (yyval.regexp) = mkAlt((yyvsp[(1) - (2)].regexp), new NullOp()); break; } - } + ;} break; case 43: +/* Line 1464 of yacc.c */ +#line 443 "../src/parser.ypp" { (yyval.regexp) = new CloseVOp((yyvsp[(1) - (2)].regexp), (yyvsp[(2) - (2)].extop).minsize, (yyvsp[(2) - (2)].extop).maxsize); - } + ;} break; case 44: +/* Line 1464 of yacc.c */ +#line 450 "../src/parser.ypp" { (yyval.op) = (yyvsp[(1) - (1)].op); - } + ;} break; case 45: +/* Line 1464 of yacc.c */ +#line 454 "../src/parser.ypp" { (yyval.op) = (yyvsp[(1) - (1)].op); - } + ;} break; case 46: +/* Line 1464 of yacc.c */ +#line 458 "../src/parser.ypp" { (yyval.op) = ((yyvsp[(1) - (2)].op) == (yyvsp[(2) - (2)].op)) ? (yyvsp[(1) - (2)].op) : '*'; - } + ;} break; case 47: +/* Line 1464 of yacc.c */ +#line 462 "../src/parser.ypp" { (yyval.op) = ((yyvsp[(1) - (2)].op) == (yyvsp[(2) - (2)].op)) ? (yyvsp[(1) - (2)].op) : '*'; - } + ;} break; case 48: +/* Line 1464 of yacc.c */ +#line 469 "../src/parser.ypp" { if(!(yyvsp[(1) - (1)].symbol)->re) { in->fatal("can't find symbol"); } (yyval.regexp) = (yyvsp[(1) - (1)].symbol)->re; - } + ;} break; case 49: +/* Line 1464 of yacc.c */ +#line 477 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 50: +/* Line 1464 of yacc.c */ +#line 481 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(1) - (1)].regexp); - } + ;} break; case 51: +/* Line 1464 of yacc.c */ +#line 485 "../src/parser.ypp" { (yyval.regexp) = (yyvsp[(2) - (3)].regexp); - } + ;} break; +/* Line 1464 of yacc.c */ +#line 2095 "./parser.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2210,6 +2302,8 @@ yyreturn: +/* Line 1684 of yacc.c */ +#line 490 "../src/parser.ypp" extern "C" { diff --git a/re2c/bootstrap/re2c.1 b/re2c/bootstrap/re2c.1 index d237ffc1..89e92a52 100644 --- a/re2c/bootstrap/re2c.1 +++ b/re2c/bootstrap/re2c.1 @@ -2,12 +2,12 @@ .\" Title: re2c .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.0 -.\" Date: 02/23/2015 +.\" Date: 05/08/2015 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "RE2C" "1" "02/23/2015" "\ \&" "\ \&" +.TH "RE2C" "1" "05/08/2015" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -904,7 +904,7 @@ or \fB(unsigned char)\fR\&. .RE .PP -\fBre2c:define:define:YYCONDTYPE\fR = \fBYYCONDTYPE\fR; +\fBre2c:define:YYCONDTYPE\fR = \fBYYCONDTYPE\fR; .RS 4 Enumeration used for condition support with \fB\-c\fR @@ -1358,7 +1358,7 @@ input characters are left This article (http://skvadrik\&.github\&.io/aleph_null/posts/re2c/2015\-01\-13\-input_model\&.html) has more details, and you can find some usage examples: http://skvadrik\&.github\&.io/aleph_null/posts/re2c/2015\-01\-15\-input_model_custom\&.html \&. .SH "UNDERSTANDING RE2C" .sp -The subdirectory lessons of the \fBre2c\fR distribution contains a few step by step lessons to get you started with \fBre2c\fR\&. All examples in the lessons subdirectory can be compiled and actually work\&. +The subdirectory examples of the \fBre2c\fR distribution contains a few step by step examples to get you started with \fBre2c\fR\&. All examples in the lessons subdirectory can be compiled and actually work\&. .SH "BUGS" .sp .RS 4 @@ -1514,4 +1514,4 @@ skvadrik@gmail\&.com .RE .SH "VERSION INFORMATION" .sp -This manpage describes \fBre2c\fR, version 0\&.14, package date 23 Feb 2015\&. +This manpage describes \fBre2c\fR, version 0\&.14\&.1\&.dev, package date 08 May 2015\&. diff --git a/re2c/bootstrap/scanner.cc b/re2c/bootstrap/scanner.cc index a528f9cd..e7d31bc8 100644 --- a/re2c/bootstrap/scanner.cc +++ b/re2c/bootstrap/scanner.cc @@ -1,14 +1,15 @@ -/* Generated by re2c 0.14.1.dev on Mon Apr 20 23:30:58 2015*/ +/* Generated by re2c 0.14.1.dev on Fri May 8 22:17:28 2015*/ #include #include #include #include -#include "scanner.h" -#include "parser.h" + +#include "src/dfa.h" +#include "src/globals.h" +#include "src/parser.h" +#include "src/print.h" +#include "src/scanner.h" #include "y.tab.h" -#include "globals.h" -#include "dfa.h" -#include "print.h" extern YYSTYPE yylval; diff --git a/re2c/bootstrap/y.tab.h b/re2c/bootstrap/y.tab.h index 840ecfb9..ba23488a 100644 --- a/re2c/bootstrap/y.tab.h +++ b/re2c/bootstrap/y.tab.h @@ -53,21 +53,6 @@ FID = 270 }; #endif -/* Tokens. */ -#define CLOSESIZE 258 -#define CLOSE 259 -#define STAR 260 -#define NOCOND 261 -#define ID 262 -#define CODE 263 -#define RANGE 264 -#define STRING 265 -#define CONFIG 266 -#define VALUE 267 -#define NUMBER 268 -#define SETUP 269 -#define FID 270 - @@ -75,6 +60,8 @@ typedef union YYSTYPE { +/* Line 1685 of yacc.c */ +#line 149 "../src/parser.ypp" re2c::Symbol *symbol; re2c::RegExp *regexp; @@ -87,6 +74,8 @@ typedef union YYSTYPE +/* Line 1685 of yacc.c */ +#line 79 "./y.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/re2c/bug2102138-test.sh b/re2c/bug2102138-test.sh deleted file mode 100755 index c143c9fd..00000000 --- a/re2c/bug2102138-test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -make && \ -for n in $(find test -name '*2102138*.re'|sed 's,.re,,'); do - ./run_tests.sh ${n}.re - test -f ${n}.c.temp && mv -f ${n}.c.temp ${n}.c - gcc ${n}.c -o ${n}.o - ./${n}.o >${n}.out - if $(diff -du ${n}.txt ${n}.out >${n}.out.diff); then - echo "OK" - rm -f ${n}.out ${n}.out.diff - else - echo "FAIL" - fi -done \ No newline at end of file diff --git a/re2c/build.sh b/re2c/build.sh new file mode 100755 index 00000000..db4be47f --- /dev/null +++ b/re2c/build.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +builddir=.build +rm -rf $builddir +mkdir $builddir + +cd $builddir +../configure --enable-docs --enable-silent-rules && \ +make bootstrap -j5 +cd .. diff --git a/re2c/c99_stdint.h b/re2c/c99_stdint.h deleted file mode 100644 index 44843c2d..00000000 --- a/re2c/c99_stdint.h +++ /dev/null @@ -1,237 +0,0 @@ -// taken from: -// http://groups.csail.mit.edu/cis/md6/submitted-2008-10-27/Optimized_64bit/ - -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUC__ -# define __STDINT_H_IS_PRESENT -#endif /* __GNUC__ */ - -#ifdef _MSC_VER -# if _MSC_VER >= 1600 -# define __STDINT_H_IS_PRESENT -# endif -#endif /* _MSC_VER */ - -#ifdef __STDINT_H_IS_PRESENT // [ -// c99 compliant compiler -#include -#else - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#if (_MSC_VER < 1300) && defined(__cplusplus) - extern "C++" { -#endif -# include -#if (_MSC_VER < 1300) && defined(__cplusplus) - } -#endif - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types -typedef signed __int8 int8_t; -typedef signed __int16 int16_t; -typedef signed __int32 int32_t; -typedef signed __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef int intptr_t; - typedef unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] -#endif diff --git a/re2c/config_w32.h b/re2c/config_w32.h deleted file mode 100644 index 316bf184..00000000 --- a/re2c/config_w32.h +++ /dev/null @@ -1,102 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -/* Name of package */ -#define PACKAGE "re2c" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "re2c-general@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "re2c" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "re2c 0.14.1.dev" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "re2c" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.14.1.dev" - -/* The size of a `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of a `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.14.1.dev" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -/* #undef volatile */ diff --git a/re2c/config_w32.h.in b/re2c/config_w32.h.in deleted file mode 100755 index 18eac045..00000000 --- a/re2c/config_w32.h.in +++ /dev/null @@ -1,102 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -/* Name of package */ -#define PACKAGE "re2c" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "re2c-general@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "re2c" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "re2c @PACKAGE_VERSION@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "re2c" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* The size of a `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of a `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "@PACKAGE_VERSION@" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -/* #undef volatile */ diff --git a/re2c/configure.ac b/re2c/configure.ac index 39e8c015..4cdd51bd 100644 --- a/re2c/configure.ac +++ b/re2c/configure.ac @@ -1,76 +1,63 @@ -AC_PREREQ([2.57]) -AC_INIT(re2c, 0.14.1.dev, re2c-general@lists.sourceforge.net) -AM_INIT_AUTOMAKE(re2c, $PACKAGE_VERSION) -AC_CONFIG_SRCDIR(actions.cc) -AM_CONFIG_HEADER(config.h) +AC_INIT([re2c],[0.14.1.dev],[re2c-general@lists.sourceforge.net]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + + +AC_CONFIG_SRCDIR([src/actions.cc]) +AC_CONFIG_HEADERS([config.h]) + AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`) AC_SUBST(PACKAGE_VERSION) AC_SUBST(PACKAGE_NAME) AC_SUBST(PACKAGE_TARNAME) AC_SUBST(PACKAGE_RELEASE, ${PACKAGE_RELEASE:-1}) -AC_SUBST(WINBUILDDIR, Release-2005) -# Checks for programs. -AC_CHECK_PROG(BISON, bison, yes, no) -AC_PROG_CXX -AC_PROG_CC -AC_PROG_INSTALL -dnl --enable-docs +# --enable-docs AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs], [regenerate man page and online documentation])]) AM_CONDITIONAL([REBUILD_DOCS], [test "x$enable_docs" = "xyes"]) AM_COND_IF([REBUILD_DOCS], [ - AC_CHECK_PROG(ASCIIDOC, asciidoc, yes, no) - AC_CHECK_PROG(A2X, a2x, yes, no) - AS_IF([test "x$ASCIIDOC" = "xno" -o "x$A2X" = "xno"], [ - AC_MSG_ERROR([need asciidoc and a2x for --enable-docs]) - ]) + AC_CHECK_PROG(ASCIIDOC, asciidoc, yes, no) + AC_CHECK_PROG(A2X, a2x, yes, no) + AS_IF([test "x$ASCIIDOC" = "xno" -o "x$A2X" = "xno"], [ + AC_MSG_ERROR([need asciidoc and a2x for --enable-docs]) + ]) ]) -if test "$GCC" = "yes"; then - AC_MSG_CHECKING([Testing GCC version]) - GCCVERSION=`$CXX -dumpversion 2>/dev/null` - if test -z "$GCCVERSION"; then - AC_MSG_ERROR([GCC version 3 or above required]) - fi - AC_MSG_RESULT([found version $GCCVERSION]) -fi - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC - -# We only rely on standard C/C++ headers. If we ever have a pressing need -# for something non-standard, we should add a check for it here. -# AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_C_VOLATILE - -# Checks for library functions. -AC_FUNC_MEMCMP -AC_FUNC_MMAP -AC_CHECK_FUNCS([memset munmap strdup strndup]) - -AC_CHECK_SIZEOF([char]) -AC_CHECK_SIZEOF([short]) -AC_CHECK_SIZEOF([int]) -AC_CHECK_SIZEOF([long]) + +# checks for programs +AC_CHECK_PROG(BISON, bison, yes, no) +AC_PROG_CXX +AC_PROG_INSTALL + + +# needed by src/c99_stdint.h +# avoid AC_INCLUDES_DEFAULT +AC_CHECK_HEADERS([stdint.h], [], [], [[]]) +# list of possible types to use in typedefs +AC_CHECK_SIZEOF([char], [], [[]]) +AC_CHECK_SIZEOF([short], [], [[]]) +AC_CHECK_SIZEOF([int], [], [[]]) +AC_CHECK_SIZEOF([long], [], [[]]) +AC_CHECK_SIZEOF([long long], [], [[]]) +AC_CHECK_SIZEOF([__int64], [], [[]]) +# size of pointers +AC_CHECK_SIZEOF([void *], [], [[]]) +# 64-bit integer constant suffix +AC_CHECK_SIZEOF([0l], [], [[]]) +AC_CHECK_SIZEOF([0ll], [], [[]]) +AC_CHECK_SIZEOF([0i8], [], [[]]) + + +# checks for library functions +AC_CHECK_FUNCS([strdup strndup]) + AC_CONFIG_FILES([\ -Makefile \ -README \ -makerpm \ -re2c.ad \ -re2c.spec \ -run_tests.sh \ -config_w32.h \ + Makefile \ + doc/re2c.ad \ ]) -AC_OUTPUT_COMMANDS([chmod +x makerpm run_tests.sh]) +AC_CONFIG_FILES([run_tests.sh], [chmod +x run_tests.sh]) + + AC_OUTPUT diff --git a/re2c/htdocs/index.html b/re2c/doc/index.html old mode 100755 new mode 100644 similarity index 92% rename from re2c/htdocs/index.html rename to re2c/doc/index.html index 49418c37..0e98d886 --- a/re2c/htdocs/index.html +++ b/re2c/doc/index.html @@ -7,64 +7,59 @@

re2c

+

re2c is a tool for writing very fast and very flexible scanners. Unlike any other such tool, re2c focuses on generating high efficient code for regular expression matching. As a result this allows a much broader range of - use than any traditional lexer offers. And Last but not least re2c + use than any traditional lexer offers. And last but not least re2c generates warning free code that is equal to hand-written code in terms of size, speed and quality.

+

The above made the PHP team to use re2c in various places.

+

Marcus Börger (helly@users.sourceforge.net)

+

I very much welcome anyone who would like to contribute to the project, either as a developer with source code access or by simply sending patches, bug reports, or suggestions for improvement.

+

Dan Nuffer (nuffer@users.sourceforge.net)

+

- Please use the SourceForge - facilities to download re2c, report bugs, subscribe to the mailing list, - etc. + Please use the sourceforge + to download re2c, report bugs, subscribe to the mailing list, etc.

+

- You can view the manual online here. -

-

- re2c is hosted at - SourceForge.net + You can view the online manual here.

+

Other re2c links:


Changelog

diff --git a/re2c/re2c.ad.in b/re2c/doc/re2c.ad.in similarity index 99% rename from re2c/re2c.ad.in rename to re2c/doc/re2c.ad.in index 5be571f8..23496038 100644 --- a/re2c/re2c.ad.in +++ b/re2c/doc/re2c.ad.in @@ -606,7 +606,7 @@ a string the braces must be specified. Now assuming your input is a *$$char *$$* buffer and you are using above mentioned switches you can set *YYCTYPE* to *unsigned char* and this setting to either *1* or *$$(unsigned char)$$*. -*re2c:define:define:YYCONDTYPE* = *YYCONDTYPE*; :: +*re2c:define:YYCONDTYPE* = *YYCONDTYPE*; :: Enumeration used for condition support with *-c* mode. *re2c:define:YYCTXMARKER* = *YYCTXMARKER*; :: @@ -873,8 +873,8 @@ http://skvadrik.github.io/aleph_null/posts/re2c/2015-01-15-input_model_custom.ht UNDERSTANDING RE2C ------------------ -The subdirectory lessons of the *re2c* distribution contains a few step by step -lessons to get you started with *re2c*. All examples in the lessons subdirectory +The subdirectory examples of the *re2c* distribution contains a few step by step +examples to get you started with *re2c*. All examples in the lessons subdirectory can be compiled and actually work. diff --git a/re2c/lessons/001_upn_calculator/readme.txt b/re2c/examples/001_upn_calculator/README old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/readme.txt rename to re2c/examples/001_upn_calculator/README diff --git a/re2c/lessons/001_upn_calculator/calc_001.re b/re2c/examples/001_upn_calculator/calc_001.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_001.re rename to re2c/examples/001_upn_calculator/calc_001.re diff --git a/re2c/lessons/001_upn_calculator/calc_002.re b/re2c/examples/001_upn_calculator/calc_002.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_002.re rename to re2c/examples/001_upn_calculator/calc_002.re diff --git a/re2c/lessons/001_upn_calculator/calc_003.re b/re2c/examples/001_upn_calculator/calc_003.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_003.re rename to re2c/examples/001_upn_calculator/calc_003.re diff --git a/re2c/lessons/001_upn_calculator/calc_004.re b/re2c/examples/001_upn_calculator/calc_004.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_004.re rename to re2c/examples/001_upn_calculator/calc_004.re diff --git a/re2c/lessons/001_upn_calculator/calc_005.re b/re2c/examples/001_upn_calculator/calc_005.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_005.re rename to re2c/examples/001_upn_calculator/calc_005.re diff --git a/re2c/lessons/001_upn_calculator/calc_006.s.re b/re2c/examples/001_upn_calculator/calc_006.s.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_006.s.re rename to re2c/examples/001_upn_calculator/calc_006.s.re diff --git a/re2c/lessons/001_upn_calculator/calc_007.b.re b/re2c/examples/001_upn_calculator/calc_007.b.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_007.b.re rename to re2c/examples/001_upn_calculator/calc_007.b.re diff --git a/re2c/lessons/001_upn_calculator/calc_008.b.re b/re2c/examples/001_upn_calculator/calc_008.b.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_008.b.re rename to re2c/examples/001_upn_calculator/calc_008.b.re diff --git a/re2c/lessons/001_upn_calculator/windows/HiResTimer.h b/re2c/examples/001_upn_calculator/windows/HiResTimer.h old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/windows/HiResTimer.h rename to re2c/examples/001_upn_calculator/windows/HiResTimer.h diff --git a/re2c/lessons/001_upn_calculator/windows/main.b.re b/re2c/examples/001_upn_calculator/windows/main.b.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/windows/main.b.re rename to re2c/examples/001_upn_calculator/windows/main.b.re diff --git a/re2c/lessons/002_strip_comments/readme.txt b/re2c/examples/002_strip_comments/README old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/readme.txt rename to re2c/examples/002_strip_comments/README diff --git a/re2c/lessons/002_strip_comments/strip_001.s.re b/re2c/examples/002_strip_comments/strip_001.s.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_001.s.re rename to re2c/examples/002_strip_comments/strip_001.s.re diff --git a/re2c/lessons/002_strip_comments/strip_002.s.re b/re2c/examples/002_strip_comments/strip_002.s.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_002.s.re rename to re2c/examples/002_strip_comments/strip_002.s.re diff --git a/re2c/lessons/002_strip_comments/strip_003.b.re b/re2c/examples/002_strip_comments/strip_003.b.re old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_003.b.re rename to re2c/examples/002_strip_comments/strip_003.b.re diff --git a/re2c/examples/basemmap.c b/re2c/examples/basemmap.c deleted file mode 100644 index 3e5b037a..00000000 --- a/re2c/examples/basemmap.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include -#include - -#ifndef MAP_NORESERVE -#define MAP_NORESERVE 0 -#endif - -volatile char ch; - -main(){ - struct stat statbuf; - uchar *buf; - fstat(0, &statbuf); - buf = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED|MAP_NORESERVE, - 0, 0); - if(buf != (uchar*)(-1)){ - uchar *cur, *lim = &buf[statbuf.st_size]; - for(cur = buf; buf != lim; ++cur){ - ch = *cur; - } - munmap(buf, statbuf.st_size); - } -} diff --git a/re2c/examples/cmmap.re b/re2c/examples/cmmap.re deleted file mode 100644 index bc4d498a..00000000 --- a/re2c/examples/cmmap.re +++ /dev/null @@ -1,267 +0,0 @@ -#include -#include -#include -#include -#include - -#define ADDEQ 257 -#define ANDAND 258 -#define ANDEQ 259 -#define ARRAY 260 -#define ASM 261 -#define AUTO 262 -#define BREAK 263 -#define CASE 264 -#define CHAR 265 -#define CONST 266 -#define CONTINUE 267 -#define DECR 268 -#define DEFAULT 269 -#define DEREF 270 -#define DIVEQ 271 -#define DO 272 -#define DOUBLE 273 -#define ELLIPSIS 274 -#define ELSE 275 -#define ENUM 276 -#define EQL 277 -#define EXTERN 278 -#define FCON 279 -#define FLOAT 280 -#define FOR 281 -#define FUNCTION 282 -#define GEQ 283 -#define GOTO 284 -#define ICON 285 -#define ID 286 -#define IF 287 -#define INCR 288 -#define INT 289 -#define LEQ 290 -#define LONG 291 -#define LSHIFT 292 -#define LSHIFTEQ 293 -#define MODEQ 294 -#define MULEQ 295 -#define NEQ 296 -#define OREQ 297 -#define OROR 298 -#define POINTER 299 -#define REGISTER 300 -#define RETURN 301 -#define RSHIFT 302 -#define RSHIFTEQ 303 -#define SCON 304 -#define SHORT 305 -#define SIGNED 306 -#define SIZEOF 307 -#define STATIC 308 -#define STRUCT 309 -#define SUBEQ 310 -#define SWITCH 311 -#define TYPEDEF 312 -#define UNION 313 -#define UNSIGNED 314 -#define VOID 315 -#define VOLATILE 316 -#define WHILE 317 -#define XOREQ 318 -#define EOI 319 - -typedef unsigned int unint; -typedef unsigned char uchar; - -#define YYCTYPE uchar -#define YYCURSOR cursor -#define YYLIMIT s->lim -#define YYMARKER s->ptr -#define YYFILL(n) {cursor = fill(s, cursor);} - -#define RET(i) {s->cur = cursor; return i;} - -typedef struct Scanner { - uchar *tok, *ptr, *cur, *pos, *lim, *eof; - unint line; -} Scanner; - -uchar *fill(Scanner *s, uchar *cursor){ - if(!s->eof){ - unint cnt = s->lim - s->tok; - uchar *buf = malloc((cnt + 1)*sizeof(uchar)); - memcpy(buf, s->tok, cnt); - cursor = &buf[cursor - s->tok]; - s->pos = &buf[s->pos - s->tok]; - s->ptr = &buf[s->ptr - s->tok]; - s->lim = &buf[cnt]; - s->eof = s->lim; *(s->eof)++ = '\n'; - s->tok = buf; - } - return cursor; -} - -int scan(Scanner *s){ - uchar *cursor = s->cur; -std: - s->tok = cursor; -/*!re2c -any = [\000-\377]; -O = [0-7]; -D = [0-9]; -L = [a-zA-Z_]; -H = [a-fA-F0-9]; -E = [Ee] [+-]? D+; -FS = [fFlL]; -IS = [uUlL]*; -ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+); -*/ - -/*!re2c - "/*" { goto comment; } - - "auto" { RET(AUTO); } - "break" { RET(BREAK); } - "case" { RET(CASE); } - "char" { RET(CHAR); } - "const" { RET(CONST); } - "continue" { RET(CONTINUE); } - "default" { RET(DEFAULT); } - "do" { RET(DO); } - "double" { RET(DOUBLE); } - "else" { RET(ELSE); } - "enum" { RET(ENUM); } - "extern" { RET(EXTERN); } - "float" { RET(FLOAT); } - "for" { RET(FOR); } - "goto" { RET(GOTO); } - "if" { RET(IF); } - "int" { RET(INT); } - "long" { RET(LONG); } - "register" { RET(REGISTER); } - "return" { RET(RETURN); } - "short" { RET(SHORT); } - "signed" { RET(SIGNED); } - "sizeof" { RET(SIZEOF); } - "static" { RET(STATIC); } - "struct" { RET(STRUCT); } - "switch" { RET(SWITCH); } - "typedef" { RET(TYPEDEF); } - "union" { RET(UNION); } - "unsigned" { RET(UNSIGNED); } - "void" { RET(VOID); } - "volatile" { RET(VOLATILE); } - "while" { RET(WHILE); } - - L (L|D)* { RET(ID); } - - ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) | - (['] (ESC|any\[\n\\'])* [']) - { RET(ICON); } - - (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?) - { RET(FCON); } - - (["] (ESC|any\[\n\\"])* ["]) - { RET(SCON); } - - "..." { RET(ELLIPSIS); } - ">>=" { RET(RSHIFTEQ); } - "<<=" { RET(LSHIFTEQ); } - "+=" { RET(ADDEQ); } - "-=" { RET(SUBEQ); } - "*=" { RET(MULEQ); } - "/=" { RET(DIVEQ); } - "%=" { RET(MODEQ); } - "&=" { RET(ANDEQ); } - "^=" { RET(XOREQ); } - "|=" { RET(OREQ); } - ">>" { RET(RSHIFT); } - "<<" { RET(LSHIFT); } - "++" { RET(INCR); } - "--" { RET(DECR); } - "->" { RET(DEREF); } - "&&" { RET(ANDAND); } - "||" { RET(OROR); } - "<=" { RET(LEQ); } - ">=" { RET(GEQ); } - "==" { RET(EQL); } - "!=" { RET(NEQ); } - ";" { RET(';'); } - "{" { RET('{'); } - "}" { RET('}'); } - "," { RET(','); } - ":" { RET(':'); } - "=" { RET('='); } - "(" { RET('('); } - ")" { RET(')'); } - "[" { RET('['); } - "]" { RET(']'); } - "." { RET('.'); } - "&" { RET('&'); } - "!" { RET('!'); } - "~" { RET('~'); } - "-" { RET('-'); } - "+" { RET('+'); } - "*" { RET('*'); } - "/" { RET('/'); } - "%" { RET('%'); } - "<" { RET('<'); } - ">" { RET('>'); } - "^" { RET('^'); } - "|" { RET('|'); } - "?" { RET('?'); } - - - [ \t\v\f]+ { goto std; } - - "\n" - { - if(cursor == s->eof) RET(EOI); - s->pos = cursor; s->line++; - goto std; - } - - any - { - printf("unexpected character: %c\n", *s->tok); - goto std; - } -*/ - -comment: -/*!re2c - "*/" { goto std; } - "\n" - { - if(cursor == s->eof) RET(EOI); - s->tok = s->pos = cursor; s->line++; - goto comment; - } - any { goto comment; } -*/ -} - -#ifndef MAP_NORESERVE -#define MAP_NORESERVE 0 -#endif - -main(){ - Scanner in; - struct stat statbuf; - uchar *buf; - fstat(0, &statbuf); - buf = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED|MAP_NORESERVE, - 0, 0); - if(buf != (uchar*)(-1)){ - int t; - in.lim = &(in.cur = buf)[statbuf.st_size]; - in.pos = NULL; - in.eof = NULL; - while((t = scan(&in)) != EOI){ -/* - printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok); - printf("%d\n", t); -*/ - } - munmap(buf, statbuf.st_size); - } -} diff --git a/re2c/examples/cnokw.re b/re2c/examples/cnokw.re deleted file mode 100644 index bdc12793..00000000 --- a/re2c/examples/cnokw.re +++ /dev/null @@ -1,239 +0,0 @@ -#include -#include -#include - -#define ADDEQ 257 -#define ANDAND 258 -#define ANDEQ 259 -#define ARRAY 260 -#define ASM 261 -#define AUTO 262 -#define BREAK 263 -#define CASE 264 -#define CHAR 265 -#define CONST 266 -#define CONTINUE 267 -#define DECR 268 -#define DEFAULT 269 -#define DEREF 270 -#define DIVEQ 271 -#define DO 272 -#define DOUBLE 273 -#define ELLIPSIS 274 -#define ELSE 275 -#define ENUM 276 -#define EQL 277 -#define EXTERN 278 -#define FCON 279 -#define FLOAT 280 -#define FOR 281 -#define FUNCTION 282 -#define GEQ 283 -#define GOTO 284 -#define ICON 285 -#define ID 286 -#define IF 287 -#define INCR 288 -#define INT 289 -#define LEQ 290 -#define LONG 291 -#define LSHIFT 292 -#define LSHIFTEQ 293 -#define MODEQ 294 -#define MULEQ 295 -#define NEQ 296 -#define OREQ 297 -#define OROR 298 -#define POINTER 299 -#define REGISTER 300 -#define RETURN 301 -#define RSHIFT 302 -#define RSHIFTEQ 303 -#define SCON 304 -#define SHORT 305 -#define SIGNED 306 -#define SIZEOF 307 -#define STATIC 308 -#define STRUCT 309 -#define SUBEQ 310 -#define SWITCH 311 -#define TYPEDEF 312 -#define UNION 313 -#define UNSIGNED 314 -#define VOID 315 -#define VOLATILE 316 -#define WHILE 317 -#define XOREQ 318 -#define EOI 319 - -typedef unsigned int uint; -typedef unsigned char uchar; - -#define BSIZE 8192 - -#define YYCTYPE uchar -#define YYCURSOR cursor -#define YYLIMIT s->lim -#define YYMARKER s->ptr -#define YYFILL(n) {cursor = fill(s, cursor);} - -#define RET(i) {s->cur = cursor; return i;} - -typedef struct Scanner { - int fd; - uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; - uint line; -} Scanner; - -uchar *fill(Scanner *s, uchar *cursor){ - if(!s->eof){ - uint cnt = s->tok - s->bot; - if(cnt){ - memcpy(s->bot, s->tok, s->lim - s->tok); - s->tok = s->bot; - s->ptr -= cnt; - cursor -= cnt; - s->pos -= cnt; - s->lim -= cnt; - } - if((s->top - s->lim) < BSIZE){ - uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar)); - memcpy(buf, s->tok, s->lim - s->tok); - s->tok = buf; - s->ptr = &buf[s->ptr - s->bot]; - cursor = &buf[cursor - s->bot]; - s->pos = &buf[s->pos - s->bot]; - s->lim = &buf[s->lim - s->bot]; - s->top = &s->lim[BSIZE]; - free(s->bot); - s->bot = buf; - } - if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){ - s->eof = &s->lim[cnt]; *(s->eof)++ = '\n'; - } - s->lim += cnt; - } - return cursor; -} - -int scan(Scanner *s){ - uchar *cursor = s->cur; -std: - s->tok = cursor; -/*!re2c -any = [\000-\377]; -O = [0-7]; -D = [0-9]; -L = [a-zA-Z_]; -H = [a-fA-F0-9]; -E = [Ee] [+-]? D+; -FS = [fFlL]; -IS = [uUlL]*; -ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+); -*/ - -/*!re2c - "/*" { goto comment; } - - L (L|D)* { RET(ID); } - - ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) | - (['] (ESC|any\[\n\\'])* [']) - { RET(ICON); } - - (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?) - { RET(FCON); } - - (["] (ESC|any\[\n\\"])* ["]) - { RET(SCON); } - - "..." { RET(ELLIPSIS); } - ">>=" { RET(RSHIFTEQ); } - "<<=" { RET(LSHIFTEQ); } - "+=" { RET(ADDEQ); } - "-=" { RET(SUBEQ); } - "*=" { RET(MULEQ); } - "/=" { RET(DIVEQ); } - "%=" { RET(MODEQ); } - "&=" { RET(ANDEQ); } - "^=" { RET(XOREQ); } - "|=" { RET(OREQ); } - ">>" { RET(RSHIFT); } - "<<" { RET(LSHIFT); } - "++" { RET(INCR); } - "--" { RET(DECR); } - "->" { RET(DEREF); } - "&&" { RET(ANDAND); } - "||" { RET(OROR); } - "<=" { RET(LEQ); } - ">=" { RET(GEQ); } - "==" { RET(EQL); } - "!=" { RET(NEQ); } - ";" { RET(';'); } - "{" { RET('{'); } - "}" { RET('}'); } - "," { RET(','); } - ":" { RET(':'); } - "=" { RET('='); } - "(" { RET('('); } - ")" { RET(')'); } - "[" { RET('['); } - "]" { RET(']'); } - "." { RET('.'); } - "&" { RET('&'); } - "!" { RET('!'); } - "~" { RET('~'); } - "-" { RET('-'); } - "+" { RET('+'); } - "*" { RET('*'); } - "/" { RET('/'); } - "%" { RET('%'); } - "<" { RET('<'); } - ">" { RET('>'); } - "^" { RET('^'); } - "|" { RET('|'); } - "?" { RET('?'); } - - - [ \t\v\f]+ { goto std; } - - "\n" - { - if(cursor == s->eof) RET(EOI); - s->pos = cursor; s->line++; - goto std; - } - - any - { - printf("unexpected character: %c\n", *s->tok); - goto std; - } -*/ - -comment: -/*!re2c - "*/" { goto std; } - "\n" - { - if(cursor == s->eof) RET(EOI); - s->tok = s->pos = cursor; s->line++; - goto comment; - } - any { goto comment; } -*/ -} - -main(){ - Scanner in; - int t; - memset((char*) &in, 0, sizeof(in)); - in.fd = 0; - while((t = scan(&in)) != EOI){ -/* - printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok); - printf("%d\n", t); -*/ - } - close(in.fd); -} diff --git a/re2c/examples/cunroll.re b/re2c/examples/cunroll.re deleted file mode 100644 index dd9d8054..00000000 --- a/re2c/examples/cunroll.re +++ /dev/null @@ -1,258 +0,0 @@ -#include -#include -#include - -#define ADDEQ 257 -#define ANDAND 258 -#define ANDEQ 259 -#define ARRAY 260 -#define ASM 261 -#define AUTO 262 -#define BREAK 263 -#define CASE 264 -#define CHAR 265 -#define CONST 266 -#define CONTINUE 267 -#define DECR 268 -#define DEFAULT 269 -#define DEREF 270 -#define DIVEQ 271 -#define DO 272 -#define DOUBLE 273 -#define ELLIPSIS 274 -#define ELSE 275 -#define ENUM 276 -#define EQL 277 -#define EXTERN 278 -#define FCON 279 -#define FLOAT 280 -#define FOR 281 -#define FUNCTION 282 -#define GEQ 283 -#define GOTO 284 -#define ICON 285 -#define ID 286 -#define IF 287 -#define INCR 288 -#define INT 289 -#define LEQ 290 -#define LONG 291 -#define LSHIFT 292 -#define LSHIFTEQ 293 -#define MODEQ 294 -#define MULEQ 295 -#define NEQ 296 -#define OREQ 297 -#define OROR 298 -#define POINTER 299 -#define REGISTER 300 -#define RETURN 301 -#define RSHIFT 302 -#define RSHIFTEQ 303 -#define SCON 304 -#define SHORT 305 -#define SIGNED 306 -#define SIZEOF 307 -#define STATIC 308 -#define STRUCT 309 -#define SUBEQ 310 -#define SWITCH 311 -#define TYPEDEF 312 -#define UNION 313 -#define UNSIGNED 314 -#define VOID 315 -#define VOLATILE 316 -#define WHILE 317 -#define XOREQ 318 -#define EOI 319 - -typedef unsigned int uint; -typedef unsigned char uchar; - -#define BSIZE 8192 - -#define YYCTYPE uchar -#define YYCURSOR cursor -#define YYLIMIT s->lim -#define YYMARKER s->ptr -#define YYFILL(n) {cursor = fill(s, cursor);} - -#define RET(i) {s->cur = cursor; return i;} - -typedef struct Scanner { - int fd; - uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; - uint line; -} Scanner; - -uchar *fill(Scanner *s, uchar *cursor){ - if(!s->eof){ - uint cnt = s->tok - s->bot; - if(cnt){ - memcpy(s->bot, s->tok, s->lim - s->tok); - s->tok = s->bot; - s->ptr -= cnt; - cursor -= cnt; - s->pos -= cnt; - s->lim -= cnt; - } - if((s->top - s->lim) < BSIZE){ - uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar)); - memcpy(buf, s->tok, s->lim - s->tok); - s->tok = buf; - s->ptr = &buf[s->ptr - s->bot]; - cursor = &buf[cursor - s->bot]; - s->pos = &buf[s->pos - s->bot]; - s->lim = &buf[s->lim - s->bot]; - s->top = &s->lim[BSIZE]; - free(s->bot); - s->bot = buf; - } - if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){ - s->eof = &s->lim[cnt]; *(s->eof)++ = '\n'; - } - s->lim += cnt; - } - return cursor; -} - -int scan(Scanner *s){ - uchar *cursor = s->cur; -std: - s->tok = cursor; -/*!re2c -any = [\000-\377]; -O = [0-7]; -D = [0-9]; -L = [a-zA-Z_]; -I = L|D; -H = [a-fA-F0-9]; -E = [Ee] [+-]? D+; -FS = [fFlL]; -IS = [uUlL]*; -ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+); -X = any\[*/]; -*/ - -/*!re2c - "/*" { goto comment; } - - - L { RET(ID); } - L I { RET(ID); } - L I I { RET(ID); } - L I I I { RET(ID); } - L I I I I { RET(ID); } - L I I I I I { RET(ID); } - L I I I I I I { RET(ID); } - L I I I I I I I { RET(ID); } - L I* { RET(ID); } - - ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) | - (['] (ESC|any\[\n\\'])* [']) - { RET(ICON); } - - (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?) - { RET(FCON); } - - (["] (ESC|any\[\n\\"])* ["]) - { RET(SCON); } - - "..." { RET(ELLIPSIS); } - ">>=" { RET(RSHIFTEQ); } - "<<=" { RET(LSHIFTEQ); } - "+=" { RET(ADDEQ); } - "-=" { RET(SUBEQ); } - "*=" { RET(MULEQ); } - "/=" { RET(DIVEQ); } - "%=" { RET(MODEQ); } - "&=" { RET(ANDEQ); } - "^=" { RET(XOREQ); } - "|=" { RET(OREQ); } - ">>" { RET(RSHIFT); } - "<<" { RET(LSHIFT); } - "++" { RET(INCR); } - "--" { RET(DECR); } - "->" { RET(DEREF); } - "&&" { RET(ANDAND); } - "||" { RET(OROR); } - "<=" { RET(LEQ); } - ">=" { RET(GEQ); } - "==" { RET(EQL); } - "!=" { RET(NEQ); } - ";" { RET(';'); } - "{" { RET('{'); } - "}" { RET('}'); } - "," { RET(','); } - ":" { RET(':'); } - "=" { RET('='); } - "(" { RET('('); } - ")" { RET(')'); } - "[" { RET('['); } - "]" { RET(']'); } - "." { RET('.'); } - "&" { RET('&'); } - "!" { RET('!'); } - "~" { RET('~'); } - "-" { RET('-'); } - "+" { RET('+'); } - "*" { RET('*'); } - "/" { RET('/'); } - "%" { RET('%'); } - "<" { RET('<'); } - ">" { RET('>'); } - "^" { RET('^'); } - "|" { RET('|'); } - "?" { RET('?'); } - - - [ \t\v\f]+ { goto std; } - - "\n" - { - if(cursor == s->eof) RET(EOI); - s->pos = cursor; s->line++; - goto std; - } - - any - { - printf("unexpected character: %c\n", *s->tok); - goto std; - } -*/ - -comment: -/*!re2c - "*/" { goto std; } - "\n" - { - if(cursor == s->eof) RET(EOI); - s->tok = s->pos = cursor; s->line++; - goto comment; - } - X { goto comment; } - X X { goto comment; } - X X X { goto comment; } - X X X X { goto comment; } - X X X X X { goto comment; } - X X X X X X { goto comment; } - X X X X X X X { goto comment; } - X X X X X X X X { goto comment; } - any { goto comment; } -*/ -} - -main(){ - Scanner in; - int t; - memset((char*) &in, 0, sizeof(in)); - in.fd = 0; - while((t = scan(&in)) != EOI){ -/* - printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok); - printf("%d\n", t); -*/ - } - close(in.fd); -} diff --git a/re2c/examples/c.re b/re2c/examples/langs/c.re similarity index 100% rename from re2c/examples/c.re rename to re2c/examples/langs/c.re diff --git a/re2c/examples/modula.re b/re2c/examples/langs/modula.re similarity index 98% rename from re2c/examples/modula.re rename to re2c/examples/langs/modula.re index 0468ba4e..186b0cc1 100644 --- a/re2c/examples/modula.re +++ b/re2c/examples/langs/modula.re @@ -11,13 +11,14 @@ typedef unsigned char uchar; #define YYCURSOR cursor #define YYLIMIT s->lim #define YYMARKER s->ptr +#define YYCTXMARKER s->ctx #define YYFILL {cursor = fill(s, cursor);} #define RETURN(i) {s->cur = cursor; return i;} typedef struct Scanner { int fd; - uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; + uchar *bot, *tok, *ptr, *ctx, *cur, *pos, *lim, *top, *eof; uint line; } Scanner; diff --git a/re2c/examples/rexx/rexx.l b/re2c/examples/langs/rexx.re similarity index 100% rename from re2c/examples/rexx/rexx.l rename to re2c/examples/langs/rexx.re diff --git a/re2c/examples/pp-c.re b/re2c/examples/pp-c.re deleted file mode 100755 index 94933f4e..00000000 --- a/re2c/examples/pp-c.re +++ /dev/null @@ -1,295 +0,0 @@ -#include -#include -#include - -#define ADDEQ 257 -#define ANDAND 258 -#define ANDEQ 259 -#define ARRAY 260 -#define ASM 261 -#define AUTO 262 -#define BREAK 263 -#define CASE 264 -#define CHAR 265 -#define CONST 266 -#define CONTINUE 267 -#define DECR 268 -#define DEFAULT 269 -#define DEREF 270 -#define DIVEQ 271 -#define DO 272 -#define DOUBLE 273 -#define ELLIPSIS 274 -#define ELSE 275 -#define ENUM 276 -#define EQL 277 -#define EXTERN 278 -#define FCON 279 -#define FLOAT 280 -#define FOR 281 -#define FUNCTION 282 -#define GEQ 283 -#define GOTO 284 -#define ICON 285 -#define ID 286 -#define IF 287 -#define INCR 288 -#define INT 289 -#define LEQ 290 -#define LONG 291 -#define LSHIFT 292 -#define LSHIFTEQ 293 -#define MODEQ 294 -#define MULEQ 295 -#define NEQ 296 -#define OREQ 297 -#define OROR 298 -#define POINTER 299 -#define REGISTER 300 -#define RETURN 301 -#define RSHIFT 302 -#define RSHIFTEQ 303 -#define SCON 304 -#define SHORT 305 -#define SIGNED 306 -#define SIZEOF 307 -#define STATIC 308 -#define STRUCT 309 -#define SUBEQ 310 -#define SWITCH 311 -#define TYPEDEF 312 -#define UNION 313 -#define UNSIGNED 314 -#define VOID 315 -#define VOLATILE 316 -#define WHILE 317 -#define XOREQ 318 -#define EOI 319 -#define PP_INCLUDE 500 -#define PP_LINE 501 -#define PP_DEFINE 502 -#define PP_UNDEF 503 -#define PP_IF 504 -#define PP_IFDEF 505 -#define PP_IFNDEF 506 -#define PP_ELSE 507 -#define PP_ELIF 508 -#define PP_ENDIF 509 -#define PP_ERROR 510 - -typedef unsigned int uint; -typedef unsigned char uchar; - -#define BSIZE 12 -//8192 - -#define YYCTYPE uchar -#define YYCURSOR cursor -#define YYLIMIT s->lim -#define YYMARKER s->ptr -#define YYFILL(n) {cursor = fill(s, cursor);} - -#define RET(i) {s->cur = cursor; return i;} - -typedef struct Scanner { - int fd; - uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; - uint line; -} Scanner; - -uchar *fill(Scanner *s, uchar *cursor){ - if(!s->eof) { - uint cnt = s->tok - s->bot; - if(cnt){ - memcpy(s->bot, s->tok, s->lim - s->tok); - s->tok = s->bot; - s->ptr -= cnt; - cursor -= cnt; - s->pos -= cnt; - s->lim -= cnt; - } - if((s->top - s->lim) < BSIZE){ - uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar)); - memcpy(buf, s->tok, s->lim - s->tok); - s->tok = buf; - s->ptr = &buf[s->ptr - s->bot]; - cursor = &buf[cursor - s->bot]; - s->pos = &buf[s->pos - s->bot]; - s->lim = &buf[s->lim - s->bot]; - s->top = &s->lim[BSIZE]; - free(s->bot); - s->bot = buf; - } - if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){ - s->eof = &s->lim[cnt]; *(s->eof)++ = '\n'; - } - s->lim += cnt; - } - return cursor; -} - -int scan(Scanner *s){ - uchar *cursor = s->cur; -std: - s->tok = cursor; -/*!re2c -any = [\000-\377]; -O = [0-7]; -D = [0-9]; -L = [a-zA-Z_]; -H = [a-fA-F0-9]; -E = [Ee] [+-]? D+; -FS = [fFlL]; -IS = [uUlL]*; -ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+); -PP = "#" [ \t]*; -*/ - -/*!re2c - "/*" { goto comment; } - - "auto" { RET(AUTO); } - "break" { RET(BREAK); } - "case" { RET(CASE); } - "char" { RET(CHAR); } - "const" { RET(CONST); } - "continue" { RET(CONTINUE); } - "default" { RET(DEFAULT); } - "do" { RET(DO); } - "double" { RET(DOUBLE); } - "else" { RET(ELSE); } - "enum" { RET(ENUM); } - "extern" { RET(EXTERN); } - "float" { RET(FLOAT); } - "for" { RET(FOR); } - "goto" { RET(GOTO); } - "if" { RET(IF); } - "int" { RET(INT); } - "long" { RET(LONG); } - "register" { RET(REGISTER); } - "return" { RET(RETURN); } - "short" { RET(SHORT); } - "signed" { RET(SIGNED); } - "sizeof" { RET(SIZEOF); } - "static" { RET(STATIC); } - "struct" { RET(STRUCT); } - "switch" { RET(SWITCH); } - "typedef" { RET(TYPEDEF); } - "union" { RET(UNION); } - "unsigned" { RET(UNSIGNED); } - "void" { RET(VOID); } - "volatile" { RET(VOLATILE); } - "while" { RET(WHILE); } - - L (L|D)* { RET(ID); } - - ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) | - (['] (ESC|any\[\n\\'])* [']) - { RET(ICON); } - - (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?) - { RET(FCON); } - - (["] (ESC|any\[\n\\"])* ["]) - { RET(SCON); } - - "..." { RET(ELLIPSIS); } - ">>=" { RET(RSHIFTEQ); } - "<<=" { RET(LSHIFTEQ); } - "+=" { RET(ADDEQ); } - "-=" { RET(SUBEQ); } - "*=" { RET(MULEQ); } - "/=" { RET(DIVEQ); } - "%=" { RET(MODEQ); } - "&=" { RET(ANDEQ); } - "^=" { RET(XOREQ); } - "|=" { RET(OREQ); } - ">>" { RET(RSHIFT); } - "<<" { RET(LSHIFT); } - "++" { RET(INCR); } - "--" { RET(DECR); } - "->" { RET(DEREF); } - "&&" { RET(ANDAND); } - "||" { RET(OROR); } - "<=" { RET(LEQ); } - ">=" { RET(GEQ); } - "==" { RET(EQL); } - "!=" { RET(NEQ); } - ";" { RET(';'); } - "{" { RET('{'); } - "}" { RET('}'); } - "," { RET(','); } - ":" { RET(':'); } - "=" { RET('='); } - "(" { RET('('); } - ")" { RET(')'); } - "[" { RET('['); } - "]" { RET(']'); } - "." { RET('.'); } - "&" { RET('&'); } - "!" { RET('!'); } - "~" { RET('~'); } - "-" { RET('-'); } - "+" { RET('+'); } - "*" { RET('*'); } - "/" { RET('/'); } - "%" { RET('%'); } - "<" { RET('<'); } - ">" { RET('>'); } - "^" { RET('^'); } - "|" { RET('|'); } - "?" { RET('?'); } - - PP "include" { RET(PP_INCLUDE); } - PP "line" { RET(PP_LINE); } - PP "define" { RET(PP_DEFINE); } - PP "undef" { RET(PP_UNDEF); } - PP "if" { RET(PP_IF); } - PP "ifdef" { RET(PP_IFDEF); } - PP "ifndef" { RET(PP_IFNDEF); } - PP "else" { RET(PP_ELSE); } - PP "elif" { RET(PP_ELIF); } - PP "endif" { RET(PP_ENDIF); } - PP "error" { RET(PP_ERROR); } - - [ \t\v\f]+ { goto std; } - - "\n" - { - if(cursor == s->eof) RET(EOI); - s->pos = cursor; s->line++; - goto std; - } - - any - { - printf("unexpected character: %c\n", *s->tok); - goto std; - } -*/ - -comment: -/*!re2c - "*/" { goto std; } - "\n" - { - if(cursor == s->eof) RET(EOI); - s->tok = s->pos = cursor; s->line++; - goto comment; - } - any { goto comment; } -*/ -} - -main(){ - Scanner in; - int t; - memset((char*) &in, 0, sizeof(in)); - in.fd = 0; - while((t = scan(&in)) != EOI){ - - printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok); - - } - close(in.fd); -} diff --git a/re2c/examples/push.re b/re2c/examples/push_model/push.re similarity index 99% rename from re2c/examples/push.re rename to re2c/examples/push_model/push.re index a76b7aec..5ad6e7ac 100644 --- a/re2c/examples/push.re +++ b/re2c/examples/push_model/push.re @@ -226,14 +226,14 @@ public: start: - /*!re2c - + /*!re2c + re2c:startlabel = 1; eol = "\n"; eof = "\000"; digit = [0-9]; integer = digit+; alpha = [A-Za-z_]; - any = [\000-\0377]; + any = [\000-\377]; space = [ \h\t\v\f\r]; "if" { SEND(kIf); } diff --git a/re2c/examples/repeater.re b/re2c/examples/repeater.re deleted file mode 100755 index 05c4c884..00000000 --- a/re2c/examples/repeater.re +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include - -#define RET(n) printf("%d\n", n); return n - -int scan(char *s, int l){ -char *p = s; -char *q; -#define YYCTYPE char -#define YYCURSOR p -#define YYLIMIT (s+l) -#define YYMARKER q -#define YYFILL(n) -/*!re2c - 'a'{1}"\n" {RET(1);} - 'a'{2,3}"\n" {RET(2);} - 'a'{6}"\n" {RET(4);} - 'a'{4,}"\n" {RET(3);} - [^aq]|"\n" {RET(0);} -*/ -} - -#define do_scan(str) scan(str, strlen(str)) - -main() -{ - do_scan("a\n"); - do_scan("aa\n"); - do_scan("aaa\n"); - do_scan("aaaa\n"); - do_scan("q"); - do_scan("a"); - do_scan("A\n"); - do_scan("AA\n"); - do_scan("aAa\n"); - do_scan("AaaA\n"); - do_scan("Q"); - do_scan("AaaAa\n"); - do_scan("AaaAaA\n"); - do_scan("A"); - do_scan("\n"); - do_scan("0"); -} diff --git a/re2c/examples/rexx/README b/re2c/examples/rexx/README deleted file mode 100644 index 2af0178d..00000000 --- a/re2c/examples/rexx/README +++ /dev/null @@ -1 +0,0 @@ -Replacement modules for an existing REXX interpreter. Not standalone. diff --git a/re2c/examples/rexx/scanio.c b/re2c/examples/rexx/scanio.c deleted file mode 100644 index de6898df..00000000 --- a/re2c/examples/rexx/scanio.c +++ /dev/null @@ -1,41 +0,0 @@ -uchar *ScanFill(uchar *cursor){ - unsigned cnt = s->tok - s->bot; - s->pos += cursor - s->mrk; - if(cnt){ - if(s->eot){ - unsigned len = s->eot - s->tok; - memcpy(s->bot, s->tok, len); - s->eot = &s->bot[len]; - if((len = s->lim - cursor) != 0) - memcpy(s->eot, cursor, len); - cursor = s->eot; - s->lim = &cursor[len]; - } else { - memcpy(s->bot, s->tok, s->lim - s->tok); - cursor -= cnt; - s->lim -= cnt; - } - s->tok = s->bot; - s->ptr -= cnt; - } - if((s->top - s->lim) < 512){ - uchar *buf = (uchar*) malloc(((s->lim - s->bot) + 512)*sizeof(uchar)); - memcpy(buf, s->bot, s->lim - s->bot); - s->tok = buf; - s->ptr = &buf[s->ptr - s->bot]; - if(s->eot) - s->eot = &buf[s->eot - s->bot]; - cursor = &buf[cursor - s->bot]; - s->lim = &buf[s->lim - s->bot]; - s->top = &s->lim[512]; - free(s->bot); - s->bot = buf; - } - s->mrk = cursor; - if(ScanCBIO.file){ - if((cnt = read(ScanCBIO.u.f.fd, (char*) s->lim, 512)) != 512) - memset(&s->lim[cnt], 0, 512 - cnt); - s->lim += 512; - } - return cursor; -} diff --git a/re2c/examples/sample.re b/re2c/examples/sample.re deleted file mode 100644 index 2f497a3b..00000000 --- a/re2c/examples/sample.re +++ /dev/null @@ -1,7 +0,0 @@ -/*!re2c - "print" {return PRINT;} - [a-z]+ {return ID;} - [0-9]+ {return DEC;} - "0x" [0-9a-f]+ {return HEX;} - [\000-\377] {return ERR;} -*/ diff --git a/re2c/examples/simple.re b/re2c/examples/simple.re deleted file mode 100644 index 5fd8891f..00000000 --- a/re2c/examples/simple.re +++ /dev/null @@ -1,13 +0,0 @@ -#define NULL ((char*) 0) -char *scan(char *p){ -char *q; -#define YYCTYPE char -#define YYCURSOR p -#define YYLIMIT p -#define YYMARKER q -#define YYFILL(n) -/*!re2c - [0-9]+ {return YYCURSOR;} - [\000-\377] {return NULL;} -*/ -} diff --git a/re2c/htdocs/.gitignore b/re2c/htdocs/.gitignore deleted file mode 100644 index c32b1bce..00000000 --- a/re2c/htdocs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -manual.html diff --git a/re2c/lessons/.gitignore b/re2c/lessons/.gitignore deleted file mode 100755 index 1938665b..00000000 --- a/re2c/lessons/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -a.out -*.temp -*.diff -*.o diff --git a/re2c/lessons/001_upn_calculator/.gitignore b/re2c/lessons/001_upn_calculator/.gitignore deleted file mode 100755 index 1938665b..00000000 --- a/re2c/lessons/001_upn_calculator/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -a.out -*.temp -*.diff -*.o diff --git a/re2c/lessons/001_upn_calculator/windows/.gitignore b/re2c/lessons/001_upn_calculator/windows/.gitignore deleted file mode 100755 index ab030f2e..00000000 --- a/re2c/lessons/001_upn_calculator/windows/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -*.diff -*.exe -*.ncb -*.opt -*.plg -*.scc -*.suo -*.temp -*.user -Debug -Release diff --git a/re2c/lessons/001_upn_calculator/windows/BuildAndRun.bat b/re2c/lessons/001_upn_calculator/windows/BuildAndRun.bat deleted file mode 100755 index e40a7d43..00000000 --- a/re2c/lessons/001_upn_calculator/windows/BuildAndRun.bat +++ /dev/null @@ -1,48 +0,0 @@ -@echo OFF -goto Start -rem BuildAndRun.bat 06-Apr-15 lda -rem Assumes re2c.exe findable with PATH or . or .. or ..\.. or $(RE2C_HOME) -rem Assumes cl.exe findable with PATH or VcToolKit2003 installed - -:Start -if exist %RE2C_HOME%\re2c.exe goto ProceedWithGenerate -if exist .\re2c.exe set RE2C_HOME=. -if exist ..\re2c.exe set RE2C_HOME=.. -if exist ..\..\re2c.exe set RE2C_HOME=..\.. -if exist ..\..\..\re2c.exe set RE2C_HOME=..\..\.. -if exist ..\..\..\Release\re2c.exe set RE2C_HOME=..\..\..\Release -if exist ..\..\..\Release-2005\re2c.exe set RE2C_HOME=..\..\..\Release-2005 -if not exist %RE2C_HOME%\re2c.exe goto ReportSetupError - -:ProceedWithGenerate -set BASE_FILE_NAME=main -%RE2C_HOME%\re2c -b -o%BASE_FILE_NAME%.c %BASE_FILE_NAME%.re -rem echo ErrorLevel is set to %ERRORLEVEL% after re2c -IF ERRORLEVEL 1 goto ReportRe2cError - -rem (to test) set path= -cl 1>nul 2>nul -IF ERRORLEVEL 1 goto AttemptToSetupCompiler -goto ProceedWithCompile - -:AttemptToSetupCompiler -echo ErrorLevel is set to %ERRORLEVEL% after blank cl command line -call %VCToolkitInstallDir%\vcvars32.bat 1>nul 2>nul -cl 1>nul 2>nul -IF ERRORLEVEL 1 goto ReportClError - -:ProceedWithCompile -cl -O2 /DNDEBUG /D_CONSOLE /DWIN32 %BASE_FILE_NAME%.c -rem echo ErrorLevel is set to %ERRORLEVEL% after cl -IF ERRORLEVEL 1 goto ReportClError -%BASE_FILE_NAME% -goto AllDone - -:ReportSetupError -echo re2c.exe not found in ., .., ..\.., ..\..\.., ..\..\..\Release -echo or ..\..\..\Release-2005 Environment variable RE2C_HOME invalid or not set? - -:ReportClError -:ReportRe2cError -:AllDone -pause diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.sln b/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.sln deleted file mode 100755 index 1b4b4e5d..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRe2c", "TestRe2c-2005.vcproj", "{E2CEB3D0-066A-4C9A-B32C-B2197448A57A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Default = Debug|Default - Release|Default = Release|Default - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E2CEB3D0-066A-4C9A-B32C-B2197448A57A}.Debug|Default.ActiveCfg = Debug|Win32 - {E2CEB3D0-066A-4C9A-B32C-B2197448A57A}.Debug|Default.Build.0 = Debug|Win32 - {E2CEB3D0-066A-4C9A-B32C-B2197448A57A}.Release|Default.ActiveCfg = Release|Win32 - {E2CEB3D0-066A-4C9A-B32C-B2197448A57A}.Release|Default.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.vcproj b/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.vcproj deleted file mode 100755 index 1d3582bb..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c-2005.vcproj +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsp b/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsp deleted file mode 100755 index 7eb94630..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsp +++ /dev/null @@ -1,124 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TestRe2c" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=TestRe2c - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "TestRe2c.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "TestRe2c.mak" CFG="TestRe2c - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "TestRe2c - Win32 Release" (basierend auf "Win32 (x86) Console Application") -!MESSAGE "TestRe2c - Win32 Debug" (basierend auf "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -RSC=rc.exe - -!IF "$(CFG)" == "TestRe2c - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "TestRe2c - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "TestRe2c - Win32 Release" -# Name "TestRe2c - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\main.b.c -# End Source File -# Begin Source File - -SOURCE=.\main.b.re - -!IF "$(CFG)" == "TestRe2c - Win32 Release" - -# Begin Custom Build - Generate $(InputName).c from $(InputName).re using Re2c -InputPath=.\main.b.re -InputName=main.b - -"$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ..\..\..\Release-2005\re2c -b -o$(InputName).c $(InputName).re - -# End Custom Build - -!ELSEIF "$(CFG)" == "TestRe2c - Win32 Debug" - -# Begin Custom Build - Generate $(InputName).c from $(InputName).re using Re2c -InputPath=.\main.b.re -InputName=main.b - -"$(InputName).c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ..\..\..\Release-2005\re2c -b -o$(InputName).c $(InputName).re - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# End Target -# End Project diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsw b/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsw deleted file mode 100755 index eb8f630d..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "TestRe2c"=.\TestRe2c.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c.sln b/re2c/lessons/001_upn_calculator/windows/TestRe2c.sln deleted file mode 100755 index 8d051b8d..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRe2c", "TestRe2c.vcproj", "{BEC086F1-62CD-4BA7-8E17-367B825FA721}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BEC086F1-62CD-4BA7-8E17-367B825FA721}.Debug.ActiveCfg = Debug|Win32 - {BEC086F1-62CD-4BA7-8E17-367B825FA721}.Debug.Build.0 = Debug|Win32 - {BEC086F1-62CD-4BA7-8E17-367B825FA721}.Release.ActiveCfg = Release|Win32 - {BEC086F1-62CD-4BA7-8E17-367B825FA721}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/re2c/lessons/001_upn_calculator/windows/TestRe2c.vcproj b/re2c/lessons/001_upn_calculator/windows/TestRe2c.vcproj deleted file mode 100755 index 1dca53dc..00000000 --- a/re2c/lessons/001_upn_calculator/windows/TestRe2c.vcproj +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/re2c/lessons/002_strip_comments/.gitignore b/re2c/lessons/002_strip_comments/.gitignore deleted file mode 100755 index eb177879..00000000 --- a/re2c/lessons/002_strip_comments/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -a.out -*.temp -*.diff -*.o -t.c diff --git a/re2c/lessons/readme.txt b/re2c/lessons/readme.txt deleted file mode 100755 index d445a0d4..00000000 --- a/re2c/lessons/readme.txt +++ /dev/null @@ -1,20 +0,0 @@ -re2c lessons, (c) M. Boerger 2006 - -001_upn_calculator - - This lesson gets you started with re2c. In the end you will have an easy - RPN calculator for use at command line. - - You will learn about the basic interface of re2c when scanning input - strings. How to detect the end of the input and use that to stop scanning - in order to avoid problems. - - The lesson also contains a windows subdirectory to get you started in the - Microsoft world. - -002_strip_comments - - In this lesson you will learn how to use multiple scanner blocks and how - to read the input from a file instead of a zero terminated string. In the - end you will have a scanner that filters comments out of c source files - but keeps re2c comments. diff --git a/re2c/logo.pspimage b/re2c/logo.pspimage deleted file mode 100755 index e096faca9cea8ecb3fd535b11e652729c83ac65f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7241 zcmeHL2|QI@*FX1O*E|oIBPk_wi6mDlB17gm6pv)M=J9efD}_iCQ6!S#$y8=S6q)BC zQ%I7FaE<3Z$Mk&fGkwqV4e$5+e!q9I?jF|OXZ_dO>#V)czGz|N;L59g73;`*(HYCD zY;R$0#j9vzXGO^Yz(fJDpTY&`S7e)cp%UiEw+n|%vbE)rNPrDMKppUpEC3*(8X7vtOk~m zZMGme6|93EkfH+sa(FZ>hk6(`wZfWtx0ww>v;`9Jha-^NBetHw2pB?-gfU-$A59Hg z1$Ki&0KJN$vLb*$A^>CP4*)9w269LbFABi`AQ=!S1_am#1ObR$LLv}IBnc8GGzkfc zgcMCiN{S{WB_pRKCnKYT8WhwNl$2Buk&)BTP*c&sb$Ajy1Nx^TBPAn)#ea*yYD5yW zDCjL5kO`ZFK%z*{kZKA_DtZ8kK%tN%C^Q5M8tDtk01^f?<391zq)eI?WPDD{68?9d zlJ8e|Rmq~&Lf}7o**SoMat|vTJI8^80*4L@9+NySC4EBX%-M5_O6QeTv~_g#^bHJ+ zu2@?AWPR1w)T$BuI`@R;gQkLW8)KFCcngg-g6!kwqDDk=6K)grK5c5b2E!+&h}z$|Ri zrbU0vpn(69MY{&=+5`3i)F=cLHYf%F18h{_&aJ9!yf>rC_h>GY+i3IFsG{5Zm7_6b zQSGP^FSjdhINGj3q@&|+>S_Rz`ImS_F0MGlj$wx-@k zx%8wEr;9{#Zmpic$H_@{mPz0%)ykxBtj!xjMr$?%vu_Ux^_6ARU8%F>x9wf)@~M1{ zt2y*CJyPFOo;%7P)mLPABhYU2V_yg_g6Qs~#1#BaJ(l9oTfrsYrB~~z!+Av7EJJnn zMOuS?H=If;hvwZU$!a|=&tp>rj$|3H*K03e7a55kXXzG0)}t`iGq>?9Kgic4XUVGl zxWhHuGn4$2lrF1ee7OA~BW#cSNiy!2)CUYZs}wWUdNGot{r8238^zy!et35IOKW<& z>Gu^=sg9aY!b?i?`XGQlydD4oHi^CEqXM-}95_w_uB+D}a7g&l_&}DdFwKZ(Qj=joI3H^Chf}^ zkM0+}9^k1i{H}Yuc2rQeO6i>1kJ9ytB&@Z)Yy0xl$V3G`BHFLJ>ylIp2>jF(&OukT zuF&*0ce1sKfUK&X<`TClsGD^0!0BdM-U^6j%kel86YxZTsz=Y~P8OYkVD~rK^qMZM z0ufh9w}WlB4iBhZ@SJzG5oRA65qpq5&8m0oc~ZOZYW}ID*H~M(S4+>6SNS&v%<>~E zFhMIkZ?QK9X)++i^>kqgBIWHRtfPmqPt+XNWldicrA+ixO3}a2v6BBn(Ku#@G8-vp zHlKY^(&NJLPF2#pSu_F2@ znf4kTSIe(8MdEYyBQRDV5LlkCQB``R+R5|1uqzb^Ft5oFHj;|;BGXMweeZQ1v|$;g zKbl`+SzP^fzNSFR^xI>i3D-+=?w{6)Gks$n_zKJeVkm2@&`RneUt&j!s7tS5d)M-# zmg2=PE$vfsG$0Ugov2@(AkpT>;)x%Q$R;fMdV_#YYnEhWn9<|dmWc7M7ozz?PD$t} z(j4Xyx5xDo^? z{iasN z@xgW%FTS0{2FrS^D&Z^T*U!%?O!_w6VL07QlyzXDdeE-x^uYRHN#d6U84$P$ z0_+Psw-yI;HQtJbn&o1uv7}#&cxrgaOndsuD@*Zexj8v`T|y~QdC|QYVpUuWCm9>k zS?DB}2MjHeH5hKb3|ov9JU8&#y|1Hq!9F2T@>)!)`mz2i>>_bIU=Msup#c0ycMdKj zo5vC~zy+OQ=%KBR8a~TFhYoV+P~sUM6g_xB+k&n31WO>(x&eE5^@Y-yUU(tlS%{3YXf){Uj%hA7RFik3TzG)8d@qI_2w~ zxX@@X5IPt>Uon3|7S|Mta#ZLaQ!Vl3u4L(JS{IrBa6hz;?Rr93&1GZN43k)#`J)nx zmt};0yF>f+Mq~S5q<=llKX)XNGV?}q)ZLJwQMypJ~9 z!|x_g-&_&tY~@|+t$xpO$d}Gv^-xrA{a7T?ek^^m^B|AspxQx{X5!!s$Zsk0BH4Gg zXidGpt8Q50_MF{X%=^MjR7g{lVXak3_Uz0Na|6wT6O;E+3Av>wdX2EJ`&N%>9f-l4 zp3wbqsySCy`Lj1)WsvIUSY_L1Vy&(Vq>>U|rzPT2R+<3LLv4jR zAMRhRlN#moNNMcAetcfL#`eM0J7VN5eP2HMx+5ouZPl*3u}_66{fId`o&Q%tj#;Lf zjQryI@rmzOh>bM$Nalpc)53lYpzPp*0Zv~X{iPDp&^Kx__A+kx;ys}isMU`GgHI2J z;*Qr3c{<#+`K;!`KspFmb$2ME zWL)uDZ}kn5%^B%Ph}!_mIa87?B&O(eu3~c5qLUNi{8o?7lfNR^1yD{a-ZT3=HnyOu zLu`mMamS=JA7}3BFa5sofq!`ryj`;Q;vF?GvHy+J=rmr;ZM5=S6F7(mLG20?l324P z{$|xd>2Km;tzFqCCMX#D-@YV}2$s(&UN23~pH!tE`_hf$;Kv(A;K>@^rAU>;G`c^C z4M@wi#>NxYK zX%j{^dOx|lyK7uE7bzNk?9q1)f3kgTe?m5wF7x##T#OIoy0TGc0O^FhiWW}^C%#t&x?j~VHa8_?J}kj`9ZjkpNbvhsS8MuW4&S-Q(%JCzKKB;}CKpOC0|FiBsGFfut>+!f)uSFBS^vV%}G2ZEdz%|*P)QA-YkZ*Utw zTmP)s5?K7Ih+Do&-oNk*8y6QTLPNi{uY$hu6WLu1B6{g8D&oeIXQ;QLkbO#M`Pxr8 z;cK%Xc)zrQ;OoU4zUD(WWekFN`D41&K=FI9jacT7dF6P zE{~ZFebDIx2+ohymxJA7Ehr|_y{E)lb}Aqf91@%1GM3NkuoW)j(5DZaR65~Lpv|O$ zf|E*AQ+S&^b1fJh5Sle4n32Xxcgk~~&QWy4p7N&W44qB>6%Ud<@(W3(6WS$2Wq#w@|6YGDou{Wdfg@PgcpYFCn|CN2%* zPnC6Ly30lva8iw`+?P%uBgqlf@Q@p?-#;38tHnmMyIa7qq}ZjoI6kAKW;IZiHGU>$ zzH?nMw+E*k(sO6g!1?%*396A&&sGIFlh7NVIL@4(?moVN^IxKpOebe5f93TK2wG;i~nAg7gSzU%cIl=D|3{2YDq3#(>9jWvpCf=t!K zY#fsq`GU#&IlJ9#l(Wie`^N&W^Cq_RmOpn)J-ctwi96L$lpSigv>-NBw)bFvHD-Ig zMVZ3px7J$#>Vemr6=L{P8UBig(*vIQR)D6M790g|KJj|KCIU}D0di1Kz%>#;6%t;D z8}z9!b<;B20{7lPx+l4@t=%=aKaZ2e_{+8`0a$P zrEvM-&SfqGF3VSa-ZVZo^mdcNa|>%Yf6`EN8=y34>n2X8JBouZy4SexAYDJ zc`Xc~C51uZ3i2Nha@Yk02T4ZVD_VImdZ0P7bhS3*bXf3NKE~)QIUtiyk~`$M z$DVL0xy&z>Gf(QK>{VxR|jE4pYfndYeYA|}ZhZb;!s_=~+37}); z2{qt#hovxGf*1*3NV3DNO(MWq?@#D&$aiiIp|d!Y_FSM}G;rG4#=;JU1H1SaIwTL> zG5u4|FER-3jtEk|J*asbCRF~mXKOA213Q2YV1$}51O&W81BgQd&=P{+@5xMqmUm@L zfG{)~<{jFxe5V9}o!WM}r3AM648(8=6Rd~?@Q30g3TiO|7qE^tR=n<52j1P31zP|! zjFbi99r}050{)${{>M{RI+UTd_RQ^+CH{Y#vKS%tJE>wTWd%Sl!>?1;=II-HF*Z{c zoQUClev5Wq!=3i8%fBIqalqdA3n`2L|3S+7wI_bl{v~B;ZCj1lT#Iv1YilijZ~NGZ zm)-4S^Ypm+@W0{f-++NT{=@v8nD`58A@na>iy9R7?iTUutp!AT@5=sL+lK_?h@I`@ EAJ^8(@&Et; diff --git a/re2c/makerpm.in b/re2c/makerpm.in deleted file mode 100644 index 6dfe80a1..00000000 --- a/re2c/makerpm.in +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh - -# $Id$ -# M.Boerger - -PREFIX="@PACKAGE_NAME@" -VERSION="@PACKAGE_VERSION@" -TARDIR="`basename \`pwd\``" -RELEASE=${1:-1} - -echo "Usage:" -echo "$0 " -echo -echo "e.g.:" -echo "$0" -echo -n "Building RPM version $VERSION, release: $RELEASE " -sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n . -echo - -TAR=@PACKAGE_TARNAME@-$VERSION.tar.gz -SPEC=re2c-${VERSION}.spec - -RPMBASE=/usr/src/redhat -for i in /usr/src/redhat /usr/src/packages /usr/src/RPM; do - if test -d $i; then - RPMBASE=$i - break - fi -done - -RPMDIR=${RPMBASE}/RPMS -SPECDIR=${RPMBASE}/SPECS -SRCDIR=${RPMBASE}/SOURCES - -make dist -cp $TAR $SRCDIR - -cat re2c.spec | sed -e "s/RPM_RELEASE/${RELEASE}/g" > ${SPEC} - -echo "CP: (`pwd`) cp -a $SPEC $SPECDIR/${SPEC}" -cp -a $SPEC $SPECDIR/${SPEC} -#cp -a *.patch $SRCDIR -cd $SPECDIR -echo "RPM: rpm -ba ${SPEC}" -rpmbuild -ba ${SPEC} diff --git a/re2c/re2c.rules b/re2c/re2c.rules deleted file mode 100755 index 45ade932..00000000 --- a/re2c/re2c.rules +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/re2c/re2c.spec.in b/re2c/re2c.spec.in deleted file mode 100644 index 0f47decd..00000000 --- a/re2c/re2c.spec.in +++ /dev/null @@ -1,52 +0,0 @@ -Summary: A tool for generating C-based recognizers from regular expressions -Name: @PACKAGE_NAME@ -Version: @PACKAGE_VERSION@ -Release: @PACKAGE_RELEASE@ -License: Public Domain -Group: Development/Tools -URL: http://re2c.org/ -Source0: http://prdownloads.sourceforge.net/re2c/re2c-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -%description -re2c is a great tool for writing fast and flexible lexers. It has -served many people well for many years and it deserves to be -maintained more actively. re2c is on the order of 2-3 times faster -than a flex based scanner, and its input model is much more -flexible. - -%prep - -%setup -q - -%build -./configure \ - --prefix=%{_prefix} -make re2c -#regenerate file scanner.cc -rm -f scanner.cc -./re2c -b scanner.re > scanner.cc -rm -f re2c scanner.o -make - -%install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_bindir} -install -m 0755 re2c $RPM_BUILD_ROOT%{_bindir} - -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 -install -m 0755 re2c.1 $RPM_BUILD_ROOT%{_mandir}/man1 - -%clean -rm -rf $RPM_BUILD_ROOT - -%changelog -* Sun Jan 04 2003 Marcus Boerger -- Initial version. - -%files -%defattr(-,root,root) -%{_bindir}/re2c -%{_mandir}/man1/re2c.1* - -%doc README examples doc/* lessons diff --git a/re2c/release.sh b/re2c/release.sh index 40f52ed2..01bba23f 100755 --- a/re2c/release.sh +++ b/re2c/release.sh @@ -11,47 +11,52 @@ fi version="$1" # edit version in configure.in -lcontext="AC_INIT\(re2c, " -rcontext=", re2c-general@lists\.sourceforge\.net\)" +lcontext="AC_INIT\(\[re2c\],\[" +rcontext="\],\[re2c-general@lists\.sourceforge\.net\]\)" old="[0-9]+(\.[0-9]+)*(\.dev)?" new=$version sed -i -E "s/$lcontext$old$rcontext/$lcontext$new$rcontext/" configure.ac ./autogen.sh -./configure --enable-docs -make clean -make -j5 -make docs -make tests -make zip dist - -# dist-check -tmpdir=` date +"%Y%m%d%H%M%S%N"` -mkdir $tmpdir -cp re2c-$version.tar.gz $tmpdir -cd $tmpdir -gunzip re2c-$version.tar.gz -tar -x -f re2c-$version.tar -cd re2c-$version -./configure -make -j5 -make tests -cd ../.. -rm -r $tmpdir +builddir=.build +rm -rf $builddir +mkdir $builddir +cd $builddir + + ../configure --enable-docs && \ + make bootstrap -j5 && \ + make tests && \ + make dist + + # dist-check + tmpdir=` date +"%Y%m%d%H%M%S%N"` + mkdir $tmpdir + cp re2c-$version.tar.gz $tmpdir + cd $tmpdir + gunzip re2c-$version.tar.gz + tar -x -f re2c-$version.tar + cd re2c-$version + ./configure && \ + make bootstrap -j5 && \ + make tests + + # upload files on sourceforge + src=release + src_tarballs=$src/frs/project/re2c/re2c/$version + src_docs=$src/project-web/re2c/htdocs + mkdir -p $src_tarballs + mkdir -p $src_docs + cp ../../re2c-$version.tar.gz $src_tarballs + cp doc/index.html doc/manual.html $src_docs + rsync -rK $src/ skvadrik@web.sourceforge.net:/home + cd .. + cd .. + rm -r $tmpdir + +cd .. # $builddir # commit release git commit -a -m "Release $version." git tag $version git push git push --tags - -# upload files on sourceforge -src=release -src_tarballs=$src/frs/project/re2c/re2c/$version -src_docs=$src/project-web/re2c/htdocs -rm -rf $src -mkdir -p $src_tarballs -mkdir -p $src_docs -cp re2c-$version-src.zip re2c-$version.tar.gz $src_tarballs -cp htdocs/index.html htdocs/manual.html $src_docs -rsync -rK $src/ skvadrik@web.sourceforge.net:/home diff --git a/re2c/run_tests.sh.in b/re2c/run_tests.sh.in index 06ffaffd..59c4823b 100644 --- a/re2c/run_tests.sh.in +++ b/re2c/run_tests.sh.in @@ -1,7 +1,28 @@ #!/bin/bash +# somewhat portable way to detect CPU count +detect_cpu_count () { + if [ "$CPUS" = "" ]; then + # Windows standard environment variable + CPUS="$NUMBER_OF_PROCESSORS" + fi + if [ "$CPUS" = "" ]; then + # Linux + CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` + fi + if [ "$CPUS" = "" ]; then + # FreeBSD + CPUS=`getconf NPROCESSORS_ONLN 2>/dev/null` + fi + if [ "$CPUS" = "" ]; then + # nothing helped + CPUS="1" + fi + echo "using ${CPUS} CPUs" >&2 +} + valgrind="" -threads=1 +threads=`detect_cpu_count; echo $CPUS` tests=() for arg in $* do @@ -19,9 +40,10 @@ do esac done +testdir="@srcdir@/test" if [ ${#tests[@]} -eq 0 ] then - tests=(`for i in test lessons; do find @top_srcdir@/$i -name '*.re'; done | sort`) + tests=(`for i in $testdir; do find $i -name '*.re'; done | sort`) fi tests_per_thread=$((${#tests[@]} / threads + 1)) packs=() @@ -62,19 +84,19 @@ run_pack() { for x in $* do local switches=`basename $x | sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g' -e 's/\([^ ]\)--/\1 --/g' -e 's/(\([^)]*\))/ \1/g' -e 's/- //g'` - local genname=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^o]*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),@builddir@/test/\1,g'` - local headers=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^t]*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),@builddir@/test/\1,g'` - local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1@builddir@/test/\2,g'` + local genname=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^o]*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),'"$testdir"'/\1,g'` + local headers=` printf "%s" "$switches" | sed -e 's,--.*$,,g' -e 's,^.[^t]*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),'"$testdir"'/\1,g'` + local switches=`printf "%s" "$switches" | sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1'"$testdir"'/\2,g'` # don't use the -o flag, since it makes it harder to diff. - local outname=@builddir@/test/`basename ${x%.re}.c.temp` - local outdiff=@builddir@/test/`basename ${x%.re}.c.diff` - local typname=@builddir@/test/`basename ${x%.re}.h.temp` - local typdiff=@builddir@/test/`basename ${x%.re}.h.diff` + local outname=$testdir/`basename ${x%.re}.c.temp` + local outdiff=$testdir/`basename ${x%.re}.c.diff` + local typname=$testdir/`basename ${x%.re}.h.temp` + local typdiff=$testdir/`basename ${x%.re}.h.diff` - $re2c $switches $x 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e "s,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g" > $outname + $re2c $switches $x 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $outname if test -n "$genname" then - cat $genname | sed -e 's,@builddir@/test/,,g' -e "s,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g" > $outname + cat $genname | sed -e 's,'"$testdir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $outname rm $genname fi @@ -96,7 +118,7 @@ run_pack() { if test -n "$headers" then - cat $headers | sed -e 's,@builddir@/test/,,g' -e "s,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g" > $typname + cat $headers | sed -e 's,'"$testdir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $typname rm $headers if test ! -f ${x%.re}.h then diff --git a/re2c/actions.cc b/re2c/src/actions.cc similarity index 99% rename from re2c/actions.cc rename to re2c/src/actions.cc index edf32bfd..2c106e61 100644 --- a/re2c/actions.cc +++ b/re2c/src/actions.cc @@ -5,13 +5,13 @@ #include #include -#include "globals.h" -#include "parser.h" -#include "dfa.h" -#include "print.h" -#include "skeleton.h" -#include "utf8_regexp.h" -#include "utf16_regexp.h" +#include "src/dfa.h" +#include "src/globals.h" +#include "src/parser.h" +#include "src/print.h" +#include "src/skeleton.h" +#include "src/utf8_regexp.h" +#include "src/utf16_regexp.h" namespace re2c { diff --git a/re2c/src/c99_stdint.h b/re2c/src/c99_stdint.h new file mode 100644 index 00000000..33d7fa91 --- /dev/null +++ b/re2c/src/c99_stdint.h @@ -0,0 +1,259 @@ +#ifndef __C99_STDINT__ +#define __C99_STDINT__ + +#include "config.h" + +#if HAVE_STDINT_H +# include +#else // HAVE_STDINT_H + +// A humble attempt to provide C99 compliant +// for environments that don't have it (e.g., MSVC 2003). +// +// First, we try to define exact-width integer types. We don't +// rely on any particular environment: instead, we search for +// a type of certain width in the following list: +// char (C89) +// short (C89) +// int (C89) +// long (C89) +// long long (C99) +// __int64 (MSVC-specific) +// (we consider even insane possibilities for simplicity). +// The size of each type is defined by autoconf in the form +// of a macro SIZEOF_ (set to 0 for nonexistent types). +// If we don't find a type with the required width, we typedef +// the corresponding exact-width C99 type to a nonexistent +// type name so that further compilation will fail. +// +// We define other types and constants based on exact-width +// types and C99 standard. +// +// We use SIZEOF_VOID_P to determine size of pointers. +// +// We use SIZEOF_0 to find suitable 64-bit integer +// constant suffix. + +typedef +#if SIZEOF_CHAR == 1 + char +#elif SIZEOF_SHORT == 1 + short +#elif SIZEOF_INT == 1 + int +#elif SIZEOF_LONG == 1 + long +#elif SIZEOF_LONG_LONG == 1 + long long +#elif SIZEOF___INT64 == 1 + __int64 +#else + nonexistent_byte1_type +#endif +byte1_type; + +typedef +#if SIZEOF_CHAR == 2 + char +#elif SIZEOF_SHORT == 2 + short +#elif SIZEOF_INT == 2 + int +#elif SIZEOF_LONG == 2 + long +#elif SIZEOF_LONG_LONG == 2 + long long +#elif SIZEOF___INT64 == 2 + __int64 +#else + nonexistent_byte2_type +#endif +byte2_type; + +typedef +#if SIZEOF_CHAR == 4 + char +#elif SIZEOF_SHORT == 4 + short +#elif SIZEOF_INT == 4 + int +#elif SIZEOF_LONG == 4 + long +#elif SIZEOF_LONG_LONG == 4 + long long +#elif SIZEOF___INT64 == 4 + __int64 +#else + nonexistent_byte4_type +#endif +byte4_type; + +typedef +#if SIZEOF_CHAR == 8 + char +#elif SIZEOF_SHORT == 8 + short +#elif SIZEOF_INT == 8 + int +#elif SIZEOF_LONG == 8 + long +#elif SIZEOF_LONG_LONG == 8 + long long +#elif SIZEOF___INT64 == 8 + __int64 +#else + nonexistent_byte8_type +#endif +byte8_type; + +// C99-7.18.1.1 Exact-width integer types +typedef byte1_type int8_t; +typedef byte2_type int16_t; +typedef byte4_type int32_t; +typedef byte8_type int64_t; +typedef unsigned byte1_type uint8_t; +typedef unsigned byte2_type uint16_t; +typedef unsigned byte4_type uint32_t; +typedef unsigned byte8_type uint64_t; + +// C99-7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// C99-7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// C99-7.18.1.4 Integer types capable of holding object pointers +#if SIZEOF_VOID_P == 8 + typedef int64_t intptr_t; + typedef uint64_t uintptr_t; +#else + typedef int intptr_t; + typedef unsigned int uintptr_t; +#endif + +// C99-7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // See footnote 220 at page 257 and footnote 221 at page 259 + +// C99-7.18.2.1 Limits of exact-width integer types +#define INT8_MIN (-128) // -2^(8 - 1) +#define INT8_MAX 127 // 2^(8 - 1) - 1 +#define INT16_MIN (-32768) // -2^(16 - 1) +#define INT16_MAX 32767 // 2^(16 - 1) - 1 +#define INT32_MIN (-2147483648) // -2^(32 - 1) +#define INT32_MAX 2147483647 // 2^(32 - 1) - 1 +#define INT64_MIN (-9223372036854775808) // -2^(64 - 1) +#define INT64_MAX 9223372036854775807 // 2^(64 - 1) - 1 +#define UINT8_MAX 0xFF // 2^8 - 1 +#define UINT16_MAX 0xFFFF // 2^16 - 1 +#define UINT32_MAX 0xFFFFffff // 2^32 - 1 +#define UINT64_MAX 0xFFFFffffFFFFffff // 2^64 - 1 + +// C99-7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// C99-7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// C99-7.18.2.4 Limits of integer types capable of holding object pointers +#define INTPTR_MIN (-32767) // -(2^15 - 1) +#define INTPTR_MAX 32767 // 2^15 - 1 +#define UINTPTR_MAX 0xFFFF // 2^16 - 1 + +// C99-7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN (-9223372036854775807) // -(2^63 - 1) +#define INTMAX_MAX 9223372036854775807 // 2^63 - 1 +#define UINTMAX_MAX 0xFFFFffffFFFFffff // 2^64 - 1 + +// C99-7.18.3 Limits of other integer types: +// "An implementation shall define only the macros +// corresponding to those typedef names it actually +// provides" +// and footnote 222 at page 259: +// "A freestanding implementation need not provide +// all of these types." +// +// Since we don't define corresponding types, we don't +// define the following limits either: +// PTRDIFF_MIN +// PTRDIFF_MAX +// SIG_ATOMIC_MIN +// SIG_ATOMIC_MAX +// SIZE_MAX +// WCHAR_MIN +// WCHAR_MAX +// WINT_MIN +// WINT_MAX + +#endif // __STDC_LIMIT_MACROS + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // See footnote 224 at page 260 + +// C99-7.18.4.1 Macros for minimum-width integer constants +#define INT8_C(x) x +#define UINT8_C(x) x##u +#define INT16_C(x) x +#define UINT16_C(x) x##u +#define INT32_C(x) x +#define UINT32_C(x) x##u +#if SIZEOF_0L == 8 +# define INT64_C(x) x##l +# define UINT64_C(x) x##ul +#elif SIZEOF_0LL == 8 +# define INT64_C(x) x##ll +# define UINT64_C(x) x##ull +#elif SIZEOF_0I8 == 8 +# define INT64_C(x) x##i8 +# define UINT64_C(x) x##ui8 +#else +# define INT64_C(x) x +# define UINT64_C(x) x##u +#endif + +// C99-7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS + +#endif // HAVE_STDINT_H + +#endif // __C99_STDINT__ diff --git a/re2c/code.cc b/re2c/src/code.cc similarity index 99% rename from re2c/code.cc rename to re2c/src/code.cc index 3ed13e14..db91252e 100644 --- a/re2c/code.cc +++ b/re2c/src/code.cc @@ -10,16 +10,16 @@ #include #include -#include "code.h" -#include "globals.h" -#include "go.h" -#include "dfa.h" -#include "indent.h" -#include "input_api.h" -#include "parser.h" -#include "print.h" -#include "skeleton.h" -#include "substr.h" +#include "src/code.h" +#include "src/dfa.h" +#include "src/globals.h" +#include "src/go.h" +#include "src/indent.h" +#include "src/input_api.h" +#include "src/parser.h" +#include "src/print.h" +#include "src/skeleton.h" +#include "src/substr.h" namespace re2c { diff --git a/re2c/code.h b/re2c/src/code.h old mode 100755 new mode 100644 similarity index 97% rename from re2c/code.h rename to re2c/src/code.h index a0b6894b..82dda71b --- a/re2c/code.h +++ b/re2c/src/code.h @@ -2,7 +2,7 @@ #ifndef _code_h #define _code_h -#include "re.h" +#include "src/re.h" namespace re2c { diff --git a/re2c/code_names.cc b/re2c/src/code_names.cc similarity index 85% rename from re2c/code_names.cc rename to re2c/src/code_names.cc index 93668acb..96f87349 100644 --- a/re2c/code_names.cc +++ b/re2c/src/code_names.cc @@ -1,5 +1,5 @@ -#include "code_names.h" -#include "globals.h" +#include "src/code_names.h" +#include "src/globals.h" namespace re2c { diff --git a/re2c/code_names.h b/re2c/src/code_names.h similarity index 100% rename from re2c/code_names.h rename to re2c/src/code_names.h diff --git a/re2c/dfa.cc b/re2c/src/dfa.cc similarity index 97% rename from re2c/dfa.cc rename to re2c/src/dfa.cc index 249358a9..e7448d97 100644 --- a/re2c/dfa.cc +++ b/re2c/src/dfa.cc @@ -1,10 +1,11 @@ #include #include #include -#include "globals.h" -#include "substr.h" -#include "dfa.h" -#include "print.h" + +#include "src/dfa.h" +#include "src/globals.h" +#include "src/print.h" +#include "src/substr.h" namespace re2c { diff --git a/re2c/dfa.h b/re2c/src/dfa.h similarity index 99% rename from re2c/dfa.h rename to re2c/src/dfa.h index 501be0d7..1722075e 100644 --- a/re2c/dfa.h +++ b/re2c/src/dfa.h @@ -5,8 +5,8 @@ #include #include -#include "go.h" -#include "re.h" +#include "src/go.h" +#include "src/re.h" namespace re2c { diff --git a/re2c/enc.cc b/re2c/src/enc.cc similarity index 99% rename from re2c/enc.cc rename to re2c/src/enc.cc index 4d7eb7d0..3580027b 100644 --- a/re2c/enc.cc +++ b/re2c/src/enc.cc @@ -1,4 +1,4 @@ -#include "enc.h" +#include "src/enc.h" namespace re2c { diff --git a/re2c/enc.h b/re2c/src/enc.h similarity index 98% rename from re2c/enc.h rename to re2c/src/enc.h index cf04a723..c5b26709 100644 --- a/re2c/enc.h +++ b/re2c/src/enc.h @@ -1,8 +1,8 @@ #ifndef _enc_h #define _enc_h -#include "c99_stdint.h" -#include "range.h" +#include "src/c99_stdint.h" +#include "src/range.h" namespace re2c { diff --git a/re2c/free_list.h b/re2c/src/free_list.h similarity index 100% rename from re2c/free_list.h rename to re2c/src/free_list.h diff --git a/re2c/globals.h b/re2c/src/globals.h similarity index 95% rename from re2c/globals.h rename to re2c/src/globals.h index 20a74784..69cd36b9 100644 --- a/re2c/globals.h +++ b/re2c/src/globals.h @@ -6,10 +6,10 @@ #include #include -#include "c99_stdint.h" -#include "code_names.h" -#include "enc.h" -#include "input_api.h" +#include "src/c99_stdint.h" +#include "src/code_names.h" +#include "src/enc.h" +#include "src/input_api.h" namespace re2c { diff --git a/re2c/go.h b/re2c/src/go.h similarity index 98% rename from re2c/go.h rename to re2c/src/go.h index cf311166..d7f8c107 100644 --- a/re2c/go.h +++ b/re2c/src/go.h @@ -4,8 +4,8 @@ #include #include -#include "c99_stdint.h" -#include "code.h" +#include "src/c99_stdint.h" +#include "src/code.h" namespace re2c { diff --git a/re2c/go_construct.cc b/re2c/src/go_construct.cc similarity index 99% rename from re2c/go_construct.cc rename to re2c/src/go_construct.cc index 692aab1c..0d096a38 100644 --- a/re2c/go_construct.cc +++ b/re2c/src/go_construct.cc @@ -1,5 +1,5 @@ -#include "dfa.h" -#include "go.h" +#include "src/dfa.h" +#include "src/go.h" namespace re2c { diff --git a/re2c/go_destruct.cc b/re2c/src/go_destruct.cc similarity index 95% rename from re2c/go_destruct.cc rename to re2c/src/go_destruct.cc index e419ef96..16ae3bc0 100644 --- a/re2c/go_destruct.cc +++ b/re2c/src/go_destruct.cc @@ -1,5 +1,5 @@ -#include "dfa.h" -#include "go.h" +#include "src/dfa.h" +#include "src/go.h" namespace re2c { diff --git a/re2c/go_emit.cc b/re2c/src/go_emit.cc similarity index 98% rename from re2c/go_emit.cc rename to re2c/src/go_emit.cc index cd8ca240..91db85ba 100644 --- a/re2c/go_emit.cc +++ b/re2c/src/go_emit.cc @@ -1,7 +1,7 @@ -#include "dfa.h" -#include "go.h" -#include "indent.h" -#include "print.h" +#include "src/dfa.h" +#include "src/go.h" +#include "src/indent.h" +#include "src/print.h" namespace re2c { diff --git a/re2c/go_used_labels.cc b/re2c/src/go_used_labels.cc similarity index 97% rename from re2c/go_used_labels.cc rename to re2c/src/go_used_labels.cc index 55e8b5ce..c441ddff 100644 --- a/re2c/go_used_labels.cc +++ b/re2c/src/go_used_labels.cc @@ -1,5 +1,5 @@ -#include "dfa.h" -#include "go.h" +#include "src/dfa.h" +#include "src/go.h" namespace re2c { diff --git a/re2c/indent.h b/re2c/src/indent.h similarity index 90% rename from re2c/indent.h rename to re2c/src/indent.h index 473f0e5f..1fdc6842 100644 --- a/re2c/indent.h +++ b/re2c/src/indent.h @@ -2,7 +2,8 @@ #define _indent_h #include -#include "globals.h" + +#include "src/globals.h" namespace re2c { diff --git a/re2c/input.cc b/re2c/src/input.cc similarity index 93% rename from re2c/input.cc rename to re2c/src/input.cc index 0056394c..cb305e43 100644 --- a/re2c/input.cc +++ b/re2c/src/input.cc @@ -1,4 +1,4 @@ -#include "input.h" +#include "src/input.h" namespace re2c { diff --git a/re2c/input.h b/re2c/src/input.h similarity index 92% rename from re2c/input.h rename to re2c/src/input.h index 8d1c9bbf..b8dd4b1a 100644 --- a/re2c/input.h +++ b/re2c/src/input.h @@ -1,7 +1,7 @@ #ifndef _input_h #define _input_h -#include "stdio.h" +#include #include namespace re2c { diff --git a/re2c/input_api.cc b/re2c/src/input_api.cc similarity index 97% rename from re2c/input_api.cc rename to re2c/src/input_api.cc index 7ee35693..031b12b0 100644 --- a/re2c/input_api.cc +++ b/re2c/src/input_api.cc @@ -1,8 +1,8 @@ #include -#include "globals.h" -#include "indent.h" -#include "input_api.h" +#include "src/globals.h" +#include "src/indent.h" +#include "src/input_api.h" namespace re2c { diff --git a/re2c/input_api.h b/re2c/src/input_api.h similarity index 96% rename from re2c/input_api.h rename to re2c/src/input_api.h index 2c87b3bb..e1af3b54 100644 --- a/re2c/input_api.h +++ b/re2c/src/input_api.h @@ -4,7 +4,7 @@ #include #include -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/ins.h b/re2c/src/ins.h similarity index 95% rename from re2c/ins.h rename to re2c/src/ins.h index e86ef3f7..7805b758 100644 --- a/re2c/ins.h +++ b/re2c/src/ins.h @@ -2,7 +2,7 @@ #ifndef _ins_h #define _ins_h -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/main.cc b/re2c/src/main.cc similarity index 98% rename from re2c/main.cc rename to re2c/src/main.cc index 45fd9fe3..91b875ad 100644 --- a/re2c/main.cc +++ b/re2c/src/main.cc @@ -1,20 +1,16 @@ /* $Id$ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#elif defined(_WIN32) -#include "config_w32.h" -#endif #include #include #include #include -#include "globals.h" -#include "parser.h" -#include "dfa.h" -#include "enc.h" -#include "mbo_getopt.h" +#include "config.h" +#include "src/dfa.h" +#include "src/enc.h" +#include "src/globals.h" +#include "src/mbo_getopt.h" +#include "src/parser.h" namespace re2c { diff --git a/re2c/mbo_getopt.cc b/re2c/src/mbo_getopt.cc old mode 100755 new mode 100644 similarity index 99% rename from re2c/mbo_getopt.cc rename to re2c/src/mbo_getopt.cc index 95b3c7fa..161f3b3f --- a/re2c/mbo_getopt.cc +++ b/re2c/src/mbo_getopt.cc @@ -8,7 +8,9 @@ #include #include #include -#include "mbo_getopt.h" + +#include "src/mbo_getopt.h" + #define OPTERRCOLON (1) #define OPTERRNF (2) #define OPTERRARG (3) diff --git a/re2c/mbo_getopt.h b/re2c/src/mbo_getopt.h old mode 100755 new mode 100644 similarity index 100% rename from re2c/mbo_getopt.h rename to re2c/src/mbo_getopt.h diff --git a/re2c/output.cc b/re2c/src/output.cc similarity index 98% rename from re2c/output.cc rename to re2c/src/output.cc index e37c8e2e..2a8ccb6c 100644 --- a/re2c/output.cc +++ b/re2c/src/output.cc @@ -1,9 +1,9 @@ #include #include -#include "output.h" -#include "print.h" -#include "re.h" +#include "src/output.h" +#include "src/print.h" +#include "src/re.h" namespace re2c { diff --git a/re2c/output.h b/re2c/src/output.h similarity index 98% rename from re2c/output.h rename to re2c/src/output.h index f61da8ea..26d1c4eb 100644 --- a/re2c/output.h +++ b/re2c/src/output.h @@ -6,7 +6,7 @@ #include #include -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/parser.h b/re2c/src/parser.h similarity index 90% rename from re2c/parser.h rename to re2c/src/parser.h index b067d8ff..c0cafb9d 100644 --- a/re2c/parser.h +++ b/re2c/src/parser.h @@ -2,9 +2,9 @@ #ifndef _parser_h #define _parser_h -#include "output.h" -#include "re.h" -#include "scanner.h" +#include "src/output.h" +#include "src/re.h" +#include "src/scanner.h" namespace re2c { diff --git a/re2c/parser.y b/re2c/src/parser.ypp similarity index 99% rename from re2c/parser.y rename to re2c/src/parser.ypp index f3582769..6f9fb5bf 100644 --- a/re2c/parser.y +++ b/re2c/src/parser.ypp @@ -2,10 +2,6 @@ /* $Id$ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include @@ -13,11 +9,12 @@ #include #include -#include "globals.h" -#include "parser.h" -#include "c99_stdint.h" -#include "dfa.h" -#include "smart_ptr.h" +#include "config.h" +#include "src/c99_stdint.h" +#include "src/dfa.h" +#include "src/globals.h" +#include "src/parser.h" +#include "src/smart_ptr.h" #define YYMALLOC malloc #define YYFREE free diff --git a/re2c/print.cc b/re2c/src/print.cc similarity index 98% rename from re2c/print.cc rename to re2c/src/print.cc index e3ae8f0f..3e7a782a 100644 --- a/re2c/print.cc +++ b/re2c/src/print.cc @@ -1,7 +1,7 @@ #include -#include "globals.h" -#include "print.h" +#include "src/globals.h" +#include "src/print.h" namespace re2c { diff --git a/re2c/print.h b/re2c/src/print.h similarity index 90% rename from re2c/print.h rename to re2c/src/print.h index 483ae819..1c12758c 100644 --- a/re2c/print.h +++ b/re2c/src/print.h @@ -3,7 +3,7 @@ #include -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/range.cc b/re2c/src/range.cc similarity index 97% rename from re2c/range.cc rename to re2c/src/range.cc index 8f4624f7..331c3606 100644 --- a/re2c/range.cc +++ b/re2c/src/range.cc @@ -1,5 +1,5 @@ -#include "print.h" -#include "range.h" +#include "src/print.h" +#include "src/range.h" namespace re2c { diff --git a/re2c/range.h b/re2c/src/range.h similarity index 93% rename from re2c/range.h rename to re2c/src/range.h index a6a0e0f0..5cb5968a 100644 --- a/re2c/range.h +++ b/re2c/src/range.h @@ -3,8 +3,8 @@ #include -#include "c99_stdint.h" -#include "free_list.h" +#include "src/c99_stdint.h" +#include "src/free_list.h" namespace re2c { diff --git a/re2c/range_suffix.cc b/re2c/src/range_suffix.cc similarity index 89% rename from re2c/range_suffix.cc rename to re2c/src/range_suffix.cc index c60eab16..1e935699 100644 --- a/re2c/range_suffix.cc +++ b/re2c/src/range_suffix.cc @@ -1,5 +1,5 @@ -#include "re.h" -#include "range_suffix.h" +#include "src/re.h" +#include "src/range_suffix.h" namespace re2c { diff --git a/re2c/range_suffix.h b/re2c/src/range_suffix.h similarity index 90% rename from re2c/range_suffix.h rename to re2c/src/range_suffix.h index f29f95b1..638cba74 100644 --- a/re2c/range_suffix.h +++ b/re2c/src/range_suffix.h @@ -3,8 +3,8 @@ #include // NULL -#include "c99_stdint.h" -#include "free_list.h" +#include "src/c99_stdint.h" +#include "src/free_list.h" namespace re2c { diff --git a/re2c/re.h b/re2c/src/re.h similarity index 97% rename from re2c/re.h rename to re2c/src/re.h index 43ea0569..b0e96959 100644 --- a/re2c/re.h +++ b/re2c/src/re.h @@ -9,13 +9,13 @@ #include #include -#include "free_list.h" -#include "globals.h" -#include "ins.h" -#include "output.h" -#include "range.h" -#include "smart_ptr.h" -#include "token.h" +#include "src/free_list.h" +#include "src/globals.h" +#include "src/ins.h" +#include "src/output.h" +#include "src/range.h" +#include "src/smart_ptr.h" +#include "src/token.h" namespace re2c { diff --git a/re2c/scanner.h b/re2c/src/scanner.h similarity index 95% rename from re2c/scanner.h rename to re2c/src/scanner.h index 8271aeb7..c8c81c4c 100644 --- a/re2c/scanner.h +++ b/re2c/src/scanner.h @@ -4,11 +4,11 @@ #include -#include "globals.h" -#include "input.h" -#include "output.h" -#include "re.h" -#include "token.h" +#include "src/globals.h" +#include "src/input.h" +#include "src/output.h" +#include "src/re.h" +#include "src/token.h" namespace re2c { diff --git a/re2c/scanner.re b/re2c/src/scanner.re similarity index 98% rename from re2c/scanner.re rename to re2c/src/scanner.re index 354aa61e..2eb403df 100644 --- a/re2c/scanner.re +++ b/re2c/src/scanner.re @@ -2,12 +2,13 @@ #include #include #include -#include "scanner.h" -#include "parser.h" + +#include "src/dfa.h" +#include "src/globals.h" +#include "src/parser.h" +#include "src/print.h" +#include "src/scanner.h" #include "y.tab.h" -#include "globals.h" -#include "dfa.h" -#include "print.h" extern YYSTYPE yylval; diff --git a/re2c/skeleton.cc b/re2c/src/skeleton.cc similarity index 99% rename from re2c/skeleton.cc rename to re2c/src/skeleton.cc index 3ddd7e02..c5db72b7 100644 --- a/re2c/skeleton.cc +++ b/re2c/src/skeleton.cc @@ -1,6 +1,6 @@ -#include "indent.h" -#include "print.h" -#include "skeleton.h" +#include "src/indent.h" +#include "src/print.h" +#include "src/skeleton.h" namespace re2c { diff --git a/re2c/skeleton.h b/re2c/src/skeleton.h similarity index 98% rename from re2c/skeleton.h rename to re2c/src/skeleton.h index bbd5a00c..2cedd2a4 100644 --- a/re2c/skeleton.h +++ b/re2c/src/skeleton.h @@ -4,8 +4,8 @@ #include #include -#include "c99_stdint.h" -#include "dfa.h" +#include "src/c99_stdint.h" +#include "src/dfa.h" namespace re2c { diff --git a/re2c/smart_ptr.h b/re2c/src/smart_ptr.h similarity index 100% rename from re2c/smart_ptr.h rename to re2c/src/smart_ptr.h diff --git a/re2c/substr.cc b/re2c/src/substr.cc similarity index 93% rename from re2c/substr.cc rename to re2c/src/substr.cc index 9ac32bd5..0c1ecd67 100644 --- a/re2c/substr.cc +++ b/re2c/src/substr.cc @@ -1,8 +1,9 @@ /* $Id$ */ #include #include -#include "substr.h" -#include "globals.h" + +#include "src/globals.h" +#include "src/substr.h" #ifndef HAVE_STRNDUP diff --git a/re2c/substr.h b/re2c/src/substr.h similarity index 94% rename from re2c/substr.h rename to re2c/src/substr.h index f8813532..4b1edb0d 100644 --- a/re2c/substr.h +++ b/re2c/src/substr.h @@ -6,13 +6,8 @@ #include #include -#include "c99_stdint.h" - -#ifdef HAVE_CONFIG_H #include "config.h" -#elif defined(_WIN32) -#include "config_w32.h" -#endif +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/token.h b/re2c/src/token.h similarity index 97% rename from re2c/token.h rename to re2c/src/token.h index 022658d3..c9066c85 100644 --- a/re2c/token.h +++ b/re2c/src/token.h @@ -2,7 +2,7 @@ #ifndef _token_h #define _token_h -#include "substr.h" +#include "src/substr.h" namespace re2c { diff --git a/re2c/translate.cc b/re2c/src/translate.cc similarity index 89% rename from re2c/translate.cc rename to re2c/src/translate.cc index 7c245e73..f4110efd 100644 --- a/re2c/translate.cc +++ b/re2c/src/translate.cc @@ -1,5 +1,5 @@ /* $Id$ */ -#include "globals.h" +#include "src/globals.h" namespace re2c { diff --git a/re2c/utf16.cc b/re2c/src/utf16.cc similarity index 90% rename from re2c/utf16.cc rename to re2c/src/utf16.cc index fff40159..83d52185 100644 --- a/re2c/utf16.cc +++ b/re2c/src/utf16.cc @@ -1,4 +1,4 @@ -#include "utf16.h" +#include "src/utf16.h" namespace re2c { diff --git a/re2c/utf16.h b/re2c/src/utf16.h similarity index 96% rename from re2c/utf16.h rename to re2c/src/utf16.h index c6613915..3a844648 100644 --- a/re2c/utf16.h +++ b/re2c/src/utf16.h @@ -1,7 +1,7 @@ #ifndef _re2c_utf16_h #define _re2c_utf16_h -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/utf16_range.cc b/re2c/src/utf16_range.cc similarity index 98% rename from re2c/utf16_range.cc rename to re2c/src/utf16_range.cc index eac41720..8d1b7576 100644 --- a/re2c/utf16_range.cc +++ b/re2c/src/utf16_range.cc @@ -1,5 +1,5 @@ -#include "re.h" -#include "utf16_range.h" +#include "src/re.h" +#include "src/utf16_range.h" namespace re2c { diff --git a/re2c/utf16_range.h b/re2c/src/utf16_range.h similarity index 90% rename from re2c/utf16_range.h rename to re2c/src/utf16_range.h index ad211b3b..8d467d36 100644 --- a/re2c/utf16_range.h +++ b/re2c/src/utf16_range.h @@ -1,8 +1,8 @@ #ifndef _utf16_range_h #define _utf16_range_h -#include "range_suffix.h" -#include "utf16.h" +#include "src/range_suffix.h" +#include "src/utf16.h" namespace re2c { diff --git a/re2c/utf16_regexp.cc b/re2c/src/utf16_regexp.cc similarity index 90% rename from re2c/utf16_regexp.cc rename to re2c/src/utf16_regexp.cc index 02c8e6c4..cdc1aa30 100644 --- a/re2c/utf16_regexp.cc +++ b/re2c/src/utf16_regexp.cc @@ -1,6 +1,6 @@ -#include "re.h" -#include "utf16_range.h" -#include "utf16_regexp.h" +#include "src/re.h" +#include "src/utf16_range.h" +#include "src/utf16_regexp.h" namespace re2c { diff --git a/re2c/utf16_regexp.h b/re2c/src/utf16_regexp.h similarity index 90% rename from re2c/utf16_regexp.h rename to re2c/src/utf16_regexp.h index c8ed3dab..e8231892 100644 --- a/re2c/utf16_regexp.h +++ b/re2c/src/utf16_regexp.h @@ -1,7 +1,7 @@ #ifndef _utf16_regexp_h #define _utf16_regexp_h -#include "utf16.h" +#include "src/utf16.h" namespace re2c { diff --git a/re2c/utf8.cc b/re2c/src/utf8.cc similarity index 98% rename from re2c/utf8.cc rename to re2c/src/utf8.cc index a32c0738..d45d4e8a 100644 --- a/re2c/utf8.cc +++ b/re2c/src/utf8.cc @@ -1,4 +1,4 @@ -#include "utf8.h" +#include "src/utf8.h" namespace re2c { diff --git a/re2c/utf8.h b/re2c/src/utf8.h similarity index 97% rename from re2c/utf8.h rename to re2c/src/utf8.h index 8e6e9b07..848622d9 100644 --- a/re2c/utf8.h +++ b/re2c/src/utf8.h @@ -1,7 +1,7 @@ #ifndef _re2c_utf8_h #define _re2c_utf8_h -#include "c99_stdint.h" +#include "src/c99_stdint.h" namespace re2c { diff --git a/re2c/utf8_range.cc b/re2c/src/utf8_range.cc similarity index 98% rename from re2c/utf8_range.cc rename to re2c/src/utf8_range.cc index 3cca7a16..0dc37e4c 100644 --- a/re2c/utf8_range.cc +++ b/re2c/src/utf8_range.cc @@ -1,5 +1,5 @@ -#include "re.h" -#include "utf8_range.h" +#include "src/re.h" +#include "src/utf8_range.h" namespace re2c { diff --git a/re2c/utf8_range.h b/re2c/src/utf8_range.h similarity index 87% rename from re2c/utf8_range.h rename to re2c/src/utf8_range.h index a624c110..fc9a4085 100644 --- a/re2c/utf8_range.h +++ b/re2c/src/utf8_range.h @@ -1,8 +1,8 @@ #ifndef _utf8_range_h #define _utf8_range_h -#include "range_suffix.h" -#include "utf8.h" +#include "src/range_suffix.h" +#include "src/utf8.h" namespace re2c { diff --git a/re2c/utf8_regexp.cc b/re2c/src/utf8_regexp.cc similarity index 91% rename from re2c/utf8_regexp.cc rename to re2c/src/utf8_regexp.cc index 22f08659..45c60012 100644 --- a/re2c/utf8_regexp.cc +++ b/re2c/src/utf8_regexp.cc @@ -1,6 +1,6 @@ -#include "re.h" -#include "utf8_range.h" -#include "utf8_regexp.h" +#include "src/re.h" +#include "src/utf8_range.h" +#include "src/utf8_regexp.h" namespace re2c { diff --git a/re2c/utf8_regexp.h b/re2c/src/utf8_regexp.h similarity index 90% rename from re2c/utf8_regexp.h rename to re2c/src/utf8_regexp.h index 2ce1d8fe..20c73cca 100644 --- a/re2c/utf8_regexp.h +++ b/re2c/src/utf8_regexp.h @@ -1,7 +1,7 @@ #ifndef _utf8_regexp_h #define _utf8_regexp_h -#include "utf8.h" +#include "src/utf8.h" namespace re2c { diff --git a/re2c/test/.gitignore b/re2c/test/.gitignore deleted file mode 100644 index a0206597..00000000 --- a/re2c/test/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -a.out -*.temp -*.diff diff --git a/re2c/test/bug1054496.c b/re2c/test/bug1054496.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1054496.re b/re2c/test/bug1054496.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1163046.c b/re2c/test/bug1163046.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1163046.re b/re2c/test/bug1163046.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1187785.c b/re2c/test/bug1187785.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1187785.re b/re2c/test/bug1187785.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1297658.re b/re2c/test/bug1297658.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1390174.c b/re2c/test/bug1390174.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1390174.re b/re2c/test/bug1390174.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253.c b/re2c/test/bug1454253.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253.re b/re2c/test/bug1454253.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253.s.c b/re2c/test/bug1454253.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253.s.re b/re2c/test/bug1454253.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253b.s.c b/re2c/test/bug1454253b.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1454253b.s.re b/re2c/test/bug1454253b.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.b.c b/re2c/test/bug1472770.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.b.re b/re2c/test/bug1472770.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.c b/re2c/test/bug1472770.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.f.c b/re2c/test/bug1472770.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.f.re b/re2c/test/bug1472770.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.re b/re2c/test/bug1472770.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.s.c b/re2c/test/bug1472770.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1472770.s.re b/re2c/test/bug1472770.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1479044.b.re b/re2c/test/bug1479044.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1479044.c b/re2c/test/bug1479044.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1479044.re b/re2c/test/bug1479044.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1479044.s.c b/re2c/test/bug1479044.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1479044.s.re b/re2c/test/bug1479044.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1528269.c b/re2c/test/bug1528269.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1528269.re b/re2c/test/bug1528269.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1529351.c b/re2c/test/bug1529351.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1682718.c b/re2c/test/bug1682718.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1682718.is.c b/re2c/test/bug1682718.is.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1682718.is.re b/re2c/test/bug1682718.is.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1682718.re b/re2c/test/bug1682718.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1708378.ib.c b/re2c/test/bug1708378.ib.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug1708378.ib.re b/re2c/test/bug1708378.ib.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug1711240.ei.re b/re2c/test/bug1711240.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138.i.c b/re2c/test/bug2102138.i.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138.i.re b/re2c/test/bug2102138.i.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138.i.txt b/re2c/test/bug2102138.i.txt deleted file mode 100644 index b8f235e1..00000000 --- a/re2c/test/bug2102138.i.txt +++ /dev/null @@ -1,19 +0,0 @@ -const uint asc2asc[256] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff - }; diff --git a/re2c/test/bug2102138a.ei.c b/re2c/test/bug2102138a.ei.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138a.ei.re b/re2c/test/bug2102138a.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138a.ei.txt b/re2c/test/bug2102138a.ei.txt deleted file mode 100644 index e952201b..00000000 --- a/re2c/test/bug2102138a.ei.txt +++ /dev/null @@ -1,19 +0,0 @@ -const uint ebc2asc[256] = - { /* Based on ISO 8859/1 and Code Page 37 */ - 0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f, 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xde, 0xb1, - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xfe, 0xae, - 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f - }; diff --git a/re2c/test/bug2102138b.ei.c b/re2c/test/bug2102138b.ei.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138b.ei.re b/re2c/test/bug2102138b.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138b.ei.txt b/re2c/test/bug2102138b.ei.txt deleted file mode 100644 index e952201b..00000000 --- a/re2c/test/bug2102138b.ei.txt +++ /dev/null @@ -1,19 +0,0 @@ -const uint ebc2asc[256] = - { /* Based on ISO 8859/1 and Code Page 37 */ - 0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f, 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xde, 0xb1, - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xfe, 0xae, - 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f - }; diff --git a/re2c/test/bug2102138c.ei.c b/re2c/test/bug2102138c.ei.c old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138c.ei.re b/re2c/test/bug2102138c.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2102138c.ei.txt b/re2c/test/bug2102138c.ei.txt deleted file mode 100755 index e952201b..00000000 --- a/re2c/test/bug2102138c.ei.txt +++ /dev/null @@ -1,19 +0,0 @@ -const uint ebc2asc[256] = - { /* Based on ISO 8859/1 and Code Page 37 */ - 0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f, 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, - 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, - 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, - 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac, - 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, - 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, - 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xde, 0xb1, - 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, - 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xfe, 0xae, - 0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, 0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7, - 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, - 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, - 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f - }; diff --git a/re2c/test/bug2462777.ci.re b/re2c/test/bug2462777.ci.re old mode 100755 new mode 100644 diff --git a/re2c/test/bug2462777.i.re b/re2c/test/bug2462777.i.re old mode 100755 new mode 100644 diff --git a/re2c/lessons/001_upn_calculator/calc_001.c b/re2c/test/calc_001.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_001.c rename to re2c/test/calc_001.c diff --git a/re2c/test/calc_001.dei.re b/re2c/test/calc_001.dei.re old mode 100755 new mode 100644 diff --git a/re2c/test/calc_001.ei.re b/re2c/test/calc_001.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/calc_001.re b/re2c/test/calc_001.re new file mode 100644 index 00000000..fe8d3ae1 --- /dev/null +++ b/re2c/test/calc_001.re @@ -0,0 +1,84 @@ +/* re2c lesson 001_upn_calculator, calc_001, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- basic interface for string reading + + . We define the macros YYCTYPE, YYCURSOR, YYLIMIT, YYMARKER, YYFILL + . YYCTYPE is the type re2c operates on or in other words the type that + it generates code for. While it is not a big difference when we were + using 'unsigned char' here we would need to run re2c with option -w + to fully support types with sieof() > 1. + . YYCURSOR is used internally and holds the current scanner position. In + expression handlers, the code blocks after re2c expressions, this can be + used to identify the end of the token. + . YYMARKER is not always being used so we set an initial value to avoid + a compiler warning. Here we could also omit it compleley. + . YYLIMIT stores the end of the input. Unfortunatley we have to use strlen() + in this lesson. In the next example we see one way to get rid of it. + . We use a 'for(;;)'-loop around the scanner block. We could have used a + 'while(1)'-loop instead but some compilers generate a warning for it. + . To make the output more readable we use 're2c:indent:top' scanner + configuration that configures re2c to prepend a single tab (the default) + to the beginning of each output line. + . The following lines are expressions and for each expression we output the + token name and continue the scanner loop. + . The second last token detects the end of our input, the terminating zero in + our input string. In other scanners detecting the end of input may vary. + For example binary code may contain \0 as valid input. + . The last expression accepts any input character. It tells re2c to accept + the opposit of the empty range. This includes numbers and our tokens but + as re2c goes from top to botton when evaluating the expressions this is no + problem. + . The first three rules show that re2c actually prioritizes the expressions + from top to bottom. Octal number require a starting "0" and the actual + number. Normal numbers start with a digit greater 0. And zero is finally a + special case. A single "0" is detected by the last rule of this set. And + valid ocal number is already being detected by the first rule. This even + includes multi "0" sequences that in octal notation also means zero. + Another way would be to only use two rules: + "0" [0-9]+ + "0" | ( [1-9] [0-9]* ) + A full description of re2c rule syntax can be found in the manual. +*/ + +#include +#include +#include + +int scan(char *s, int l) +{ + char *p = s; + char *q = 0; +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT (s+l) +#define YYMARKER q +#define YYFILL(n) + + for(;;) + { +/*!re2c + re2c:indent:top = 2; + "0"[0-9]+ { printf("Oct\n"); continue; } + [1-9][0-9]* { printf("Num\n"); continue; } + "0" { printf("Num\n"); continue; } + "+" { printf("+\n"); continue; } + "-" { printf("-\n"); continue; } + "\000" { printf("EOF\n"); return 0; } + [^] { printf("ERR\n"); return 1; } +*/ + } +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(argv[1], strlen(argv[1])); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 1; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_002.c b/re2c/test/calc_002.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_002.c rename to re2c/test/calc_002.c diff --git a/re2c/test/calc_002.re b/re2c/test/calc_002.re new file mode 100644 index 00000000..417e9f31 --- /dev/null +++ b/re2c/test/calc_002.re @@ -0,0 +1,69 @@ +/* re2c lesson 001_upn_calculator, calc_002, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- making use of YYFILL + + . Here we modified the scanner to not require strlen() on the call. Instead + we compute limit on the fly. That is whenever more input is needed we + search for the terminating \0 in the next n chars the scanner needs. + . If there is not enough input we quit the scanner. + . Note that in lesson_001 YYLIMIT was a character pointer computed only once. + Here is of course also of type YYCTYPE but a variable that gets reevaluated + by YYFILL(). + . To make the code smaller we take advantage of the fact that our loop has no + break so far. This allows us to use break here and have the code that is + used for YYFILL() not contain the printf in every occurence. That way the + generated code gets smaller. + +*/ + +#include +#include +#include + +int fill(char *p, int n, char **l) +{ + while (*++p && n--) ; + * l = p; + return n <= 0; +} + +int scan(char *s) +{ + char *p = s; + char *l = s; + char *q = 0; +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT l +#define YYMARKER q +#define YYFILL(n) { if (!fill(p, n, &l)) break; } + + for(;;) + { +/*!re2c + re2c:indent:top = 2; + "0"[0-9]+ { printf("Oct\n"); continue; } + [1-9][0-9]* { printf("Num\n"); continue; } + "0" { printf("Num\n"); continue; } + "+" { printf("+\n"); continue; } + "-" { printf("+\n"); continue; } + "\000" { printf("EOF\n"); return 0; } + [^] { printf("ERR\n"); return 1; } +*/ + } + printf("OOD\n"); return 2; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(argv[1]); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_003.c b/re2c/test/calc_003.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_003.c rename to re2c/test/calc_003.c diff --git a/re2c/test/calc_003.re b/re2c/test/calc_003.re new file mode 100644 index 00000000..e48aec92 --- /dev/null +++ b/re2c/test/calc_003.re @@ -0,0 +1,61 @@ +/* re2c lesson 001_upn_calculator, calc_003, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- making use of YYFILL + + . Again provide the length of the input to generate the limit only once. Now + we can use YYFILL() to detect the end and simply return since YYFILL() is + only being used if the next scanner run might use more chars then YYLIMIT + allows. + . Note that we now use (s+l+2) instead of (s+l) as we did in lesson_001. In + the first lesson we did not quit from YYFILL() and used a special rule to + detect the end of input. Here we use the fact that we know the exact end + of input and that this length does not include the terminating zero. Since + YYLIMIT points to the first character behind the used buffer we use "+ 2". + If we would use "+1" we could drop the "\000" rule but could no longer + distinguish between end of input and out of data. + +*/ + +#include +#include +#include + +int scan(char *s, int l) +{ + char *p = s; + char *q = 0; +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT (s+l+2) +#define YYMARKER q +#define YYFILL(n) { printf("OOD\n"); return 2; } + + for(;;) + { +/*!re2c + re2c:indent:top = 2; + "0"[0-9]+ { printf("Oct\n"); continue; } + [1-9][0-9]* { printf("Num\n"); continue; } + "0" { printf("Num\n"); continue; } + "+" { printf("+\n"); continue; } + "-" { printf("+\n"); continue; } + "\000" { printf("EOF\n"); return 0; } + [^] { printf("ERR\n"); return 1; } +*/ + } + return 0; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(argv[1], strlen(argv[1])); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_004.c b/re2c/test/calc_004.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_004.c rename to re2c/test/calc_004.c diff --git a/re2c/test/calc_004.re b/re2c/test/calc_004.re new file mode 100644 index 00000000..977e438b --- /dev/null +++ b/re2c/test/calc_004.re @@ -0,0 +1,78 @@ +/* re2c lesson 001_upn_calculator, calc_004, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- making use of definitions + . We provide complex rules as definitions. We can even have definitions made + up from other definitions. And we could also use definitions as part of + rules and not only as full rules as shown in this lesson. + +- showing the tokens + . re2c does not store the beginning of a token on its own but we can easily + do this by providing variable, in our case t, that is set to YYCURSOR on + every loop. If we were not using a loop here the token, we could have used + s instead of a new variable instead. + . As we use the token for an output function that requires a terminating zero + we copy the token. Alternatively we could store the end of the token, then + replace it with a zero character and replace it after the token has been + used. However that approach is not always acceptable. + +*/ + +#include +#include +#include + +char * tokendup(const char *t, const char *l) +{ + size_t n = l -t + 1; + char *r = (char*)malloc(n); + + memmove(r, t, n-1); + r[n] = '\0'; + return r; +} + +int scan(char *s, int l) +{ + char *p = s; + char *q = 0; + char *t; +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT (s+l+2) +#define YYMARKER q +#define YYFILL(n) { printf("OOD\n"); return 2; } + + for(;;) + { + t = p; +/*!re2c + re2c:indent:top = 2; + + DIGIT = [0-9] ; + OCT = "0" DIGIT+ ; + INT = "0" | ( [1-9] DIGIT* ) ; + + OCT { t = tokendup(t, p); printf("Oct: %s\n", t); free(t); continue; } + INT { t = tokendup(t, p); printf("Num: %s\n", t); free(t); continue; } + "+" { printf("+\n"); continue; } + "-" { printf("+\n"); continue; } + "\000" { printf("EOF\n"); return 0; } + [^] { printf("ERR\n"); return 1; } +*/ + } + return 0; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(argv[1], strlen(argv[1])); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_005.c b/re2c/test/calc_005.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_005.c rename to re2c/test/calc_005.c diff --git a/re2c/test/calc_005.re b/re2c/test/calc_005.re new file mode 100644 index 00000000..6ae2a484 --- /dev/null +++ b/re2c/test/calc_005.re @@ -0,0 +1,144 @@ +/* re2c lesson 001_upn_calculator, calc_005, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- turning this lesson into an easy calculator + . We are going to write an UPN calculator so we need an additional rule to + ignore white space. + . Then we need to store the scanned input somewhere and do our math on it. + . Also we need to scan all arguments since the main c code gets the input + split up into chunks. + . In contrast to what we did before we now add a variable res that holds the + scanner state. We initialize that variable to 0 and quit the loop when it + is non zero. This will also be our return value so that we can use it in + function main to generate error information. + . To support operating systems where ' and " get passed in program arguments + we check for them being first and last input character. If so we correct + input pointer and input length. Since now our scanner might not see a + terminating zero we change YYLIMIT again and drop the special zero rule. +*/ + +#include +#include +#include + +#define DEBUG(stmt) stmt + +int stack[4]; +int depth = 0; + +int push_num(const char *t, const char *l, int radix) +{ + int num = 0; + + if (depth >= sizeof(stack)) + { + return 3; + } + + --t; + while(++t < l) + { + num = num * radix + (*t - '0'); + } + DEBUG(printf("Num: %d\n", num)); + + stack[depth++] = num; + return 0; +} + +int stack_add() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] + stack[depth]; + return 0; +} + +int stack_sub() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] - stack[depth]; + return 0; +} + +int scan(char *s, int l) +{ + char *p = s; + char *q = 0; + char *t; + int res = 0; + +#define YYCTYPE char +#define YYCURSOR p +#define YYLIMIT (s+l+1) +#define YYMARKER q +#define YYFILL(n) { return depth == 1 ? 0 : 2; } + + while(!res) + { + t = p; +/*!re2c + re2c:indent:top = 2; + + DIGIT = [0-9] ; + OCT = "0" DIGIT+ ; + INT = "0" | ( [1-9] DIGIT* ) ; + WS = [ \t]+ ; + + WS { continue; } + OCT { res = push_num(t, p, 8); continue; } + INT { res = push_num(t, p, 10); continue; } + "+" { res = stack_add(); continue; } + "-" { res = stack_sub(); continue; } + [^] { res = 1; continue; } +*/ + } + return res; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + char *inp; + int res = 0, argp = 0, len; + + while(!res && ++argp < argc) + { + inp = argv[argp]; + len = strlen(inp); + if (inp[0] == '\"' && inp[len-1] == '\"') + { + ++inp; + len -=2; + } + res = scan(inp, len); + } + switch(res) + { + case 0: + printf("Result: %d\n", stack[0]); + return 0; + case 1: + fprintf(stderr, "Illegal character in input.\n"); + return 1; + case 2: + fprintf(stderr, "Premature end of input.\n"); + return 2; + case 3: + fprintf(stderr, "Stack overflow.\n"); + return 3; + case 4: + fprintf(stderr, "Stack underflow.\n"); + return 4; + } + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_006.s.c b/re2c/test/calc_006.s.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_006.s.c rename to re2c/test/calc_006.s.c diff --git a/re2c/test/calc_006.s.re b/re2c/test/calc_006.s.re new file mode 100644 index 00000000..10da31cd --- /dev/null +++ b/re2c/test/calc_006.s.re @@ -0,0 +1,162 @@ +/* re2c lesson 001_upn_calculator, calc_006, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- avoiding YYFILL() + . We use the inplace configuration re2c:yyfill to suppress generation of + YYFILL() blocks. This of course means we no longer have to provide the + macro. + . We also drop the YYMARKER stuff since we know that re2c does not generate + it for this example. + . Since re2c does no longer check for out of data situations we must do this. + For that reason we first reintroduce our zero rule and second we need to + ensure that the scanner does not take more than one bytes in one go. + + In the example suppose "0" is passed. The scanner reads the first "0" and + then is in an undecided state. The scanner can earliest decide on the next + char what the token is. In case of a zero the input ends and it was a + number, 0 to be precise. In case of a digit it is an octal number and the + next character needs to be read. In case of any other character the scanner + will detect an error with the any rule [^]. + + Now the above shows that the scanner may read two characters directly. But + only if the first is a "0". So we could easily check that if the first char + is "0" and the next char is a digit then yet another charcter is present. + But we require our inut to be zero terminated. And that means we do not + have to check anything for this scanner. + + However with other rule sets re2c might read more then one character in a + row. In those cases it is normally hard to impossible to avoid YYFILL. + +- optimizing the generated code by using -s command line switch of re2c + . This tells re2c to generate code that uses if statements rather + then endless switch/case expressions where appropriate. Note that the + generated code now requires the input to be unsigned char rather than char + due to the way comparisons are generated. +*/ + +#include +#include +#include + +#define DEBUG(stmt) stmt + +int stack[4]; +int depth = 0; + +int push_num(const unsigned char *t, const unsigned char *l, int radix) +{ + int num = 0; + + if (depth >= sizeof(stack)) + { + return 3; + } + + --t; + while(++t < l) + { + num = num * radix + (*t - (unsigned char)'0'); + } + DEBUG(printf("Num: %d\n", num)); + + stack[depth++] = num; + return 0; +} + +int stack_add() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] + stack[depth]; + DEBUG(printf("+\n")); + return 0; +} + +int stack_sub() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] - stack[depth]; + DEBUG(printf("-\n")); + return 0; +} + +int scan(char *s) +{ + unsigned char *p = (unsigned char*)s; + unsigned char *t; + int res = 0; + +#define YYCTYPE unsigned char +#define YYCURSOR p + + while(!res) + { + t = p; +/*!re2c + re2c:indent:top = 2; + re2c:yyfill:enable = 0; + + DIGIT = [0-9] ; + OCT = "0" DIGIT+ ; + INT = "0" | ( [1-9] DIGIT* ) ; + WS = [ \t]+ ; + + WS { continue; } + OCT { res = push_num(t, p, 8); continue; } + INT { res = push_num(t, p, 10); continue; } + "+" { res = stack_add(); continue; } + "-" { res = stack_sub(); continue; } + "\000" { res = depth == 1 ? 0 : 2; break; } + [^] { res = 1; continue; } +*/ + } + return res; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + char *inp; + int res = 0, argp = 0, len; + + while(!res && ++argp < argc) + { + inp = strdup(argv[argp]); + len = strlen(inp); + if (inp[0] == '\"' && inp[len-1] == '\"') + { + inp[len - 1] = '\0'; + ++inp; + } + res = scan(inp); + free(inp); + } + switch(res) + { + case 0: + printf("Result: %d\n", stack[0]); + return 0; + case 1: + fprintf(stderr, "Illegal character in input.\n"); + return 1; + case 2: + fprintf(stderr, "Premature end of input.\n"); + return 2; + case 3: + fprintf(stderr, "Stack overflow.\n"); + return 3; + case 4: + fprintf(stderr, "Stack underflow.\n"); + return 4; + } + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_007.b.c b/re2c/test/calc_007.b.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_007.b.c rename to re2c/test/calc_007.b.c diff --git a/re2c/test/calc_007.b.re b/re2c/test/calc_007.b.re new file mode 100644 index 00000000..52381965 --- /dev/null +++ b/re2c/test/calc_007.b.re @@ -0,0 +1,135 @@ +/* re2c lesson 001_upn_calculator, calc_007, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- optimizing the generated code by using -b command line switch of re2c + . This tells re2c to generate code that uses a decision table. The -b switch + also contains the -s behavior. And -b also requires the input to be + unsigned chars. +*/ + +#include +#include +#include + +#define DEBUG(stmt) stmt + +int stack[4]; +int depth = 0; + +int push_num(const unsigned char *t, const unsigned char *l, int radix) +{ + int num = 0; + + if (depth >= sizeof(stack)) + { + return 3; + } + + --t; + while(++t < l) + { + num = num * radix + (*t - (unsigned char)'0'); + } + DEBUG(printf("Num: %d\n", num)); + + stack[depth++] = num; + return 0; +} + +int stack_add() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] + stack[depth]; + DEBUG(printf("+\n")); + return 0; +} + +int stack_sub() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] - stack[depth]; + DEBUG(printf("+\n")); + return 0; +} + +int scan(char *s) +{ + unsigned char *p = (unsigned char*)s; + unsigned char *t; + int res = 0; + +#define YYCTYPE unsigned char +#define YYCURSOR p + + while(!res) + { + t = p; +/*!re2c + re2c:indent:top = 2; + re2c:yyfill:enable = 0; + + DIGIT = [0-9] ; + OCT = "0" DIGIT+ ; + INT = "0" | ( [1-9] DIGIT* ) ; + WS = [ \t]+ ; + + WS { continue; } + OCT { res = push_num(t, p, 8); continue; } + INT { res = push_num(t, p, 10); continue; } + "+" { res = stack_add(); continue; } + "-" { res = stack_sub(); continue; } + "\000" { res = depth == 1 ? 0 : 2; break; } + [^] { res = 1; continue; } +*/ + } + return res; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + char *inp; + int res = 0, argp = 0, len; + + while(!res && ++argp < argc) + { + inp = strdup(argv[argp]); + len = strlen(inp); + if (inp[0] == '\"' && inp[len-1] == '\"') + { + inp[len - 1] = '\0'; + ++inp; + } + res = scan(inp); + free(inp); + } + switch(res) + { + case 0: + printf("Result: %d\n", stack[0]); + return 0; + case 1: + fprintf(stderr, "Illegal character in input.\n"); + return 1; + case 2: + fprintf(stderr, "Premature end of input.\n"); + return 2; + case 3: + fprintf(stderr, "Stack overflow.\n"); + return 3; + case 4: + fprintf(stderr, "Stack underflow.\n"); + return 4; + } + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/lessons/001_upn_calculator/calc_008.b.c b/re2c/test/calc_008.b.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/calc_008.b.c rename to re2c/test/calc_008.b.c diff --git a/re2c/test/calc_008.b.re b/re2c/test/calc_008.b.re new file mode 100644 index 00000000..ed1a088e --- /dev/null +++ b/re2c/test/calc_008.b.re @@ -0,0 +1,158 @@ +/* re2c lesson 001_upn_calculator, calc_008, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- using -b with signed character input + . Since the code is being generated with -b switch re2c requires the internal + character variable yych to use an unsigned character type. For that reason + the previous lessons had a conversion at the beginning of their scan() + function. Other re2c generated code often have the scanners work completely + on unsigned input. Thus requesting a conversion. + + To avoid the conversion on input, re2c allows to do the conversion when + reading the internal yych variable. To enable that conversion you need to + use the implace configuration 're2c:yych:conversion' and set it to 1. This + will change the generated code to insert conversions to YYCTYPE whenever + yych is being read. + +- More inplace configurations for better/nicer code + . re2c allows to overwrite the generation of any define, label or variable + used in the generated code. For example we overwrite the 'yych' variable + name to 'curr' using inplace configuration 're2c:variable:yych = curr;'. + + . We further more use inplace configurations instead of defines. This allows + to use correct conversions to 'unsigned char' instead of having to convert + to 'YYCTYPE' when placing 're2c:define:YYCTYPE = "unsigned char";' infront + of 're2c:yych:conversion'. Note that we have to use apostrophies for the + first setting as it contains a space. + + . Last but not least we use 're2c:labelprefix = scan' to change the prefix + of generated labels. +*/ + +#include +#include +#include + +#define DEBUG(stmt) stmt + +int stack[4]; +int depth = 0; + +int push_num(const char *t, const char *l, int radix) +{ + int num = 0; + + if (depth >= sizeof(stack)) + { + return 3; + } + + --t; + while(++t < l) + { + num = num * radix + (*t - '0'); + } + DEBUG(printf("Num: %d\n", num)); + + stack[depth++] = num; + return 0; +} + +int stack_add() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] + stack[depth]; + DEBUG(printf("+\n")); + return 0; +} + +int stack_sub() +{ + if (depth < 2) return 4; + + --depth; + stack[depth-1] = stack[depth-1] - stack[depth]; + DEBUG(printf("+\n")); + return 0; +} + +int scan(char *p) +{ + char *t; + int res = 0; + + while(!res) + { + t = p; +/*!re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = p; + re2c:variable:yych = curr; + re2c:indent:top = 2; + re2c:yyfill:enable = 0; + re2c:yych:conversion = 1; + re2c:labelprefix = scan; + + DIGIT = [0-9] ; + OCT = "0" DIGIT+ ; + INT = "0" | ( [1-9] DIGIT* ) ; + WS = [ \t]+ ; + + WS { continue; } + OCT { res = push_num(t, p, 8); continue; } + INT { res = push_num(t, p, 10); continue; } + "+" { res = stack_add(); continue; } + "-" { res = stack_sub(); continue; } + "\000" { res = depth == 1 ? 0 : 2; break; } + [^] { res = 1; continue; } +*/ + } + return res; +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + char *inp; + int res = 0, argp = 0, len; + + while(!res && ++argp < argc) + { + inp = strdup(argv[argp]); + len = strlen(inp); + if (inp[0] == '\"' && inp[len-1] == '\"') + { + inp[len - 1] = '\0'; + ++inp; + } + res = scan(inp); + free(inp); + } + switch(res) + { + case 0: + printf("Result: %d\n", stack[0]); + return 0; + case 1: + fprintf(stderr, "Illegal character in input.\n"); + return 1; + case 2: + fprintf(stderr, "Premature end of input.\n"); + return 2; + case 3: + fprintf(stderr, "Stack overflow.\n"); + return 3; + case 4: + fprintf(stderr, "Stack underflow.\n"); + return 4; + } + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 0; + } +} diff --git a/re2c/test/casing-flags.i--case-insensitive.c b/re2c/test/casing-flags.i--case-insensitive.c old mode 100755 new mode 100644 diff --git a/re2c/test/casing-flags.i--case-insensitive.re b/re2c/test/casing-flags.i--case-insensitive.re old mode 100755 new mode 100644 diff --git a/re2c/test/casing-flags.i--case-inverted.c b/re2c/test/casing-flags.i--case-inverted.c old mode 100755 new mode 100644 diff --git a/re2c/test/casing-flags.i--case-inverted.re b/re2c/test/casing-flags.i--case-inverted.re old mode 100755 new mode 100644 diff --git a/re2c/test/casing-flags.i.c b/re2c/test/casing-flags.i.c old mode 100755 new mode 100644 diff --git a/re2c/test/casing-flags.i.re b/re2c/test/casing-flags.i.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_00.c b/re2c/test/cond_error_00.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_00.re b/re2c/test/cond_error_00.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_01.c.c b/re2c/test/cond_error_01.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_01.c.re b/re2c/test/cond_error_01.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_02.c.c b/re2c/test/cond_error_02.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_02.c.re b/re2c/test/cond_error_02.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_03.c.c b/re2c/test/cond_error_03.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_03.c.re b/re2c/test/cond_error_03.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_04.c.c b/re2c/test/cond_error_04.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_04.c.re b/re2c/test/cond_error_04.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_05.c.c b/re2c/test/cond_error_05.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_05.c.re b/re2c/test/cond_error_05.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_06.c.c b/re2c/test/cond_error_06.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_06.c.re b/re2c/test/cond_error_06.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_07.c.c b/re2c/test/cond_error_07.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_07.c.re b/re2c/test/cond_error_07.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_08.c.c b/re2c/test/cond_error_08.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_08.c.re b/re2c/test/cond_error_08.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_09.c.c b/re2c/test/cond_error_09.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_09.c.re b/re2c/test/cond_error_09.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_10.c.c b/re2c/test/cond_error_10.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_10.c.re b/re2c/test/cond_error_10.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_11.c.c b/re2c/test/cond_error_11.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/cond_error_11.c.re b/re2c/test/cond_error_11.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01.c.c b/re2c/test/condition_01.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01.c.re b/re2c/test/condition_01.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01a.c.c b/re2c/test/condition_01a.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01a.c.re b/re2c/test/condition_01a.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01b.c.c b/re2c/test/condition_01b.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_01b.c.re b/re2c/test/condition_01b.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_02.c.c b/re2c/test/condition_02.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_02.c.re b/re2c/test/condition_02.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_02.cg.c b/re2c/test/condition_02.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_02.cg.re b/re2c/test/condition_02.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_03.cg.c b/re2c/test/condition_03.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_03.cg.re b/re2c/test/condition_03.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_04.cg.c b/re2c/test/condition_04.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_04.cg.re b/re2c/test/condition_04.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cg.c b/re2c/test/condition_05.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cg.re b/re2c/test/condition_05.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.c b/re2c/test/condition_05.cgitcondition_05.cgit.h.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.h b/re2c/test/condition_05.cgitcondition_05.cgit.h.h old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgitcondition_05.cgit.h.re b/re2c/test/condition_05.cgitcondition_05.cgit.h.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.c b/re2c/test/condition_05.cgtcondition_05.cgt.h.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.h b/re2c/test/condition_05.cgtcondition_05.cgt.h.h old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cgtcondition_05.cgt.h.re b/re2c/test/condition_05.cgtcondition_05.cgt.h.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cs.c b/re2c/test/condition_05.cs.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_05.cs.re b/re2c/test/condition_05.cs.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_06.cs.c b/re2c/test/condition_06.cs.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_06.cs.re b/re2c/test/condition_06.cs.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_07.cbi.c b/re2c/test/condition_07.cbi.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_07.cbi.re b/re2c/test/condition_07.cbi.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_08.cbi.re b/re2c/test/condition_08.cbi.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_08.cbif.re b/re2c/test/condition_08.cbif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_09.cbif.re b/re2c/test/condition_09.cbif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_09.cgif.c b/re2c/test/condition_09.cgif.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_09.cgif.re b/re2c/test/condition_09.cgif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_10.cgif.c b/re2c/test/condition_10.cgif.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_10.cgif.re b/re2c/test/condition_10.cgif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_11.cg.c b/re2c/test/condition_11.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_11.cg.re b/re2c/test/condition_11.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_12.cgif.c b/re2c/test/condition_12.cgif.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_12.cgif.re b/re2c/test/condition_12.cgif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_13.cg.c b/re2c/test/condition_13.cg.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_13.cg.re b/re2c/test/condition_13.cg.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_14.cbif.re b/re2c/test/condition_14.cbif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_14.cgif.c b/re2c/test/condition_14.cgif.c old mode 100755 new mode 100644 diff --git a/re2c/test/condition_14.cgif.re b/re2c/test/condition_14.cgif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_14.cif.re b/re2c/test/condition_14.cif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_14.csif.re b/re2c/test/condition_14.csif.re old mode 100755 new mode 100644 diff --git a/re2c/test/condition_15.csif.re b/re2c/test/condition_15.csif.re old mode 100755 new mode 100644 diff --git a/re2c/test/config1.c b/re2c/test/config1.c old mode 100755 new mode 100644 diff --git a/re2c/test/config1.re b/re2c/test/config1.re old mode 100755 new mode 100644 diff --git a/re2c/test/config10.c b/re2c/test/config10.c old mode 100755 new mode 100644 diff --git a/re2c/test/config10.re b/re2c/test/config10.re old mode 100755 new mode 100644 diff --git a/re2c/test/config11.ei.c b/re2c/test/config11.ei.c old mode 100755 new mode 100644 diff --git a/re2c/test/config11.ei.re b/re2c/test/config11.ei.re old mode 100755 new mode 100644 diff --git a/re2c/test/config2.s.c b/re2c/test/config2.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/config2.s.re b/re2c/test/config2.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/config3.c b/re2c/test/config3.c old mode 100755 new mode 100644 diff --git a/re2c/test/config3.re b/re2c/test/config3.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4a.f.c b/re2c/test/config4a.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4a.f.re b/re2c/test/config4a.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4b.f.c b/re2c/test/config4b.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4b.f.re b/re2c/test/config4b.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4c.f.c b/re2c/test/config4c.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4c.f.re b/re2c/test/config4c.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4d.f.c b/re2c/test/config4d.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4d.f.re b/re2c/test/config4d.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4e.f.c b/re2c/test/config4e.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4e.f.re b/re2c/test/config4e.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4f.f.c b/re2c/test/config4f.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4f.f.re b/re2c/test/config4f.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/config4g.ifs.c b/re2c/test/config4g.ifs.c old mode 100755 new mode 100644 diff --git a/re2c/test/config4g.ifs.re b/re2c/test/config4g.ifs.re old mode 100755 new mode 100644 diff --git a/re2c/test/config5.c b/re2c/test/config5.c old mode 100755 new mode 100644 diff --git a/re2c/test/config5.re b/re2c/test/config5.re old mode 100755 new mode 100644 diff --git a/re2c/test/config6.c b/re2c/test/config6.c old mode 100755 new mode 100644 diff --git a/re2c/test/config6.re b/re2c/test/config6.re old mode 100755 new mode 100644 diff --git a/re2c/test/config7a.g.c b/re2c/test/config7a.g.c old mode 100755 new mode 100644 diff --git a/re2c/test/config7a.g.re b/re2c/test/config7a.g.re old mode 100755 new mode 100644 diff --git a/re2c/test/config7b.g.c b/re2c/test/config7b.g.c old mode 100755 new mode 100644 diff --git a/re2c/test/config7b.g.re b/re2c/test/config7b.g.re old mode 100755 new mode 100644 diff --git a/re2c/test/config8.c b/re2c/test/config8.c old mode 100755 new mode 100644 diff --git a/re2c/test/config8.re b/re2c/test/config8.re old mode 100755 new mode 100644 diff --git a/re2c/test/config9.b.c b/re2c/test/config9.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/config9.b.re b/re2c/test/config9.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.b.c b/re2c/test/ctx.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.b.re b/re2c/test/ctx.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.c b/re2c/test/ctx.c old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.re b/re2c/test/ctx.re old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.s.c b/re2c/test/ctx.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/ctx.s.re b/re2c/test/ctx.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.b.re b/re2c/test/cvsignore.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.c b/re2c/test/cvsignore.c old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.re b/re2c/test/cvsignore.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.s.re b/re2c/test/cvsignore.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.u.re b/re2c/test/cvsignore.u.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.ub.re b/re2c/test/cvsignore.ub.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.w.re b/re2c/test/cvsignore.w.re old mode 100755 new mode 100644 diff --git a/re2c/test/cvsignore.wb.re b/re2c/test/cvsignore.wb.re old mode 100755 new mode 100644 diff --git a/re2c/test/error1.c b/re2c/test/error1.c old mode 100755 new mode 100644 diff --git a/re2c/test/error1.re b/re2c/test/error1.re old mode 100755 new mode 100644 diff --git a/re2c/test/error10.c b/re2c/test/error10.c old mode 100755 new mode 100644 diff --git a/re2c/test/error10.re b/re2c/test/error10.re old mode 100755 new mode 100644 diff --git a/re2c/test/error11.c b/re2c/test/error11.c old mode 100755 new mode 100644 diff --git a/re2c/test/error11.re b/re2c/test/error11.re old mode 100755 new mode 100644 diff --git a/re2c/test/error12.c b/re2c/test/error12.c old mode 100755 new mode 100644 diff --git a/re2c/test/error12.re b/re2c/test/error12.re old mode 100755 new mode 100644 diff --git a/re2c/test/error13.1.c b/re2c/test/error13.1.c old mode 100755 new mode 100644 diff --git a/re2c/test/error13.1.re b/re2c/test/error13.1.re old mode 100755 new mode 100644 diff --git a/re2c/test/error13.c b/re2c/test/error13.c old mode 100755 new mode 100644 diff --git a/re2c/test/error13.re b/re2c/test/error13.re old mode 100755 new mode 100644 diff --git a/re2c/test/error14.1.c b/re2c/test/error14.1.c old mode 100755 new mode 100644 diff --git a/re2c/test/error14.1.re b/re2c/test/error14.1.re old mode 100755 new mode 100644 diff --git a/re2c/test/error14.c b/re2c/test/error14.c old mode 100755 new mode 100644 diff --git a/re2c/test/error14.re b/re2c/test/error14.re old mode 100755 new mode 100644 diff --git a/re2c/test/error2.c b/re2c/test/error2.c old mode 100755 new mode 100644 diff --git a/re2c/test/error2.re b/re2c/test/error2.re old mode 100755 new mode 100644 diff --git a/re2c/test/error3.c b/re2c/test/error3.c old mode 100755 new mode 100644 diff --git a/re2c/test/error3.re b/re2c/test/error3.re old mode 100755 new mode 100644 diff --git a/re2c/test/error4.c b/re2c/test/error4.c old mode 100755 new mode 100644 diff --git a/re2c/test/error4.re b/re2c/test/error4.re old mode 100755 new mode 100644 diff --git a/re2c/test/error5.c b/re2c/test/error5.c old mode 100755 new mode 100644 diff --git a/re2c/test/error5.re b/re2c/test/error5.re old mode 100755 new mode 100644 diff --git a/re2c/test/error6.c b/re2c/test/error6.c old mode 100755 new mode 100644 diff --git a/re2c/test/error6.re b/re2c/test/error6.re old mode 100755 new mode 100644 diff --git a/re2c/test/error7.c b/re2c/test/error7.c old mode 100755 new mode 100644 diff --git a/re2c/test/error7.re b/re2c/test/error7.re old mode 100755 new mode 100644 diff --git a/re2c/test/error8.c b/re2c/test/error8.c old mode 100755 new mode 100644 diff --git a/re2c/test/error8.re b/re2c/test/error8.re old mode 100755 new mode 100644 diff --git a/re2c/test/error9.c b/re2c/test/error9.c old mode 100755 new mode 100644 diff --git a/re2c/test/error9.re b/re2c/test/error9.re old mode 100755 new mode 100644 diff --git a/re2c/test/flex-01.i.c b/re2c/test/flex-01.i.c old mode 100755 new mode 100644 diff --git a/re2c/test/flex-01.i.re b/re2c/test/flex-01.i.re old mode 100755 new mode 100644 diff --git a/re2c/test/flex-01.iF.c b/re2c/test/flex-01.iF.c old mode 100755 new mode 100644 diff --git a/re2c/test/flex-01.iF.re b/re2c/test/flex-01.iF.re old mode 100755 new mode 100644 diff --git a/re2c/test/input10.b.c b/re2c/test/input10.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/input10.b.re b/re2c/test/input10.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/input10.c b/re2c/test/input10.c old mode 100755 new mode 100644 diff --git a/re2c/test/input10.re b/re2c/test/input10.re old mode 100755 new mode 100644 diff --git a/re2c/test/input10.s.c b/re2c/test/input10.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/input10.s.re b/re2c/test/input10.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/input11.b.c b/re2c/test/input11.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/input11.b.re b/re2c/test/input11.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/input11.c b/re2c/test/input11.c old mode 100755 new mode 100644 diff --git a/re2c/test/input11.i.c b/re2c/test/input11.i.c old mode 100755 new mode 100644 diff --git a/re2c/test/input11.i.re b/re2c/test/input11.i.re old mode 100755 new mode 100644 diff --git a/re2c/test/input11.re b/re2c/test/input11.re old mode 100755 new mode 100644 diff --git a/re2c/test/input11.s.c b/re2c/test/input11.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/input11.s.re b/re2c/test/input11.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/input12.boinput12.c.c b/re2c/test/input12.boinput12.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/input12.boinput12.c.re b/re2c/test/input12.boinput12.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/input12.oinput12.c.c b/re2c/test/input12.oinput12.c.c old mode 100755 new mode 100644 diff --git a/re2c/test/input12.oinput12.c.re b/re2c/test/input12.oinput12.c.re old mode 100755 new mode 100644 diff --git a/re2c/test/input13.c b/re2c/test/input13.c old mode 100755 new mode 100644 diff --git a/re2c/test/input13.re b/re2c/test/input13.re old mode 100755 new mode 100644 diff --git a/re2c/test/input4.c b/re2c/test/input4.c old mode 100755 new mode 100644 diff --git a/re2c/test/input4.re b/re2c/test/input4.re old mode 100755 new mode 100644 diff --git a/re2c/test/input5.c b/re2c/test/input5.c old mode 100755 new mode 100644 diff --git a/re2c/test/input5.re b/re2c/test/input5.re old mode 100755 new mode 100644 diff --git a/re2c/test/input6.c b/re2c/test/input6.c old mode 100755 new mode 100644 diff --git a/re2c/test/input6.re b/re2c/test/input6.re old mode 100755 new mode 100644 diff --git a/re2c/test/input7.c b/re2c/test/input7.c old mode 100755 new mode 100644 diff --git a/re2c/test/input7.re b/re2c/test/input7.re old mode 100755 new mode 100644 diff --git a/re2c/test/input8.b.c b/re2c/test/input8.b.c old mode 100755 new mode 100644 diff --git a/re2c/test/input8.b.re b/re2c/test/input8.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/input8.c b/re2c/test/input8.c old mode 100755 new mode 100644 diff --git a/re2c/test/input8.g.c b/re2c/test/input8.g.c old mode 100755 new mode 100644 diff --git a/re2c/test/input8.g.re b/re2c/test/input8.g.re old mode 100755 new mode 100644 diff --git a/re2c/test/input8.re b/re2c/test/input8.re old mode 100755 new mode 100644 diff --git a/re2c/test/input9.c b/re2c/test/input9.c old mode 100755 new mode 100644 diff --git a/re2c/test/input9.re b/re2c/test/input9.re old mode 100755 new mode 100644 diff --git a/re2c/test/line-01.c b/re2c/test/line-01.c old mode 100755 new mode 100644 diff --git a/re2c/test/line-01.re b/re2c/test/line-01.re old mode 100755 new mode 100644 diff --git a/re2c/lessons/001_upn_calculator/windows/main.b.c b/re2c/test/main.b.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/001_upn_calculator/windows/main.b.c rename to re2c/test/main.b.c diff --git a/re2c/test/main.b.re b/re2c/test/main.b.re new file mode 100644 index 00000000..1600b83d --- /dev/null +++ b/re2c/test/main.b.re @@ -0,0 +1,291 @@ +/* re2c lesson 001_upn_calculator, main.b.re, (c) M. Boerger, L. Allan 2006 */ +/*!ignore:re2c + +- basic interface for string reading + + . We define the macros YYCTYPE, YYCURSOR, YYLIMIT, YYMARKER, YYFILL + . YYCTYPE is the type re2c operates on or in other words the type that + it generates code for. While it is not a big difference when we were + using 'unsigned char' here we would need to run re2c with option -w + to fully support types with sieof() > 1. + . YYCURSOR is used internally and holds the current scanner position. In + expression handlers, the code blocks after re2c expressions, this can be + used to identify the end of the token. + . YYMARKER is not always being used so we set an initial value to avoid + a compiler warning. + . YYLIMIT stores the end of the input. Unfortunatley we have to use strlen() + in this lesson. In the next example we see one way to get rid of it. + . We use a 'for(;;)'-loop around the scanner block. We could have used a + 'while(1)'-loop instead but some compilers generate a warning for it. + . To make the output more readable we use 're2c:indent:top' scanner + configuration that configures re2c to prepend a single tab (the default) + to the beginning of each output line. + . The following lines are expressions and for each expression we output the + token name and continue the scanner loop. + . The second last token detects the end of our input, the terminating zero in + our input string. In other scanners detecting the end of input may vary. + For example binary code may contain \0 as valid input. + . The last expression accepts any input character. It tells re2c to accept + the opposit of the empty range. This includes numbers and our tokens but + as re2c goes from top to botton when evaluating the expressions this is no + problem. + . The first three rules show that re2c actually prioritizes the expressions + from top to bottom. Octal number require a starting "0" and the actual + number. Normal numbers start with a digit greater 0. And zero is finally a + special case. A single "0" is detected by the last rule of this set. And + valid ocal number is already being detected by the first rule. This even + includes multi "0" sequences that in octal notation also means zero. + Another way would be to only use two rules: + "0" [0-9]+ + "0" | ( [1-9] [0-9]* ) + A full description of re2c rule syntax can be found in the manual. +*/ + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#if _MSC_VER > 1200 +#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif // Prevents warning from vc7.1 complaining about redefinition + +#include +#include +#include +#include +#include +#include "HiResTimer.h" + +static char gTestBuf[1000] = ""; + +/** + * @brief Setup HiResolution timer and confirm it is working ok + */ +void InitHiResTimerAndVerifyWorking(void) +{ + double elapsed; + HrtInit(); + HrtSetPriority(ABOVE_NORMAL_PRIORITY_CLASS); + HrtStart(); + Sleep(100); + elapsed = HrtElapsedMillis(); + if ((elapsed < 90) || (elapsed > 110)) { + printf("HiResTimer misbehaving: %f\n", elapsed); + exit(2); + } +} + +/** + * @brief Scan for numbers in different formats + */ +int ScanFullSpeed(char *pzStrToScan, size_t lenStrToScan) +{ + unsigned char *pzCurScanPos = (unsigned char*)pzStrToScan; + unsigned char *pzBacktrackInfo = 0; +#define YYCTYPE unsigned char +#define YYCURSOR pzCurScanPos +#define YYLIMIT (pzStrToScan+lenStrToScan) +#define YYMARKER pzBacktrackInfo +#define YYFILL(n) + + for(;;) + { +/*!re2c + re2c:indent:top = 2; + [1-9][0-9]* { continue; } + [0][0-9]+ { continue; } + "+" { continue; } + "-" { continue; } + "\000" { return 0; } + [^] { return 1; } +*/ + } +} + +/** + * @brief Scan for numbers in different formats + */ +int scan(char *pzStrToScan, size_t lenStrToScan) +{ + unsigned char *pzCurScanPos = (unsigned char*)pzStrToScan; + unsigned char *pzBacktrackInfo = 0; +#define YYCTYPE unsigned char +#define YYCURSOR pzCurScanPos +#define YYLIMIT (pzStrToScan+lenStrToScan) +#define YYMARKER pzBacktrackInfo +#define YYFILL(n) + + for(;;) + { +/*!re2c + re2c:indent:top = 2; + [1-9][0-9]* { printf("Num\n"); strcat(gTestBuf, "Num "); continue; } + [0][0-9]+ { printf("Oct\n"); strcat(gTestBuf, "Oct "); continue; } + "+" { printf("+\n"); strcat(gTestBuf, "+ "); continue; } + "-" { printf("-\n"); strcat(gTestBuf, "- "); continue; } + "\000" { printf("EOF\n"); return 0; } + [^] { printf("ERR\n"); strcat(gTestBuf, "ERR "); return 1; } +*/ + } +} + +/** + * @brief Show high resolution elapsed time for 10,000 and 100,000 loops + */ +void DoTimingsOfStrnCmp(void) +{ + char testStr[] = "Hello, world"; + int totLoops = 10000; + int totFoundCount = 0; + int foundCount = 0; + int loop; + int rc; + const int progressAnd = 0xFFFFF000; + double elapsed; + + printf("\n\n%d loops with * every %d loops to confirm\n", totLoops, ((~progressAnd) + 1)); + + HrtStart(); + for (loop = 0; loop < totLoops; ++loop) { + foundCount = 0; + rc = strncmp(testStr, "Hello", 5); + if (rc == 0) { + foundCount++; + totFoundCount++; + if ((totFoundCount & progressAnd) == totFoundCount) { + printf("*"); + } + } + } + elapsed = HrtElapsedMillis(); + printf("\nstrncmp Elapsed for %7d loops milliseconds: %7.3f\n", totLoops, elapsed); + printf("FoundCount each loop: %d\n", foundCount); + printf("TotalFoundCount for all loops: %d\n", totFoundCount); + + totLoops = 100000; + HrtStart(); + for (loop = 0; loop < totLoops; ++loop) { + foundCount = 0; + rc = strncmp(testStr, "Hello", 5); + if (rc == 0) { + foundCount++; + totFoundCount++; + if ((totFoundCount & progressAnd) == totFoundCount) { + printf("*"); + } + } + } + elapsed = HrtElapsedMillis(); + printf("\nstrncmp Elapsed for %7d loops milliseconds: %7.3f\n", totLoops, elapsed); + printf("FoundCount each loop: %d\n", foundCount); + printf("TotalFoundCount for all loops: %d\n", totFoundCount); +} + +/** + * @brief Show high resolution elapsed time for 10,000 and 100,000 loops + */ +void DoTimingsOfRe2c(void) +{ + char* testStrings[] = { "123", "1234", "+123", "01234", "-04321", "abc", "123abc" }; + const int testCount = sizeof(testStrings) / sizeof(testStrings[0]); + int i; + int totLoops = 10000 / testCount; // Doing more than one per loop + int totFoundCount = 0; + int foundCount = 0; + int loop; + int rc; + const int progressAnd = 0xFFFFF000; + double elapsed; + + printf("\n\n%d loops with * every %d loops to confirm\n", totLoops, ((~progressAnd) + 1)); + + HrtStart(); + for (loop = 0; loop < totLoops; ++loop) { + foundCount = 0; + strcpy(gTestBuf, ""); + for (i = 0; i < testCount; ++i) { + char* pzCurStr = testStrings[i]; + size_t len = strlen(pzCurStr); // Calc of strlen slows things down ... std::string? + rc = ScanFullSpeed(pzCurStr, len); + if (rc == 0) { + foundCount++; + totFoundCount++; + if ((totFoundCount & progressAnd) == totFoundCount) { + printf("*"); + } + } + } + } + elapsed = HrtElapsedMillis(); + printf("\nRe2c Elapsed for %7d loops milliseconds: %7.3f\n", totLoops, elapsed); + printf("FoundCount each loop: %d\n", foundCount); + printf("TotalFoundCount for all loops: %d\n", totFoundCount); + + totLoops = 100000 / testCount; + printf("\n\n%d loops with * every %d loops to confirm\n", totLoops, ((~progressAnd) + 1)); + + HrtStart(); + for (loop = 0; loop < totLoops; ++loop) { + foundCount = 0; + strcpy(gTestBuf, ""); + for (i = 0; i < testCount; ++i) { + char* pzCurStr = testStrings[i]; + size_t len = strlen(pzCurStr); // Calc of strlen slows things down ... std::string? + rc = ScanFullSpeed(pzCurStr, len); + if (rc == 0) { + foundCount++; + totFoundCount++; + if ((totFoundCount & progressAnd) == totFoundCount) { + printf("*"); + } + } + } + } + elapsed = HrtElapsedMillis(); + printf("\nRe2c Elapsed for %7d loops milliseconds: %7.3f\n", totLoops, elapsed); + printf("FoundCount each loop: %d\n", foundCount); + printf("TotalFoundCount for all loops: %d\n", totFoundCount); +} + +/** + * @brief Entry point for console app + */ +int main(int argc, char **argv) +{ + char testStr_A[] = "123"; + char* testStr_B = "456"; + char* testStrings[] = { "123", "1234", "+123", "01234", "-04321", "abc", "123abc" }; + const int testCount = sizeof(testStrings) / sizeof(testStrings[0]); + int i; + + int rc = scan(testStr_A, 3); + printf("rc: %d\n", rc); + + rc = scan(testStr_B, 3); + printf("rc: %d\n", rc); + + rc = scan("789", 3); + printf("rc: %d\n", rc); + + strcpy(gTestBuf, ""); + for (i = 0; i < testCount; ++i) { + char* pzCurStr = testStrings[i]; + size_t len = strlen(pzCurStr); + scan(pzCurStr, len); + } + printf("%s\n", gTestBuf); + rc = strcmp(gTestBuf, "Num Num + Num Oct - Oct ERR Num ERR "); + if (rc == 0) { + printf("Success\n"); + } + else { + printf("Failure\n"); + } + assert(0 == rc); // Doesn't work with Release build + + InitHiResTimerAndVerifyWorking(); + + DoTimingsOfStrnCmp(); + + DoTimingsOfRe2c(); + + return 0; +} diff --git a/re2c/test/overflow-1.c b/re2c/test/overflow-1.c old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-1.re b/re2c/test/overflow-1.re old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-2.c b/re2c/test/overflow-2.c old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-2.re b/re2c/test/overflow-2.re old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-3.c b/re2c/test/overflow-3.c old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-3.re b/re2c/test/overflow-3.re old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-4.c b/re2c/test/overflow-4.c old mode 100755 new mode 100644 diff --git a/re2c/test/overflow-4.re b/re2c/test/overflow-4.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.b.re b/re2c/test/parse_date.b.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.c b/re2c/test/parse_date.c old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.db.re b/re2c/test/parse_date.db.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.g.c b/re2c/test/parse_date.g.c old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.g.re b/re2c/test/parse_date.g.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.re b/re2c/test/parse_date.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date.s.re b/re2c/test/parse_date.s.re old mode 100755 new mode 100644 diff --git a/re2c/test/parse_date_1_78.db.re b/re2c/test/parse_date_1_78.db.re old mode 100755 new mode 100644 diff --git a/re2c/test/push.c b/re2c/test/push.c old mode 100755 new mode 100644 diff --git a/re2c/test/push.f.c b/re2c/test/push.f.c old mode 100755 new mode 100644 diff --git a/re2c/test/push.f.re b/re2c/test/push.f.re old mode 100755 new mode 100644 diff --git a/re2c/test/push.fb.c b/re2c/test/push.fb.c old mode 100755 new mode 100644 diff --git a/re2c/test/push.fb.re b/re2c/test/push.fb.re old mode 100755 new mode 100644 diff --git a/re2c/test/push.fg.c b/re2c/test/push.fg.c old mode 100755 new mode 100644 diff --git a/re2c/test/push.fg.re b/re2c/test/push.fg.re old mode 100755 new mode 100644 diff --git a/re2c/test/push.fs.c b/re2c/test/push.fs.c old mode 100755 new mode 100644 diff --git a/re2c/test/push.fs.re b/re2c/test/push.fs.re old mode 100755 new mode 100644 diff --git a/re2c/test/push.re b/re2c/test/push.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-00.cgi.c b/re2c/test/repeat-00.cgi.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-00.cgi.re b/re2c/test/repeat-00.cgi.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-01.cgir.c b/re2c/test/repeat-01.cgir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-01.cgir.re b/re2c/test/repeat-01.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-02.cgir.c b/re2c/test/repeat-02.cgir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-02.cgir.re b/re2c/test/repeat-02.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-03.cgir.c b/re2c/test/repeat-03.cgir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-03.cgir.re b/re2c/test/repeat-03.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-04.cgir.c b/re2c/test/repeat-04.cgir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-04.cgir.re b/re2c/test/repeat-04.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-05.cgir.c b/re2c/test/repeat-05.cgir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-05.cgir.re b/re2c/test/repeat-05.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-06.gir.c b/re2c/test/repeat-06.gir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-06.gir.re b/re2c/test/repeat-06.gir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-07.gir.c b/re2c/test/repeat-07.gir.c old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-07.gir.re b/re2c/test/repeat-07.gir.re old mode 100755 new mode 100644 diff --git a/re2c/test/repeat-07_error.gir.re b/re2c/test/repeat-07_error.gir.re old mode 100755 new mode 100644 diff --git a/re2c/test/reuse_conds_default_0.cgir.re b/re2c/test/reuse_conds_default_0.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/reuse_conds_default_1.cgir.re b/re2c/test/reuse_conds_default_1.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/reuse_conds_setup_0.cgir.re b/re2c/test/reuse_conds_setup_0.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/reuse_conds_setup_1.cgir.re b/re2c/test/reuse_conds_setup_1.cgir.re old mode 100755 new mode 100644 diff --git a/re2c/test/rexx.c b/re2c/test/rexx.c new file mode 100644 index 00000000..593fba11 --- /dev/null +++ b/re2c/test/rexx.c @@ -0,0 +1,6979 @@ +/* Generated by re2c */ +#line 1 "rexx.re" +#include "scanio.h" +#include "scanner.h" + +#define CURSOR ch +#define LOADCURSOR ch = *cursor; +#define ADVANCE cursor++; +#define BACK(n) cursor -= (n); +#define CHECK(n) if((ScanCB.lim - cursor) < (n)){cursor = ScanFill(cursor);} +#define MARK(n) ScanCB.ptr = cursor; sel = (n); +#define REVERT cursor = ScanCB.ptr; +#define MARKER sel + +#define RETURN(i) {ScanCB.cur = cursor; return i;} + +int ScanToken(){ + uchar *cursor = ScanCB.cur; + unsigned sel; + uchar ch; + ScanCB.tok = cursor; + ScanCB.eot = NULL; +#line 63 "rexx.re" + + +scan: + +#line 29 "" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + + if ((YYLIMIT - YYCURSOR) < 13) YYFILL(13); + yych = *YYCURSOR; + switch (yych) { + case 0x00: goto yy63; + case '\n': goto yy3; + case '!': + case '?': + case 'G': + case 'J': + case 'K': + case 'M': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'g': + case 'j': + case 'k': + case 'm': + case 'x': + case 'y': + case 'z': goto yy59; + case '"': goto yy62; + case '%': goto yy15; + case '&': goto yy25; + case '\'': goto yy60; + case '(': goto yy31; + case ')': goto yy33; + case '*': goto yy11; + case '+': goto yy7; + case ',': goto yy29; + case '-': goto yy9; + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy57; + case '/': goto yy13; + case ':': goto yy27; + case ';': goto yy35; + case '<': goto yy21; + case '=': goto yy17; + case '>': goto yy23; + case 'A': + case 'a': goto yy37; + case 'B': + case 'b': goto yy52; + case 'C': + case 'c': goto yy39; + case 'D': + case 'd': goto yy40; + case 'E': + case 'e': goto yy41; + case 'F': + case 'f': goto yy53; + case 'H': + case 'h': goto yy54; + case 'I': + case 'i': goto yy42; + case 'L': + case 'l': goto yy43; + case 'N': + case 'n': goto yy44; + case 'O': + case 'o': goto yy45; + case 'P': + case 'p': goto yy46; + case 'Q': + case 'q': goto yy47; + case 'R': + case 'r': goto yy48; + case 'S': + case 's': goto yy49; + case 'T': + case 't': goto yy50; + case 'U': + case 'u': goto yy55; + case 'V': + case 'v': goto yy56; + case 'W': + case 'w': goto yy51; + case '\\': + case '~': goto yy19; + case '|': goto yy5; + default: goto yy65; + } +yy2: +#line 253 "rexx.re" + { RETURN(SU_SYMBOL_COMPOUND); } +#line 129 "" +yy3: + ++YYCURSOR; +#line 68 "rexx.re" + { + ++(ScanCB.lineNum); + ScanCB.linePos = ScanCB.pos + (cursor - ScanCB.mrk); + RETURN(SU_EOL); + } +#line 138 "" +yy5: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy423; + case '|': goto yy425; + default: goto yy6; + } +yy6: +#line 116 "rexx.re" + { RETURN(OP_OR); } +#line 151 "" +yy7: + ++YYCURSOR; +#line 76 "rexx.re" + { RETURN(OP_PLUS); } +#line 156 "" +yy9: + ++YYCURSOR; +#line 78 "rexx.re" + { RETURN(OP_MINUS); } +#line 161 "" +yy11: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy419; + case '*': goto yy421; + default: goto yy12; + } +yy12: +#line 80 "rexx.re" + { RETURN(OP_MULT); } +#line 174 "" +yy13: + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy415; + case '/': goto yy417; + default: goto yy14; + } +yy14: +#line 82 "rexx.re" + { RETURN(OP_DIV); } +#line 187 "" +yy15: + ++YYCURSOR; +#line 84 "rexx.re" + { RETURN(OP_IDIV); } +#line 192 "" +yy17: + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy411; + case '=': goto yy413; + default: goto yy18; + } +yy18: +#line 90 "rexx.re" + { RETURN(OP_EQUAL); } +#line 205 "" +yy19: + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': + case '<': + case '=': + case '>': goto yy399; + default: goto yy20; + } +yy20: +#line 120 "rexx.re" + { RETURN(OP_NOT); } +#line 220 "" +yy21: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': + case '<': + case '=': + case '>': goto yy389; + default: goto yy22; + } +yy22: +#line 96 "rexx.re" + { RETURN(OP_LT); } +#line 235 "" +yy23: + yyaccept = 6; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': + case '<': + case '=': + case '>': goto yy377; + default: goto yy24; + } +yy24: +#line 94 "rexx.re" + { RETURN(OP_GT); } +#line 250 "" +yy25: + yyaccept = 7; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy372; + case '&': goto yy374; + default: goto yy26; + } +yy26: +#line 114 "rexx.re" + { RETURN(OP_AND); } +#line 263 "" +yy27: + ++YYCURSOR; +#line 123 "rexx.re" + { RETURN(SU_COLON); } +#line 268 "" +yy29: + ++YYCURSOR; +#line 125 "rexx.re" + { RETURN(SU_COMMA); } +#line 273 "" +yy31: + ++YYCURSOR; +#line 127 "rexx.re" + { RETURN(SU_POPEN); } +#line 278 "" +yy33: + ++YYCURSOR; +#line 129 "rexx.re" + { RETURN(SU_PCLOSE); } +#line 283 "" +yy35: + ++YYCURSOR; +#line 131 "rexx.re" + { RETURN(SU_EOC); } +#line 288 "" +yy37: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case 'D': + case 'd': goto yy362; + case 'R': + case 'r': goto yy363; + default: goto yy81; + } +yy38: +#line 249 "rexx.re" + { RETURN(SU_SYMBOL); } +#line 301 "" +yy39: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy358; + default: goto yy81; + } +yy40: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy346; + case 'O': + case 'o': goto yy347; + case 'R': + case 'r': goto yy349; + default: goto yy81; + } +yy41: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy315; + case 'N': + case 'n': goto yy316; + case 'R': + case 'r': goto yy317; + case 'X': + case 'x': goto yy318; + default: goto yy81; + } +yy42: + yych = *++YYCURSOR; + switch (yych) { + case 'F': + case 'f': goto yy297; + case 'N': + case 'n': goto yy299; + case 'T': + case 't': goto yy300; + default: goto yy81; + } +yy43: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy286; + case 'I': + case 'i': goto yy287; + default: goto yy81; + } +yy44: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy259; + case 'O': + case 'o': goto yy260; + case 'U': + case 'u': goto yy261; + default: goto yy81; + } +yy45: + yych = *++YYCURSOR; + switch (yych) { + case 'F': + case 'f': goto yy238; + case 'N': + case 'n': goto yy239; + case 'P': + case 'p': goto yy241; + case 'T': + case 't': goto yy242; + default: goto yy81; + } +yy46: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy217; + case 'R': + case 'r': goto yy218; + case 'U': + case 'u': goto yy219; + default: goto yy81; + } +yy47: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy212; + default: goto yy81; + } +yy48: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy206; + default: goto yy81; + } +yy49: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy169; + case 'C': + case 'c': goto yy170; + case 'E': + case 'e': goto yy171; + case 'I': + case 'i': goto yy172; + case 'O': + case 'o': goto yy173; + case 'Y': + case 'y': goto yy174; + default: goto yy81; + } +yy50: + yych = *++YYCURSOR; + switch (yych) { + case 'H': + case 'h': goto yy158; + case 'O': + case 'o': goto yy159; + case 'R': + case 'r': goto yy161; + default: goto yy81; + } +yy51: + yych = *++YYCURSOR; + switch (yych) { + case 'H': + case 'h': goto yy146; + case 'I': + case 'i': goto yy147; + default: goto yy81; + } +yy52: + yych = *++YYCURSOR; + switch (yych) { + case 'Y': + case 'y': goto yy144; + default: goto yy81; + } +yy53: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy123; + case 'O': + case 'o': goto yy124; + case 'U': + case 'u': goto yy125; + default: goto yy81; + } +yy54: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy119; + default: goto yy81; + } +yy55: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy109; + case 'P': + case 'p': goto yy110; + default: goto yy81; + } +yy56: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy95; + case 'E': + case 'e': goto yy96; + default: goto yy81; + } +yy57: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy87; +yy58: +#line 247 "rexx.re" + { RETURN(SU_CONST); } +#line 489 "" +yy59: + yych = *++YYCURSOR; + goto yy81; +yy60: + yyaccept = 8; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 0x00: + case '\n': goto yy61; + default: goto yy78; + } +yy61: +#line 264 "rexx.re" + { RETURN(SU_ERROR); } +#line 504 "" +yy62: + yyaccept = 8; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 0x00: + case '\n': goto yy61; + default: goto yy67; + } +yy63: + ++YYCURSOR; +#line 262 "rexx.re" + { RETURN(SU_EOF); } +#line 517 "" +yy65: + yych = *++YYCURSOR; + goto yy61; +yy66: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy67: + switch (yych) { + case 0x00: + case '\n': goto yy68; + case '"': goto yy69; + default: goto yy66; + } +yy68: + YYCURSOR = YYMARKER; + switch (yyaccept) { + case 0: goto yy6; + case 1: goto yy12; + case 2: goto yy14; + case 3: goto yy18; + case 4: goto yy20; + case 5: goto yy22; + case 6: goto yy24; + case 7: goto yy26; + case 8: goto yy61; + case 9: goto yy70; + case 10: goto yy58; + case 11: goto yy379; + case 12: goto yy391; + case 13: goto yy393; + case 14: goto yy381; + default: goto yy383; + } +yy69: + yyaccept = 9; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch (yych) { + case '"': goto yy66; + case 'B': + case 'b': goto yy71; + case 'X': + case 'x': goto yy72; + default: goto yy70; + } +yy70: +#line 255 "rexx.re" + { RETURN(SU_LITERAL); } +#line 568 "" +yy71: + YYCTXMARKER = YYCURSOR + 1; + yych = *++YYCURSOR; + switch (yych) { + case '!': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy68; + default: goto yy75; + } +yy72: + YYCTXMARKER = YYCURSOR + 1; + yych = *++YYCURSOR; + switch (yych) { + case '!': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy68; + default: goto yy73; + } +yy73: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; +#line 259 "rexx.re" + { RETURN(SU_LITERAL_HEX); } +#line 718 "" +yy75: + ++YYCURSOR; + YYCURSOR = YYCTXMARKER; +#line 257 "rexx.re" + { RETURN(SU_LITERAL_BIN); } +#line 724 "" +yy77: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy78: + switch (yych) { + case 0x00: + case '\n': goto yy68; + case '\'': goto yy79; + default: goto yy77; + } +yy79: + yyaccept = 9; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch (yych) { + case '\'': goto yy77; + case 'B': + case 'b': goto yy71; + case 'X': + case 'x': goto yy72; + default: goto yy70; + } +yy80: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy81: + switch (yych) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy38; + } +yy82: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy84; + default: goto yy83; + } +yy83: +#line 251 "rexx.re" + { RETURN(SU_SYMBOL_STEM); } +#line 897 "" +yy84: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '!': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy84; + default: goto yy2; + } +yy86: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy87: + switch (yych) { + case '!': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy86; + case 'E': + case 'e': goto yy88; + default: goto yy58; + } +yy88: + yyaccept = 10; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch (yych) { + case '!': + case '.': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy86; + case '+': + case '-': goto yy90; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy91; + case 'E': + case 'e': goto yy88; + default: goto yy58; + } +yy90: + yych = *++YYCURSOR; + switch (yych) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy93; + default: goto yy68; + } +yy91: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '!': + case '.': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy86; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy91; + case 'E': + case 'e': goto yy88; + default: goto yy58; + } +yy93: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy93; + default: goto yy58; + } +yy95: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy103; + case 'R': + case 'r': goto yy104; + default: goto yy81; + } +yy96: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy97; + default: goto yy81; + } +yy97: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy98; + default: goto yy81; + } +yy98: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy99; + default: goto yy81; + } +yy99: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy100; + default: goto yy81; + } +yy100: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy101; + default: goto yy81; + } +yy101: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy102; + } +yy102: +#line 240 "rexx.re" + { RETURN(RXS_VERSION); } +#line 1344 "" +yy103: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy106; + default: goto yy81; + } +yy104: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy105; + } +yy105: +#line 238 "rexx.re" + { RETURN(RXS_VAR); } +#line 1426 "" +yy106: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy107; + default: goto yy81; + } +yy107: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy108; + } +yy108: +#line 236 "rexx.re" + { RETURN(RXS_VALUE); } +#line 1508 "" +yy109: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy115; + default: goto yy81; + } +yy110: + yych = *++YYCURSOR; + switch (yych) { + case 'P': + case 'p': goto yy111; + default: goto yy81; + } +yy111: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy112; + default: goto yy81; + } +yy112: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy113; + default: goto yy81; + } +yy113: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy114; + } +yy114: +#line 234 "rexx.re" + { RETURN(RXS_UPPER); } +#line 1611 "" +yy115: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy116; + default: goto yy81; + } +yy116: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy117; + default: goto yy81; + } +yy117: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy118; + } +yy118: +#line 232 "rexx.re" + { RETURN(RXS_UNTIL); } +#line 1700 "" +yy119: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy120; + default: goto yy81; + } +yy120: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy121; + default: goto yy81; + } +yy121: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy122; + } +yy122: +#line 214 "rexx.re" + { RETURN(RXS_HALT); } +#line 1789 "" +yy123: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy138; + default: goto yy81; + } +yy124: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy129; + default: goto yy81; + } +yy125: + yych = *++YYCURSOR; + switch (yych) { + case 'Z': + case 'z': goto yy126; + default: goto yy81; + } +yy126: + yych = *++YYCURSOR; + switch (yych) { + case 'Z': + case 'z': goto yy127; + default: goto yy81; + } +yy127: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy128; + } +yy128: +#line 212 "rexx.re" + { RETURN(RXS_FUZZ); } +#line 1892 "" +yy129: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + case 'E': + case 'e': goto yy131; + case 'M': + case 'm': goto yy132; + default: goto yy130; + } +yy130: +#line 206 "rexx.re" + { RETURN(RXS_FOR); } +#line 1967 "" +yy131: + yych = *++YYCURSOR; + switch (yych) { + case 'V': + case 'v': goto yy134; + default: goto yy81; + } +yy132: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy133; + } +yy133: +#line 210 "rexx.re" + { RETURN(RXS_FORM); } +#line 2049 "" +yy134: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy135; + default: goto yy81; + } +yy135: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy136; + default: goto yy81; + } +yy136: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy137; + } +yy137: +#line 208 "rexx.re" + { RETURN(RXS_FOREVER); } +#line 2138 "" +yy138: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy139; + default: goto yy81; + } +yy139: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy140; + default: goto yy81; + } +yy140: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy141; + default: goto yy81; + } +yy141: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy142; + default: goto yy81; + } +yy142: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy143; + } +yy143: +#line 204 "rexx.re" + { RETURN(RXS_FAILURE); } +#line 2241 "" +yy144: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy145; + } +yy145: +#line 194 "rexx.re" + { RETURN(RXS_BY); } +#line 2316 "" +yy146: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy151; + case 'I': + case 'i': goto yy152; + default: goto yy81; + } +yy147: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy148; + default: goto yy81; + } +yy148: + yych = *++YYCURSOR; + switch (yych) { + case 'H': + case 'h': goto yy149; + default: goto yy81; + } +yy149: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy150; + } +yy150: +#line 244 "rexx.re" + { RETURN(RXS_WITH); } +#line 2414 "" +yy151: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy156; + default: goto yy81; + } +yy152: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy153; + default: goto yy81; + } +yy153: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy154; + default: goto yy81; + } +yy154: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy155; + } +yy155: +#line 242 "rexx.re" + { RETURN(RXS_WHILE); } +#line 2510 "" +yy156: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy157; + } +yy157: +#line 188 "rexx.re" + { RETURN(RX_WHEN); } +#line 2585 "" +yy158: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy166; + default: goto yy81; + } +yy159: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy160; + } +yy160: +#line 230 "rexx.re" + { RETURN(RXS_TO); } +#line 2667 "" +yy161: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy162; + default: goto yy81; + } +yy162: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy163; + default: goto yy81; + } +yy163: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy164; + default: goto yy81; + } +yy164: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy165; + } +yy165: +#line 186 "rexx.re" + { RETURN(RX_TRACE); } +#line 2763 "" +yy166: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy167; + default: goto yy81; + } +yy167: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy168; + } +yy168: +#line 184 "rexx.re" + { RETURN(RX_THEN); } +#line 2845 "" +yy169: + yych = *++YYCURSOR; + switch (yych) { + case 'Y': + case 'y': goto yy204; + default: goto yy81; + } +yy170: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy195; + default: goto yy81; + } +yy171: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy190; + default: goto yy81; + } +yy172: + yych = *++YYCURSOR; + switch (yych) { + case 'G': + case 'g': goto yy185; + default: goto yy81; + } +yy173: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy180; + default: goto yy81; + } +yy174: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy175; + default: goto yy81; + } +yy175: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy176; + default: goto yy81; + } +yy176: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy177; + default: goto yy81; + } +yy177: + yych = *++YYCURSOR; + switch (yych) { + case 'X': + case 'x': goto yy178; + default: goto yy81; + } +yy178: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy179; + } +yy179: +#line 228 "rexx.re" + { RETURN(RXS_SYNTAX); } +#line 2983 "" +yy180: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy181; + default: goto yy81; + } +yy181: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy182; + default: goto yy81; + } +yy182: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy183; + default: goto yy81; + } +yy183: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy184; + } +yy184: +#line 226 "rexx.re" + { RETURN(RXS_SOURCE); } +#line 3079 "" +yy185: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy186; + default: goto yy81; + } +yy186: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy187; + default: goto yy81; + } +yy187: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy188; + default: goto yy81; + } +yy188: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy189; + } +yy189: +#line 182 "rexx.re" + { RETURN(RX_SIGNAL); } +#line 3175 "" +yy190: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy191; + default: goto yy81; + } +yy191: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy192; + default: goto yy81; + } +yy192: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy193; + default: goto yy81; + } +yy193: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy194; + } +yy194: +#line 180 "rexx.re" + { RETURN(RX_SELECT); } +#line 3271 "" +yy195: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy196; + default: goto yy81; + } +yy196: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy197; + default: goto yy81; + } +yy197: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy198; + default: goto yy81; + } +yy198: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy199; + default: goto yy81; + } +yy199: + yych = *++YYCURSOR; + switch (yych) { + case 'F': + case 'f': goto yy200; + default: goto yy81; + } +yy200: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy201; + default: goto yy81; + } +yy201: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy202; + default: goto yy81; + } +yy202: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy203; + } +yy203: +#line 224 "rexx.re" + { RETURN(RXS_SCIENTIFIC); } +#line 3395 "" +yy204: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy205; + } +yy205: +#line 178 "rexx.re" + { RETURN(RX_SAY); } +#line 3470 "" +yy206: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy207; + default: goto yy81; + } +yy207: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy208; + default: goto yy81; + } +yy208: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy209; + default: goto yy81; + } +yy209: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy210; + default: goto yy81; + } +yy210: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy211; + } +yy211: +#line 176 "rexx.re" + { RETURN(RX_RETURN); } +#line 3573 "" +yy212: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy213; + default: goto yy81; + } +yy213: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy214; + default: goto yy81; + } +yy214: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy215; + default: goto yy81; + } +yy215: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy216; + } +yy216: +#line 174 "rexx.re" + { RETURN(RX_QUEUE); } +#line 3669 "" +yy217: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy234; + default: goto yy81; + } +yy218: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy226; + default: goto yy81; + } +yy219: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy220; + case 'S': + case 's': goto yy221; + default: goto yy81; + } +yy220: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy224; + default: goto yy81; + } +yy221: + yych = *++YYCURSOR; + switch (yych) { + case 'H': + case 'h': goto yy222; + default: goto yy81; + } +yy222: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy223; + } +yy223: +#line 172 "rexx.re" + { RETURN(RX_PUSH); } +#line 3781 "" +yy224: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy225; + } +yy225: +#line 170 "rexx.re" + { RETURN(RX_PULL); } +#line 3856 "" +yy226: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy227; + default: goto yy81; + } +yy227: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy228; + default: goto yy81; + } +yy228: + yych = *++YYCURSOR; + switch (yych) { + case 'D': + case 'd': goto yy229; + default: goto yy81; + } +yy229: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy230; + default: goto yy81; + } +yy230: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy231; + default: goto yy81; + } +yy231: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy232; + default: goto yy81; + } +yy232: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy233; + } +yy233: +#line 168 "rexx.re" + { RETURN(RX_PROCEDURE); } +#line 3973 "" +yy234: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy235; + default: goto yy81; + } +yy235: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy236; + default: goto yy81; + } +yy236: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy237; + } +yy237: +#line 166 "rexx.re" + { RETURN(RX_PARSE); } +#line 4062 "" +yy238: + yych = *++YYCURSOR; + switch (yych) { + case 'F': + case 'f': goto yy257; + default: goto yy81; + } +yy239: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy240; + } +yy240: +#line 192 "rexx.re" + { RETURN(RXS_ON); } +#line 4144 "" +yy241: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy251; + default: goto yy81; + } +yy242: + yych = *++YYCURSOR; + switch (yych) { + case 'H': + case 'h': goto yy243; + default: goto yy81; + } +yy243: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy244; + default: goto yy81; + } +yy244: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy245; + default: goto yy81; + } +yy245: + yych = *++YYCURSOR; + switch (yych) { + case 'W': + case 'w': goto yy246; + default: goto yy81; + } +yy246: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy247; + default: goto yy81; + } +yy247: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy248; + default: goto yy81; + } +yy248: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy249; + default: goto yy81; + } +yy249: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy250; + } +yy250: +#line 164 "rexx.re" + { RETURN(RX_OTHERWISE); } +#line 4275 "" +yy251: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy252; + default: goto yy81; + } +yy252: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy253; + default: goto yy81; + } +yy253: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy254; + default: goto yy81; + } +yy254: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy255; + default: goto yy81; + } +yy255: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy256; + } +yy256: +#line 162 "rexx.re" + { RETURN(RX_OPTIONS); } +#line 4378 "" +yy257: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy258; + } +yy258: +#line 190 "rexx.re" + { RETURN(RXS_OFF); } +#line 4453 "" +yy259: + yych = *++YYCURSOR; + switch (yych) { + case 'M': + case 'm': goto yy283; + default: goto yy81; + } +yy260: + yych = *++YYCURSOR; + switch (yych) { + case 'P': + case 'p': goto yy268; + case 'T': + case 't': goto yy270; + case 'V': + case 'v': goto yy271; + default: goto yy81; + } +yy261: + yych = *++YYCURSOR; + switch (yych) { + case 'M': + case 'm': goto yy262; + default: goto yy81; + } +yy262: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy263; + default: goto yy81; + } +yy263: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy264; + default: goto yy81; + } +yy264: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy265; + default: goto yy81; + } +yy265: + yych = *++YYCURSOR; + switch (yych) { + case 'C': + case 'c': goto yy266; + default: goto yy81; + } +yy266: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy267; + } +yy267: +#line 160 "rexx.re" + { RETURN(RX_NUMERIC); } +#line 4581 "" +yy268: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy269; + } +yy269: +#line 158 "rexx.re" + { RETURN(RX_NOP); } +#line 4656 "" +yy270: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy277; + default: goto yy81; + } +yy271: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy272; + default: goto yy81; + } +yy272: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy273; + default: goto yy81; + } +yy273: + yych = *++YYCURSOR; + switch (yych) { + case 'U': + case 'u': goto yy274; + default: goto yy81; + } +yy274: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy275; + default: goto yy81; + } +yy275: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy276; + } +yy276: +#line 222 "rexx.re" + { RETURN(RXS_NOVALUE); } +#line 4766 "" +yy277: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy278; + default: goto yy81; + } +yy278: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy279; + default: goto yy81; + } +yy279: + yych = *++YYCURSOR; + switch (yych) { + case 'D': + case 'd': goto yy280; + default: goto yy81; + } +yy280: + yych = *++YYCURSOR; + switch (yych) { + case 'Y': + case 'y': goto yy281; + default: goto yy81; + } +yy281: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy282; + } +yy282: +#line 220 "rexx.re" + { RETURN(RXS_NOTREADY); } +#line 4869 "" +yy283: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy284; + default: goto yy81; + } +yy284: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy285; + } +yy285: +#line 218 "rexx.re" + { RETURN(RXS_NAME); } +#line 4951 "" +yy286: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy293; + default: goto yy81; + } +yy287: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy288; + default: goto yy81; + } +yy288: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy289; + default: goto yy81; + } +yy289: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy290; + default: goto yy81; + } +yy290: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy291; + default: goto yy81; + } +yy291: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy292; + } +yy292: +#line 216 "rexx.re" + { RETURN(RXS_LINEIN); } +#line 5061 "" +yy293: + yych = *++YYCURSOR; + switch (yych) { + case 'V': + case 'v': goto yy294; + default: goto yy81; + } +yy294: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy295; + default: goto yy81; + } +yy295: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy296; + } +yy296: +#line 156 "rexx.re" + { RETURN(RX_LEAVE); } +#line 5150 "" +yy297: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy298; + } +yy298: +#line 150 "rexx.re" + { RETURN(RX_IF); } +#line 5225 "" +yy299: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy307; + default: goto yy81; + } +yy300: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy301; + default: goto yy81; + } +yy301: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy302; + default: goto yy81; + } +yy302: + yych = *++YYCURSOR; + switch (yych) { + case 'A': + case 'a': goto yy303; + default: goto yy81; + } +yy303: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy304; + default: goto yy81; + } +yy304: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy305; + default: goto yy81; + } +yy305: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy306; + } +yy306: +#line 154 "rexx.re" + { RETURN(RX_ITERATE); } +#line 5342 "" +yy307: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy308; + default: goto yy81; + } +yy308: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy309; + default: goto yy81; + } +yy309: + yych = *++YYCURSOR; + switch (yych) { + case 'P': + case 'p': goto yy310; + default: goto yy81; + } +yy310: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy311; + default: goto yy81; + } +yy311: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy312; + default: goto yy81; + } +yy312: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy313; + default: goto yy81; + } +yy313: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy314; + } +yy314: +#line 152 "rexx.re" + { RETURN(RX_INTERPRET); } +#line 5459 "" +yy315: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy343; + default: goto yy81; + } +yy316: + yych = *++YYCURSOR; + switch (yych) { + case 'D': + case 'd': goto yy331; + case 'G': + case 'g': goto yy333; + default: goto yy81; + } +yy317: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy327; + default: goto yy81; + } +yy318: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy319; + case 'P': + case 'p': goto yy320; + default: goto yy81; + } +yy319: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy325; + default: goto yy81; + } +yy320: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy321; + default: goto yy81; + } +yy321: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy322; + default: goto yy81; + } +yy322: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy323; + default: goto yy81; + } +yy323: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy324; + } +yy324: +#line 202 "rexx.re" + { RETURN(RXS_EXPOSE); } +#line 5594 "" +yy325: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy326; + } +yy326: +#line 148 "rexx.re" + { RETURN(RX_EXIT); } +#line 5669 "" +yy327: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy328; + default: goto yy81; + } +yy328: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy329; + default: goto yy81; + } +yy329: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy330; + } +yy330: +#line 200 "rexx.re" + { RETURN(RXS_ERROR); } +#line 5758 "" +yy331: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy332; + } +yy332: +#line 146 "rexx.re" + { RETURN(RX_END); } +#line 5833 "" +yy333: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy334; + default: goto yy81; + } +yy334: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy335; + default: goto yy81; + } +yy335: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy336; + default: goto yy81; + } +yy336: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy337; + default: goto yy81; + } +yy337: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy338; + default: goto yy81; + } +yy338: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy339; + default: goto yy81; + } +yy339: + yych = *++YYCURSOR; + switch (yych) { + case 'N': + case 'n': goto yy340; + default: goto yy81; + } +yy340: + yych = *++YYCURSOR; + switch (yych) { + case 'G': + case 'g': goto yy341; + default: goto yy81; + } +yy341: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy342; + } +yy342: +#line 198 "rexx.re" + { RETURN(RXS_ENGINEERING); } +#line 5964 "" +yy343: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy344; + default: goto yy81; + } +yy344: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy345; + } +yy345: +#line 144 "rexx.re" + { RETURN(RX_ELSE); } +#line 6046 "" +yy346: + yych = *++YYCURSOR; + switch (yych) { + case 'G': + case 'g': goto yy353; + default: goto yy81; + } +yy347: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy348; + } +yy348: +#line 140 "rexx.re" + { RETURN(RX_DO); } +#line 6128 "" +yy349: + yych = *++YYCURSOR; + switch (yych) { + case 'O': + case 'o': goto yy350; + default: goto yy81; + } +yy350: + yych = *++YYCURSOR; + switch (yych) { + case 'P': + case 'p': goto yy351; + default: goto yy81; + } +yy351: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy352; + } +yy352: +#line 142 "rexx.re" + { RETURN(RX_DROP); } +#line 6217 "" +yy353: + yych = *++YYCURSOR; + switch (yych) { + case 'I': + case 'i': goto yy354; + default: goto yy81; + } +yy354: + yych = *++YYCURSOR; + switch (yych) { + case 'T': + case 't': goto yy355; + default: goto yy81; + } +yy355: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy356; + default: goto yy81; + } +yy356: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy357; + } +yy357: +#line 196 "rexx.re" + { RETURN(RXS_DIGITS); } +#line 6313 "" +yy358: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy359; + default: goto yy81; + } +yy359: + yych = *++YYCURSOR; + switch (yych) { + case 'L': + case 'l': goto yy360; + default: goto yy81; + } +yy360: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy361; + } +yy361: +#line 138 "rexx.re" + { RETURN(RX_CALL); } +#line 6402 "" +yy362: + yych = *++YYCURSOR; + switch (yych) { + case 'D': + case 'd': goto yy366; + default: goto yy81; + } +yy363: + yych = *++YYCURSOR; + switch (yych) { + case 'G': + case 'g': goto yy364; + default: goto yy81; + } +yy364: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy365; + } +yy365: +#line 136 "rexx.re" + { RETURN(RX_ARG); } +#line 6491 "" +yy366: + yych = *++YYCURSOR; + switch (yych) { + case 'R': + case 'r': goto yy367; + default: goto yy81; + } +yy367: + yych = *++YYCURSOR; + switch (yych) { + case 'E': + case 'e': goto yy368; + default: goto yy81; + } +yy368: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy369; + default: goto yy81; + } +yy369: + yych = *++YYCURSOR; + switch (yych) { + case 'S': + case 's': goto yy370; + default: goto yy81; + } +yy370: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '!': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '?': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy80; + case '.': goto yy82; + default: goto yy371; + } +yy371: +#line 134 "rexx.re" + { RETURN(RX_ADDRESS); } +#line 6594 "" +yy372: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy372; + case '&': goto yy374; + default: goto yy68; + } +yy374: + ++YYCURSOR; +#line 118 "rexx.re" + { RETURN(OP_XOR); } +#line 6609 "" +yy376: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy377: + switch (yych) { + case '\t': + case ' ': goto yy376; + case '<': goto yy382; + case '=': goto yy380; + case '>': goto yy378; + default: goto yy68; + } +yy378: + yyaccept = 11; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy384; + case '=': goto yy386; + default: goto yy379; + } +yy379: +#line 106 "rexx.re" + { RETURN(OP_GT_STRICT); } +#line 6635 "" +yy380: + ++YYCURSOR; +yy381: +#line 98 "rexx.re" + { RETURN(OP_GE); } +#line 6641 "" +yy382: + ++YYCURSOR; +yy383: +#line 92 "rexx.re" + { RETURN(OP_EQUAL_N); } +#line 6647 "" +yy384: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy384; + case '=': goto yy386; + default: goto yy68; + } +yy386: + ++YYCURSOR; +#line 110 "rexx.re" + { RETURN(OP_GE_STRICT); } +#line 6662 "" +yy388: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy389: + switch (yych) { + case '\t': + case ' ': goto yy388; + case '<': goto yy390; + case '=': goto yy392; + case '>': goto yy382; + default: goto yy68; + } +yy390: + yyaccept = 12; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy394; + case '=': goto yy396; + default: goto yy391; + } +yy391: +#line 108 "rexx.re" + { RETURN(OP_LT_STRICT); } +#line 6688 "" +yy392: + ++YYCURSOR; +yy393: +#line 100 "rexx.re" + { RETURN(OP_LE); } +#line 6694 "" +yy394: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy394; + case '=': goto yy396; + default: goto yy68; + } +yy396: + ++YYCURSOR; +#line 112 "rexx.re" + { RETURN(OP_LE_STRICT); } +#line 6709 "" +yy398: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy399: + switch (yych) { + case '\t': + case ' ': goto yy398; + case '<': goto yy401; + case '=': goto yy402; + case '>': goto yy400; + default: goto yy68; + } +yy400: + yyaccept = 13; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy409; + case '>': goto yy396; + default: goto yy393; + } +yy401: + yyaccept = 14; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy407; + case '<': goto yy386; + default: goto yy381; + } +yy402: + yyaccept = 15; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '\t': + case ' ': goto yy403; + case '=': goto yy405; + default: goto yy383; + } +yy403: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy403; + case '=': goto yy405; + default: goto yy68; + } +yy405: + ++YYCURSOR; +#line 104 "rexx.re" + { RETURN(OP_EQUAL_EQ_N); } +#line 6764 "" +yy407: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy407; + case '<': goto yy386; + default: goto yy68; + } +yy409: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy409; + case '>': goto yy396; + default: goto yy68; + } +yy411: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy411; + case '=': goto yy413; + default: goto yy68; + } +yy413: + ++YYCURSOR; +#line 102 "rexx.re" + { RETURN(OP_EQUAL_EQ); } +#line 6799 "" +yy415: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy415; + case '/': goto yy417; + default: goto yy68; + } +yy417: + ++YYCURSOR; +#line 86 "rexx.re" + { RETURN(OP_REMAIN); } +#line 6814 "" +yy419: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy419; + case '*': goto yy421; + default: goto yy68; + } +yy421: + ++YYCURSOR; +#line 88 "rexx.re" + { RETURN(OP_POWER); } +#line 6829 "" +yy423: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy423; + case '|': goto yy425; + default: goto yy68; + } +yy425: + ++YYCURSOR; +#line 74 "rexx.re" + { RETURN(OP_CONCAT); } +#line 6844 "" +} +#line 265 "rexx.re" + +} + +bool StripToken(){ + uchar *cursor = ScanCB.cur; + unsigned depth; + uchar ch; + bool blanks = FALSE; + ScanCB.eot = cursor; +strip: + +#line 6858 "" +{ + YYCTYPE yych; + YYCTXMARKER = YYCURSOR + 1; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch (yych) { + case '\t': + case ' ': goto yy433; + case '\r': goto yy431; + case '/': goto yy429; + default: goto yy435; + } +yy429: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '*': goto yy436; + default: goto yy430; + } +yy430: + YYCURSOR = YYCTXMARKER; +#line 289 "rexx.re" + { RETURN(blanks); } +#line 6881 "" +yy431: + ++YYCURSOR; +#line 282 "rexx.re" + { goto strip; } +#line 6886 "" +yy433: + ++YYCURSOR; +#line 284 "rexx.re" + { + blanks = TRUE; + goto strip; + } +#line 6894 "" +yy435: + yych = *++YYCURSOR; + goto yy430; +yy436: + ++YYCURSOR; +#line 277 "rexx.re" + { + depth = 1; + goto comment; + } +#line 6905 "" +} +#line 290 "rexx.re" + + +comment: + +#line 6912 "" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch (yych) { + case 0x00: goto yy445; + case '\n': goto yy442; + case '*': goto yy440; + case '/': goto yy444; + default: goto yy447; + } +yy440: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case '/': goto yy450; + default: goto yy441; + } +yy441: +#line 315 "rexx.re" + { + goto comment; + } +#line 6935 "" +yy442: + ++YYCURSOR; +#line 302 "rexx.re" + { + ++(ScanCB.lineNum); + ScanCB.linePos = ScanCB.pos + (cursor - ScanCB.mrk); + goto comment; + } +#line 6944 "" +yy444: + yych = *++YYCURSOR; + switch (yych) { + case '*': goto yy448; + default: goto yy441; + } +yy445: + ++YYCURSOR; +#line 313 "rexx.re" + { RETURN(blanks); } +#line 6955 "" +yy447: + yych = *++YYCURSOR; + goto yy441; +yy448: + ++YYCURSOR; +#line 308 "rexx.re" + { + ++depth; + goto comment; + } +#line 6966 "" +yy450: + ++YYCURSOR; +#line 295 "rexx.re" + { + if(--depth == 0) + goto strip; + else + goto comment; + } +#line 6976 "" +} +#line 318 "rexx.re" + +} diff --git a/re2c/test/rexx.re b/re2c/test/rexx.re new file mode 100644 index 00000000..b74741da --- /dev/null +++ b/re2c/test/rexx.re @@ -0,0 +1,319 @@ +#include "scanio.h" +#include "scanner.h" + +#define CURSOR ch +#define LOADCURSOR ch = *cursor; +#define ADVANCE cursor++; +#define BACK(n) cursor -= (n); +#define CHECK(n) if((ScanCB.lim - cursor) < (n)){cursor = ScanFill(cursor);} +#define MARK(n) ScanCB.ptr = cursor; sel = (n); +#define REVERT cursor = ScanCB.ptr; +#define MARKER sel + +#define RETURN(i) {ScanCB.cur = cursor; return i;} + +int ScanToken(){ + uchar *cursor = ScanCB.cur; + unsigned sel; + uchar ch; + ScanCB.tok = cursor; + ScanCB.eot = NULL; +/*!re2c +all = [\000-\377]; +eof = [\000]; +any = all\eof; +letter = [a-z]|[A-Z]; +digit = [0-9]; +symchr = letter|digit|[.!?_]; +const = (digit|[.])symchr*([eE][+-]?digit+)?; +simple = (symchr\(digit|[.]))(symchr\[.])*; +stem = simple [.]; +symbol = symchr*; +sqstr = ['] ((any\['\n])|(['][']))* [']; +dqstr = ["] ((any\["\n])|(["]["]))* ["]; +str = sqstr|dqstr; +ob = [ \t]*; +not = [\\~]; +A = [aA]; +B = [bB]; +C = [cC]; +D = [dD]; +E = [eE]; +F = [fF]; +G = [gG]; +H = [hH]; +I = [iI]; +J = [jJ]; +K = [kK]; +L = [lL]; +M = [mM]; +N = [nN]; +O = [oO]; +P = [pP]; +Q = [qQ]; +R = [rR]; +S = [sS]; +T = [tT]; +U = [uU]; +V = [vV]; +W = [wW]; +X = [xX]; +Y = [yY]; +Z = [zZ]; +*/ + +scan: +/*!re2c +"\n" + { + ++(ScanCB.lineNum); + ScanCB.linePos = ScanCB.pos + (cursor - ScanCB.mrk); + RETURN(SU_EOL); + } +"|" ob "|" + { RETURN(OP_CONCAT); } +"+" + { RETURN(OP_PLUS); } +"-" + { RETURN(OP_MINUS); } +"*" + { RETURN(OP_MULT); } +"/" + { RETURN(OP_DIV); } +"%" + { RETURN(OP_IDIV); } +"/" ob "/" + { RETURN(OP_REMAIN); } +"*" ob "*" + { RETURN(OP_POWER); } +"=" + { RETURN(OP_EQUAL); } +not ob "=" | "<" ob ">" | ">" ob "<" + { RETURN(OP_EQUAL_N); } +">" + { RETURN(OP_GT); } +"<" + { RETURN(OP_LT); } +">" ob "=" | not ob "<" + { RETURN(OP_GE); } +"<" ob "=" | not ob ">" + { RETURN(OP_LE); } +"=" ob "=" + { RETURN(OP_EQUAL_EQ); } +not ob "=" ob "=" + { RETURN(OP_EQUAL_EQ_N); } +">" ob ">" + { RETURN(OP_GT_STRICT); } +"<" ob "<" + { RETURN(OP_LT_STRICT); } +">" ob ">" ob "=" | not ob "<" ob "<" + { RETURN(OP_GE_STRICT); } +"<" ob "<" ob "=" | not ob ">" ob ">" + { RETURN(OP_LE_STRICT); } +"&" + { RETURN(OP_AND); } +"|" + { RETURN(OP_OR); } +"&" ob "&" + { RETURN(OP_XOR); } +not + { RETURN(OP_NOT); } + +":" + { RETURN(SU_COLON); } +"," + { RETURN(SU_COMMA); } +"(" + { RETURN(SU_POPEN); } +")" + { RETURN(SU_PCLOSE); } +";" + { RETURN(SU_EOC); } + +A D D R E S S + { RETURN(RX_ADDRESS); } +A R G + { RETURN(RX_ARG); } +C A L L + { RETURN(RX_CALL); } +D O + { RETURN(RX_DO); } +D R O P + { RETURN(RX_DROP); } +E L S E + { RETURN(RX_ELSE); } +E N D + { RETURN(RX_END); } +E X I T + { RETURN(RX_EXIT); } +I F + { RETURN(RX_IF); } +I N T E R P R E T + { RETURN(RX_INTERPRET); } +I T E R A T E + { RETURN(RX_ITERATE); } +L E A V E + { RETURN(RX_LEAVE); } +N O P + { RETURN(RX_NOP); } +N U M E R I C + { RETURN(RX_NUMERIC); } +O P T I O N S + { RETURN(RX_OPTIONS); } +O T H E R W I S E + { RETURN(RX_OTHERWISE); } +P A R S E + { RETURN(RX_PARSE); } +P R O C E D U R E + { RETURN(RX_PROCEDURE); } +P U L L + { RETURN(RX_PULL); } +P U S H + { RETURN(RX_PUSH); } +Q U E U E + { RETURN(RX_QUEUE); } +R E T U R N + { RETURN(RX_RETURN); } +S A Y + { RETURN(RX_SAY); } +S E L E C T + { RETURN(RX_SELECT); } +S I G N A L + { RETURN(RX_SIGNAL); } +T H E N + { RETURN(RX_THEN); } +T R A C E + { RETURN(RX_TRACE); } +W H E N + { RETURN(RX_WHEN); } +O F F + { RETURN(RXS_OFF); } +O N + { RETURN(RXS_ON); } +B Y + { RETURN(RXS_BY); } +D I G I T S + { RETURN(RXS_DIGITS); } +E N G I N E E R I N G + { RETURN(RXS_ENGINEERING); } +E R R O R + { RETURN(RXS_ERROR); } +E X P O S E + { RETURN(RXS_EXPOSE); } +F A I L U R E + { RETURN(RXS_FAILURE); } +F O R + { RETURN(RXS_FOR); } +F O R E V E R + { RETURN(RXS_FOREVER); } +F O R M + { RETURN(RXS_FORM); } +F U Z Z + { RETURN(RXS_FUZZ); } +H A L T + { RETURN(RXS_HALT); } +L I N E I N + { RETURN(RXS_LINEIN); } +N A M E + { RETURN(RXS_NAME); } +N O T R E A D Y + { RETURN(RXS_NOTREADY); } +N O V A L U E + { RETURN(RXS_NOVALUE); } +S C I E N T I F I C + { RETURN(RXS_SCIENTIFIC); } +S O U R C E + { RETURN(RXS_SOURCE); } +S Y N T A X + { RETURN(RXS_SYNTAX); } +T O + { RETURN(RXS_TO); } +U N T I L + { RETURN(RXS_UNTIL); } +U P P E R + { RETURN(RXS_UPPER); } +V A L U E + { RETURN(RXS_VALUE); } +V A R + { RETURN(RXS_VAR); } +V E R S I O N + { RETURN(RXS_VERSION); } +W H I L E + { RETURN(RXS_WHILE); } +W I T H + { RETURN(RXS_WITH); } + +const + { RETURN(SU_CONST); } +simple + { RETURN(SU_SYMBOL); } +stem + { RETURN(SU_SYMBOL_STEM); } +symbol + { RETURN(SU_SYMBOL_COMPOUND); } +str + { RETURN(SU_LITERAL); } +str [bB] / (all\symchr) + { RETURN(SU_LITERAL_BIN); } +str [xX] / (all\symchr) + { RETURN(SU_LITERAL_HEX); } + +eof + { RETURN(SU_EOF); } +any + { RETURN(SU_ERROR); } +*/ +} + +bool StripToken(){ + uchar *cursor = ScanCB.cur; + unsigned depth; + uchar ch; + bool blanks = FALSE; + ScanCB.eot = cursor; +strip: +/*!re2c +"/*" + { + depth = 1; + goto comment; + } +"\r" + { goto strip; } +[ \t] + { + blanks = TRUE; + goto strip; + } +[] / all + { RETURN(blanks); } +*/ + +comment: +/*!re2c +"*/" + { + if(--depth == 0) + goto strip; + else + goto comment; + } +"\n" + { + ++(ScanCB.lineNum); + ScanCB.linePos = ScanCB.pos + (cursor - ScanCB.mrk); + goto comment; + } +"/*" + { + ++depth; + goto comment; + } +eof + { RETURN(blanks); } +any + { + goto comment; + } +*/ +} diff --git a/re2c/test/scanner.fs.c b/re2c/test/scanner.fs.c old mode 100755 new mode 100644 diff --git a/re2c/test/scanner.fs.re b/re2c/test/scanner.fs.re old mode 100755 new mode 100644 diff --git a/re2c/test/scanner.s.c b/re2c/test/scanner.s.c old mode 100755 new mode 100644 diff --git a/re2c/test/scanner.s.re b/re2c/test/scanner.s.re old mode 100755 new mode 100644 diff --git a/re2c/lessons/002_strip_comments/strip_001.s.c b/re2c/test/strip_001.s.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_001.s.c rename to re2c/test/strip_001.s.c diff --git a/re2c/test/strip_001.s.re b/re2c/test/strip_001.s.re new file mode 100644 index 00000000..5525ae3c --- /dev/null +++ b/re2c/test/strip_001.s.re @@ -0,0 +1,147 @@ +/* re2c lesson 002_strip_comments, strip_001.s, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- basic interface for file reading + . This scanner will read chunks of input from a file. The easiest way would + be to read the whole file into a memory buffer and use that a zero + terminated string. + . Instead we want to read input chunks of a reasonable size as they are neede + by the scanner. Thus we basically need YYFILL(n) to call fread(n). + . Before we provide a buffer that we constantly reallocate we instead use + one buffer that we get from the stack or global memory just once. When we + reach the end of the buffer we simply move the beginning of our input + that is somewhere in our buffer to the beginning of our buffer and then + append the next chunk of input to the correct end inside our buffer. + . As re2c scanners might read more than one character we need to ensure our + buffer is long enough. We can use re2c to inform about the maximum size + by placing a "!max:re2c" comment somewhere. This gets translated to a + "#define YYMAXFILL " line where is the maximum length value. This + define can be used as precompiler condition. + +- multiple scanner blocks + . We use a main scanner block that outputs every input character unless the + input is two /s or a / followed by a *. In the latter two cases we switch + to a special c++ comment and a comment block respectively. + . Both special blocks simply detect their end ignore any other character. + . The c++ block is a bit special. Since the terminating new line needs to + be output and that can either be a new line or a carridge return followed + by a new line. + . In order to ensure that we do not read behind our buffer we reset the token + pointer to the cursor on every scanner run. +*/ + +#include +#include +#include + +/*!max:re2c */ +#define BSIZE 128 + +#if BSIZE < YYMAXFILL +# error BSIZE must be greater YYMAXFILL +#endif + +#define YYCTYPE unsigned char +#define YYCURSOR s.cur +#define YYLIMIT s.lim +#define YYFILL(n) { if ((res = fill(&s, n)) >= 0) break; } + +typedef struct Scanner +{ + FILE *fp; + unsigned char *cur, *tok, *lim, *eof; + unsigned char buffer[BSIZE]; +} Scanner; + +int fill(Scanner *s, int len) +{ + if (!len) + { + s->cur = s->tok = s->lim = s->buffer; + s->eof = 0; + } + if (!s->eof) + { + int got, cnt = s->tok - s->buffer; + + if (cnt > 0) + { + memcpy(s->buffer, s->tok, s->lim - s->tok); + s->tok -= cnt; + s->cur -= cnt; + s->lim -= cnt; + } + cnt = BSIZE - cnt; + if ((got = fread(s->lim, 1, cnt, s->fp)) != cnt) + { + s->eof = &s->lim[got]; + } + s->lim += got; + } + else if (s->cur + len > s->eof) + { + return 0; /* not enough input data */ + } + return -1; +} + +int scan(FILE *fp) +{ + int res = 0; + Scanner s; + + if (!fp) + { + return 1; /* no file was opened */ + } + + s.fp = fp; + + fill(&s, 0); + + for(;;) + { + s.tok = s.cur; +/*!re2c + re2c:indent:top = 2; + + NL = "\r"? "\n" ; + ANY = [^] ; + + "/" "/" { goto cppcomment; } + "/" "*" { goto comment; } + ANY { fputc(*s.tok, stdout); continue; } +*/ +comment: + s.tok = s.cur; +/*!re2c + "*" "/" { continue; } + ANY { goto comment; } +*/ +cppcomment: + s.tok = s.cur; +/*!re2c + NL { fwrite(s.tok, 1, s.cur - s.tok, stdout); continue; } + ANY { goto cppcomment; } +*/ + } + + if (fp != stdin) + { + fclose(fp); /* close only if not stdin */ + } + return res; /* return result */ +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(!strcmp(argv[1], "-") ? stdin : fopen(argv[1], "r")); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 1; + } +} diff --git a/re2c/lessons/002_strip_comments/strip_002.s.c b/re2c/test/strip_002.s.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_002.s.c rename to re2c/test/strip_002.s.c diff --git a/re2c/test/strip_002.s.re b/re2c/test/strip_002.s.re new file mode 100644 index 00000000..3c2a6cf8 --- /dev/null +++ b/re2c/test/strip_002.s.re @@ -0,0 +1,162 @@ +/* re2c lesson 002_strip_comments, strip_002.s, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- complexity + . When a comment is preceeded by a new line and followed by whitespace and a + new line then we can drop the trailing whitespace and new line. + . Additional to what we strip out already what about two consequtive comment + blocks? When two comments are only separated by whitespace we want to drop + both. In other words when detecting the end of a comment block we need to + check whether it is followed by only whitespace and the a new comment in + which case we continure ignoring the input. If it is followed only by white + space and a new line we strip out the new white space and new line. In any + other case we start outputting all that follows. + But we cannot simply use the following two rules: + "*" "/" WS* "/" "*" { continue; } + "*" "/" WS* NL { continue; } + The main problem is that WS* can get bigger then our buffer, so we need a + new scanner. + . Meanwhile our scanner gets a bit more complex and we have to add two more + things. First the scanner code now uses a YYMARKER to store backtracking + information. + +- backtracking information + . When the scanner has two rules that can have the same beginning but a + different ending then it needs to store the position that identifies the + common part. This is called backtracking. As mentioned above re2c expects + you to provide compiler define YYMARKER and a pointer variable. + . When shifting buffer contents as done in our fill function the marker needs + to be corrected, too. + +*/ + +#include +#include +#include + +/*!max:re2c */ +#define BSIZE 128 + +#if BSIZE < YYMAXFILL +# error BSIZE must be greater YYMAXFILL +#endif + +#define YYCTYPE unsigned char +#define YYCURSOR s.cur +#define YYLIMIT s.lim +#define YYMARKER s.mrk +#define YYFILL(n) { if ((res = fill(&s, n)) >= 0) break; } + +typedef struct Scanner +{ + FILE *fp; + unsigned char *cur, *tok, *lim, *eof, *mrk; + unsigned char buffer[BSIZE]; +} Scanner; + +int fill(Scanner *s, int len) +{ + if (!len) + { + s->cur = s->tok = s->lim = s->mrk = s->buffer; + s->eof = 0; + } + if (!s->eof) + { + int got, cnt = s->tok - s->buffer; + + if (cnt > 0) + { + memcpy(s->buffer, s->tok, s->lim - s->tok); + s->tok -= cnt; + s->cur -= cnt; + s->lim -= cnt; + s->mrk -= cnt; + } + cnt = BSIZE - cnt; + if ((got = fread(s->lim, 1, cnt, s->fp)) != cnt) + { + s->eof = &s->lim[got]; + } + s->lim += got; + } + else if (s->cur + len > s->eof) + { + return 0; /* not enough input data */ + } + return -1; +} + +void echo(Scanner *s) +{ + fwrite(s->tok, 1, s->cur - s->tok, stdout); +} + +int scan(FILE *fp) +{ + int res = 0; + Scanner s; + + if (!fp) + { + return 1; /* no file was opened */ + } + + s.fp = fp; + + fill(&s, 0); + + for(;;) + { + s.tok = s.cur; +/*!re2c + re2c:indent:top = 2; + + NL = "\r"? "\n" ; + WS = [\r\n\t ] ; + ANY = [^] ; + + "/" "/" { goto cppcomment; } + "/" "*" { goto comment; } + ANY { fputc(*s.tok, stdout); continue; } +*/ +comment: + s.tok = s.cur; +/*!re2c + "*" "/" { goto commentws; } + ANY { goto comment; } +*/ +commentws: + s.tok = s.cur; +/*!re2c + NL { echo(&s); continue; } + WS { goto commentws; } + ANY { echo(&s); continue; } +*/ +cppcomment: + s.tok = s.cur; +/*!re2c + NL { echo(&s); continue; } + ANY { goto cppcomment; } +*/ + } + + if (fp != stdin) + { + fclose(fp); /* close only if not stdin */ + } + return res; /* return result */ +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(!strcmp(argv[1], "-") ? stdin : fopen(argv[1], "r")); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 1; + } +} diff --git a/re2c/lessons/002_strip_comments/strip_003.b.c b/re2c/test/strip_003.b.c old mode 100755 new mode 100644 similarity index 100% rename from re2c/lessons/002_strip_comments/strip_003.b.c rename to re2c/test/strip_003.b.c diff --git a/re2c/test/strip_003.b.re b/re2c/test/strip_003.b.re new file mode 100644 index 00000000..a7b1a5c7 --- /dev/null +++ b/re2c/test/strip_003.b.re @@ -0,0 +1,179 @@ +/* re2c lesson 002_strip_comments, strip_003.b, (c) M. Boerger 2006 - 2007 */ +/*!ignore:re2c + +- more complexity + . Right now we strip out trailing white space and new lines after a comment + block. This can be a problem when the comment block was not preceeded by + a new line. + . The solution is to use trailing contexts. + +- trailing contexts + . Re2c allows to check for a portion of input and only recognize it when it + is followed by another portion. This is called a trailing context. + . The trailing context is not part of the identified input. That means that + it follows exactly at the cursor. A consequence is that the scanner has + already read more input and on the next run you need to restore begining + of input, in our case s.tok, from the cursor, here s.cur, rather then + restoring to the beginning of the buffer. This way the scanner can reuse + the portion it has already read. + . The position of the trailing context is stored in YYCTXMARKER for which + a pointer variable needs to be provided. + . As with YYMARKER the corrsponding variable needs to be corrected if we + shift in some buffer. + . Still this is not all we need to solve the problem. What is left is that + the information whether we detected a trailing context was detected has to + be stored somewhere. This is done by the new variable nlcomment. + +- formatting + . Until now we only used single line expression code and we always had the + opening { on the same line as the rule itself. If we have multiline rule + code and care for formatting we can no longer rely on re2c. Now we have + to indent the rule code ourself. Also we need to take care of the opening + {. If we keep it on the same line as the rule then re2c will indent it + correctly and the emitted #line informations will be correct. If we place + it on the next line then the #line directive will also point to that line + and not to the rule. +*/ + +#include +#include +#include + +/*!max:re2c */ +#define BSIZE 128 + +#if BSIZE < YYMAXFILL +# error BSIZE must be greater YYMAXFILL +#endif + +#define YYCTYPE unsigned char +#define YYCURSOR s.cur +#define YYLIMIT s.lim +#define YYMARKER s.mrk +#define YYCTXMARKER s.ctx +#define YYFILL(n) { if ((res = fill(&s, n)) >= 0) break; } + +typedef struct Scanner +{ + FILE *fp; + unsigned char *cur, *tok, *lim, *eof, *ctx, *mrk; + unsigned char buffer[BSIZE]; +} Scanner; + +int fill(Scanner *s, int len) +{ + if (!len) + { + s->cur = s->tok = s->lim = s->mrk = s->buffer; + s->eof = 0; + } + if (!s->eof) + { + int got, cnt = s->tok - s->buffer; + + if (cnt > 0) + { + memcpy(s->buffer, s->tok, s->lim - s->tok); + s->tok -= cnt; + s->cur -= cnt; + s->lim -= cnt; + s->mrk -= cnt; + s->ctx -= cnt; + } + cnt = BSIZE - cnt; + if ((got = fread(s->lim, 1, cnt, s->fp)) != cnt) + { + s->eof = &s->lim[got]; + } + s->lim += got; + } + else if (s->cur + len > s->eof) + { + return 0; /* not enough input data */ + } + return -1; +} + +void echo(Scanner *s) +{ + fwrite(s->tok, 1, s->cur - s->tok, stdout); +} + +int scan(FILE *fp) +{ + int res = 0; + int nlcomment = 0; + Scanner s; + + if (!fp) + { + return 1; /* no file was opened */ + } + + s.fp = fp; + + fill(&s, 0); + + for(;;) + { + s.tok = s.cur; +/*!re2c + re2c:indent:top = 2; + + NL = "\r"? "\n" ; + WS = [\r\n\t ] ; + ANY = [^] ; + + "/" "/" { goto cppcomment; } + NL / "/""*" { echo(&s); nlcomment = 1; continue; } + "/" "*" { goto comment; } + ANY { fputc(*s.tok, stdout); continue; } +*/ +comment: + s.tok = s.cur; +/*!re2c + "*" "/" { goto commentws; } + ANY { goto comment; } +*/ +commentws: + s.tok = s.cur; +/*!re2c + NL? "/" "*" { goto comment; } + NL { + if (!nlcomment) + { + echo(&s); + } + nlcomment = 0; + continue; + } + WS { goto commentws; } + ANY { echo(&s); nlcomment = 0; continue; } +*/ +cppcomment: + s.tok = s.cur; +/*!re2c + NL { echo(&s); continue; } + ANY { goto cppcomment; } +*/ + } + + if (fp != stdin) + { + fclose(fp); /* close only if not stdin */ + } + return res; /* return result */ +} + +int main(int argc, char **argv) +{ + if (argc > 1) + { + return scan(!strcmp(argv[1], "-") ? stdin : fopen(argv[1], "r")); + } + else + { + fprintf(stderr, "%s \n", argv[0]); + return 1; + } +} diff --git a/re2c/test/yyaccept_missing.bci.c b/re2c/test/yyaccept_missing.bci.c old mode 100755 new mode 100644 diff --git a/re2c/test/yyaccept_missing.bci.re b/re2c/test/yyaccept_missing.bci.re old mode 100755 new mode 100644 -- 2.40.0