diff -Nru ssh-cron-1.02.00/changelog ssh-cron-1.03.00/changelog --- ssh-cron-1.02.00/changelog 2019-04-24 10:23:33.000000000 +0000 +++ ssh-cron-1.03.00/changelog 2020-11-14 13:26:28.000000000 +0000 @@ -1,3 +1,12 @@ +ssh-cron (1.03.00) + + * Parser adapted to the code generated by bisonc++ 6.04.01 + * Repaired flaws in the parser's grammar specifications + * Scanner adapted to the code generated by flexc++ 2.08.01 + * Requires bobcat >= 5.05.00 + + -- Frank B. Brokken Sat, 14 Nov 2020 10:08:53 +0100 + ssh-cron (1.02.00) * Requires bobcat >= 5.00.00 diff -Nru ssh-cron-1.02.00/debian/changelog ssh-cron-1.03.00/debian/changelog --- ssh-cron-1.02.00/debian/changelog 2020-03-23 06:26:13.000000000 +0000 +++ ssh-cron-1.03.00/debian/changelog 2020-11-16 14:56:01.000000000 +0000 @@ -1,8 +1,16 @@ -ssh-cron (1.02.00-1build1) focal; urgency=medium +ssh-cron (1.03.00-1) unstable; urgency=medium - * No-change rebuild for libgcc-s1 package name change. + [ Frank B. Brokken ] + * New upstrem release fixes some errors in its parser/grammar specifications + and uses flexc++ 2.08.01 and bisonc++ 6.04.01 + * New upstream version 1.03.00 - -- Matthias Klose Mon, 23 Mar 2020 07:26:13 +0100 + [ tony mancill ] + * Update debian/watch for new upstream repo + * Freshed debian/copyright and update Source to point to gitlab + * Set "Rules-Requires-Root: no" in debian/control + + -- tony mancill Mon, 16 Nov 2020 06:56:01 -0800 ssh-cron (1.02.00-1) unstable; urgency=medium diff -Nru ssh-cron-1.02.00/debian/compat ssh-cron-1.03.00/debian/compat --- ssh-cron-1.02.00/debian/compat 2019-07-25 00:45:25.000000000 +0000 +++ ssh-cron-1.03.00/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -12 diff -Nru ssh-cron-1.02.00/debian/control ssh-cron-1.03.00/debian/control --- ssh-cron-1.02.00/debian/control 2019-07-25 00:45:25.000000000 +0000 +++ ssh-cron-1.03.00/debian/control 2020-11-16 14:56:01.000000000 +0000 @@ -4,15 +4,16 @@ Maintainer: Frank B. Brokken Uploaders: George Danchev , tony mancill -Build-Depends: debhelper (>= 12), - icmake (>= 8.00.04), - libbobcat-dev (>= 5.00.00), +Build-Depends: debhelper-compat (= 13), + icmake (>= 9.03.01), + libbobcat-dev (>= 5.05.00), libssl-dev, - yodl (>= 3.06.0) -Standards-Version: 4.4.0 + yodl (>= 4.02.02) +Standards-Version: 4.5.0 Homepage: https://fbb-git.github.io/ssh-cron/ Vcs-Browser: https://salsa.debian.org/debian/ssh-cron Vcs-Git: https://salsa.debian.org/debian/ssh-cron.git +Rules-Requires-Root: no Package: ssh-cron Architecture: any diff -Nru ssh-cron-1.02.00/debian/copyright ssh-cron-1.03.00/debian/copyright --- ssh-cron-1.02.00/debian/copyright 2019-07-25 00:45:25.000000000 +0000 +++ ssh-cron-1.03.00/debian/copyright 2020-11-16 14:56:01.000000000 +0000 @@ -1,18 +1,18 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: ssh-cron Upstream-Contact: Frank B. Brokken -Source: https://github.com/fbb-git/ssh-cron +Source: https://gitlab.com/fbb-git/ssh-cron Comment: See ./Copyright-notice in the sources for a statement of copyright and license GPG-signed by the upstream author. Files: * -Copyright: (c) 2014-2019 now by Frank B. Brokken +Copyright: (c) 2014-2020 now by Frank B. Brokken License: GPL-3+ Files: debian/* -Copyright: 2014-2019 Frank B. Brokken +Copyright: 2014-2020 Frank B. Brokken 2014 George Danchev - 2014-2019 tony mancill + 2014-2020 tony mancill License: GPL-3+ License: GPL-3+ diff -Nru ssh-cron-1.02.00/debian/rules ssh-cron-1.03.00/debian/rules --- ssh-cron-1.02.00/debian/rules 2019-07-25 00:45:25.000000000 +0000 +++ ssh-cron-1.03.00/debian/rules 2020-11-16 14:56:01.000000000 +0000 @@ -14,23 +14,32 @@ export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) -export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) -export CXXFLAGS += --std=c++17 -Wall -pthread -D_FORTIFY_SOURCE=2 +export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) +export LDFLAGS += -Wl,-z,now -export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -Wl,-z,now +export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) +export CXXFLAGS += --std=c++2a -Wall -pthread -D_FORTIFY_SOURCE=2 export CXX = g++ %: dh $@ -override_dh_auto_build-arch: +override_dh_auto_clean: + ./build clean + dh_auto_clean + +override_dh_auto_build: + # compile the package. ./build program ./build man + dh_auto_build -a -override_dh_clean: - ./build clean - dh_clean - -override_dh_install-arch: +override_dh_auto_install: + # Add here commands to install the package into debian/flexc++. ./build install x debian/ssh-cron + dh_auto_install + +print-version: + @@echo "Debian version: $(DEBVERSION)" + @@echo "Upstream version: $(UPVERSION)" diff -Nru ssh-cron-1.02.00/debian/watch ssh-cron-1.03.00/debian/watch --- ssh-cron-1.02.00/debian/watch 2019-07-25 00:45:25.000000000 +0000 +++ ssh-cron-1.03.00/debian/watch 2020-11-16 14:56:01.000000000 +0000 @@ -1,3 +1,3 @@ version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/ssh-cron-$1\.tar\.gz/ \ - https://github.com/fbb-git/ssh-cron/tags .*/v?(\d\S*)\.tar\.gz + https://gitlab.com/fbb-git/ssh-cron/tags .*/v?(\d\S*)\.tar\.gz diff -Nru ssh-cron-1.02.00/icmake/cuteoln ssh-cron-1.03.00/icmake/cuteoln --- ssh-cron-1.02.00/icmake/cuteoln 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/icmake/cuteoln 2020-11-14 13:26:28.000000000 +0000 @@ -5,5 +5,6 @@ len = strlen(text) - 1; if (text[len] == "\n") text = substr(text, 0, len); + return text; } diff -Nru ssh-cron-1.02.00/icmake/install ssh-cron-1.03.00/icmake/install --- ssh-cron-1.02.00/icmake/install 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/icmake/install 2020-11-14 13:26:28.000000000 +0000 @@ -30,7 +30,6 @@ logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]); } - if (components & (4 | 8)) { target = base + DOC "/"; @@ -45,7 +44,7 @@ if (components & 8) { - printf(" installing the html-manual pages at `", target, "\n"); + printf(" installing the html-manual page at `", target, "\n"); logInstall("tmp/manhtml", "", target); } } @@ -54,7 +53,7 @@ if (components & 8) { target = base + MAN "/"; - printf(" installing the manual pages below `", target, "'\n"); + printf(" installing the manual page below `", target, "'\n"); logZip("tmp/man", "ssh-cron.1", target); } diff -Nru ssh-cron-1.02.00/icmake/loginstall ssh-cron-1.03.00/icmake/loginstall --- ssh-cron-1.02.00/icmake/loginstall 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/icmake/loginstall 2020-11-14 13:26:28.000000000 +0000 @@ -22,18 +22,21 @@ return; } - entries = findAll("f", src, pattern); + entries = findAll("f", src, pattern); // all files in the src dir. - for (idx = listlen(entries); idx--; ) - run("cp " + src + entries[idx] + " " + dest); + for (idx = listlen(entries); idx--; ) // cp all files to the target + run("cp " + src + entries[idx] + " " + dest); // dir - chdir(g_cwd); - entries = findAll("l", src, pattern); + chdir(g_cwd); + entries = findAll("l", src, pattern); // find all links for (idx = listlen(entries); idx--; ) - run("cp " CPOPTS " " + src + entries[idx] + " " + dest); + { + if (strlen(entries[idx]) != 0) // install existing links + run("cp " CPOPTS " " + src + entries[idx] + " " + dest); + } } - + diff -Nru ssh-cron-1.02.00/icmconf ssh-cron-1.03.00/icmconf --- ssh-cron-1.02.00/icmconf 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/icmconf 2020-11-14 13:26:28.000000000 +0000 @@ -4,25 +4,25 @@ #define LIBRARY "modules" #define MAIN "main.cc" #define OBJ_EXT ".o" -#define PARSER_DIR "parser" -#define PARSFILES "inc/*" -#define PARSFLAGS "" - // "-V" -#define PARSGEN "bisonc++" -#define PARSOUT "parse.cc" -#define PARSSPEC "grammar" -#define REFRESH -#define SCANNER_DIR "scanner" -#define SCANFLAGS "" -#define SCANGEN "flexc++" -#define SCANOUT "lex.cc" -#define SCANSPEC "lexer" +// #define PARSER_DIR "parser" +// #define PARSFILES "inc/*" +// #define PARSFLAGS "" +// // "-V" +// #define PARSGEN "bisonc++" +// #define PARSOUT "parse.cc" +// #define PARSSPEC "grammar" +// #define REFRESH +// #define SCANNER_DIR "scanner" +// #define SCANFLAGS "" +// #define SCANGEN "flexc++" +// #define SCANOUT "lex.cc" +// #define SCANSPEC "lexer" #define SHAREDREQ "" #define SOURCES "*.cc" #define TMP_DIR "tmp" #define USE_ALL "a" #define IH ".ih" -#define PRECOMP "-x c++-header" +// #define PRECOMP "-x c++-header" #define USE_ECHO ON #define USE_VERSION #define DEFCOM "program" diff -Nru ssh-cron-1.02.00/icmconf.lib ssh-cron-1.03.00/icmconf.lib --- ssh-cron-1.02.00/icmconf.lib 1970-01-01 00:00:00.000000000 +0000 +++ ssh-cron-1.03.00/icmconf.lib 2020-11-14 13:26:28.000000000 +0000 @@ -0,0 +1,15 @@ +#define PRECOMP "-x c++-header" + +#define CLS +#define SOURCES "*.cc" +#define OBJ_EXT ".o" +#define TMP_DIR "tmp" +#define USE_ECHO ON +#define IH ".ih" +#define CXX "g++" +#define CXXFLAGS " --std=c++2a -Wall -O2 " \ + " -fdiagnostics-color=never " +#define ADD_LIBRARIES "bobcat" +#define ADD_LIBRARY_PATHS "" + +#define DEFCOM "library" diff -Nru ssh-cron-1.02.00/parser/error.cc ssh-cron-1.03.00/parser/error.cc --- ssh-cron-1.02.00/parser/error.cc 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/error.cc 2020-11-14 13:26:28.000000000 +0000 @@ -1,8 +1,8 @@ #include "parser.ih" -void Parser::error(char const *msg) +void Parser::error() { - emsg << msg << " at line " << d_cronData.lineNr() << + emsg << "Syntax error at line " << d_cronData.lineNr() << endl; } diff -Nru ssh-cron-1.02.00/parser/grammar ssh-cron-1.03.00/parser/grammar --- ssh-cron-1.02.00/parser/grammar 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/grammar 2020-11-14 13:26:28.000000000 +0000 @@ -1,6 +1,7 @@ %filenames parser %scanner ../scanner/scanner.h +%token-path ../scanner/tokens.h %baseclass-preinclude parserpre.ih %polymorphic STRING: std::string; INT: int @@ -8,7 +9,7 @@ %token WS NR ID CHAR %type opt_tokens tokens token_noWs _tokenAnyMatched _tokenMatched - _nameContents _nameID nameLine + _nameContents _nameID %type nr opt_nr_step %% diff -Nru ssh-cron-1.02.00/parser/icmconf ssh-cron-1.03.00/parser/icmconf --- ssh-cron-1.02.00/parser/icmconf 1970-01-01 00:00:00.000000000 +0000 +++ ssh-cron-1.03.00/parser/icmconf 2020-11-14 13:26:28.000000000 +0000 @@ -0,0 +1,2 @@ +#define LIBRARY "parser" +#include "../icmconf.lib" diff -Nru ssh-cron-1.02.00/parser/inc/token ssh-cron-1.03.00/parser/inc/token --- ssh-cron-1.02.00/parser/inc/token 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/inc/token 2020-11-14 13:26:28.000000000 +0000 @@ -41,19 +41,19 @@ _tokenNoWs _tokenMatched { - $$ =$2; + $$ = $2; } ; tokens: tokens _tokenAny { - $$ += d_scanner.matched(); + $$ = $1 + d_scanner.matched(); } | _tokenAnyMatched { - $$ = $$; + $$ = $1; } ; @@ -61,6 +61,6 @@ tokens | { - $$ = string(); + $$ = string{}; } ; diff -Nru ssh-cron-1.02.00/parser/parse.cc ssh-cron-1.03.00/parser/parse.cc --- ssh-cron-1.02.00/parser/parse.cc 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/parse.cc 2020-11-14 13:26:28.000000000 +0000 @@ -1,4 +1,6 @@ -// Generated by Bisonc++ V4.09.01 on Thu, 15 May 2014 09:30:55 +0200 +// Generated by Bisonc++ V6.04.01 on Sat, 14 Nov 2020 10:06:30 +0100 + +// base/comment // $insert class.ih #include "parser.ih" @@ -6,7 +8,7 @@ // The FIRST element of SR arrays shown below uses `d_type', defining the // state's type, and `d_lastIdx' containing the last element's index. If // d_lastIdx contains the REQ_TOKEN bitflag (see below) then the state needs -// a token: if in this state d_token__ is _UNDETERMINED_, nextToken() will be +// a token: if in this state d_token is Reserved_::UNDETERMINED_, nextToken() will be // called // The LAST element of SR arrays uses `d_token' containing the last retrieved @@ -16,13 +18,13 @@ // indicates `ACCEPT', if negative, -d_action represents the number of the // rule to reduce to. -// `lookup()' tries to find d_token__ in the current SR array. If it fails, and -// there is no default reduction UNEXPECTED_TOKEN__ is thrown, which is then +// `lookup()' tries to find d_token in the current SR array. If it fails, and +// there is no default reduction UNEXPECTED_TOKEN_ is thrown, which is then // caught by the error-recovery function. // The error-recovery function will pop elements off the stack until a state -// having bit flag ERR_ITEM is found. This state has a transition on _error_ -// which is applied. In this _error_ state, while the current token is not a +// having bit flag ERR_ITEM is found. This state has a transition on errTok_ +// which is applied. In this errTok_ state, while the current token is not a // proper continuation, new tokens are obtained by nextToken(). If such a // token is found, error recovery is successful and the token is // handled according to the error state's SR table and parsing continues. @@ -46,30 +48,19 @@ // ( < 0: reduce, // 0: ACCEPT, // > 0: next state) -// Last element: {set to d_token__, action to perform} // } -// When the --thread-safe option is specified, all static data are defined as -// const. If --thread-safe is not provided, the state-tables are not defined -// as const, since the lookup() function below will modify them - +// base/declarations namespace // anonymous { char const author[] = "Frank B. Brokken (f.b.brokken@rug.nl)"; - enum - { - STACK_EXPANSION = 5 // size to expand the state-stack with when - // full - }; - - enum ReservedTokens + enum Reserved_ { - PARSE_ACCEPT = 0, // `ACCEPT' TRANSITION - _UNDETERMINED_ = -2, - _EOF_ = -1, - _error_ = 256 + UNDETERMINED_ = -2, + EOF_ = -1, + errTok_ = 256 }; enum StateType // modify statetype/data.cc when this enum changes { @@ -82,21 +73,30 @@ REQ_DEF, // REQ_TOKEN | DEF_RED ERR_REQ_DEF // ERR_ITEM | REQ_TOKEN | DEF_RED }; - struct PI__ // Production Info + inline bool operator&(StateType lhs, StateType rhs) + { + return (static_cast(lhs) & rhs) != 0; + } + enum StateTransition + { + ACCEPT_ = 0, // `ACCEPT' TRANSITION + }; + + struct PI_ // Production Info { size_t d_nonTerm; // identification number of this production's // non-terminal size_t d_size; // number of elements in this production }; - struct SR__ // Shift Reduce info, see its description above + struct SR_ // Shift Reduce info, see its description above { union { int _field_1_; // initializer, allowing initializations // of the SR s_[] arrays - int d_type; - int d_token; + StateType d_type; + int d_token; }; union { @@ -105,330 +105,334 @@ int d_lastIdx; // if negative, the state uses SHIFT int d_action; // may be negative (reduce), // postive (shift), or 0 (accept) - size_t d_errorState; // used with Error states }; }; // $insert staticdata + enum // size to expand the state-stack with when + { // full + STACK_EXPANSION_ = 10 + }; + // Productions Info Records: -PI__ const s_productionInfo[] = +PI_ const s_productionInfo[] = { {0, 0}, // not used: reduction values are negative - {271, 2}, // 1: startrule -> startrule line - {271, 0}, // 2: startrule -> - {273, 1}, // 3: nr (NR) -> NR - {274, 0}, // 4: opt_nr_step -> - {274, 2}, // 5: opt_nr_step ('/') -> '/' nr - {275, 1}, // 6: nr_add -> nr - {276, 4}, // 7: nr_range ('-') -> nr '-' nr opt_nr_step - {276, 1}, // 8: nr_range -> nr_add - {277, 3}, // 9: nr_Sequence (',') -> nr_Sequence ',' nr_range - {277, 1}, // 10: nr_Sequence -> nr_range - {278, 1}, // 11: opt_ws (WS) -> WS - {278, 0}, // 12: opt_ws -> - {279, 1}, // 13: _tokenNoWs (NR) -> NR - {279, 1}, // 14: _tokenNoWs (ID) -> ID - {279, 1}, // 15: _tokenNoWs ('*') -> '*' - {279, 1}, // 16: _tokenNoWs ('/') -> '/' - {279, 1}, // 17: _tokenNoWs (',') -> ',' - {279, 1}, // 18: _tokenNoWs ('-') -> '-' - {279, 1}, // 19: _tokenNoWs (CHAR) -> CHAR - {279, 1}, // 20: _tokenNoWs ('=') -> '=' - {280, 1}, // 21: _tokenAny (WS) -> WS - {280, 1}, // 22: _tokenAny -> _tokenNoWs - {281, 0}, // 23: _tokenMatched -> - {282, 2}, // 24: _tokenAnyMatched -> _tokenAny _tokenMatched - {283, 2}, // 25: token_noWs -> _tokenNoWs _tokenMatched - {284, 2}, // 26: tokens -> tokens _tokenAny - {284, 1}, // 27: tokens -> _tokenAnyMatched - {285, 1}, // 28: opt_tokens -> tokens - {285, 0}, // 29: opt_tokens -> - {286, 3}, // 30: _nameContents ('=') -> opt_ws '=' opt_tokens - {287, 1}, // 31: _nameID (ID) -> ID - {288, 2}, // 32: nameLine -> _nameID _nameContents - {289, 2}, // 33: _all ('*') -> '*' opt_nr_step - {290, 1}, // 34: _timeUnit -> nr_range - {290, 1}, // 35: _timeUnit (ID) -> ID - {291, 3}, // 36: _timeSequence (',') -> _timeSequence ',' _timeUnit - {291, 1}, // 37: _timeSequence -> _timeUnit - {292, 1}, // 38: time_numberedSpec -> _all - {292, 1}, // 39: time_numberedSpec -> nr_Sequence - {293, 1}, // 40: time_spec -> _all - {293, 1}, // 41: time_spec -> _timeSequence - {294, 2}, // 42: _minutes (WS) -> time_numberedSpec WS - {295, 2}, // 43: _hours (WS) -> time_numberedSpec WS - {296, 2}, // 44: _dayOfMonth (WS) -> time_numberedSpec WS - {297, 2}, // 45: _monthOfYear (WS) -> time_spec WS - {298, 2}, // 46: _dayOfWeek (WS) -> time_spec WS - {299, 2}, // 47: _command -> token_noWs opt_tokens - {300, 6}, // 48: cronLine -> _minutes _hours _dayOfMonth _monthOfYear _dayOfWeek _command - {301, 1}, // 49: _line_contents -> nameLine - {301, 1}, // 50: _line_contents -> cronLine - {301, 1}, // 51: _line_contents (_error_) -> _error_ - {302, 0}, // 52: _line_preamble -> - {303, 2}, // 53: _opt_line_contents -> _line_preamble _line_contents - {303, 0}, // 54: _opt_line_contents -> - {272, 2}, // 55: line ('\x0a') -> _opt_line_contents '\x0a' - {304, 1}, // 56: startrule_$ -> startrule + {270, 2}, // 1: startrule -> startrule line + {270, 0}, // 2: startrule -> + {272, 1}, // 3: nr (NR) -> NR + {273, 0}, // 4: opt_nr_step -> + {273, 2}, // 5: opt_nr_step ('/') -> '/' nr + {274, 1}, // 6: nr_add -> nr + {275, 4}, // 7: nr_range ('-') -> nr '-' nr opt_nr_step + {275, 1}, // 8: nr_range -> nr_add + {276, 3}, // 9: nr_Sequence (',') -> nr_Sequence ',' nr_range + {276, 1}, // 10: nr_Sequence -> nr_range + {277, 1}, // 11: opt_ws (WS) -> WS + {277, 0}, // 12: opt_ws -> + {278, 1}, // 13: _tokenNoWs (NR) -> NR + {278, 1}, // 14: _tokenNoWs (ID) -> ID + {278, 1}, // 15: _tokenNoWs ('*') -> '*' + {278, 1}, // 16: _tokenNoWs ('/') -> '/' + {278, 1}, // 17: _tokenNoWs (',') -> ',' + {278, 1}, // 18: _tokenNoWs ('-') -> '-' + {278, 1}, // 19: _tokenNoWs (CHAR) -> CHAR + {278, 1}, // 20: _tokenNoWs ('=') -> '=' + {279, 1}, // 21: _tokenAny (WS) -> WS + {279, 1}, // 22: _tokenAny -> _tokenNoWs + {280, 0}, // 23: _tokenMatched -> + {281, 2}, // 24: _tokenAnyMatched -> _tokenAny _tokenMatched + {282, 2}, // 25: token_noWs -> _tokenNoWs _tokenMatched + {283, 2}, // 26: tokens -> tokens _tokenAny + {283, 1}, // 27: tokens -> _tokenAnyMatched + {284, 1}, // 28: opt_tokens -> tokens + {284, 0}, // 29: opt_tokens -> + {285, 3}, // 30: _nameContents ('=') -> opt_ws '=' opt_tokens + {286, 1}, // 31: _nameID (ID) -> ID + {287, 2}, // 32: nameLine -> _nameID _nameContents + {288, 2}, // 33: _all ('*') -> '*' opt_nr_step + {289, 1}, // 34: _timeUnit -> nr_range + {289, 1}, // 35: _timeUnit (ID) -> ID + {290, 3}, // 36: _timeSequence (',') -> _timeSequence ',' _timeUnit + {290, 1}, // 37: _timeSequence -> _timeUnit + {291, 1}, // 38: time_numberedSpec -> _all + {291, 1}, // 39: time_numberedSpec -> nr_Sequence + {292, 1}, // 40: time_spec -> _all + {292, 1}, // 41: time_spec -> _timeSequence + {293, 2}, // 42: _minutes (WS) -> time_numberedSpec WS + {294, 2}, // 43: _hours (WS) -> time_numberedSpec WS + {295, 2}, // 44: _dayOfMonth (WS) -> time_numberedSpec WS + {296, 2}, // 45: _monthOfYear (WS) -> time_spec WS + {297, 2}, // 46: _dayOfWeek (WS) -> time_spec WS + {298, 2}, // 47: _command -> token_noWs opt_tokens + {299, 6}, // 48: cronLine -> _minutes _hours _dayOfMonth _monthOfYear _dayOfWeek _command + {300, 1}, // 49: _line_contents -> nameLine + {300, 1}, // 50: _line_contents -> cronLine + {300, 1}, // 51: _line_contents (errTok_) -> errTok_ + {301, 0}, // 52: _line_preamble -> + {302, 2}, // 53: _opt_line_contents -> _line_preamble _line_contents + {302, 0}, // 54: _opt_line_contents -> + {271, 2}, // 55: line ('\x0a') -> _opt_line_contents '\x0a' + {303, 1}, // 56: startrule_$ -> startrule }; -// State info and SR__ transitions for each state. +// State info and SR_ transitions for each state. -SR__ s_0[] = +SR_ s_0[] = { { { DEF_RED}, { 2} }, - { { 271}, { 1} }, // startrule + { { 270}, { 1} }, // startrule { { 0}, { -2} }, }; -SR__ s_1[] = +SR_ s_1[] = { - { { REQ_DEF}, { 6} }, - { { 272}, { 2} }, // line - { { 303}, { 3} }, // _opt_line_contents - { { 302}, { 4} }, // _line_preamble - { { _EOF_}, { PARSE_ACCEPT} }, - { { 10}, { -54} }, // '\x0a' - { { 0}, { -52} }, + { { REQ_DEF}, { 6} }, + { { 271}, { 2} }, // line + { { 302}, { 3} }, // _opt_line_contents + { { 301}, { 4} }, // _line_preamble + { { EOF_}, { ACCEPT_} }, + { { 10}, { -54} }, // '\x0a' + { { 0}, { -52} }, }; -SR__ s_2[] = +SR_ s_2[] = { { { DEF_RED}, { 1} }, { { 0}, { -1} }, }; -SR__ s_3[] = +SR_ s_3[] = { { { REQ_TOKEN}, { 2} }, { { 10}, { 5} }, // '\x0a' { { 0}, { 0} }, }; -SR__ s_4[] = +SR_ s_4[] = { { { ERR_REQ}, { 16} }, - { { 301}, { 6} }, // _line_contents - { { 288}, { 7} }, // nameLine - { { 300}, { 8} }, // cronLine - { { _error_}, { 9} }, // _error_ - { { 287}, { 10} }, // _nameID - { { 294}, { 11} }, // _minutes + { { 300}, { 6} }, // _line_contents + { { 287}, { 7} }, // nameLine + { { 299}, { 8} }, // cronLine + { { errTok_}, { 9} }, // errTok_ + { { 286}, { 10} }, // _nameID + { { 293}, { 11} }, // _minutes { { 259}, { 12} }, // ID - { { 292}, { 13} }, // time_numberedSpec - { { 289}, { 14} }, // _all - { { 277}, { 15} }, // nr_Sequence + { { 291}, { 13} }, // time_numberedSpec + { { 288}, { 14} }, // _all + { { 276}, { 15} }, // nr_Sequence { { 42}, { 16} }, // '*' - { { 276}, { 17} }, // nr_range - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 275}, { 17} }, // nr_range + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_5[] = +SR_ s_5[] = { { { DEF_RED}, { 1} }, { { 0}, { -55} }, }; -SR__ s_6[] = +SR_ s_6[] = { { { DEF_RED}, { 1} }, { { 0}, { -53} }, }; -SR__ s_7[] = +SR_ s_7[] = { { { DEF_RED}, { 1} }, { { 0}, { -49} }, }; -SR__ s_8[] = +SR_ s_8[] = { { { DEF_RED}, { 1} }, { { 0}, { -50} }, }; -SR__ s_9[] = +SR_ s_9[] = { { { DEF_RED}, { 1} }, { { 0}, { -51} }, }; -SR__ s_10[] = +SR_ s_10[] = { { { REQ_DEF}, { 4} }, - { { 286}, { 21} }, // _nameContents - { { 278}, { 22} }, // opt_ws + { { 285}, { 21} }, // _nameContents + { { 277}, { 22} }, // opt_ws { { 257}, { 23} }, // WS { { 0}, { -12} }, }; -SR__ s_11[] = +SR_ s_11[] = { { { REQ_TOKEN}, { 10} }, - { { 295}, { 24} }, // _hours - { { 292}, { 25} }, // time_numberedSpec - { { 289}, { 14} }, // _all - { { 277}, { 15} }, // nr_Sequence + { { 294}, { 24} }, // _hours + { { 291}, { 25} }, // time_numberedSpec + { { 288}, { 14} }, // _all + { { 276}, { 15} }, // nr_Sequence { { 42}, { 16} }, // '*' - { { 276}, { 17} }, // nr_range - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 275}, { 17} }, // nr_range + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_12[] = +SR_ s_12[] = { { { DEF_RED}, { 1} }, { { 0}, { -31} }, }; -SR__ s_13[] = +SR_ s_13[] = { { { REQ_TOKEN}, { 2} }, { { 257}, { 26} }, // WS { { 0}, { 0} }, }; -SR__ s_14[] = +SR_ s_14[] = { { { DEF_RED}, { 1} }, { { 0}, { -38} }, }; -SR__ s_15[] = +SR_ s_15[] = { { { REQ_DEF}, { 2} }, { { 44}, { 27} }, // ',' { { 0}, { -39} }, }; -SR__ s_16[] = +SR_ s_16[] = { { { REQ_DEF}, { 3} }, - { { 274}, { 28} }, // opt_nr_step + { { 273}, { 28} }, // opt_nr_step { { 47}, { 29} }, // '/' { { 0}, { -4} }, }; -SR__ s_17[] = +SR_ s_17[] = { { { DEF_RED}, { 1} }, { { 0}, { -10} }, }; -SR__ s_18[] = +SR_ s_18[] = { { { REQ_DEF}, { 2} }, { { 45}, { 30} }, // '-' { { 0}, { -6} }, }; -SR__ s_19[] = +SR_ s_19[] = { { { DEF_RED}, { 1} }, { { 0}, { -8} }, }; -SR__ s_20[] = +SR_ s_20[] = { { { DEF_RED}, { 1} }, { { 0}, { -3} }, }; -SR__ s_21[] = +SR_ s_21[] = { { { DEF_RED}, { 1} }, { { 0}, { -32} }, }; -SR__ s_22[] = +SR_ s_22[] = { { { REQ_TOKEN}, { 2} }, { { 61}, { 31} }, // '=' { { 0}, { 0} }, }; -SR__ s_23[] = +SR_ s_23[] = { { { DEF_RED}, { 1} }, { { 0}, { -11} }, }; -SR__ s_24[] = +SR_ s_24[] = { { { REQ_TOKEN}, { 10} }, - { { 296}, { 32} }, // _dayOfMonth - { { 292}, { 33} }, // time_numberedSpec - { { 289}, { 14} }, // _all - { { 277}, { 15} }, // nr_Sequence + { { 295}, { 32} }, // _dayOfMonth + { { 291}, { 33} }, // time_numberedSpec + { { 288}, { 14} }, // _all + { { 276}, { 15} }, // nr_Sequence { { 42}, { 16} }, // '*' - { { 276}, { 17} }, // nr_range - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 275}, { 17} }, // nr_range + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_25[] = +SR_ s_25[] = { { { REQ_TOKEN}, { 2} }, { { 257}, { 34} }, // WS { { 0}, { 0} }, }; -SR__ s_26[] = +SR_ s_26[] = { { { DEF_RED}, { 1} }, { { 0}, { -42} }, }; -SR__ s_27[] = +SR_ s_27[] = { { { REQ_TOKEN}, { 5} }, - { { 276}, { 35} }, // nr_range - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 275}, { 35} }, // nr_range + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_28[] = +SR_ s_28[] = { { { DEF_RED}, { 1} }, { { 0}, { -33} }, }; -SR__ s_29[] = +SR_ s_29[] = { { { REQ_TOKEN}, { 3} }, - { { 273}, { 36} }, // nr + { { 272}, { 36} }, // nr { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_30[] = +SR_ s_30[] = { { { REQ_TOKEN}, { 3} }, - { { 273}, { 37} }, // nr + { { 272}, { 37} }, // nr { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_31[] = +SR_ s_31[] = { { { REQ_DEF}, { 15} }, - { { 285}, { 38} }, // opt_tokens - { { 284}, { 39} }, // tokens - { { 282}, { 40} }, // _tokenAnyMatched - { { 280}, { 41} }, // _tokenAny + { { 284}, { 38} }, // opt_tokens + { { 283}, { 39} }, // tokens + { { 281}, { 40} }, // _tokenAnyMatched + { { 279}, { 41} }, // _tokenAny { { 257}, { 42} }, // WS - { { 279}, { 43} }, // _tokenNoWs + { { 278}, { 43} }, // _tokenNoWs { { 258}, { 44} }, // NR { { 259}, { 45} }, // ID { { 42}, { 46} }, // '*' @@ -440,68 +444,68 @@ { { 0}, { -29} }, }; -SR__ s_32[] = +SR_ s_32[] = { { { REQ_TOKEN}, { 12} }, - { { 297}, { 52} }, // _monthOfYear - { { 293}, { 53} }, // time_spec - { { 289}, { 54} }, // _all - { { 291}, { 55} }, // _timeSequence + { { 296}, { 52} }, // _monthOfYear + { { 292}, { 53} }, // time_spec + { { 288}, { 54} }, // _all + { { 290}, { 55} }, // _timeSequence { { 42}, { 16} }, // '*' - { { 290}, { 56} }, // _timeUnit - { { 276}, { 57} }, // nr_range + { { 289}, { 56} }, // _timeUnit + { { 275}, { 57} }, // nr_range { { 259}, { 58} }, // ID - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_33[] = +SR_ s_33[] = { { { REQ_TOKEN}, { 2} }, { { 257}, { 59} }, // WS { { 0}, { 0} }, }; -SR__ s_34[] = +SR_ s_34[] = { { { DEF_RED}, { 1} }, { { 0}, { -43} }, }; -SR__ s_35[] = +SR_ s_35[] = { { { DEF_RED}, { 1} }, { { 0}, { -9} }, }; -SR__ s_36[] = +SR_ s_36[] = { { { DEF_RED}, { 1} }, { { 0}, { -5} }, }; -SR__ s_37[] = +SR_ s_37[] = { { { REQ_DEF}, { 3} }, - { { 274}, { 60} }, // opt_nr_step + { { 273}, { 60} }, // opt_nr_step { { 47}, { 29} }, // '/' { { 0}, { -4} }, }; -SR__ s_38[] = +SR_ s_38[] = { { { DEF_RED}, { 1} }, { { 0}, { -30} }, }; -SR__ s_39[] = +SR_ s_39[] = { { { REQ_DEF}, { 12} }, - { { 280}, { 61} }, // _tokenAny + { { 279}, { 61} }, // _tokenAny { { 257}, { 42} }, // WS - { { 279}, { 43} }, // _tokenNoWs + { { 278}, { 43} }, // _tokenNoWs { { 258}, { 44} }, // NR { { 259}, { 45} }, // ID { { 42}, { 46} }, // '*' @@ -513,164 +517,164 @@ { { 0}, { -28} }, }; -SR__ s_40[] = +SR_ s_40[] = { { { DEF_RED}, { 1} }, { { 0}, { -27} }, }; -SR__ s_41[] = +SR_ s_41[] = { { { DEF_RED}, { 2} }, - { { 281}, { 62} }, // _tokenMatched + { { 280}, { 62} }, // _tokenMatched { { 0}, { -23} }, }; -SR__ s_42[] = +SR_ s_42[] = { { { DEF_RED}, { 1} }, { { 0}, { -21} }, }; -SR__ s_43[] = +SR_ s_43[] = { { { DEF_RED}, { 1} }, { { 0}, { -22} }, }; -SR__ s_44[] = +SR_ s_44[] = { { { DEF_RED}, { 1} }, { { 0}, { -13} }, }; -SR__ s_45[] = +SR_ s_45[] = { { { DEF_RED}, { 1} }, { { 0}, { -14} }, }; -SR__ s_46[] = +SR_ s_46[] = { { { DEF_RED}, { 1} }, { { 0}, { -15} }, }; -SR__ s_47[] = +SR_ s_47[] = { { { DEF_RED}, { 1} }, { { 0}, { -16} }, }; -SR__ s_48[] = +SR_ s_48[] = { { { DEF_RED}, { 1} }, { { 0}, { -17} }, }; -SR__ s_49[] = +SR_ s_49[] = { { { DEF_RED}, { 1} }, { { 0}, { -18} }, }; -SR__ s_50[] = +SR_ s_50[] = { { { DEF_RED}, { 1} }, { { 0}, { -19} }, }; -SR__ s_51[] = +SR_ s_51[] = { { { DEF_RED}, { 1} }, { { 0}, { -20} }, }; -SR__ s_52[] = +SR_ s_52[] = { { { REQ_TOKEN}, { 12} }, - { { 298}, { 63} }, // _dayOfWeek - { { 293}, { 64} }, // time_spec - { { 289}, { 54} }, // _all - { { 291}, { 55} }, // _timeSequence + { { 297}, { 63} }, // _dayOfWeek + { { 292}, { 64} }, // time_spec + { { 288}, { 54} }, // _all + { { 290}, { 55} }, // _timeSequence { { 42}, { 16} }, // '*' - { { 290}, { 56} }, // _timeUnit - { { 276}, { 57} }, // nr_range + { { 289}, { 56} }, // _timeUnit + { { 275}, { 57} }, // nr_range { { 259}, { 58} }, // ID - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_53[] = +SR_ s_53[] = { { { REQ_TOKEN}, { 2} }, { { 257}, { 65} }, // WS { { 0}, { 0} }, }; -SR__ s_54[] = +SR_ s_54[] = { { { DEF_RED}, { 1} }, { { 0}, { -40} }, }; -SR__ s_55[] = +SR_ s_55[] = { { { REQ_DEF}, { 2} }, { { 44}, { 66} }, // ',' { { 0}, { -41} }, }; -SR__ s_56[] = +SR_ s_56[] = { { { DEF_RED}, { 1} }, { { 0}, { -37} }, }; -SR__ s_57[] = +SR_ s_57[] = { { { DEF_RED}, { 1} }, { { 0}, { -34} }, }; -SR__ s_58[] = +SR_ s_58[] = { { { DEF_RED}, { 1} }, { { 0}, { -35} }, }; -SR__ s_59[] = +SR_ s_59[] = { { { DEF_RED}, { 1} }, { { 0}, { -44} }, }; -SR__ s_60[] = +SR_ s_60[] = { { { DEF_RED}, { 1} }, { { 0}, { -7} }, }; -SR__ s_61[] = +SR_ s_61[] = { { { DEF_RED}, { 1} }, { { 0}, { -26} }, }; -SR__ s_62[] = +SR_ s_62[] = { { { DEF_RED}, { 1} }, { { 0}, { -24} }, }; -SR__ s_63[] = +SR_ s_63[] = { { { REQ_TOKEN}, { 12} }, - { { 299}, { 67} }, // _command - { { 283}, { 68} }, // token_noWs - { { 279}, { 69} }, // _tokenNoWs + { { 298}, { 67} }, // _command + { { 282}, { 68} }, // token_noWs + { { 278}, { 69} }, // _tokenNoWs { { 258}, { 44} }, // NR { { 259}, { 45} }, // ID { { 42}, { 46} }, // '*' @@ -682,46 +686,46 @@ { { 0}, { 0} }, }; -SR__ s_64[] = +SR_ s_64[] = { { { REQ_TOKEN}, { 2} }, { { 257}, { 70} }, // WS { { 0}, { 0} }, }; -SR__ s_65[] = +SR_ s_65[] = { { { DEF_RED}, { 1} }, { { 0}, { -45} }, }; -SR__ s_66[] = +SR_ s_66[] = { { { REQ_TOKEN}, { 7} }, - { { 290}, { 71} }, // _timeUnit - { { 276}, { 57} }, // nr_range + { { 289}, { 71} }, // _timeUnit + { { 275}, { 57} }, // nr_range { { 259}, { 58} }, // ID - { { 273}, { 18} }, // nr - { { 275}, { 19} }, // nr_add + { { 272}, { 18} }, // nr + { { 274}, { 19} }, // nr_add { { 258}, { 20} }, // NR { { 0}, { 0} }, }; -SR__ s_67[] = +SR_ s_67[] = { { { DEF_RED}, { 1} }, { { 0}, { -48} }, }; -SR__ s_68[] = +SR_ s_68[] = { { { REQ_DEF}, { 15} }, - { { 285}, { 72} }, // opt_tokens - { { 284}, { 39} }, // tokens - { { 282}, { 40} }, // _tokenAnyMatched - { { 280}, { 41} }, // _tokenAny + { { 284}, { 72} }, // opt_tokens + { { 283}, { 39} }, // tokens + { { 281}, { 40} }, // _tokenAnyMatched + { { 279}, { 41} }, // _tokenAny { { 257}, { 42} }, // WS - { { 279}, { 43} }, // _tokenNoWs + { { 278}, { 43} }, // _tokenNoWs { { 258}, { 44} }, // NR { { 259}, { 45} }, // ID { { 42}, { 46} }, // '*' @@ -733,32 +737,32 @@ { { 0}, { -29} }, }; -SR__ s_69[] = +SR_ s_69[] = { { { DEF_RED}, { 2} }, - { { 281}, { 73} }, // _tokenMatched + { { 280}, { 73} }, // _tokenMatched { { 0}, { -23} }, }; -SR__ s_70[] = +SR_ s_70[] = { { { DEF_RED}, { 1} }, { { 0}, { -46} }, }; -SR__ s_71[] = +SR_ s_71[] = { { { DEF_RED}, { 1} }, { { 0}, { -36} }, }; -SR__ s_72[] = +SR_ s_72[] = { { { DEF_RED}, { 1} }, { { 0}, { -47} }, }; -SR__ s_73[] = +SR_ s_73[] = { { { DEF_RED}, { 1} }, { { 0}, { -25} }, @@ -766,7 +770,7 @@ // State array: -SR__ *s_state[] = +SR_ *s_state[] = { s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10, s_11, s_12, s_13, s_14, s_15, s_16, s_17, s_18, s_19, @@ -782,202 +786,491 @@ -// If the parsing function call uses arguments, then provide an overloaded -// function. The code below doesn't rely on parameters, so no arguments are -// required. Furthermore, parse uses a function try block to allow us to do -// ACCEPT and ABORT from anywhere, even from within members called by actions, -// simply throwing the appropriate exceptions. +// $insert polymorphicCode +namespace Meta_ +{ + +size_t const *t_nErrors; +// $insert idoftag +char const *idOfTag_[] = { + "INT", + "STRING", + "" +}; + +size_t const *s_nErrors_; + +Base::~Base() +{} + +} // namespace Meta_ + +// If the parsing function call (i.e., parse()' needs arguments, then provide +// an overloaded function. The code below doesn't rely on parameters, so no +// arguments are required. Furthermore, parse uses a function try block to +// allow us to do ACCEPT and ABORT from anywhere, even from within members +// called by actions, simply throwing the appropriate exceptions. + +// base/base1 ParserBase::ParserBase() : - d_stackIdx__(-1), - // $insert debuginit - d_debug__(false), - d_nErrors__(0), - // $insert requiredtokens - d_requiredTokens__(0), - d_acceptedTokens__(d_requiredTokens__), - d_token__(_UNDETERMINED_), - d_nextToken__(_UNDETERMINED_) -{} + d_token(Reserved_::UNDETERMINED_), + // $insert baseclasscode + d_requiredTokens_(0) +{ + Meta_::t_nErrors = &d_nErrors_; +} + +// base/clearin +void ParserBase::clearin_() +{ + d_nErrors_ = 0; + d_stackIdx = -1; + d_stateStack.clear(); + d_token = Reserved_::UNDETERMINED_; + d_next = TokenPair{ Reserved_::UNDETERMINED_, STYPE_{} }; + d_recovery = false; + d_acceptedTokens_ = d_requiredTokens_; + d_val_ = STYPE_{}; + + push_(0); +} +// base/debugfunctions -void Parser::print__() +void ParserBase::setDebug(bool mode) { -// $insert print + d_actionCases_ = false; + d_debug_ = mode; } -void ParserBase::clearin() +void ParserBase::setDebug(DebugMode_ mode) { - d_token__ = d_nextToken__ = _UNDETERMINED_; + d_actionCases_ = mode & ACTIONCASES; + d_debug_ = mode & ON; } -void ParserBase::push__(size_t state) +// base/lex +void ParserBase::lex_(int token) { - if (static_cast(d_stackIdx__ + 1) == d_stateStack__.size()) + d_token = token; + + if (d_token <= 0) + d_token = Reserved_::EOF_; + + d_terminalToken = true; +} + +// base/lookup +int ParserBase::lookup_() const +{ + // if the final transition is negative, then we should reduce by the rule + // given by its positive value. + + SR_ const *sr = s_state[d_state]; + SR_ const *last = sr + sr->d_lastIdx; + + for ( ; ++sr != last; ) // visit all but the last SR entries { - size_t newSize = d_stackIdx__ + STACK_EXPANSION; - d_stateStack__.resize(newSize); - d_valueStack__.resize(newSize); + if (sr->d_token == d_token) + return sr->d_action; } - ++d_stackIdx__; - d_stateStack__[d_stackIdx__] = d_state__ = state; - *(d_vsp__ = &d_valueStack__[d_stackIdx__]) = d_val__; + + if (sr == last) // reached the last element + { + if (sr->d_action < 0) // default reduction + { + return sr->d_action; + } + + // No default reduction, so token not found, so error. + throw UNEXPECTED_TOKEN_; + } + + // not at the last element: inspect the nature of the action + // (< 0: reduce, 0: ACCEPT, > 0: shift) + + int action = sr->d_action; + + + return action; } -void ParserBase::popToken__() +// base/pop +void ParserBase::pop_(size_t count) { - d_token__ = d_nextToken__; + if (d_stackIdx < static_cast(count)) + { + ABORT(); + } - d_val__ = d_nextVal__; - d_nextVal__ = STYPE__(); + d_stackIdx -= count; + d_state = d_stateStack[d_stackIdx].first; + d_vsp = &d_stateStack[d_stackIdx]; - d_nextToken__ = _UNDETERMINED_; } - -void ParserBase::pushToken__(int token) + +// base/poptoken +void ParserBase::popToken_() { - d_nextToken__ = d_token__; - d_nextVal__ = d_val__; - d_token__ = token; + d_token = d_next.first; + d_val_ = std::move(d_next.second); + + d_next.first = Reserved_::UNDETERMINED_; } - -void ParserBase::pop__(size_t count) + +// base/push +void ParserBase::push_(size_t state) { - if (d_stackIdx__ < static_cast(count)) + size_t currentSize = d_stateStack.size(); + if (stackSize_() == currentSize) + { + size_t newSize = currentSize + STACK_EXPANSION_; + d_stateStack.resize(newSize); + } + + ++d_stackIdx; + d_stateStack[d_stackIdx] = + StatePair{ d_state = state, std::move(d_val_) }; + + d_vsp = &d_stateStack[d_stackIdx]; + + if (d_stackIdx == 0) + { + } + else { - ABORT(); } +} - d_stackIdx__ -= count; - d_state__ = d_stateStack__[d_stackIdx__]; - d_vsp__ = &d_valueStack__[d_stackIdx__]; +// base/pushtoken +void ParserBase::pushToken_(int token) +{ + d_next = TokenPair{ d_token, std::move(d_val_) }; + d_token = token; } -inline size_t ParserBase::top__() const +// base/redotoken +void ParserBase::redoToken_() { - return d_stateStack__[d_stackIdx__]; + if (d_token != Reserved_::UNDETERMINED_) + pushToken_(d_token); } -void Parser::executeAction(int production) -try +// base/reduce +void ParserBase::reduce_(int rule) +{ + PI_ const &pi = s_productionInfo[rule]; + + d_token = pi.d_nonTerm; + pop_(pi.d_size); + + d_terminalToken = false; +} + +// base/shift +void ParserBase::shift_(int action) +{ + push_(action); + popToken_(); // token processed + + if (d_recovery and d_terminalToken) + { + d_recovery = false; + d_acceptedTokens_ = 0; + } +} + +// base/startrecovery +void ParserBase::startRecovery_() +{ + int lastToken = d_token; // give the unexpected token a + // chance to be processed + // again. + + pushToken_(Reserved_::errTok_); // specify errTok_ as next token + push_(lookup_()); // push the error state + + d_token = lastToken; // reactivate the unexpected + // token (we're now in an + // ERROR state). + + d_recovery = true; +} + +// base/top +inline size_t ParserBase::top_() const { - if (d_token__ != _UNDETERMINED_) - pushToken__(d_token__); // save an already available token + return d_stateStack[d_stackIdx].first; +} + +// derived/errorrecovery +void Parser::errorRecovery_() +{ + // When an error has occurred, pop elements off the stack until the top + // state has an error-item. If none is found, the default recovery + // mode (which is to abort) is activated. + // + // If EOF is encountered without being appropriate for the current state, + // then the error recovery will fall back to the default recovery mode. + // (i.e., parsing terminates) + + + + if (d_acceptedTokens_ >= d_requiredTokens_)// only generate an error- + { // message if enough tokens + ++d_nErrors_; // were accepted. Otherwise + error(); // simply skip input + } + + // get the error state + while (not (s_state[top_()][0].d_type & ERR_ITEM)) + { + pop_(); + } - // save default non-nested block $$ - if (int size = s_productionInfo[production].d_size) - d_val__ = d_vsp__[1 - size]; + // In the error state, looking up a token allows us to proceed. + // Continuation may be require multiple reductions, but eventually a + // terminal-token shift is used. See nextCycle_ for details. + startRecovery_(); +} + +// derived/executeaction +void Parser::executeAction_(int production) +try +{ + if (token_() != Reserved_::UNDETERMINED_) + pushToken_(token_()); // save an already available token switch (production) { // $insert actioncases + case 1: +#line 19 "grammar" + { + d_val_ = std::move(vs_(-1)); + } + break; + case 3: #line 3 "inc/nr" { - d_val__.get() = stol(d_scanner.matched()); + d_val_ = stol(d_scanner.matched()); } break; case 4: #line 10 "inc/nr" { - d_val__.get() = 1; + d_val_ = 1; } break; case 5: #line 15 "inc/nr" { - d_val__.get() = d_vsp__[0].data(); + d_val_ = vs_(0).get(); } break; case 6: #line 22 "inc/nr" { - d_cronData.addNr(d_vsp__[0].data()); + d_cronData.addNr(vs_(0).get()); } break; case 7: #line 30 "inc/nr" { - d_cronData.addRange(d_vsp__[-3].data(), d_vsp__[-1].data(), d_vsp__[0].data()); + d_cronData.addRange(vs_(-3).get(), vs_(-1).get(), vs_(0).get()); } break; + case 8: +#line 35 "inc/nr" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 9: +#line 39 "inc/nr" + { + d_val_ = std::move(vs_(-2)); + } + break; + + case 10: +#line 41 "inc/nr" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 11: +#line 3 "inc/ws" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 13: +#line 3 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 14: +#line 5 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 15: +#line 7 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 16: +#line 9 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 17: +#line 11 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 18: +#line 13 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 19: +#line 15 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 20: +#line 17 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 21: +#line 21 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 22: +#line 23 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + case 23: #line 26 "inc/token" { - d_val__.get() = d_scanner.matched(); + d_val_ = d_scanner.matched(); } break; case 24: #line 35 "inc/token" { - d_val__.get() = d_vsp__[0].data(); + d_val_ = vs_(0).get(); } break; case 25: #line 43 "inc/token" { - d_val__.get() =d_vsp__[0].data(); + d_val_ = vs_(0).get(); } break; case 26: #line 50 "inc/token" { - d_val__.get() += d_scanner.matched(); + d_val_ = vs_(-1).get() + d_scanner.matched(); } break; case 27: #line 55 "inc/token" { - d_val__.get() = d_val__.get(); + d_val_ = vs_(0).get(); } break; + case 28: +#line 62 "inc/token" + { + d_val_ = std::move(vs_(0)); + } + break; + case 29: #line 63 "inc/token" { - d_val__.get() = string(); + d_val_ = string{}; } break; case 30: #line 8 "inc/nameline" { - d_val__.get() = d_vsp__[0].data(); + d_val_ = vs_(0).get(); } break; case 31: #line 15 "inc/nameline" { - d_val__.get() = d_scanner.matched(); + d_val_ = d_scanner.matched(); } break; case 32: #line 22 "inc/nameline" { - d_cronData.setEnvVar(d_vsp__[-1].data(), d_vsp__[0].data()); + d_cronData.setEnvVar(vs_(-1).get(), vs_(0).get()); } break; case 33: #line 3 "inc/time" { - d_cronData.setAll(d_vsp__[0].data()); + d_cronData.setAll(vs_(0).get()); } break; + case 34: +#line 10 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + case 35: #line 12 "inc/time" { @@ -985,6 +1278,48 @@ } break; + case 36: +#line 19 "inc/time" + { + d_val_ = std::move(vs_(-2)); + } + break; + + case 37: +#line 21 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 38: +#line 27 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 39: +#line 29 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 40: +#line 34 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 41: +#line 36 "inc/time" + { + d_val_ = std::move(vs_(0)); + } + break; + case 42: #line 4 "inc/cronline" { @@ -1023,7 +1358,7 @@ case 47: #line 44 "inc/cronline" { - d_cronData.setCommand(d_vsp__[-1].data() + d_vsp__[0].data()); + d_cronData.setCommand(vs_(-1).get() + vs_(0).get()); } break; @@ -1034,6 +1369,27 @@ } break; + case 49: +#line 3 "inc/line" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 50: +#line 5 "inc/line" + { + d_val_ = std::move(vs_(0)); + } + break; + + case 51: +#line 7 "inc/line" + { + d_val_ = std::move(vs_(0)); + } + break; + case 52: #line 10 "inc/line" { @@ -1041,192 +1397,122 @@ } break; + case 53: +#line 17 "inc/line" + { + d_val_ = std::move(vs_(-1)); + } + break; + + case 55: +#line 23 "inc/line" + { + d_val_ = std::move(vs_(-1)); + } + break; + } } catch (std::exception const &exc) { - exceptionHandler__(exc); + exceptionHandler(exc); } -inline void ParserBase::reduce__(PI__ const &pi) +// derived/nextcycle +void Parser::nextCycle_() +try { - d_token__ = pi.d_nonTerm; - pop__(pi.d_size); + if (s_state[state_()]->d_type & REQ_TOKEN) + nextToken_(); // obtain next token -} -// If d_token__ is _UNDETERMINED_ then if d_nextToken__ is _UNDETERMINED_ another -// token is obtained from lex(). Then d_nextToken__ is assigned to d_token__. -void Parser::nextToken() -{ - if (d_token__ != _UNDETERMINED_) // no need for a token: got one - return; // already + int action = lookup_(); // lookup d_token in d_state - if (d_nextToken__ != _UNDETERMINED_) - { - popToken__(); // consume pending token - } - else + if (action > 0) // SHIFT: push a new state { - ++d_acceptedTokens__; // accept another token (see - // errorRecover()) - d_token__ = lex(); - if (d_token__ <= 0) - d_token__ = _EOF_; + shift_(action); + return; } - print(); -} -// if the final transition is negative, then we should reduce by the rule -// given by its positive value. Note that the `recovery' parameter is only -// used with the --debug option -int Parser::lookup(bool recovery) -{ -// $insert threading - SR__ *sr = s_state[d_state__]; // get the appropriate state-table - int lastIdx = sr->d_lastIdx; // sentinel-index in the SR__ array - - SR__ *lastElementPtr = sr + lastIdx; - lastElementPtr->d_token = d_token__; // set search-token - - SR__ *elementPtr = sr + 1; // start the search at s_xx[1] - while (elementPtr->d_token != d_token__) - ++elementPtr; - - - if (elementPtr == lastElementPtr) // reached the last element + if (action < 0) // REDUCE: execute and pop. { - if (elementPtr->d_action < 0) // default reduction - { - return elementPtr->d_action; - } - // No default reduction, so token not found, so error. - throw UNEXPECTED_TOKEN__; + if (recovery_()) + redoToken_(); + else + executeAction_(-action); + // next token is the rule's LHS + reduce_(-action); + return; } - // not at the last element: inspect the nature of the action - // (< 0: reduce, 0: ACCEPT, > 0: shift) - - int action = elementPtr->d_action; - - - return action; + if (recovery_()) + ABORT(); + else + ACCEPT(); } - - // When an error has occurred, pop elements off the stack until the top - // state has an error-item. If none is found, the default recovery - // mode (which is to abort) is activated. - // - // If EOF is encountered without being appropriate for the current state, - // then the error recovery will fall back to the default recovery mode. - // (i.e., parsing terminates) -void Parser::errorRecovery() -try +catch (ErrorRecovery_) { - if (d_acceptedTokens__ >= d_requiredTokens__)// only generate an error- - { // message if enough tokens - ++d_nErrors__; // were accepted. Otherwise - error("Syntax error"); // simply skip input - + if (not recovery_()) + errorRecovery_(); + else + { + if (token_() == Reserved_::EOF_) + ABORT(); + popToken_(); // skip the failing token } +} - // get the error state - while (not (s_state[top__()][0].d_type & ERR_ITEM)) +// derived/nexttoken +void Parser::nextToken_() +{ + // If d_token is Reserved_::UNDETERMINED_ then if savedToken_() is + // Reserved_::UNDETERMINED_ another token is obtained from lex(). Then + // savedToken_() is assigned to d_token. + + // no need for a token: got one already + if (token_() != Reserved_::UNDETERMINED_) { - pop__(); + return; } - // In the error state, lookup a token allowing us to proceed. - // Continuation may be possible following multiple reductions, - // but eventuall a shift will be used, requiring the retrieval of - // a terminal token. If a retrieved token doesn't match, the catch below - // will ensure the next token is requested in the while(true) block - // implemented below: - - int lastToken = d_token__; // give the unexpected token a - // chance to be processed - // again. - - pushToken__(_error_); // specify _error_ as next token - push__(lookup(true)); // push the error state - - d_token__ = lastToken; // reactivate the unexpected - // token (we're now in an - // ERROR state). - - bool gotToken = true; // the next token is a terminal - - while (true) + if (savedToken_() != Reserved_::UNDETERMINED_) { - try - { - if (s_state[d_state__]->d_type & REQ_TOKEN) - { - gotToken = d_token__ == _UNDETERMINED_; - nextToken(); // obtain next token - } - - int action = lookup(true); - - if (action > 0) // push a new state - { - push__(action); - popToken__(); - - if (gotToken) - { - - d_acceptedTokens__ = 0; - return; - } - } - else if (action < 0) - { - // no actions executed on recovery but save an already - // available token: - if (d_token__ != _UNDETERMINED_) - pushToken__(d_token__); - - // next token is the rule's LHS - reduce__(s_productionInfo[-action]); - } - else - ABORT(); // abort when accepting during - // error recovery - } - catch (...) - { - if (d_token__ == _EOF_) - ABORT(); // saw inappropriate _EOF_ - - popToken__(); // failing token now skipped - } + popToken_(); // consume pending token } + else + { + ++d_acceptedTokens_; // accept another token (see + // errorRecover()) + lex_(lex()); + print_(); + } + print(); } -catch (ErrorRecovery__) // This is: DEFAULT_RECOVERY_MODE + +// derived/print +void Parser::print_() { - ABORT(); +// $insert print } +// derived/parse +int Parser::parse() +try +{ // The parsing algorithm: - // Initially, state 0 is pushed on the stack, and d_token__ as well as - // d_nextToken__ are initialized to _UNDETERMINED_. + // Initially, state 0 is pushed on the stack, and all relevant variables + // are initialized by Base::clearin_. // // Then, in an eternal loop: // - // 1. If a state does not have REQ_TOKEN no token is assigned to - // d_token__. If the state has REQ_TOKEN, nextToken() is called to - // determine d_nextToken__ and d_token__ is set to - // d_nextToken__. nextToken() will not call lex() unless d_nextToken__ is - // _UNDETERMINED_. - // - // 2. lookup() is called: - // d_token__ is stored in the final element's d_token field of the - // state's SR_ array. + // 1. If a state is a REQ_TOKEN type, then the next token is obtained + // from nextToken(). This may very well be the currently available + // token. When retrieving a terminal token d_terminal is set to true. // - // 3. The current token is looked up in the state's SR_ array + // 2. lookup() is called, d_token is looked up in the current state's + // SR_ array. // // 4. Depending on the result of the lookup() function the next state is // shifted on the parser's stack, a reduction by some rule is applied, @@ -1234,50 +1520,23 @@ // called for, any action that may have been defined for that // reduction is executed. // - // 5. An error occurs if d_token__ is not found, and the state has no - // default reduction. Error handling was described at the top of this - // file. + // 5. An error occurs if d_token is not found, and the state has no + // default reduction. -int Parser::parse() -try -{ - push__(0); // initial state - clearin(); // clear the tokens. + clearin_(); // initialize, push(0) while (true) { - try - { - if (s_state[d_state__]->d_type & REQ_TOKEN) - nextToken(); // obtain next token - - - int action = lookup(false); // lookup d_token__ in d_state__ - - if (action > 0) // SHIFT: push a new state - { - push__(action); - popToken__(); // token processed - } - else if (action < 0) // REDUCE: execute and pop. - { - executeAction(-action); - // next token is the rule's LHS - reduce__(s_productionInfo[-action]); - } - else - ACCEPT(); - } - catch (ErrorRecovery__) - { - errorRecovery(); - } +// $insert prompt + nextCycle_(); } } -catch (Return__ retValue) +catch (Return_ retValue) { - return retValue; + return retValue or d_nErrors_; } +// derived/tail + diff -Nru ssh-cron-1.02.00/parser/parserbase.h ssh-cron-1.03.00/parser/parserbase.h --- ssh-cron-1.02.00/parser/parserbase.h 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/parserbase.h 2020-11-14 13:26:28.000000000 +0000 @@ -1,346 +1,487 @@ -// Generated by Bisonc++ V4.09.01 on Thu, 15 May 2014 09:30:55 +0200 +// Generated by Bisonc++ V6.04.01 on Sat, 14 Nov 2020 10:06:30 +0100 +// hdr/includes #ifndef ParserBase_h_included #define ParserBase_h_included #include #include #include - -// $insert preincludes +// $insert polyincludes #include +// $insert preincludes #include "parserpre.ih" +#include "../scanner/tokens.h" + +// hdr/baseclass namespace // anonymous { - struct PI__; + struct PI_; } // $insert polymorphic -enum class Tag__ +enum class Tag_ { INT, STRING, }; -namespace Meta__ +namespace Meta_ { - template - struct TypeOf; - template - struct TagOf; +extern size_t const *t_nErrors; -// $insert polymorphicSpecializations - template <> - struct TagOf - { - static Tag__ const tag = Tag__::INT; - }; +extern size_t const *s_nErrors_; - template <> - struct TagOf - { - static Tag__ const tag = Tag__::STRING; - }; - - template <> - struct TypeOf - { - typedef int type; - }; - - template <> - struct TypeOf - { - typedef std::string type; - }; +template +struct TypeOf; +template +struct TagOf; - // The Base class: - // Individual semantic value classes are derived from this class. - // This class offers a member returning the value's Tag__ - // and two member templates get() offering const/non-const access to - // the actual semantic value type. - class Base - { - Tag__ d_tag; - - protected: - Base(Tag__ tag); +// $insert polymorphicSpecializations +enum { sizeofTag_ = 2 }; - public: - Base(Base const &other) = delete; +extern char const *idOfTag_[]; +template <> +struct TagOf +{ + static Tag_ const tag = Tag_::INT; +}; - Tag__ tag() const; - - template - typename TypeOf::type &get(); - }; - - // The class Semantic is derived from Base. It stores a particular - // semantic value type. - template - class Semantic: public Base - { - typedef typename TypeOf::type DataType; - - DataType d_data; - - public: - // The default constructor and constructors for - // defined data types are available - Semantic(); - Semantic(DataType const &data); - Semantic(DataType &&tmp); - - DataType &data(); - }; - - // The class Stype wraps the shared_ptr holding a pointer to Base. - // It becomes the polymorphic STYPE__ - // It also wraps Base's get members, allowing constructions like - // $$.get to be used, rather than $$->get. - // Its operator= can be used to assign a Semantic * - // directly to the SType object. The free functions (in the parser's - // namespace (if defined)) semantic__ can be used to obtain a - // Semantic *. - struct SType: public std::shared_ptr - { - template - SType &operator=(Tp_ &&value); +template <> +struct TagOf +{ + static Tag_ const tag = Tag_::STRING; +}; - Tag__ tag() const; +template <> +struct TypeOf +{ + typedef int type; +}; - // this get()-member checks for 0-pointer and correct tag - // in shared_ptr, and resets the shared_ptr's Base * - // to point to Meta::__Semantic() if not - template - typename TypeOf::type &get(); - - // the data()-member does not check, and may result in a - // segfault if used incorrectly - template - typename TypeOf::type &data(); - }; +template <> +struct TypeOf +{ + typedef std::string type; +}; -} // namespace Meta__ -class ParserBase + // Individual semantic value classes are derived from Base, offering a + // member returning the value's Tag_, a member cloning the object of its + // derived Semantic and a member returning a pointerr to its + // derived Semantic data. See also Bisonc++'s distribution file + // README.polymorphic-techical +class Base { - public: -// $insert tokens + protected: + Tag_ d_baseTag; // d_baseTag is assigned by Semantic. - // Symbolic tokens: - enum Tokens__ - { - WS = 257, - NR, - ID, - CHAR, - }; + public: + Base() = default; + Base(Base const &other) = delete; -// $insert STYPE - typedef Meta__::SType STYPE__; + virtual ~Base(); + Tag_ tag() const; + Base *clone() const; + void *data() const; private: - int d_stackIdx__; - std::vector d_stateStack__; - std::vector d_valueStack__; + virtual Base *vClone() const = 0; + virtual void *vData() const = 0; +}; - protected: - enum Return__ - { - PARSE_ACCEPT__ = 0, // values used as parse()'s return values - PARSE_ABORT__ = 1 - }; - enum ErrorRecovery__ - { - DEFAULT_RECOVERY_MODE__, - UNEXPECTED_TOKEN__, - }; - bool d_debug__; - size_t d_nErrors__; - size_t d_requiredTokens__; - size_t d_acceptedTokens__; - int d_token__; - int d_nextToken__; - size_t d_state__; - STYPE__ *d_vsp__; - STYPE__ d_val__; - STYPE__ d_nextVal__; +inline Base *Base::clone() const +{ + return vClone(); +} - ParserBase(); +inline void *Base::data() const +{ + return vData(); +} - void ABORT() const; - void ACCEPT() const; - void ERROR() const; - void clearin(); - bool debug() const; - void pop__(size_t count = 1); - void push__(size_t nextState); - void popToken__(); - void pushToken__(int token); - void reduce__(PI__ const &productionInfo); - void errorVerbose__(); - size_t top__() const; +inline Tag_ Base::tag() const +{ + return d_baseTag; +} + // The class Semantic stores a semantic value of the type matching tg_ +template +class Semantic: public Base +{ + typename TypeOf::type d_data; + public: - void setDebug(bool mode); -}; + Semantic(); + Semantic(Semantic const &other); // req'd for cloning + + // This constructor member template forwards its arguments to + // d_data, allowing it to be initialized using whatever + // constructor is available for DataType + template + Semantic(Params &&...params); + + private: + Base *vClone() const override; + void *vData() const override; +}; -inline bool ParserBase::debug() const +template +Semantic::Semantic() { - return d_debug__; + d_baseTag = tg_; // Base's data member: } -inline void ParserBase::setDebug(bool mode) +template +Semantic::Semantic(Semantic const &other) +: + d_data(other.d_data) { - d_debug__ = mode; + d_baseTag = other.d_baseTag; } -inline void ParserBase::ABORT() const +template +template +Semantic::Semantic(Params &&...params) +: + d_data(std::forward(params) ...) { - throw PARSE_ABORT__; + d_baseTag = tg_; } -inline void ParserBase::ACCEPT() const + +template +Base *Semantic::vClone() const { - throw PARSE_ACCEPT__; + return new Semantic{*this}; } -inline void ParserBase::ERROR() const +template +void *Semantic::vData() const { - throw UNEXPECTED_TOKEN__; + return const_cast::type *>(&d_data); } -// $insert polymorphicInline -namespace Meta__ + + // The class SType wraps a pointer to Base. It becomes the polymorphic + // STYPE_ type. It also defines get members, allowing constructions like + // $$.get to be used. +class SType: private std::unique_ptr { + typedef std::unique_ptr BasePtr; -inline Base::Base(Tag__ tag) -: - d_tag(tag) -{} + public: + SType() = default; + SType(SType const &other); + SType(SType &&tmp); + + ~SType() = default; + + // Specific overloads are needed for SType = SType assignments + SType &operator=(SType const &rhs); + SType &operator=(SType &rhs); // required so it is used + // instead of the template op= + SType &operator=(SType &&tmp); + +// $insert polymorphicOpAssignDecl + SType &operator=(int const &value); + SType &operator=(int &&tmp); -inline Tag__ Base::tag() const -{ - return d_tag; -} + SType &operator=(std::string const &value); + SType &operator=(std::string &&tmp); -template -inline Semantic::Semantic() -: - Base(tg_), - d_data(typename TypeOf::type()) -{} + template + void assign(Args &&...args); + + // By default the get()-members check whether the specified + // matches the tag returned by SType::tag (d_data's tag). If they + // don't match a run-time fatal error results. + template + typename TypeOf::type &get(); + + template + typename TypeOf::type const &get() const; -template -inline Semantic::Semantic(typename TypeOf::type const &data) + Tag_ tag() const; + bool valid() const; +}; + +inline SType::SType(SType const &other) : - Base(tg_), - d_data(data) + BasePtr{other ? other->clone() : 0} {} -template -inline Semantic::Semantic(typename TypeOf::type &&tmp) +inline SType::SType(SType &&tmp) : - Base(tg_), - d_data(std::move(tmp)) + BasePtr{std::move(tmp)} {} -template -inline typename TypeOf::type &Semantic::data() +inline SType &SType::operator=(SType const &rhs) { - return d_data; + reset(rhs->clone()); + return *this; } -template -inline typename TypeOf::type &Base::get() +inline SType &SType::operator=(SType &rhs) { - return static_cast *>(this)->data(); + reset(rhs->clone()); + return *this; } -inline Tag__ SType::tag() const +inline SType &SType::operator=(SType &&tmp) { - return std::shared_ptr::get()->tag(); + BasePtr::operator=(std::move(tmp)); + return *this; } - -template -inline typename TypeOf::type &SType::get() + +// $insert polymorphicOpAssignImpl +inline SType &SType::operator=(int const &value) { - // if we're not yet holding a (tg_) value, initialize to - // a Semantic holding a default value - if (std::shared_ptr::get() == 0 || tag() != tg_) - reset(new Semantic()); + assign< Tag_::INT >(value); + return *this; +} +inline SType &SType::operator=(int &&tmp) +{ + assign< Tag_::INT >(std::move(tmp)); + return *this; +} +inline SType &SType::operator=(std::string const &value) +{ + assign< Tag_::STRING >(value); + return *this; +} +inline SType &SType::operator=(std::string &&tmp) +{ + assign< Tag_::STRING >(std::move(tmp)); + return *this; +} - return std::shared_ptr::get()->get(); +template +void SType::assign(Args &&...args) +{ + reset(new Semantic(std::forward(args) ...)); } -template -inline typename TypeOf::type &SType::data() +template +typename TypeOf::type &SType::get() { - return std::shared_ptr::get()->get(); +// $insert warnTagMismatches + + if (tag() != tg) + { + if (*t_nErrors != 0) + const_cast(this)->assign(); + else + { + std::cerr << "[Fatal] calling `.get(tg)] << + ">()', but Tag " << + idOfTag_[static_cast(tag())] << " is encountered. Try " + "option --debug and call setDebug(Parser::ACTIONCASES)\n"; + throw 1; // ABORTs + } + } + + return *static_cast::type *>( (*this)->data() ); } -template -struct Assign; +template +typename TypeOf::type const &SType::get() const +{ +// $insert warnTagMismatches -template -struct Assign + if (tag() != tg) + { + if (*t_nErrors != 0) + const_cast(this)->assign(); + else + { + std::cerr << "[Fatal] calling `.get(tg)] << + ">()', but Tag " << + idOfTag_[static_cast(tag())] << " is encountered. Try " + "option --debug and call setDebug(Parser::ACTIONCASES)\n"; + throw 1; // ABORTs + } + } + + return *static_cast::type *>( (*this)->data() ); +} + +inline Tag_ SType::tag() const { - static SType &assign(SType *lhs, Tp_ &&tp); -}; + return valid() ? (*this)->tag() : static_cast(sizeofTag_); +} -template -struct Assign +inline bool SType::valid() const { - static SType &assign(SType *lhs, Tp_ const &tp); -}; + return BasePtr::get() != 0; +} -template <> -struct Assign +} // namespace Meta_ + +// $insert parserbase +class ParserBase: public Tokens { - static SType &assign(SType *lhs, SType const &tp); + public: + enum DebugMode_ + { + OFF = 0, + ON = 1 << 0, + ACTIONCASES = 1 << 1 + }; + +// $insert tokens +// $insert STYPE + typedef Meta_::SType STYPE_; + + + private: + // state semval + typedef std::pair StatePair; + // token semval + typedef std::pair TokenPair; + + int d_stackIdx = -1; + std::vector d_stateStack; + StatePair *d_vsp = 0; // points to the topmost value stack + size_t d_state = 0; + + TokenPair d_next; + int d_token; + + bool d_terminalToken = false; + bool d_recovery = false; + + + protected: + enum Return_ + { + PARSE_ACCEPT_ = 0, // values used as parse()'s return values + PARSE_ABORT_ = 1 + }; + enum ErrorRecovery_ + { + UNEXPECTED_TOKEN_, + }; + + bool d_actionCases_ = false; // set by options/directives + bool d_debug_ = true; + size_t d_requiredTokens_; + size_t d_nErrors_; // initialized by clearin() + size_t d_acceptedTokens_; + STYPE_ d_val_; + + + ParserBase(); + + void ABORT() const; + void ACCEPT() const; + void ERROR() const; + + STYPE_ &vs_(int idx); // value stack element idx + int lookup_() const; + int savedToken_() const; + int token_() const; + size_t stackSize_() const; + size_t state_() const; + size_t top_() const; + void clearin_(); + void errorVerbose_(); + void lex_(int token); + void popToken_(); + void pop_(size_t count = 1); + void pushToken_(int token); + void push_(size_t nextState); + void redoToken_(); + bool recovery_() const; + void reduce_(int rule); + void shift_(int state); + void startRecovery_(); + + public: + void setDebug(bool mode); + void setDebug(DebugMode_ mode); +}; + +// hdr/abort +inline void ParserBase::ABORT() const +{ + throw PARSE_ABORT_; +} + +// hdr/accept +inline void ParserBase::ACCEPT() const +{ + throw PARSE_ACCEPT_; +} + + +// hdr/error +inline void ParserBase::ERROR() const +{ + throw UNEXPECTED_TOKEN_; +} + +// hdr/savedtoken +inline int ParserBase::savedToken_() const +{ + return d_next.first; +} + +// hdr/opbitand +inline ParserBase::DebugMode_ operator&(ParserBase::DebugMode_ lhs, + ParserBase::DebugMode_ rhs) +{ + return static_cast( + static_cast(lhs) & rhs); +} + +// hdr/opbitor +inline ParserBase::DebugMode_ operator|(ParserBase::DebugMode_ lhs, + ParserBase::DebugMode_ rhs) +{ + return static_cast(static_cast(lhs) | rhs); }; -template -inline SType &Assign::assign(SType *lhs, Tp_ &&tp) +// hdr/recovery +inline bool ParserBase::recovery_() const { - lhs->reset(new Semantic::tag>(std::move(tp))); - return *lhs; + return d_recovery; } -template -inline SType &Assign::assign(SType *lhs, Tp_ const &tp) +// hdr/stacksize +inline size_t ParserBase::stackSize_() const { - lhs->reset(new Semantic::tag>(tp)); - return *lhs; + return d_stackIdx + 1; } -inline SType &Assign::assign(SType *lhs, SType const &tp) +// hdr/state +inline size_t ParserBase::state_() const { - return lhs->operator=(tp); + return d_state; } -template -inline SType &SType::operator=(Tp_ &&rhs) +// hdr/token +inline int ParserBase::token_() const { - return Assign< - std::is_rvalue_reference::value, - typename std::remove_reference::type - >::assign(this, std::forward(rhs)); + return d_token; } -} // namespace Meta__ +// hdr/vs +inline ParserBase::STYPE_ &ParserBase::vs_(int idx) +{ + return (d_vsp + idx)->second; +} -// As a convenience, when including ParserBase.h its symbols are available as -// symbols in the class Parser, too. -#define Parser ParserBase #endif + diff -Nru ssh-cron-1.02.00/parser/parser.h ssh-cron-1.03.00/parser/parser.h --- ssh-cron-1.02.00/parser/parser.h 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/parser.h 2020-11-14 13:26:28.000000000 +0000 @@ -1,4 +1,4 @@ -// Generated by Bisonc++ V4.08.00 on Fri, 09 May 2014 11:23:30 +0200 +// Generated by Bisonc++ V6.04.01 on Fri, 13 Nov 2020 13:03:52 +0100 #ifndef Parser_h_included #define Parser_h_included @@ -10,14 +10,13 @@ class CronData; -#undef Parser class Parser: public ParserBase { CronData &d_cronData; - + // $insert scannerobject Scanner d_scanner; - + public: Parser(std::istream &in, CronData &cronData); int parse(); @@ -25,18 +24,18 @@ private: void addSet(std::set &lhs, std::set const &rhs) const; - void error(char const *msg); // called on (syntax) errors + void error(); // called on (syntax) errors int lex(); // returns the next token from the // lexical scanner. void print(); // use, e.g., d_token, d_loc + void exceptionHandler(std::exception const &exc); // support functions for parse(): - void executeAction(int ruleNr); - void errorRecovery(); - int lookup(bool recovery); - void nextToken(); - void print__(); - void exceptionHandler__(std::exception const &exc); + void executeAction_(int ruleNr); + void errorRecovery_(); + void nextCycle_(); + void nextToken_(); + void print_(); }; diff -Nru ssh-cron-1.02.00/parser/parser.ih ssh-cron-1.03.00/parser/parser.ih --- ssh-cron-1.02.00/parser/parser.ih 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/parser/parser.ih 2020-11-14 13:26:28.000000000 +0000 @@ -1,10 +1,11 @@ -// Generated by Bisonc++ V4.08.00 on Fri, 09 May 2014 11:23:30 +0200 +// Generated by Bisonc++ V6.04.01 on Fri, 13 Nov 2020 13:03:52 +0100 // Include this file in the sources of the class Parser. // $insert class.h #include "parser.h" + #include #include @@ -19,23 +20,13 @@ inline void Parser::print() { - print__(); // displays tokens if --print was specified + print_(); // displays tokens if --print was specified } -inline void Parser::exceptionHandler__(std::exception const &exc) +inline void Parser::exceptionHandler(std::exception const &exc) { throw; // re-implement to handle exceptions thrown by actions } - - // Add here includes that are only required for the compilation - // of Parser's sources. - - - - // UN-comment the next using-declaration if you want to use - // int Parser's sources symbols from the namespace std without - // specifying std:: - using namespace std; using namespace FBB; diff -Nru ssh-cron-1.02.00/scanner/icmconf ssh-cron-1.03.00/scanner/icmconf --- ssh-cron-1.02.00/scanner/icmconf 1970-01-01 00:00:00.000000000 +0000 +++ ssh-cron-1.03.00/scanner/icmconf 2020-11-14 13:26:28.000000000 +0000 @@ -0,0 +1,2 @@ +#define LIBRARY "scanner" +#include "../icmconf.lib" diff -Nru ssh-cron-1.02.00/scanner/lex.cc ssh-cron-1.03.00/scanner/lex.cc --- ssh-cron-1.02.00/scanner/lex.cc 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/scanner/lex.cc 2020-11-14 13:26:28.000000000 +0000 @@ -1,19 +1,22 @@ -// Generated by Flexc++ V2.01.00 on Mon, 26 May 2014 16:06:55 +0200 +// Generated by Flexc++ V2.08.01 on Sat, 14 Nov 2020 10:05:45 +0100 #include #include #include #include +//FBB +#include + // $insert class_ih #include "scanner.ih" - // s_ranges__: use (unsigned) characters as index to obtain + // s_ranges_: use (unsigned) characters as index to obtain // that character's range-number. // The range for EOF is defined in a constant in the // class header file -size_t const ScannerBase::s_ranges__[] = +size_t const ScannerBase::s_ranges_[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7, 7, 7, 7, 7, 7, 8, 9,10,11,12,13,14,14, @@ -28,41 +31,42 @@ 23,23,23,23,23,23, }; - // s_dfa__ contains the rows of *all* DFAs ordered by start state. The - // enum class StartCondition__ is defined in the baseclass header - // StartCondition__::INITIAL is always 0. Each entry defines the row to +// $insert startcondinfo + // s_dfa_ contains the rows of *all* DFAs ordered by start state. The + // enum class StartCondition_is defined in the baseclass header. + // StartCondition_::INITIAL is always 0. Each entry defines the row to // transit to if the column's character range was sensed. Row numbers are - // relative to the used DFA, and d_dfaBase__ is set to the first row of + // relative to the used DFA, and d_dfaBase_ is set to the first row of // the subset to use. The row's final two values are respectively the // rule that may be matched at this state, and the rule's FINAL flag. If // the final value equals FINAL (= 1) then, if there's no continuation, // the rule is matched. If the BOL flag (8) is also set (so FINAL + BOL (= // 9) is set) then the rule only matches when d_atBOL is also true. -int const ScannerBase::s_dfa__[][27] = +int const ScannerBase::s_dfa_[][27] = { // INITIAL - {-1, 1, 2, 3, 1, 3, 4, 3, 2, 3, 2, 2, 3, 2, 5, 3, 2, 3, 6, 3, - 6, 3, 6, 3,-1, -1, 0}, // 0 - {-1, 1,-1,-1, 1,-1, 7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1, 1, 0}, // 1 + { 1, 2, 3, 1, 2, 1, 4, 1, 3, 1, 3, 3, 1, 3, 5, 1, 3, 1, 6, 1, + 6, 1, 6, 1,-1, -1, 0}, // 0 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1, 4, -1}, // 2 + -1,-1,-1,-1,-1, 5, -1}, // 1 + {-1, 2,-1,-1, 2,-1, 7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1, 1, 0}, // 2 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1, 5, -1}, // 3 - {-1, 7,-1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + -1,-1,-1,-1,-1, 4, -1}, // 3 + { 7, 7,-1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,-1, 5, 0}, // 4 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1, 2, -1}, // 5 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 6,-1,-1, 6,-1,-1,-1, 6,-1, 6,-1, 6,-1,-1, 3, -1}, // 6 - {-1, 7,-1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + { 7, 7,-1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,-1, -1, 0}, // 7 }; -int const (*ScannerBase::s_dfaBase__[])[27] = +int const (*ScannerBase::s_dfaBase_[])[27] = { - s_dfa__ + 0, + s_dfa_ + 0, }; size_t ScannerBase::s_istreamNr = 0; @@ -86,7 +90,7 @@ { case '\n': ++d_lineNr; - // FALLING THROUGH + [[fallthrough]]; default: return ch; @@ -129,75 +133,42 @@ ScannerBase::ScannerBase(std::istream &in, std::ostream &out) : - d_filename("-"), d_out(new std::ostream(out.rdbuf())), // $insert interactiveInit d_in(0), - d_input(new std::istream(in.rdbuf())), - d_dfaBase__(s_dfa__) -{} + d_dfaBase_(s_dfa_) +{ + p_pushStream("(istream)", new std::istream(in.rdbuf())); +} -void ScannerBase::switchStream__(std::istream &in, size_t lineNr) +void ScannerBase::switchStream_(std::istream &in, size_t lineNr) { - d_input.close(); - d_input = Input(new std::istream(in.rdbuf()), lineNr); + d_input->close(); + d_streamStack.back().input = { new std::istream(in.rdbuf()), lineNr }; } ScannerBase::ScannerBase(std::string const &infilename, std::string const &outfilename) : - d_filename(infilename), d_out(outfilename == "-" ? new std::ostream(std::cout.rdbuf()) : outfilename == "" ? new std::ostream(std::cerr.rdbuf()) : new std::ofstream(outfilename)), - d_input(new std::ifstream(infilename)), - d_dfaBase__(s_dfa__) -{} - -void ScannerBase::switchStreams(std::istream &in, std::ostream &out) + d_dfaBase_(s_dfa_) { - switchStream__(in, 1); - switchOstream(out); + p_pushStream(infilename, { new std::ifstream(infilename) }); } - -void ScannerBase::switchOstream(std::ostream &out) -{ - *d_out << std::flush; - d_out.reset(new std::ostream(out.rdbuf())); -} - -// $insert debugFunctions -void ScannerBase::setDebug(bool onOff) -{} - -bool ScannerBase::debug() const -{ - return false; -} - -void ScannerBase::redo(size_t nChars) -{ - size_t from = nChars >= length() ? 0 : length() - nChars; - d_input.reRead(d_matched, from); - d_matched.resize(from); -} - -void ScannerBase::switchOstream(std::string const &outfilename) +void ScannerBase::switchStreams(std::istream &in, std::ostream &out) { - *d_out << std::flush; - d_out.reset( - outfilename == "-" ? new std::ostream(std::cout.rdbuf()) : - outfilename == "" ? new std::ostream(std::cerr.rdbuf()) : - new std::ofstream(outfilename)); + switchStream_(in, 1); + switchOstream(out); } - void ScannerBase::switchIstream(std::string const &infilename) { - d_input.close(); + d_input->close(); d_filename = infilename; - d_input = Input(new std::ifstream(infilename)); + d_streamStack.back().input = new std::ifstream(infilename); d_atBOL = true; } @@ -210,8 +181,7 @@ void ScannerBase::pushStream(std::istream &istr) { - std::istream *streamPtr = new std::istream(istr.rdbuf()); - p_pushStream("(istream)", streamPtr); + p_pushStream("(istream)", new std::istream(istr.rdbuf())); //streamPtr); } void ScannerBase::pushStream(std::string const &name) @@ -226,33 +196,87 @@ } + +// static +std::string ScannerBase::setCwd(std::string const &name) // any name +{ + using namespace std; + using namespace filesystem; + + error_code ec; + if (not exists(name, ec)) // not a filename + return name; + // a filename: get its + auto path = canonical(name); // full pathname + current_path(path.parent_path(), ec); + + return path.string(); // return the pathname +} + void ScannerBase::p_pushStream(std::string const &name, std::istream *streamPtr) { - if (d_streamStack.size() == s_maxSizeofStreamStack__) + if (d_streamStack.size() == s_maxSizeofStreamStack_) { delete streamPtr; throw std::length_error("Max stream stack size exceeded"); } - d_streamStack.push_back(StreamStruct{d_filename, d_input}); d_filename = name; - d_input = Input(streamPtr); + d_streamStack.push_back(StreamStruct{setCwd(d_filename), { streamPtr } }); + + d_input = &d_streamStack.back().input; + d_atBOL = true; } +void ScannerBase::switchOstream(std::ostream &out) +{ + *d_out << std::flush; + d_out.reset(new std::ostream(out.rdbuf())); +} + +// $insert debugFunctions +void ScannerBase::setDebug(bool onOff) +{} + +bool ScannerBase::debug() const +{ + return false; +} + +void ScannerBase::redo(size_t nChars) +{ + size_t from = nChars >= length() ? 0 : length() - nChars; + d_input->reRead(d_matched, from); + d_matched.resize(from); +} + +void ScannerBase::switchOstream(std::string const &outfilename) +{ + *d_out << std::flush; + d_out.reset( + outfilename == "-" ? new std::ostream(std::cout.rdbuf()) : + outfilename == "" ? new std::ostream(std::cerr.rdbuf()) : + new std::ofstream(outfilename)); +} + + bool ScannerBase::popStream() { - d_input.close(); + using namespace std::filesystem; - if (d_streamStack.empty()) - return false; + d_input->close(); - StreamStruct &top = d_streamStack.back(); + if (d_streamStack.size() <= 1) + return false; - d_input = top.pushedInput; - d_filename = top.pushedName; d_streamStack.pop_back(); + d_filename = + path{ setCwd(d_streamStack.back().pushedName) }.filename().string(); + + d_input = &d_streamStack.back().input; + return true; } @@ -260,37 +284,37 @@ // See the manual's section `Run-time operations' section for an explanation // of this member. -ScannerBase::ActionType__ ScannerBase::actionType__(size_t range) +ScannerBase::ActionType_ ScannerBase::actionType_(size_t range) { - d_nextState = d_dfaBase__[d_state][range]; + d_nextState = d_dfaBase_[d_state][range]; if (d_nextState != -1) // transition is possible - return ActionType__::CONTINUE; + return ActionType_::CONTINUE; if (knownFinalState()) // FINAL state reached - return ActionType__::MATCH; + return ActionType_::MATCH; if (d_matched.size()) - return ActionType__::ECHO_FIRST; // no match, echo the 1st char + return ActionType_::ECHO_FIRST; // no match, echo the 1st char - return range != s_rangeOfEOF__ ? - ActionType__::ECHO_CH + return range != s_rangeOfEOF_ ? + ActionType_::ECHO_CH : - ActionType__::RETURN; + ActionType_::RETURN; } void ScannerBase::accept(size_t nChars) // old name: less { if (nChars < d_matched.size()) { - d_input.reRead(d_matched, nChars); + d_input->reRead(d_matched, nChars); d_matched.resize(nChars); } } void ScannerBase::setMatchedSize(size_t length) { - d_input.reRead(d_matched, length); // reread the tail section + d_input->reRead(d_matched, length); // reread the tail section d_matched.resize(length); // return what's left } @@ -300,9 +324,9 @@ // d_atBOL is updated. Finally the rule's index is returned. // The numbers behind the finalPtr assignments are explained in the // manual's `Run-time operations' section. -size_t ScannerBase::matched__(size_t ch) +size_t ScannerBase::matched_(size_t ch) { - d_input.reRead(ch); + d_input->reRead(ch); FinalData *finalPtr; @@ -341,14 +365,14 @@ return finalPtr->rule; } -size_t ScannerBase::getRange__(int ch) // using int to prevent casts +size_t ScannerBase::getRange_(int ch) // using int to prevent casts { - return ch == AT_EOF ? as(s_rangeOfEOF__) : s_ranges__[ch]; + return ch == AT_EOF ? as(s_rangeOfEOF_) : s_ranges_[ch]; } // At this point d_nextState contains the next state and continuation is // possible. The just read char. is appended to d_match -void ScannerBase::continue__(int ch) +void ScannerBase::continue_(int ch) { d_state = d_nextState; @@ -356,7 +380,7 @@ d_matched += ch; } -void ScannerBase::echoCh__(size_t ch) +void ScannerBase::echoCh_(size_t ch) { *d_out << as(ch); d_atBOL = ch == '\n'; @@ -368,22 +392,22 @@ // the buffer. The first char. in the buffer is echoed to stderr. // If there isn't any 1st char yet then the current char doesn't fit any // rules and that char is then echoed -void ScannerBase::echoFirst__(size_t ch) +void ScannerBase::echoFirst_(size_t ch) { - d_input.reRead(ch); - d_input.reRead(d_matched, 1); - echoCh__(d_matched[0]); + d_input->reRead(ch); + d_input->reRead(d_matched, 1); + echoCh_(d_matched[0]); } // Update the rules associated with the current state, do this separately // for BOL and std rules. // If a rule was set, update the rule index and the current d_matched // length. -void ScannerBase::updateFinals__() +void ScannerBase::updateFinals_() { size_t len = d_matched.size(); - int const *rf = d_dfaBase__[d_state] + s_finIdx__; + int const *rf = d_dfaBase_[d_state] + s_finIdx_; if (rf[0] != -1) // update to the latest std rule { @@ -396,7 +420,7 @@ } } -void ScannerBase::reset__() +void ScannerBase::reset_() { d_final = Final{ FinalData{s_unavailable, 0}, @@ -412,7 +436,7 @@ d_more = false; } -int Scanner::executeAction__(size_t ruleIdx) +int Scanner::executeAction_(size_t ruleIdx) try { switch (ruleIdx) @@ -421,19 +445,19 @@ case 1: { #line 13 "lexer" - return Parser::WS; + return Tokens::WS; } break; case 2: { #line 15 "lexer" - return Parser::NR; + return Tokens::NR; } break; case 3: { #line 17 "lexer" - return Parser::ID; + return Tokens::ID; } break; case 4: @@ -445,74 +469,74 @@ case 5: { #line 21 "lexer" - return Parser::CHAR; + return Tokens::CHAR; } break; } - noReturn__(); + noReturn_(); return 0; } -catch (Leave__ value) +catch (Leave_ value) { return static_cast(value); } -int Scanner::lex__() +int Scanner::lex_() { - reset__(); + reset_(); preCode(); while (true) { - size_t ch = get__(); // fetch next char - size_t range = getRange__(ch); // determine the range + size_t ch = get_(); // fetch next char + size_t range = getRange_(ch); // determine the range - updateFinals__(); // update the state's Final info + updateFinals_(); // update the state's Final info - switch (actionType__(range)) // determine the action + switch (actionType_(range)) // determine the action { - case ActionType__::CONTINUE: - continue__(ch); + case ActionType_::CONTINUE: + continue_(ch); continue; - case ActionType__::MATCH: + case ActionType_::MATCH: { - d_token__ = executeAction__(matched__(ch)); - if (return__()) + d_token_ = executeAction_(matched_(ch)); + if (return_()) { print(); - postCode(PostEnum__::RETURN); - return d_token__; + postCode(PostEnum_::RETURN); + return d_token_; } break; } - case ActionType__::ECHO_FIRST: - echoFirst__(ch); + case ActionType_::ECHO_FIRST: + echoFirst_(ch); break; - case ActionType__::ECHO_CH: - echoCh__(ch); + case ActionType_::ECHO_CH: + echoCh_(ch); break; - case ActionType__::RETURN: + case ActionType_::RETURN: if (!popStream()) { - postCode(PostEnum__::END); + postCode(PostEnum_::END); return 0; } - postCode(PostEnum__::POP); + postCode(PostEnum_::POP); continue; } // switch - postCode(PostEnum__::WIP); + postCode(PostEnum_::WIP); - reset__(); + reset_(); preCode(); } // while } -void ScannerBase::print__() const +void ScannerBase::print_() const { } diff -Nru ssh-cron-1.02.00/scanner/lexer ssh-cron-1.03.00/scanner/lexer --- ssh-cron-1.02.00/scanner/lexer 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/scanner/lexer 2020-11-14 13:26:28.000000000 +0000 @@ -10,15 +10,15 @@ //%nowarn ^[ \t]*(#.*)? // ignore ws (+ comment) at BOL -[ \t]+ return Parser::WS; +[ \t]+ return Tokens::WS; -[0-9]+ return Parser::NR; +[0-9]+ return Tokens::NR; -{ID} return Parser::ID; +{ID} return Tokens::ID; [*/,=\n-] return matched()[0]; -. return Parser::CHAR; +. return Tokens::CHAR; diff -Nru ssh-cron-1.02.00/scanner/scannerbase.h ssh-cron-1.03.00/scanner/scannerbase.h --- ssh-cron-1.02.00/scanner/scannerbase.h 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/scanner/scannerbase.h 2020-11-14 13:26:28.000000000 +0000 @@ -1,4 +1,4 @@ -// Generated by Flexc++ V2.01.00 on Mon, 26 May 2014 16:06:55 +0200 +// Generated by Flexc++ V2.08.01 on Sat, 14 Nov 2020 10:05:45 +0100 #ifndef ScannerBASE_H_INCLUDED #define ScannerBASE_H_INCLUDED @@ -25,10 +25,10 @@ }; protected: - enum Leave__ + enum Leave_ {}; - enum class ActionType__ + enum class ActionType_ { CONTINUE, // transition succeeded, go on ECHO_CH, // echo ch itself (d_matched empty) @@ -37,18 +37,18 @@ RETURN, // no further continuation, lex returns 0. }; - enum class PostEnum__ + enum class PostEnum_ { - END, // postCode called when lex__() ends + END, // postCode called when lex_() ends POP, // postCode called after switching files - RETURN, // postCode called when lex__() returns + RETURN, // postCode called when lex_() returns WIP // postCode called when a non-returning rule // was matched }; public: - enum class StartCondition__ { - // $insert startCondNames + // $insert startcondenum + enum class StartCondition_{ INITIAL, }; @@ -108,7 +108,7 @@ struct StreamStruct { std::string pushedName; - Input pushedInput; + Input input; }; private: @@ -132,38 +132,39 @@ std::istream *d_in; // points to the input stream std::shared_ptr d_line; // holds line fm d_in - Input d_input; + Input *d_input; // input now in d_streamStack + std::string d_matched; // matched characters std::string d_lopMatched; // matched lop-rule characters std::string::iterator d_lopIter; std::string::iterator d_lopTail; std::string::iterator d_lopEnd; - size_t d_lopPending; // # pending input chars at lop1__ + size_t d_lopPending; // # pending input chars at lop1_ bool d_return; // return after a rule's action bool d_more = false; // set to true by more() size_t (ScannerBase::*d_get)() = &ScannerBase::getInput; protected: - std::istream *d_in__; - int d_token__; // returned by lex__ + std::istream *d_in_; + int d_token_; // returned by lex_ - int const (*d_dfaBase__)[27]; + int const (*d_dfaBase_)[27]; - static int const s_dfa__[][27]; - static int const (*s_dfaBase__[])[27]; - enum: bool { s_interactive__ = false }; + static int const s_dfa_[][27]; + static int const (*s_dfaBase_[])[27]; + enum: bool { s_interactive_ = false }; enum: size_t { - s_rangeOfEOF__ = 24, - s_finIdx__ = 25, - s_nRules__ = 6, - s_maxSizeofStreamStack__ = 10 + s_rangeOfEOF_ = 24, + s_finIdx_ = 25, + s_nRules_ = 6, + s_maxSizeofStreamStack_ = 10 }; - static size_t const s_ranges__[]; - static size_t const s_rf__[][2]; + static size_t const s_ranges_[]; + static size_t const s_rf_[][2]; public: ScannerBase(ScannerBase const &other) = delete; @@ -195,11 +196,10 @@ protected: ScannerBase(std::istream &in, std::ostream &out); ScannerBase(std::string const &infilename, std::string const &outfilename); + ~ScannerBase(); - StartCondition__ startCondition() const; // current start condition bool popStream(); std::ostream &out(); - void begin(StartCondition__ startCondition); void echo() const; void leave(int retValue) const; @@ -226,72 +226,96 @@ void setFilename(std::string const &name); void setMatched(std::string const &text); - static std::string istreamName__(); + static std::string istreamName_(); - // members used by lex__(): they end in __ and should not be used + // members used by lex_(): they end in _ and should not be used // otherwise. - ActionType__ actionType__(size_t range); // next action - bool return__(); // 'return' from codeblock - size_t matched__(size_t ch); // handles a matched rule - size_t getRange__(int ch); // convert char to range - size_t get__(); // next character - size_t state__() const; // current state - void continue__(int ch); // handles a transition - void echoCh__(size_t ch); // echoes ch, sets d_atBOL - void echoFirst__(size_t ch); // handles unknown input - void updateFinals__(); // update a state's Final info - void noReturn__(); // d_return to false - void print__() const; // optionally print token - void pushFront__(size_t ch); // return char to Input - void reset__(); // prepare for new cycle + ActionType_ actionType_(size_t range); // next action + bool return_(); // 'return' from codeblock + size_t matched_(size_t ch); // handles a matched rule + size_t getRange_(int ch); // convert char to range + size_t get_(); // next character + size_t state_() const; // current state + void continue_(int ch); // handles a transition + void echoCh_(size_t ch); // echoes ch, sets d_atBOL + void echoFirst_(size_t ch); // handles unknown input + void updateFinals_(); // update a state's Final info + void noReturn_(); // d_return to false + void print_() const; // optionally print token + void pushFront_(size_t ch); // return char to Input + void reset_(); // prepare for new cycle // next input stream: - void switchStream__(std::istream &in, size_t lineNr); - void lopf__(size_t tail); // matched fixed size tail - void lop1__(int lopSC); // matched ab for a/b - void lop2__(); // matches the LOP's b tail - void lop3__(); // catch-all while matching b - void lop4__(); // matches the LOP's a head + void switchStream_(std::istream &in, size_t lineNr); + void lopf_(size_t tail); // matched fixed size tail + void lop1_(int lopSC); // matched ab for a/b + void lop2_(); // matches the LOP's b tail + void lop3_(); // catch-all while matching b + void lop4_(); // matches the LOP's a head + +// $insert startconddecl + StartCondition_ startCondition() const; // current start condition + void begin(StartCondition_ startCondition); private: + static StartCondition_ constexpr SC(int sc); + static int constexpr SC(StartCondition_ sc); + size_t getInput(); size_t getLOP(); void p_pushStream(std::string const &name, std::istream *streamPtr); void setMatchedSize(size_t length); bool knownFinalState(); + static std::string setCwd(std::string const &filename); + template static ReturnType constexpr as(ArgType value); static bool constexpr available(size_t value); - static StartCondition__ constexpr SC(int sc); - static int constexpr SC(StartCondition__ sc); }; +inline ScannerBase::~ScannerBase() +{ + d_input->close(); +} + template inline ReturnType constexpr ScannerBase::as(ArgType value) { return static_cast(value); } -inline bool ScannerBase::knownFinalState() +// $insert startcondimpl +inline ScannerBase::StartCondition_ constexpr ScannerBase::SC(int sc) { - return (d_atBOL && available(d_final.bol.rule)) || - available(d_final.std.rule); + return as(sc); } -inline bool constexpr ScannerBase::available(size_t value) -{ - return value != std::numeric_limits::max(); +inline int constexpr ScannerBase::SC(StartCondition_ sc) +{ + return as(sc); +} + +inline ScannerBase::StartCondition_ ScannerBase::startCondition() const +{ + return SC(d_startCondition); } -inline ScannerBase::StartCondition__ constexpr ScannerBase::SC(int sc) +inline void ScannerBase::begin(StartCondition_ startCondition) { - return as(sc); + // d_state is reset to 0 by reset_() + d_dfaBase_ = s_dfaBase_[d_startCondition = SC(startCondition)]; } -inline int constexpr ScannerBase::SC(StartCondition__ sc) +inline bool ScannerBase::knownFinalState() { - return as(sc); + return (d_atBOL && available(d_final.bol.rule)) || + available(d_final.std.rule); +} + +inline bool constexpr ScannerBase::available(size_t value) +{ + return value != std::numeric_limits::max(); } inline std::ostream &ScannerBase::out() @@ -301,14 +325,22 @@ inline void ScannerBase::push(size_t ch) { - d_input.reRead(ch); + d_input->reRead(ch); } inline void ScannerBase::push(std::string const &str) { - d_input.reRead(str, 0); + d_input->reRead(str, 0); +} + + +inline std::vector const &ScannerBase::streamStack() const +{ + return d_streamStack; } + + inline void ScannerBase::setFilename(std::string const &name) { d_filename = name; @@ -324,11 +356,6 @@ return d_matched; } -inline ScannerBase::StartCondition__ ScannerBase::startCondition() const -{ - return SC(d_startCondition); -} - inline std::string const &ScannerBase::filename() const { return d_filename; @@ -346,12 +373,12 @@ inline void ScannerBase::leave(int retValue) const { - throw as(retValue); + throw as(retValue); } inline size_t ScannerBase::lineNr() const { - return d_input.lineNr(); + return d_input->lineNr(); } inline void ScannerBase::more() @@ -359,33 +386,27 @@ d_more = true; } -inline void ScannerBase::begin(StartCondition__ startCondition) -{ - // d_state is reset to 0 by reset__() - d_dfaBase__ = s_dfaBase__[d_startCondition = SC(startCondition)]; -} - -inline size_t ScannerBase::state__() const +inline size_t ScannerBase::state_() const { return d_state; } -inline size_t ScannerBase::get__() +inline size_t ScannerBase::get_() { return (this->*d_get)(); } inline size_t ScannerBase::getInput() { - return d_input.get(); + return d_input->get(); } -inline bool ScannerBase::return__() +inline bool ScannerBase::return_() { return d_return; } -inline void ScannerBase::noReturn__() +inline void ScannerBase::noReturn_() { d_return = false; } diff -Nru ssh-cron-1.02.00/scanner/scanner.h ssh-cron-1.03.00/scanner/scanner.h --- ssh-cron-1.02.00/scanner/scanner.h 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/scanner/scanner.h 2020-11-14 13:26:28.000000000 +0000 @@ -1,4 +1,4 @@ -// Generated by Flexc++ V2.01.00 on Fri, 09 May 2014 09:50:28 +0200 +// Generated by Flexc++ V2.08.00 on Fri, 13 Nov 2020 12:59:07 +0100 #ifndef Scanner_H_INCLUDED_ #define Scanner_H_INCLUDED_ @@ -22,17 +22,16 @@ int lex(); private: - int lex__(); - int executeAction__(size_t ruleNr); + int lex_(); + int executeAction_(size_t ruleNr); void print(); void preCode(); // re-implement this function for code that must // be exec'ed before the patternmatching starts - void postCode(PostEnum__ type); + void postCode(PostEnum_ type); // re-implement this function for code that must // be exec'ed after the rules's actions. - }; // $insert scannerConstructors @@ -49,7 +48,7 @@ // $insert inlineLexFunction inline int Scanner::lex() { - return lex__(); + return lex_(); } inline void Scanner::preCode() @@ -57,14 +56,14 @@ // optionally replace by your own code } -inline void Scanner::postCode(PostEnum__ type) +inline void Scanner::postCode([[maybe_unused]] PostEnum_ type) { // optionally replace by your own code } inline void Scanner::print() { - print__(); + print_(); } diff -Nru ssh-cron-1.02.00/scanner/scanner.ih ssh-cron-1.03.00/scanner/scanner.ih --- ssh-cron-1.02.00/scanner/scanner.ih 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/scanner/scanner.ih 2020-11-14 13:26:28.000000000 +0000 @@ -1,6 +1,6 @@ #include "scanner.h" -#include "../parser/parserbase.h" +#include "tokens.h" // end of scanner.ih diff -Nru ssh-cron-1.02.00/scanner/tokens.h ssh-cron-1.03.00/scanner/tokens.h --- ssh-cron-1.02.00/scanner/tokens.h 1970-01-01 00:00:00.000000000 +0000 +++ ssh-cron-1.03.00/scanner/tokens.h 2020-11-14 13:26:28.000000000 +0000 @@ -0,0 +1,17 @@ +#ifndef INCLUDED_TOKENS_ +#define INCLUDED_TOKENS_ + +struct Tokens +{ + // Symbolic tokens: + enum Tokens_ + { + WS = 257, + NR, + ID, + CHAR, + }; + +}; + +#endif diff -Nru ssh-cron-1.02.00/ssh-cron.xref ssh-cron-1.03.00/ssh-cron.xref --- ssh-cron-1.02.00/ssh-cron.xref 2018-06-25 10:41:36.000000000 +0000 +++ ssh-cron-1.03.00/ssh-cron.xref 2020-11-14 13:26:28.000000000 +0000 @@ -1,9 +1,11 @@ oxref by Frank B. Brokken (f.b.brokken@rug.nl) -oxref V1.00.03 2012-2015 +oxref V2.00.00 2012-2019 -CREATED Mon, 14 Dec 2015 12:58:48 +0000 +CREATED Fri, 26 Apr 2019 13:07:58 +0000 CROSS REFERENCE FOR: -fxs tmp/libmodules.a + ---------------------------------------------------------------------- +CROSS REFERENCE LISTING: addCronCommand() Full name: CronData::addCronCommand() @@ -17,18 +19,18 @@ Used By: parse.cc: Parser::executeAction(int) -addNr(unsigned int) - Full name: CronData::addNr(unsigned int) +addNr(unsigned long) + Full name: CronData::addNr(unsigned long) Source: addnr.cc Used By: parse.cc: Parser::executeAction(int) -addRange(unsigned int, unsigned int, unsigned int) - Full name: CronData::addRange(unsigned int, unsigned int, unsigned int) +addRange(unsigned long, unsigned long, unsigned long) + Full name: CronData::addRange(unsigned long, unsigned long, unsigned long) Source: addrange.cc Used By: parse.cc: Parser::executeAction(int) - setall.cc: CronData::setAll(unsigned int) + setall.cc: CronData::setAll(unsigned long) assign() Full name: CronData::assign() @@ -117,12 +119,6 @@ parentprocess.cc: Cron::parentProcess() cxx11] - Full name: Cron::s_agent[abi:cxx11] - Source: data.cc - Used By: - childprocess.cc: Cron::childProcess() - -cxx11] Full name: Options::s_syslogPriorities[abi:cxx11] Source: data.cc Used By: @@ -134,6 +130,12 @@ Used By: syslogfacility.cc: Options::syslogFacility() const +cxx11] + Full name: Cron::s_agent[abi:cxx11] + Source: data.cc + Used By: + childprocess.cc: Cron::childProcess() + cxx11]() Full name: Daemon::askPassPhrase[abi:cxx11]() Source: askpassphrase.cc @@ -204,6 +206,17 @@ getpassphrase.cc: Daemon::getPassPhrase() idmsg() const + Full name: Cron::idmsg() const + Source: idmsg.cc + Used By: + cronloop.cc: Cron::cronLoop() + definerunfunction.cc: Cron::defineRunFunction() + execute.cc: Cron::execute(CronEntry const&) + handlerequests.cc: Cron::handleRequests() + parentprocess.cc: Cron::parentProcess() + reload.cc: Cron::reload(std::istream&) + +idmsg() const Full name: Daemon::idmsg() const Source: idmsg.cc Used By: @@ -215,17 +228,6 @@ reload.cc: Daemon::reload() terminate.cc: Daemon::terminate() const -idmsg() const - Full name: Cron::idmsg() const - Source: idmsg.cc - Used By: - cronloop.cc: Cron::cronLoop() - definerunfunction.cc: Cron::defineRunFunction() - execute.cc: Cron::execute(CronEntry const&) - handlerequests.cc: Cron::handleRequests() - parentprocess.cc: Cron::parentProcess() - reload.cc: Cron::reload(std::istream&) - insert(std::ostream&) const Full name: CronEntry::insert(std::ostream&) const Source: insert.cc @@ -244,20 +246,20 @@ Full name: Options::instance() Source: instance.cc Used By: + cron1.cc: Cron::Cron(CronData&) + handlerequests.cc: Cron::handleRequests() addcroncommand.cc: CronData::addCronCommand() crondata1.cc: CronData::CronData() setenvvar.cc: CronData::setEnvVar(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) - cron1.cc: Cron::Cron(CronData&) - handlerequests.cc: Cron::handleRequests() daemon1.cc: Daemon::Daemon() getipcinfo.cc: Daemon::getIPCInfo() const parentprocess.cc: Daemon::parentProcess() -invalidRange(unsigned int, unsigned int) const - Full name: CronData::invalidRange(unsigned int, unsigned int) const +invalidRange(unsigned long, unsigned long) const + Full name: CronData::invalidRange(unsigned long, unsigned long) const Source: invalidrange.cc Used By: - addrange.cc: CronData::addRange(unsigned int, unsigned int, unsigned int) + addrange.cc: CronData::addRange(unsigned long, unsigned long, unsigned long) ipc() Full name: Daemon::ipc() @@ -277,8 +279,8 @@ Used By: listrequest.cc: Daemon::listRequest() -list(unsigned int*, int, FBB::SharedStream&) - Full name: Cron::list(unsigned int*, int, FBB::SharedStream&) +list(unsigned long*, long, FBB::SharedStream&) + Full name: Cron::list(unsigned long*, long, FBB::SharedStream&) Source: list.cc Used By: handlerequests.cc: Cron::handleRequests() @@ -299,8 +301,8 @@ Full name: operator<<(std::ostream&, CronEntry const&) Source: operatorinsert.cc Used By: + list.cc: Cron::list(unsigned long*, long, FBB::SharedStream&) addcroncommand.cc: CronData::addCronCommand() - list.cc: Cron::list(unsigned int*, int, FBB::SharedStream&) Options() Full name: Options::Options() @@ -308,11 +310,11 @@ Used By: instance.cc: Options::instance() -outOfRange(unsigned int) - Full name: CronData::outOfRange(unsigned int) +outOfRange(unsigned long) + Full name: CronData::outOfRange(unsigned long) Source: outofrange.cc Used By: - addnr.cc: CronData::addNr(unsigned int) + addnr.cc: CronData::addNr(unsigned long) assign.cc: CronData::assign() parentProcess() @@ -372,8 +374,8 @@ Used By: parentprocess.cc: Cron::parentProcess() -reset(unsigned int) - Full name: CronData::reset(unsigned int) +reset(unsigned long) + Full name: CronData::reset(unsigned long) Source: reset.cc Used By: parse.cc: Parser::executeAction(int) @@ -486,8 +488,8 @@ execute.cc: Cron::execute(CronEntry const&) parentprocess.cc: Cron::parentProcess() -setAll(unsigned int) - Full name: CronData::setAll(unsigned int) +setAll(unsigned long) + Full name: CronData::setAll(unsigned long) Source: setall.cc Used By: parse.cc: Parser::executeAction(int) @@ -510,8 +512,8 @@ Used By: parse.cc: Parser::executeAction(int) -setEnvironment(unsigned int, unsigned int, std::vector, std::allocator >, std::allocator, std::allocator > > > const*) - Full name: CronEntry::setEnvironment(unsigned int, unsigned int, std::vector, std::allocator >, std::allocator, std::allocator > > > const*) +setEnvironment(unsigned long, unsigned long, std::vector, std::allocator >, std::allocator, std::allocator > > > const*) + Full name: CronEntry::setEnvironment(unsigned long, unsigned long, std::vector, std::allocator >, std::allocator, std::allocator > > > const*) Source: setenvironment.cc Used By: addcroncommand.cc: CronData::addCronCommand() @@ -546,23 +548,23 @@ Used By: options1.cc: Options::Options() -showSet(std::ostream&, std::set, std::allocator > const&) - Full name: CronEntry::showSet(std::ostream&, std::set, std::allocator > const&) +showSet(std::ostream&, std::set, std::allocator > const&) + Full name: CronEntry::showSet(std::ostream&, std::set, std::allocator > const&) Source: showset.cc Used By: insert.cc: CronEntry::insert(std::ostream&) const -signalHandler(unsigned int) - Full name: Daemon::signalHandler(unsigned int) +signalHandler(unsigned long) + Full name: Daemon::signalHandler(unsigned long) Source: signalhandler.cc Used By: parentprocess.cc: Daemon::parentProcess() -stop(unsigned int) - Full name: Cron::stop(unsigned int) +stop(unsigned long) + Full name: Cron::stop(unsigned long) Source: stop.cc Used By: - signalhandler.cc: Daemon::signalHandler(unsigned int) + signalhandler.cc: Daemon::signalHandler(unsigned long) syslogFacility() const Full name: Options::syslogFacility() const diff -Nru ssh-cron-1.02.00/VERSION ssh-cron-1.03.00/VERSION --- ssh-cron-1.02.00/VERSION 2019-04-24 10:23:57.000000000 +0000 +++ ssh-cron-1.03.00/VERSION 2020-11-14 13:26:28.000000000 +0000 @@ -1,3 +1,3 @@ #define AUTHOR "Frank B. Brokken (f.b.brokken@rug.nl)"; -#define VERSION "1.02.00" -#define YEARS "2014-2019" +#define VERSION "1.03.00" +#define YEARS "2014-2020" diff -Nru ssh-cron-1.02.00/version.cc ssh-cron-1.03.00/version.cc --- ssh-cron-1.02.00/version.cc 2019-04-24 10:24:31.000000000 +0000 +++ ssh-cron-1.03.00/version.cc 2020-11-14 13:26:28.000000000 +0000 @@ -3,21 +3,7 @@ #include "main.ih" #include "icmconf" -#ifdef USE_VERSION #include "VERSION" -#endif - -#ifndef AUTHOR -#define AUTHOR "" -#endif - -#ifndef VERSION -#define VERSION "0.00.00" -#endif - -#ifndef YEARS -#define YEARS "2012" -#endif namespace Icmbuild {