From 12e09f9f85ac48ff891adf92f3b2c9a5fea27273 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 4 Dec 2021 14:10:21 -0800 Subject: Chore(REMOVE): finished deprecation of old io functions. The old methods were simple wrappers of C standard library functions. We've moved (painfully) over to a new interface that allows for files to live on the stack. All users of the functionality are ported over. --- src/cmd/rc/code.c | 17 +- src/cmd/rc/exec.c | 56 ++++- src/cmd/rc/exec.h | 1 + src/cmd/rc/input.c | 111 +++------ src/cmd/rc/parse.c | 639 +++++++++++++++++++++++++++------------------------- src/cmd/rc/parse.h | 31 ++- src/cmd/rc/syntax.y | 4 +- 7 files changed, 447 insertions(+), 412 deletions(-) (limited to 'src/cmd/rc') diff --git a/src/cmd/rc/code.c b/src/cmd/rc/code.c index 47266e4..9c6316c 100644 --- a/src/cmd/rc/code.c +++ b/src/cmd/rc/code.c @@ -17,8 +17,7 @@ static struct Interpreter interpreter; #define emitf(x) ((void)(interpreter.i != interpreter.cap || grow()), interpreter.code[interpreter.i].f = (x), interpreter.i++) #define emits(x) ((void)(interpreter.i != interpreter.cap || grow()), interpreter.code[interpreter.i].s = (x), interpreter.i++) -static -int +static int grow(void) { interpreter.cap += 100; @@ -28,8 +27,7 @@ grow(void) return 0; } -static -void +static void storepc(int a) { if(interpreter.i <= a || a < 0) @@ -342,12 +340,17 @@ walk(Tree *node) storepc(addr2); emitf(Xpipewait); - break; -#if 0 case Tpipefd: -#endif + emitf(Xpipefd); + emiti(node->redir.type); + addr1 = emiti(0); + + walk(node->child[0]); + emitf(Xexit); + storepc(addr1); + break; case Tdup: if(node->redir.type == Rdupfd){ diff --git a/src/cmd/rc/exec.c b/src/cmd/rc/exec.c index bd68bf5..bdbc151 100644 --- a/src/cmd/rc/exec.c +++ b/src/cmd/rc/exec.c @@ -5,16 +5,20 @@ int yyparse(void); -struct Builtin{ +struct Builtin +{ char *name; void (*func)(void); }; -struct State { +#if 0 +struct State +{ int async; }; static struct State state; +#endif // ----------------------------------------------------------------------- // globals @@ -1414,6 +1418,54 @@ Xpipe(void) } } +void +Xpipefd(void) +{ + char name[40]; + Thread *orig = runner; + int pc, fd, pid, pfd[2], sidefd, mainfd; + + pc = runner->code.i; + if(pipe(pfd)<0){ + Xerror("can't get pipe"); + return; + } + + if(runner->code.exe[runner->code.i].i == Rread) + fd=1, sidefd=pfd[1], mainfd=pfd[0]; + else + fd=0, sidefd=pfd[0], mainfd=pfd[1]; + + switch(pid = fork()){ + case -1: + Xerror("try again"); + break; + case 0: + initchild(runner,1); + + /* child 0 (writer) forked process */ + run(runner->code.exe, pc+2, runner->local, 1); + + close(mainfd); + pushredir(Ropen, sidefd, fd); + runner->caller = nil; + break; + + default: + initparent(runner,pid,0); + + close(sidefd); + pushredir(Ropen, mainfd, mainfd); + + strcpy(name, "/dev/fd/"); + strĀ·itoa(name+8, mainfd); + pushword(name); + + orig->code.i = orig->code.exe[pc+1].i; + break; + } +} + void Xbasic(void) { diff --git a/src/cmd/rc/exec.h b/src/cmd/rc/exec.h index 28cbd80..de3fdde 100644 --- a/src/cmd/rc/exec.h +++ b/src/cmd/rc/exec.h @@ -45,6 +45,7 @@ void Xpipe(void); void Xpipewait(void); void Xpopredir(void); void Xglob(void); +void Xpipefd(void); void Xreturn(void); void Xexit(void); diff --git a/src/cmd/rc/input.c b/src/cmd/rc/input.c index cc2383d..9771174 100644 --- a/src/cmd/rc/input.c +++ b/src/cmd/rc/input.c @@ -131,8 +131,7 @@ typedef struct typedef Position (*Noun)(struct TerminalState*, int); typedef void (*Verb)(struct TerminalState*, Position); -static -int +static int runetype(rune r) { if(r<128) @@ -147,23 +146,20 @@ runetype(rune r) return NonPrintable; } -static -void +static void normalcursor(int fd) { write(fd,"\e[2 q",5); } -static -void +static void insertcursor(int fd) { write(fd,"\e[6 q",5); } /* raw mode: 1960 magic shit. */ -static -int +static int enterraw(int fd) { struct termios raw; @@ -206,8 +202,7 @@ fatal: return 0; } -static -void +static void exitraw(int fd) { /* don't even check the return value as it's too late. */ @@ -218,8 +213,7 @@ exitraw(int fd) /* use the esc [6n escape sequence to query the horizontal cursor position * and return it. on error -1 is returned, on success the position of the * cursor. */ -static -int +static int cursorposition(int ifd, int ofd) { char buf[32]; @@ -250,8 +244,7 @@ cursorposition(int ifd, int ofd) } /* try to get the number of columns in the current terminal, or assume 80 if it fails. */ -static -int +static int columns(int ifd, int ofd) { struct winsize ws; @@ -287,8 +280,7 @@ failed: return 80; } -static -void +static void clear(void) { if(write(1,"\x1b[H\x1b[2J",7) <= 0) @@ -297,8 +289,7 @@ clear(void) /* beep: used for completion when there is nothing to complete or when all * the choices were already shown. */ -static -void +static void beep(void) { fprintf(stderr, "\x7"); @@ -335,8 +326,7 @@ addhistory(char *line) return 1; } -static -void +static void pophistory(void) { if(--history.top < history.entry) @@ -346,8 +336,7 @@ pophistory(void) static void refreshline(struct TerminalState *); -static -char ** +static char ** currenthistory(struct TerminalState *term, intptr *size) { char **entry; @@ -369,8 +358,7 @@ currenthistory(struct TerminalState *term, intptr *size) return entry; } -static -void +static void usehistory(struct TerminalState *term, int d) { rune r; @@ -423,16 +411,14 @@ struct Buffer char *b; }; -static -void +static void initbuffer(struct Buffer *ab) { ab->b = nil; ab->len = 0; } -static -void +static void append(struct Buffer *ab, const char *s, int len) { char *new = realloc(ab->b,ab->len+len); @@ -443,8 +429,7 @@ append(struct Buffer *ab, const char *s, int len) ab->len += len; } -static -void +static void freebuffer(struct Buffer *ab) { free(ab->b); @@ -454,8 +439,7 @@ freebuffer(struct Buffer *ab) * * rewrite the currently edited line accordingly to the buffer content, * cursor position, and number of columns of the terminal. */ -static -void +static void refreshsingleline(struct TerminalState *term) { char esc[64]; @@ -519,8 +503,7 @@ refreshsingleline(struct TerminalState *term) * * Rewrite the currently edited line accordingly to the buffer content, * cursor position, and number of columns of the terminal. */ -static -void +static void refreshmultilines(struct TerminalState *term) { #if 0 @@ -603,8 +586,7 @@ refreshmultilines(struct TerminalState *term) /* Calls the two low level functions refreshSingleLine() or * refreshMultiLine() according to the selected mode. */ -static -void +static void refreshline(struct TerminalState *term) { if(mode.multiline) @@ -695,16 +677,14 @@ insertbytes(struct TerminalState *term, int len, char *buf) /* modes */ -static -void +static void normalmode(int fd) { mode.vi.insert = 0; normalcursor(fd); } -static -void +static void insertmode(int fd) { mode.vi.insert = 1; @@ -713,8 +693,7 @@ insertmode(int fd) /* actions */ -static -void +static void move(struct TerminalState *term, Position to) { if(to.buffer != term->edit.pos){ @@ -724,8 +703,7 @@ move(struct TerminalState *term, Position to) } } -static -void +static void yank(struct TerminalState *term, Position to) { intptr len, off; @@ -751,8 +729,7 @@ yank(struct TerminalState *term, Position to) term->yank.buf[len] = 0; } -static -void +static void delete(struct TerminalState *term, Position to) { intptr diff; @@ -790,8 +767,7 @@ refresh: #define CURRENT(term) (Position){ .buffer=(term)->edit.pos, .cursor=(term)->cursor.pos }; // move cursor to the left n boxes -static -Position +static Position left(struct TerminalState *term, int n) { rune r; @@ -814,8 +790,7 @@ left(struct TerminalState *term, int n) } // move cursor to the right n boxes -static -Position +static Position right(struct TerminalState *term, int n) { rune r; @@ -839,8 +814,7 @@ right(struct TerminalState *term, int n) return pos; } -static -Position +static Position prevword(struct TerminalState *term, int n) { rune r; @@ -884,8 +858,7 @@ prevword(struct TerminalState *term, int n) return pos; } -static -Position +static Position nextword(struct TerminalState *term, int n) { rune r; @@ -932,8 +905,7 @@ nextword(struct TerminalState *term, int n) } -static -Position +static Position prevWord(struct TerminalState *term, int n) { rune r; @@ -977,8 +949,7 @@ prevWord(struct TerminalState *term, int n) return pos; } -static -Position +static Position nextWord(struct TerminalState *term, int n) { rune r; @@ -1023,8 +994,7 @@ nextWord(struct TerminalState *term, int n) return pos; } -static -Position +static Position nextend(struct TerminalState *term, int n) { rune r; @@ -1067,8 +1037,7 @@ nextend(struct TerminalState *term, int n) return pos; } -static -Position +static Position nextEnd(struct TerminalState *term, int n) { rune r; @@ -1116,8 +1085,7 @@ nextEnd(struct TerminalState *term, int n) #define HOME(term) (Position){0} #define END(term) (Position){(term)->edit.len, (term)->cursor.len} -static -int +static int vi(struct TerminalState *term, char c) { int n = 1; @@ -1269,8 +1237,7 @@ action: #define END(term) (Position){(term).edit.len, (term).cursor.len} -static -int +static int size(char *s) { rune c; @@ -1304,8 +1271,7 @@ size(char *s) * when ctrl+d is typed. * * the function returns the length of the current buffer. */ -static -int +static int interact(int ifd, int ofd, char *buf, intptr len, char *prompt) { int n, aux; @@ -1597,8 +1563,7 @@ printkeycode(void) /* * this function calls the line editing function edit() using the stdin set in raw mode */ -static -int +static int raw(char *buf, intptr len, char *prompt) { int n; @@ -1622,8 +1587,7 @@ raw(char *buf, intptr len, char *prompt) * program is called in pipe or with a file redirected to its standard input * in this case, we want to be able to return the line regardless of its length */ -static -int +static int notty(void) { int c; @@ -1670,8 +1634,7 @@ readline(char *prompt) } /* At exit we'll try to fix the terminal to the initial conditions. */ -static -void +static void doatexit(void) { exitraw(0); diff --git a/src/cmd/rc/parse.c b/src/cmd/rc/parse.c index 42b69e4..af4608d 100644 --- a/src/cmd/rc/parse.c +++ b/src/cmd/rc/parse.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.8.2. */ +/* A Bison parser, made by GNU Bison 3.7.6. */ /* Bison implementation for Yacc-like parsers in C @@ -46,10 +46,10 @@ USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ -#define YYBISON 30802 +#define YYBISON 30706 /* Bison version string. */ -#define YYBISON_VERSION "3.8.2" +#define YYBISON_VERSION "3.7.6" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -120,52 +120,53 @@ enum yysymbol_kind_t YYSYMBOL_Tredir = 15, /* Tredir */ YYSYMBOL_Tdup = 16, /* Tdup */ YYSYMBOL_Tpipe = 17, /* Tpipe */ - YYSYMBOL_Tindex = 18, /* Tindex */ - YYSYMBOL_Tbasic = 19, /* Tbasic */ - YYSYMBOL_Targs = 20, /* Targs */ - YYSYMBOL_Tword = 21, /* Tword */ - YYSYMBOL_Twords = 22, /* Twords */ - YYSYMBOL_Tparen = 23, /* Tparen */ - YYSYMBOL_Tblock = 24, /* Tblock */ - YYSYMBOL_25_ = 25, /* ')' */ - YYSYMBOL_Tandand = 26, /* Tandand */ - YYSYMBOL_Toror = 27, /* Toror */ - YYSYMBOL_28_n_ = 28, /* '\n' */ - YYSYMBOL_29_ = 29, /* '^' */ - YYSYMBOL_30_ = 30, /* '$' */ - YYSYMBOL_Tcount = 31, /* Tcount */ - YYSYMBOL_Tjoin = 32, /* Tjoin */ - YYSYMBOL_33_ = 33, /* '(' */ - YYSYMBOL_34_ = 34, /* '{' */ - YYSYMBOL_35_ = 35, /* '}' */ - YYSYMBOL_36_ = 36, /* ';' */ - YYSYMBOL_37_ = 37, /* '&' */ - YYSYMBOL_38_ = 38, /* '=' */ - YYSYMBOL_39_ = 39, /* '`' */ - YYSYMBOL_YYACCEPT = 40, /* $accept */ - YYSYMBOL_rc = 41, /* rc */ - YYSYMBOL_line = 42, /* line */ - YYSYMBOL_body = 43, /* body */ - YYSYMBOL_paren = 44, /* paren */ - YYSYMBOL_block = 45, /* block */ - YYSYMBOL_cmds = 46, /* cmds */ - YYSYMBOL_cmdsln = 47, /* cmdsln */ - YYSYMBOL_ifbody = 48, /* ifbody */ - YYSYMBOL_case = 49, /* case */ - YYSYMBOL_casebody = 50, /* casebody */ - YYSYMBOL_assign = 51, /* assign */ - YYSYMBOL_redir = 52, /* redir */ - YYSYMBOL_epilog = 53, /* epilog */ - YYSYMBOL_cmd = 54, /* cmd */ - YYSYMBOL_basic = 55, /* basic */ - YYSYMBOL_atom = 56, /* atom */ - YYSYMBOL_word = 57, /* word */ - YYSYMBOL_executable = 58, /* executable */ - YYSYMBOL_nonkeyword = 59, /* nonkeyword */ - YYSYMBOL_keyword = 60, /* keyword */ - YYSYMBOL_words = 61, /* words */ - YYSYMBOL_wordsnl = 62, /* wordsnl */ - YYSYMBOL_nl = 63 /* nl */ + YYSYMBOL_Tpipefd = 18, /* Tpipefd */ + YYSYMBOL_Tindex = 19, /* Tindex */ + YYSYMBOL_Tbasic = 20, /* Tbasic */ + YYSYMBOL_Targs = 21, /* Targs */ + YYSYMBOL_Tword = 22, /* Tword */ + YYSYMBOL_Twords = 23, /* Twords */ + YYSYMBOL_Tparen = 24, /* Tparen */ + YYSYMBOL_Tblock = 25, /* Tblock */ + YYSYMBOL_26_ = 26, /* ')' */ + YYSYMBOL_Tandand = 27, /* Tandand */ + YYSYMBOL_Toror = 28, /* Toror */ + YYSYMBOL_29_n_ = 29, /* '\n' */ + YYSYMBOL_30_ = 30, /* '^' */ + YYSYMBOL_31_ = 31, /* '$' */ + YYSYMBOL_Tcount = 32, /* Tcount */ + YYSYMBOL_Tjoin = 33, /* Tjoin */ + YYSYMBOL_34_ = 34, /* '(' */ + YYSYMBOL_35_ = 35, /* '{' */ + YYSYMBOL_36_ = 36, /* '}' */ + YYSYMBOL_37_ = 37, /* ';' */ + YYSYMBOL_38_ = 38, /* '&' */ + YYSYMBOL_39_ = 39, /* '=' */ + YYSYMBOL_40_ = 40, /* '`' */ + YYSYMBOL_YYACCEPT = 41, /* $accept */ + YYSYMBOL_rc = 42, /* rc */ + YYSYMBOL_line = 43, /* line */ + YYSYMBOL_body = 44, /* body */ + YYSYMBOL_paren = 45, /* paren */ + YYSYMBOL_block = 46, /* block */ + YYSYMBOL_cmds = 47, /* cmds */ + YYSYMBOL_cmdsln = 48, /* cmdsln */ + YYSYMBOL_ifbody = 49, /* ifbody */ + YYSYMBOL_case = 50, /* case */ + YYSYMBOL_casebody = 51, /* casebody */ + YYSYMBOL_assign = 52, /* assign */ + YYSYMBOL_redir = 53, /* redir */ + YYSYMBOL_epilog = 54, /* epilog */ + YYSYMBOL_cmd = 55, /* cmd */ + YYSYMBOL_basic = 56, /* basic */ + YYSYMBOL_atom = 57, /* atom */ + YYSYMBOL_word = 58, /* word */ + YYSYMBOL_executable = 59, /* executable */ + YYSYMBOL_nonkeyword = 60, /* nonkeyword */ + YYSYMBOL_keyword = 61, /* keyword */ + YYSYMBOL_words = 62, /* words */ + YYSYMBOL_wordsnl = 63, /* wordsnl */ + YYSYMBOL_nl = 64 /* nl */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -323,18 +324,12 @@ typedef int yy_state_fast_t; # define YY_USE(E) /* empty */ #endif +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ -# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") -# else -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -491,21 +486,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 61 +#define YYFINAL 63 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 486 +#define YYLAST 479 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 40 +#define YYNTOKENS 41 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 24 /* YYNRULES -- Number of rules. */ -#define YYNRULES 74 +#define YYNRULES 75 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 136 +#define YYNSTATES 139 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 283 +#define YYMAXUTOK 284 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -520,18 +515,18 @@ union yyalloc static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 28, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 30, 2, 37, 2, - 33, 25, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, - 2, 38, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 31, 2, 38, 2, + 34, 26, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 37, + 2, 39, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 29, 2, 39, 2, 2, 2, + 2, 2, 2, 2, 30, 2, 40, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 34, 2, 35, 2, 2, 2, 2, + 2, 2, 2, 35, 2, 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -547,11 +542,11 @@ static const yytype_int8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 26, 27, 31, 32 + 25, 27, 28, 32, 33 }; #if YYDEBUG -/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 38, 38, 39, 42, 43, 46, 47, 50, 53, @@ -559,9 +554,9 @@ static const yytype_uint8 yyrline[] = 78, 79, 82, 83, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 105, 106, 107, 110, 111, 114, 115, 118, 119, - 122, 123, 124, 125, 126, 127, 128, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 132, 135, 136, - 139, 140, 141, 143, 145 + 122, 123, 124, 125, 126, 127, 128, 129, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 135, + 136, 139, 140, 141, 143, 145 }; #endif @@ -579,10 +574,10 @@ static const char *const yytname[] = { "\"end of file\"", "error", "\"invalid token\"", "Tfor", "Tin", "Twhile", "Tif", "Telse", "Tswitch", "Tcase", "Tcasebody", "Ttwiddle", - "Tbang", "Tsubshell", "Tfunc", "Tredir", "Tdup", "Tpipe", "Tindex", - "Tbasic", "Targs", "Tword", "Twords", "Tparen", "Tblock", "')'", - "Tandand", "Toror", "'\\n'", "'^'", "'$'", "Tcount", "Tjoin", "'('", - "'{'", "'}'", "';'", "'&'", "'='", "'`'", "$accept", "rc", "line", + "Tbang", "Tsubshell", "Tfunc", "Tredir", "Tdup", "Tpipe", "Tpipefd", + "Tindex", "Tbasic", "Targs", "Tword", "Twords", "Tparen", "Tblock", + "')'", "Tandand", "Toror", "'\\n'", "'^'", "'$'", "Tcount", "Tjoin", + "'('", "'{'", "'}'", "';'", "'&'", "'='", "'`'", "$accept", "rc", "line", "body", "paren", "block", "cmds", "cmdsln", "ifbody", "case", "casebody", "assign", "redir", "epilog", "cmd", "basic", "atom", "word", "executable", "nonkeyword", "keyword", "words", "wordsnl", "nl", YY_NULLPTR @@ -595,6 +590,19 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif +#ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 41, 281, 282, 10, + 94, 36, 283, 284, 40, 123, 125, 59, 38, 61, + 96 +}; +#endif + #define YYPACT_NINF (-44) #define yypact_value_is_default(Yyn) \ @@ -605,206 +613,204 @@ yysymbol_name (yysymbol_kind_t yysymbol) #define yytable_value_is_error(Yyn) \ 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { - 124, -18, -16, -16, 19, 415, 447, 447, -44, 415, - -44, -44, 415, 415, 415, -44, 447, -9, 55, 36, - 56, 447, 447, 447, 73, 161, 15, -44, 415, 447, - -44, -44, 415, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, 39, -44, -44, 59, 59, - 235, 39, 60, -44, -44, 198, 38, -44, 447, -8, - -44, -44, -44, 56, -44, -44, 59, 59, -44, -44, - -44, -44, -44, -44, 39, 415, 415, 12, 61, 267, - 267, 32, 415, 415, -44, 39, -44, -44, -44, 39, - -44, -44, -44, -44, 267, 267, 267, -44, 39, -44, - -44, -44, -44, 33, 51, -44, 33, -44, -44, 304, - -44, 59, 59, 341, 267, -44, 17, -44, -44, 33, - 267, -44, 267, 33, 5, 33, -44, 75, 52, 378, - -44, -44, -44, 267, -44, -8 + 127, -19, -17, -17, -9, 393, 439, 439, -44, 203, + -44, -44, 393, 393, 393, -44, 439, 32, 69, 45, + 50, 439, 439, 439, -8, 241, 15, -44, 393, 439, + -44, -44, 393, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, -44, 32, -44, 42, -44, -44, 58, + 58, 203, -44, 42, 57, -44, -44, 165, 53, -44, + 439, 117, -44, -44, -44, 393, 50, -44, -44, 58, + 58, -44, -44, -44, -44, -44, -44, 42, 393, 393, + 10, 55, 406, 406, 2, 393, 393, -44, 42, -44, + -44, -44, 42, -44, -44, -44, -44, 406, 406, 406, + -44, 42, -44, -44, -44, -44, 43, 37, -44, 43, + -44, -44, 279, -44, 58, 58, 317, 406, -44, 28, + -44, -44, 43, 406, -44, 406, 43, 9, 43, -44, + 70, 54, 355, -44, -44, -44, 406, -44, 117 }; -/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_int8 yydefact[] = { - 24, 0, 0, 0, 0, 0, 24, 24, 68, 0, - 20, 50, 0, 0, 0, 70, 24, 0, 0, 0, + 24, 0, 0, 0, 0, 0, 24, 24, 69, 0, + 20, 50, 0, 0, 0, 71, 24, 0, 0, 0, 22, 24, 24, 24, 4, 25, 41, 48, 0, 24, - 73, 73, 0, 57, 58, 59, 60, 61, 62, 63, - 66, 64, 65, 67, 46, 68, 44, 45, 32, 33, - 0, 21, 51, 54, 55, 0, 0, 12, 24, 6, - 56, 1, 3, 22, 26, 5, 31, 30, 73, 73, - 73, 10, 11, 43, 42, 0, 0, 0, 0, 24, - 24, 0, 0, 34, 40, 69, 68, 53, 71, 72, - 9, 7, 13, 23, 24, 24, 24, 49, 19, 68, - 73, 8, 74, 37, 22, 38, 14, 73, 47, 0, - 27, 28, 29, 0, 24, 73, 0, 52, 73, 35, - 24, 73, 24, 15, 17, 36, 68, 17, 0, 0, - 18, 39, 73, 24, 16, 0 + 74, 74, 0, 58, 59, 60, 61, 62, 63, 64, + 67, 65, 66, 68, 0, 46, 69, 44, 45, 32, + 33, 0, 57, 21, 51, 54, 55, 0, 0, 12, + 24, 6, 56, 1, 3, 0, 22, 26, 5, 31, + 30, 74, 74, 74, 10, 11, 43, 42, 0, 0, + 0, 0, 24, 24, 0, 0, 34, 40, 70, 69, + 53, 72, 73, 9, 7, 13, 23, 24, 24, 24, + 49, 19, 69, 74, 8, 75, 37, 22, 38, 14, + 74, 47, 0, 27, 28, 29, 0, 24, 74, 0, + 52, 74, 35, 24, 74, 24, 15, 17, 36, 69, + 17, 0, 0, 18, 39, 74, 24, 16, 0 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -44, -44, 77, -26, 98, 13, 26, -28, -44, -44, - -24, -44, -15, 43, 0, -44, 22, 37, -44, -1, + -44, -44, 72, -27, 93, 17, 16, -35, -44, -44, + -28, -44, -15, 38, 0, -44, 35, 30, -44, -1, -44, -43, -44, -30 }; -/* YYDEFGOTO[NTERM-NUM]. */ + /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_uint8 yydefgoto[] = { - 0, 18, 19, 56, 30, 20, 57, 58, 105, 127, - 128, 22, 23, 64, 59, 25, 44, 85, 26, 27, - 47, 50, 55, 79 + 0, 18, 19, 58, 30, 20, 59, 60, 108, 130, + 131, 22, 23, 67, 61, 25, 45, 88, 26, 27, + 48, 51, 57, 82 }; -/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 24, 80, 83, 78, 46, 63, 48, 49, 46, 68, - 73, 46, 46, 46, 126, 28, 99, 29, 69, 70, - 92, 24, 66, 67, 46, 16, 21, 46, 71, 72, - 60, 46, 91, 102, 52, 53, 54, 100, 94, 95, - 96, 82, 45, 109, 75, 102, 51, 21, 63, 46, - 68, 121, 32, 76, 46, 61, 113, 107, 115, 69, - 70, 82, 74, 84, 62, 77, 9, 10, 82, 81, - 114, 9, 10, 90, 46, 46, 68, 116, 86, 103, - 106, 46, 46, 129, 126, 120, 101, 131, 122, 63, - 68, 124, 89, 104, 110, 111, 112, 97, 65, 69, - 70, 31, 133, 130, 108, 134, 93, 0, 46, 71, - 72, 0, 46, 98, 119, 0, 0, 0, 0, 0, - 123, 0, 125, 0, -2, 0, 0, 1, 46, 2, - 3, 0, 4, 135, 0, 5, 6, 7, 8, 9, - 10, 0, 0, 0, 0, 11, 0, 0, 0, 0, + 24, 83, 81, 86, 47, 66, 49, 50, 47, 71, + 76, 47, 47, 47, 102, 28, 21, 29, 129, 72, + 73, 24, 69, 70, 47, 32, 52, 47, 110, 74, + 75, 47, 85, 94, 62, 46, 103, 21, 105, 53, + 85, 97, 98, 99, 118, 78, 112, 54, 55, 56, + 47, 66, 65, 10, 79, 77, 47, 105, 80, 116, + 71, 52, 84, 124, 47, 65, 10, 16, 87, 63, + 72, 73, 85, 117, 64, 71, 89, 47, 47, 129, + 119, 104, 106, 109, 47, 47, 132, 92, 123, 93, + 134, 125, 66, 68, 127, 53, 31, 113, 114, 115, + 107, 137, 133, 0, 96, 136, 0, 0, 0, 101, + 0, 47, 0, 100, 0, 47, 0, 122, 0, 0, + 111, 0, 0, 126, 0, 128, 0, -2, 0, 0, + 1, 47, 2, 3, 71, 4, 138, 0, 5, 6, + 7, 8, 9, 10, 72, 73, 95, 0, 0, 11, + 0, 0, 0, 0, 74, 75, 0, 0, 12, 13, + 14, 15, 16, 0, 0, 0, 0, 17, 33, 34, + 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, + 44, 0, 0, 0, 0, 0, 0, 11, 0, 0, + 0, 90, 0, 0, 91, 0, 12, 13, 14, 15, + 0, 0, 0, 0, 0, 17, 33, 34, 35, 36, + 37, 38, 39, 0, 40, 41, 42, 43, 44, 0, + 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 15, 16, 0, 0, 0, 0, 17, 33, 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, 9, 10, 0, 0, - 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, - 0, 12, 13, 14, 15, 0, 0, 0, 0, 0, - 17, 33, 34, 35, 36, 37, 38, 39, 0, 40, - 41, 42, 43, 0, 0, 0, 0, 0, 0, 11, - 0, 0, 0, 87, 0, 0, 88, 0, 12, 13, + 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 14, 15, 0, 0, 0, 0, + 0, 17, 33, 34, 35, 36, 37, 38, 39, 0, + 40, 41, 42, 43, 44, 0, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 120, 0, 0, 0, 0, + 12, 13, 14, 15, 0, 0, 0, 0, 0, 17, + 33, 34, 35, 36, 37, 38, 39, 0, 40, 41, + 42, 43, 44, 0, 0, 0, 0, 0, 0, 11, + 0, 0, 0, 121, 0, 0, 0, 0, 12, 13, 14, 15, 0, 0, 0, 0, 0, 17, 33, 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, - 0, 0, 0, 0, 0, 12, 13, 14, 15, 16, - 1, 0, 2, 3, 17, 4, 0, 0, 5, 6, - 7, 8, 9, 10, 0, 0, 0, 0, 11, 0, - 0, 0, 0, 0, 0, 102, 0, 12, 13, 14, - 15, 16, 0, 0, 0, 0, 17, 33, 34, 35, - 36, 37, 38, 39, 0, 40, 41, 42, 43, 0, - 0, 0, 0, 0, 0, 11, 0, 0, 0, 117, - 0, 0, 0, 0, 12, 13, 14, 15, 0, 0, - 0, 0, 0, 17, 33, 34, 35, 36, 37, 38, - 39, 0, 40, 41, 42, 43, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 0, 118, 0, 0, 0, - 0, 12, 13, 14, 15, 0, 0, 0, 0, 0, - 17, 33, 34, 35, 36, 37, 38, 39, 0, 40, - 41, 42, 43, 0, 0, 0, 0, 0, 0, 11, - 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, - 14, 15, 0, 0, 132, 0, 0, 17, 33, 34, - 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, - 0, 0, 0, 0, 0, 12, 13, 14, 15, 0, - 1, 0, 2, 3, 17, 4, 0, 0, 5, 6, - 7, 8, 9, 10, 0, 0, 0, 0, 11, 0, - 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, - 15, 16, 0, 0, 0, 0, 17 + 44, 0, 0, 0, 0, 0, 0, 11, 0, 0, + 0, 0, 0, 0, 0, 0, 12, 13, 14, 15, + 0, 0, 135, 0, 0, 17, 33, 34, 35, 36, + 37, 38, 39, 0, 40, 41, 42, 43, 44, 1, + 0, 2, 3, 0, 4, 11, 0, 5, 6, 7, + 8, 9, 10, 0, 12, 13, 14, 15, 11, 0, + 0, 0, 0, 17, 0, 105, 0, 12, 13, 14, + 15, 16, 1, 0, 2, 3, 17, 4, 0, 0, + 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 13, 14, 15, 16, 0, 0, 0, 0, 17 }; static const yytype_int16 yycheck[] = { - 0, 31, 45, 29, 5, 20, 6, 7, 9, 17, - 25, 12, 13, 14, 9, 33, 4, 33, 26, 27, - 28, 21, 22, 23, 25, 34, 0, 28, 36, 37, - 17, 32, 58, 28, 12, 13, 14, 25, 68, 69, - 70, 29, 5, 86, 29, 28, 9, 21, 63, 50, - 17, 34, 33, 38, 55, 0, 99, 25, 7, 26, - 27, 29, 25, 50, 28, 28, 15, 16, 29, 32, - 100, 15, 16, 35, 75, 76, 17, 107, 18, 79, - 80, 82, 83, 126, 9, 115, 25, 35, 118, 104, - 17, 121, 55, 80, 94, 95, 96, 75, 21, 26, - 27, 3, 132, 127, 82, 133, 63, -1, 109, 36, - 37, -1, 113, 76, 114, -1, -1, -1, -1, -1, - 120, -1, 122, -1, 0, -1, -1, 3, 129, 5, - 6, -1, 8, 133, -1, 11, 12, 13, 14, 15, - 16, -1, -1, -1, -1, 21, -1, -1, -1, -1, - -1, -1, -1, -1, 30, 31, 32, 33, 34, -1, - -1, -1, -1, 39, 3, 4, 5, 6, 7, 8, - 9, -1, 11, 12, 13, 14, 15, 16, -1, -1, - -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, - -1, 30, 31, 32, 33, -1, -1, -1, -1, -1, - 39, 3, 4, 5, 6, 7, 8, 9, -1, 11, - 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, - -1, -1, -1, 25, -1, -1, 28, -1, 30, 31, - 32, 33, -1, -1, -1, -1, -1, 39, 3, 4, + 0, 31, 29, 46, 5, 20, 6, 7, 9, 17, + 25, 12, 13, 14, 4, 34, 0, 34, 9, 27, + 28, 21, 22, 23, 25, 34, 9, 28, 26, 37, + 38, 32, 30, 60, 17, 5, 26, 21, 29, 9, + 30, 71, 72, 73, 7, 30, 89, 12, 13, 14, + 51, 66, 15, 16, 39, 25, 57, 29, 28, 102, + 17, 44, 32, 35, 65, 15, 16, 35, 51, 0, + 27, 28, 30, 103, 29, 17, 19, 78, 79, 9, + 110, 26, 82, 83, 85, 86, 129, 57, 118, 36, + 36, 121, 107, 21, 124, 65, 3, 97, 98, 99, + 83, 136, 130, -1, 66, 135, -1, -1, -1, 79, + -1, 112, -1, 78, -1, 116, -1, 117, -1, -1, + 85, -1, -1, 123, -1, 125, -1, 0, -1, -1, + 3, 132, 5, 6, 17, 8, 136, -1, 11, 12, + 13, 14, 15, 16, 27, 28, 29, -1, -1, 22, + -1, -1, -1, -1, 37, 38, -1, -1, 31, 32, + 33, 34, 35, -1, -1, -1, -1, 40, 3, 4, 5, 6, 7, 8, 9, -1, 11, 12, 13, 14, - -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, - -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, - 3, -1, 5, 6, 39, 8, -1, -1, 11, 12, - 13, 14, 15, 16, -1, -1, -1, -1, 21, -1, - -1, -1, -1, -1, -1, 28, -1, 30, 31, 32, - 33, 34, -1, -1, -1, -1, 39, 3, 4, 5, - 6, 7, 8, 9, -1, 11, 12, 13, 14, -1, - -1, -1, -1, -1, -1, 21, -1, -1, -1, 25, - -1, -1, -1, -1, 30, 31, 32, 33, -1, -1, - -1, -1, -1, 39, 3, 4, 5, 6, 7, 8, - 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, - -1, -1, 21, -1, -1, -1, 25, -1, -1, -1, - -1, 30, 31, 32, 33, -1, -1, -1, -1, -1, - 39, 3, 4, 5, 6, 7, 8, 9, -1, 11, - 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, - -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, - 32, 33, -1, -1, 36, -1, -1, 39, 3, 4, + 15, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, 26, -1, -1, 29, -1, 31, 32, 33, 34, + -1, -1, -1, -1, -1, 40, 3, 4, 5, 6, + 7, 8, 9, -1, 11, 12, 13, 14, 15, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, -1, -1, 31, 32, 33, 34, 35, -1, + -1, -1, -1, 40, 3, 4, 5, 6, 7, 8, + 9, -1, 11, 12, 13, 14, 15, 16, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + -1, -1, 31, 32, 33, 34, -1, -1, -1, -1, + -1, 40, 3, 4, 5, 6, 7, 8, 9, -1, + 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, 26, -1, -1, -1, -1, + 31, 32, 33, 34, -1, -1, -1, -1, -1, 40, + 3, 4, 5, 6, 7, 8, 9, -1, 11, 12, + 13, 14, 15, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, 26, -1, -1, -1, -1, 31, 32, + 33, 34, -1, -1, -1, -1, -1, 40, 3, 4, 5, 6, 7, 8, 9, -1, 11, 12, 13, 14, - -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, - -1, -1, -1, -1, -1, 30, 31, 32, 33, -1, - 3, -1, 5, 6, 39, 8, -1, -1, 11, 12, - 13, 14, 15, 16, -1, -1, -1, -1, 21, -1, - -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, - 33, 34, -1, -1, -1, -1, 39 + 15, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, -1, -1, 31, 32, 33, 34, + -1, -1, 37, -1, -1, 40, 3, 4, 5, 6, + 7, 8, 9, -1, 11, 12, 13, 14, 15, 3, + -1, 5, 6, -1, 8, 22, -1, 11, 12, 13, + 14, 15, 16, -1, 31, 32, 33, 34, 22, -1, + -1, -1, -1, 40, -1, 29, -1, 31, 32, 33, + 34, 35, 3, -1, 5, 6, 40, 8, -1, -1, + 11, 12, 13, 14, 15, 16, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, 35, -1, -1, -1, -1, 40 }; -/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of - state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { 0, 3, 5, 6, 8, 11, 12, 13, 14, 15, - 16, 21, 30, 31, 32, 33, 34, 39, 41, 42, - 45, 46, 51, 52, 54, 55, 58, 59, 33, 33, - 44, 44, 33, 3, 4, 5, 6, 7, 8, 9, - 11, 12, 13, 14, 56, 57, 59, 60, 54, 54, - 61, 57, 56, 56, 56, 62, 43, 46, 47, 54, - 45, 0, 28, 52, 53, 42, 54, 54, 17, 26, - 27, 36, 37, 52, 57, 29, 38, 57, 43, 63, - 63, 57, 29, 61, 45, 57, 18, 25, 28, 57, - 35, 43, 28, 53, 63, 63, 63, 56, 57, 4, - 25, 25, 28, 54, 45, 48, 54, 25, 56, 61, - 54, 54, 54, 61, 63, 7, 63, 25, 25, 54, - 63, 34, 63, 54, 63, 54, 9, 49, 50, 61, - 50, 35, 36, 63, 47, 54 + 16, 22, 31, 32, 33, 34, 35, 40, 42, 43, + 46, 47, 52, 53, 55, 56, 59, 60, 34, 34, + 45, 45, 34, 3, 4, 5, 6, 7, 8, 9, + 11, 12, 13, 14, 15, 57, 58, 60, 61, 55, + 55, 62, 46, 58, 57, 57, 57, 63, 44, 47, + 48, 55, 46, 0, 29, 15, 53, 54, 43, 55, + 55, 17, 27, 28, 37, 38, 53, 58, 30, 39, + 58, 44, 64, 64, 58, 30, 62, 46, 58, 19, + 26, 29, 58, 36, 44, 29, 54, 64, 64, 64, + 57, 58, 4, 26, 26, 29, 55, 46, 49, 55, + 26, 57, 62, 55, 55, 55, 62, 64, 7, 64, + 26, 26, 55, 64, 35, 64, 55, 64, 55, 9, + 50, 51, 62, 51, 36, 37, 64, 48, 55 }; -/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int8 yyr1[] = { - 0, 40, 41, 41, 42, 42, 43, 43, 44, 45, - 46, 46, 47, 47, 48, 48, 49, 50, 50, 51, - 52, 52, 53, 53, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, - 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, + 0, 41, 42, 42, 43, 43, 44, 44, 45, 46, + 47, 47, 48, 48, 49, 49, 50, 51, 51, 52, + 53, 53, 54, 54, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, - 62, 62, 62, 63, 63 + 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, + 62, 63, 63, 63, 64, 64 }; -/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 1, 2, 1, 2, 3, 3, @@ -812,9 +818,9 @@ static const yytype_int8 yyr2[] = 1, 2, 0, 2, 0, 1, 2, 4, 4, 4, 2, 2, 2, 2, 3, 6, 8, 4, 4, 9, 3, 1, 2, 2, 1, 1, 1, 3, 1, 3, - 1, 2, 5, 3, 2, 2, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, - 0, 2, 2, 0, 2 + 1, 2, 5, 3, 2, 2, 2, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 2, 0, 2, 2, 0, 2 }; @@ -826,7 +832,6 @@ enum { YYENOMEM = -2 }; #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab -#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) @@ -867,7 +872,10 @@ do { \ YYFPRINTF Args; \ } while (0) - +/* This macro is provided for backward compatibility. */ +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ @@ -894,6 +902,10 @@ yy_symbol_value_print (FILE *yyo, YY_USE (yyoutput); if (!yyvaluep) return; +# ifdef YYPRINT + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); +# endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END @@ -1348,7 +1360,6 @@ yyparse (void) YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; @@ -1374,7 +1385,7 @@ yysetstate: if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - YYNOMEM; + goto yyexhaustedlab; #else { /* Get the current used size of the three stacks, in elements. */ @@ -1402,7 +1413,7 @@ yysetstate: # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - YYNOMEM; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -1413,7 +1424,7 @@ yysetstate: YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - YYNOMEM; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE @@ -1435,7 +1446,6 @@ yysetstate: } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - if (yystate == YYFINAL) YYACCEPT; @@ -1550,293 +1560,299 @@ yyreduce: case 2: /* rc: %empty */ #line 38 "src/cmd/rc/syntax.y" { return 1; } -#line 1554 "src/cmd/rc/parse.c" +#line 1564 "src/cmd/rc/parse.c" break; case 3: /* rc: line '\n' */ #line 39 "src/cmd/rc/syntax.y" { return compile((yyvsp[-1].tree)); } -#line 1560 "src/cmd/rc/parse.c" +#line 1570 "src/cmd/rc/parse.c" break; case 5: /* line: cmds line */ #line 43 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(';', (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1566 "src/cmd/rc/parse.c" +#line 1576 "src/cmd/rc/parse.c" break; case 7: /* body: cmdsln body */ #line 47 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(';', (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1572 "src/cmd/rc/parse.c" +#line 1582 "src/cmd/rc/parse.c" break; case 8: /* paren: '(' body ')' */ #line 50 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tparen, (yyvsp[-1].tree)); } -#line 1578 "src/cmd/rc/parse.c" +#line 1588 "src/cmd/rc/parse.c" break; case 9: /* block: '{' body '}' */ #line 53 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tblock, (yyvsp[-1].tree)); } -#line 1584 "src/cmd/rc/parse.c" +#line 1594 "src/cmd/rc/parse.c" break; case 11: /* cmds: cmd '&' */ #line 57 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1('&', (yyvsp[-1].tree)); } -#line 1590 "src/cmd/rc/parse.c" +#line 1600 "src/cmd/rc/parse.c" break; case 14: /* ifbody: cmd */ #line 64 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Tif, nil, (yyvsp[0].tree)); } -#line 1596 "src/cmd/rc/parse.c" +#line 1606 "src/cmd/rc/parse.c" break; case 15: /* ifbody: block Telse nl cmd */ #line 65 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree3(Tif, nil, (yyvsp[-3].tree), (yyvsp[-2].tree)); } -#line 1602 "src/cmd/rc/parse.c" +#line 1612 "src/cmd/rc/parse.c" break; case 16: /* case: Tcase words ';' nl cmdsln */ #line 68 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-4].tree), (yyvsp[-3].tree), 0, (yyvsp[0].tree), 1);} -#line 1608 "src/cmd/rc/parse.c" +#line 1618 "src/cmd/rc/parse.c" break; case 17: /* casebody: %empty */ #line 71 "src/cmd/rc/syntax.y" { (yyval.tree) = nil; } -#line 1614 "src/cmd/rc/parse.c" +#line 1624 "src/cmd/rc/parse.c" break; case 18: /* casebody: case casebody */ #line 72 "src/cmd/rc/syntax.y" { (yyval.tree) = (!(yyvsp[0].tree)) ? (yyvsp[-1].tree) : maketree2(';', (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1620 "src/cmd/rc/parse.c" +#line 1630 "src/cmd/rc/parse.c" break; case 19: /* assign: executable '=' word */ #line 75 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2('=', (yyvsp[-2].tree), (yyvsp[0].tree)); } -#line 1626 "src/cmd/rc/parse.c" +#line 1636 "src/cmd/rc/parse.c" break; case 21: /* redir: Tredir word */ #line 79 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild1((yyvsp[-1].tree), ((yyvsp[-1].tree)->redir.type == Rhere)?heredoc((yyvsp[0].tree)):(yyvsp[0].tree), 0); } -#line 1632 "src/cmd/rc/parse.c" +#line 1642 "src/cmd/rc/parse.c" break; case 22: /* epilog: %empty */ #line 82 "src/cmd/rc/syntax.y" { (yyval.tree) = nil; } -#line 1638 "src/cmd/rc/parse.c" +#line 1648 "src/cmd/rc/parse.c" break; case 23: /* epilog: redir epilog */ #line 83 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild1((yyvsp[-1].tree), (yyvsp[0].tree), 1); } -#line 1644 "src/cmd/rc/parse.c" +#line 1654 "src/cmd/rc/parse.c" break; case 24: /* cmd: %empty */ #line 86 "src/cmd/rc/syntax.y" { (yyval.tree) = nil; } -#line 1650 "src/cmd/rc/parse.c" +#line 1660 "src/cmd/rc/parse.c" break; case 25: /* cmd: basic */ #line 87 "src/cmd/rc/syntax.y" { (yyval.tree) = basictree((yyvsp[0].tree)); } -#line 1656 "src/cmd/rc/parse.c" +#line 1666 "src/cmd/rc/parse.c" break; case 26: /* cmd: block epilog */ #line 88 "src/cmd/rc/syntax.y" { (yyval.tree) = hangepilog((yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1662 "src/cmd/rc/parse.c" +#line 1672 "src/cmd/rc/parse.c" break; case 27: /* cmd: cmd Tpipe nl cmd */ #line 89 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-2].tree), (yyvsp[-3].tree), 0, (yyvsp[0].tree), 1); } -#line 1668 "src/cmd/rc/parse.c" +#line 1678 "src/cmd/rc/parse.c" break; case 28: /* cmd: cmd Tandand nl cmd */ #line 90 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Tandand, (yyvsp[-3].tree), (yyvsp[0].tree)); } -#line 1674 "src/cmd/rc/parse.c" +#line 1684 "src/cmd/rc/parse.c" break; case 29: /* cmd: cmd Toror nl cmd */ #line 91 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Toror, (yyvsp[-3].tree), (yyvsp[0].tree)); } -#line 1680 "src/cmd/rc/parse.c" +#line 1690 "src/cmd/rc/parse.c" break; case 30: /* cmd: redir cmd */ #line 92 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild1((yyvsp[-1].tree), (yyvsp[0].tree), 1); } -#line 1686 "src/cmd/rc/parse.c" +#line 1696 "src/cmd/rc/parse.c" break; case 31: /* cmd: assign cmd */ #line 93 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild1((yyvsp[-1].tree), (yyvsp[0].tree), 2); } -#line 1692 "src/cmd/rc/parse.c" +#line 1702 "src/cmd/rc/parse.c" break; case 32: /* cmd: Tbang cmd */ #line 94 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tbang, (yyvsp[0].tree)); } -#line 1698 "src/cmd/rc/parse.c" +#line 1708 "src/cmd/rc/parse.c" break; case 33: /* cmd: Tsubshell cmd */ #line 95 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tsubshell, (yyvsp[0].tree)); } -#line 1704 "src/cmd/rc/parse.c" +#line 1714 "src/cmd/rc/parse.c" break; case 34: /* cmd: Ttwiddle word words */ #line 96 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-2].tree), (yyvsp[-1].tree), 0, (yyvsp[0].tree), 1); } -#line 1710 "src/cmd/rc/parse.c" +#line 1720 "src/cmd/rc/parse.c" break; case 35: /* cmd: Tfor '(' word ')' nl cmd */ #line 97 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild3((yyvsp[-5].tree), (yyvsp[-3].tree), nil, (yyvsp[0].tree)); } -#line 1716 "src/cmd/rc/parse.c" +#line 1726 "src/cmd/rc/parse.c" break; case 36: /* cmd: Tfor '(' word Tin words ')' nl cmd */ #line 98 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild3((yyvsp[-7].tree), (yyvsp[-5].tree), (yyvsp[-3].tree), (yyvsp[0].tree)); } -#line 1722 "src/cmd/rc/parse.c" +#line 1732 "src/cmd/rc/parse.c" break; case 37: /* cmd: Twhile paren nl cmd */ #line 99 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-3].tree), (yyvsp[-2].tree), 0, (yyvsp[0].tree), 1); } -#line 1728 "src/cmd/rc/parse.c" +#line 1738 "src/cmd/rc/parse.c" break; case 38: /* cmd: Tif paren nl ifbody */ #line 100 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild1((yyvsp[0].tree), (yyvsp[-2].tree), 0); } -#line 1734 "src/cmd/rc/parse.c" +#line 1744 "src/cmd/rc/parse.c" break; case 39: /* cmd: Tswitch '(' word ')' nl '{' nl casebody '}' */ #line 101 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-8].tree), (yyvsp[-6].tree), 0, (yyvsp[-1].tree), 1); } -#line 1740 "src/cmd/rc/parse.c" +#line 1750 "src/cmd/rc/parse.c" break; case 40: /* cmd: Tfunc words block */ #line 102 "src/cmd/rc/syntax.y" { (yyval.tree) = hangchild2((yyvsp[-2].tree), (yyvsp[-1].tree), 0, (yyvsp[0].tree), 1); } -#line 1746 "src/cmd/rc/parse.c" +#line 1756 "src/cmd/rc/parse.c" break; case 42: /* basic: basic word */ #line 106 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Targs, (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1752 "src/cmd/rc/parse.c" +#line 1762 "src/cmd/rc/parse.c" break; case 43: /* basic: basic redir */ #line 107 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Targs, (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1758 "src/cmd/rc/parse.c" +#line 1768 "src/cmd/rc/parse.c" break; case 45: /* atom: keyword */ #line 111 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tword, (yyvsp[0].tree)); } -#line 1764 "src/cmd/rc/parse.c" +#line 1774 "src/cmd/rc/parse.c" break; case 47: /* word: word '^' atom */ #line 115 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2('^', (yyvsp[-2].tree), (yyvsp[0].tree)); } -#line 1770 "src/cmd/rc/parse.c" +#line 1780 "src/cmd/rc/parse.c" break; case 49: /* executable: executable '^' atom */ #line 119 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2('^', (yyvsp[-2].tree), (yyvsp[0].tree)); } -#line 1776 "src/cmd/rc/parse.c" +#line 1786 "src/cmd/rc/parse.c" break; case 51: /* nonkeyword: '$' atom */ #line 123 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1('$', (yyvsp[0].tree)); } -#line 1782 "src/cmd/rc/parse.c" +#line 1792 "src/cmd/rc/parse.c" break; case 52: /* nonkeyword: '$' atom Tindex words ')' */ #line 124 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Tindex, (yyvsp[-3].tree), (yyvsp[-1].tree)); } -#line 1788 "src/cmd/rc/parse.c" +#line 1798 "src/cmd/rc/parse.c" break; case 53: /* nonkeyword: '(' wordsnl ')' */ #line 125 "src/cmd/rc/syntax.y" { (yyval.tree) = (yyvsp[-1].tree); } -#line 1794 "src/cmd/rc/parse.c" +#line 1804 "src/cmd/rc/parse.c" break; case 54: /* nonkeyword: Tcount atom */ #line 126 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tcount, (yyvsp[0].tree)); } -#line 1800 "src/cmd/rc/parse.c" +#line 1810 "src/cmd/rc/parse.c" break; case 55: /* nonkeyword: Tjoin atom */ #line 127 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1(Tjoin, (yyvsp[0].tree)); } -#line 1806 "src/cmd/rc/parse.c" +#line 1816 "src/cmd/rc/parse.c" break; case 56: /* nonkeyword: '`' block */ #line 128 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree1('`', (yyvsp[0].tree)); } -#line 1812 "src/cmd/rc/parse.c" +#line 1822 "src/cmd/rc/parse.c" + break; + + case 57: /* nonkeyword: Tredir block */ +#line 129 "src/cmd/rc/syntax.y" + { (yyval.tree) = hangchild1((yyvsp[-1].tree), (yyvsp[0].tree), 0); (yyval.tree)->type = Tpipefd; } +#line 1828 "src/cmd/rc/parse.c" break; - case 68: /* words: %empty */ + case 69: /* words: %empty */ #line 135 "src/cmd/rc/syntax.y" { (yyval.tree) = nil; } -#line 1818 "src/cmd/rc/parse.c" +#line 1834 "src/cmd/rc/parse.c" break; - case 69: /* words: words word */ + case 70: /* words: words word */ #line 136 "src/cmd/rc/syntax.y" { (yyval.tree) = maketree2(Twords, (yyvsp[-1].tree), (yyvsp[0].tree)); } -#line 1824 "src/cmd/rc/parse.c" +#line 1840 "src/cmd/rc/parse.c" break; - case 70: /* wordsnl: %empty */ + case 71: /* wordsnl: %empty */ #line 139 "src/cmd/rc/syntax.y" { (yyval.tree) = nil; } -#line 1830 "src/cmd/rc/parse.c" +#line 1846 "src/cmd/rc/parse.c" break; - case 72: /* wordsnl: wordsnl word */ + case 73: /* wordsnl: wordsnl word */ #line 141 "src/cmd/rc/syntax.y" {(yyval.tree) = (!(yyvsp[-1].tree)) ? ((!(yyvsp[0].tree)) ? nil : (yyvsp[0].tree)) : ((!(yyvsp[0].tree)) ? (yyvsp[-1].tree) : maketree2(Twords, (yyvsp[-1].tree), (yyvsp[0].tree))); } -#line 1836 "src/cmd/rc/parse.c" +#line 1852 "src/cmd/rc/parse.c" break; -#line 1840 "src/cmd/rc/parse.c" +#line 1856 "src/cmd/rc/parse.c" default: break; } @@ -1912,7 +1928,7 @@ yyerrlab: } yyerror (yymsgp); if (yysyntax_error_status == YYENOMEM) - YYNOMEM; + goto yyexhaustedlab; } } @@ -1948,7 +1964,6 @@ yyerrorlab: label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; - ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2009,7 +2024,7 @@ yyerrlab1: `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturnlab; + goto yyreturn; /*-----------------------------------. @@ -2017,22 +2032,24 @@ yyacceptlab: `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturnlab; + goto yyreturn; -/*-----------------------------------------------------------. -| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | -`-----------------------------------------------------------*/ +#if 1 +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - goto yyreturnlab; + goto yyreturn; +#endif -/*----------------------------------------------------------. -| yyreturnlab -- parsing is finished, clean up and return. | -`----------------------------------------------------------*/ -yyreturnlab: +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ +yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at diff --git a/src/cmd/rc/parse.h b/src/cmd/rc/parse.h index 88859ea..ee56e0c 100644 --- a/src/cmd/rc/parse.h +++ b/src/cmd/rc/parse.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.8.2. */ +/* A Bison parser, made by GNU Bison 3.7.6. */ /* Bison interface for Yacc-like parsers in C @@ -39,7 +39,7 @@ # define YY_YY_SRC_CMD_RC_PARSE_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 1 +# define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; @@ -69,17 +69,18 @@ extern int yydebug; Tredir = 270, /* Tredir */ Tdup = 271, /* Tdup */ Tpipe = 272, /* Tpipe */ - Tindex = 273, /* Tindex */ - Tbasic = 274, /* Tbasic */ - Targs = 275, /* Targs */ - Tword = 276, /* Tword */ - Twords = 277, /* Twords */ - Tparen = 278, /* Tparen */ - Tblock = 279, /* Tblock */ - Tandand = 280, /* Tandand */ - Toror = 281, /* Toror */ - Tcount = 282, /* Tcount */ - Tjoin = 283 /* Tjoin */ + Tpipefd = 273, /* Tpipefd */ + Tindex = 274, /* Tindex */ + Tbasic = 275, /* Tbasic */ + Targs = 276, /* Targs */ + Tword = 277, /* Tword */ + Twords = 278, /* Twords */ + Tparen = 279, /* Tparen */ + Tblock = 280, /* Tblock */ + Tandand = 281, /* Tandand */ + Toror = 282, /* Toror */ + Tcount = 283, /* Tcount */ + Tjoin = 284 /* Tjoin */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -92,7 +93,7 @@ union YYSTYPE struct Tree *tree; -#line 96 "src/cmd/rc/parse.h" +#line 97 "src/cmd/rc/parse.h" }; typedef union YYSTYPE YYSTYPE; @@ -103,8 +104,6 @@ typedef union YYSTYPE YYSTYPE; extern YYSTYPE yylval; - int yyparse (void); - #endif /* !YY_YY_SRC_CMD_RC_PARSE_H_INCLUDED */ diff --git a/src/cmd/rc/syntax.y b/src/cmd/rc/syntax.y index 3777710..dfd6e87 100644 --- a/src/cmd/rc/syntax.y +++ b/src/cmd/rc/syntax.y @@ -1,5 +1,5 @@ %token Tfor Tin Twhile Tif Telse Tswitch Tcase Tcasebody Ttwiddle Tbang Tsubshell Tfunc -%token Tredir Tdup Tpipe Tindex +%token Tredir Tdup Tpipe Tpipefd Tindex %token Tbasic Targs Tword Twords Tparen Tblock %define parse.error verbose @@ -126,7 +126,7 @@ nonkeyword: | Tcount atom { $$ = maketree1(Tcount, $2); } | Tjoin atom { $$ = maketree1(Tjoin, $2); } | '`' block { $$ = maketree1('`', $2); } -//| Tredir block { $$ = hangchild1($1, $2, 0); $$->type = Tpipefd; } +| Tredir block { $$ = hangchild1($1, $2, 0); $$->type = Tpipefd; } keyword: Tfor|Tin|Twhile|Tif|Telse|Tswitch|Tcase|Tbang|Tsubshell|Ttwiddle|Tfunc -- cgit v1.2.1