📄 jamgram.c
字号:
#ifndef lintstatic char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28.2.1 2001/07/19 05:46:39 peter Exp $";#endif#include <stdlib.h>#define YYBYACC 1#define YYMAJOR 1#define YYMINOR 9#define YYLEX yylex()#define YYEMPTY -1#define yyclearin (yychar=(YYEMPTY))#define yyerrok (yyerrflag=0)#define YYRECOVERING() (yyerrflag!=0)#if defined(__cplusplus) || __STDC__static int yygrowstack(void);#elsestatic int yygrowstack();#endif#define YYPREFIX "yy"#line 85 "jamgram.y"#include "jam.h"#include "lists.h"#include "variable.h"#include "parse.h"#include "scan.h"#include "compile.h"#include "newstr.h"#include "rules.h"# define YYMAXDEPTH 10000 /* for OSF and other less endowed yaccs */# define F0 (LIST *(*)(PARSE *, LOL *, int *))0# define P0 (PARSE *)0# define S0 (char *)0# define pappend( l,r ) parse_make( compile_append,l,r,P0,S0,S0,0 )# define pbreak( l,f ) parse_make( compile_break,l,P0,P0,S0,S0,f )# define peval( c,l,r ) parse_make( compile_eval,l,r,P0,S0,S0,c )# define pfor( s,l,r ) parse_make( compile_foreach,l,r,P0,s,S0,0 )# define pif( l,r,t ) parse_make( compile_if,l,r,t,S0,S0,0 )# define pincl( l ) parse_make( compile_include,l,P0,P0,S0,S0,0 )# define plist( s ) parse_make( compile_list,P0,P0,P0,s,S0,0 )# define plocal( l,r,t ) parse_make( compile_local,l,r,t,S0,S0,0 )# define pnull() parse_make( compile_null,P0,P0,P0,S0,S0,0 )# define pon( l,r ) parse_make( compile_on,l,r,P0,S0,S0,0 )# define prule( a,p ) parse_make( compile_rule,a,p,P0,S0,S0,0 )# define prules( l,r ) parse_make( compile_rules,l,r,P0,S0,S0,0 )# define pset( l,r,a ) parse_make( compile_set,l,r,P0,S0,S0,a )# define pset1( l,r,t,a ) parse_make( compile_settings,l,r,t,S0,S0,a )# define psetc( s,l,r ) parse_make( compile_setcomp,l,r,P0,s,S0,0 )# define psete( s,l,s1,f ) parse_make( compile_setexec,l,P0,P0,s,s1,f )# define pswitch( l,r ) parse_make( compile_switch,l,r,P0,S0,S0,0 )# define pwhile( l,r ) parse_make( compile_while,l,r,P0,S0,S0,0 )# define pnode( l,r ) parse_make( F0,l,r,P0,S0,S0,0 )# define psnode( s,l ) parse_make( F0,l,P0,P0,s,S0,0 )#line 60 "y.tab.c"#define YYERRCODE 256#define _BANG_t 257#define _BANG_EQUALS_t 258#define _AMPER_t 259#define _AMPERAMPER_t 260#define _LPAREN_t 261#define _RPAREN_t 262#define _PLUS_EQUALS_t 263#define _COLON_t 264#define _SEMIC_t 265#define _LANGLE_t 266#define _LANGLE_EQUALS_t 267#define _EQUALS_t 268#define _RANGLE_t 269#define _RANGLE_EQUALS_t 270#define _QUESTION_EQUALS_t 271#define _LBRACKET_t 272#define _RBRACKET_t 273#define ACTIONS_t 274#define BIND_t 275#define BREAK_t 276#define CASE_t 277#define CONTINUE_t 278#define DEFAULT_t 279#define ELSE_t 280#define EXISTING_t 281#define FOR_t 282#define IF_t 283#define IGNORE_t 284#define IN_t 285#define INCLUDE_t 286#define LOCAL_t 287#define MAXLINE_t 288#define ON_t 289#define PIECEMEAL_t 290#define QUIETLY_t 291#define RETURN_t 292#define RULE_t 293#define SWITCH_t 294#define TOGETHER_t 295#define UPDATED_t 296#define WHILE_t 297#define _LBRACE_t 298#define _BAR_t 299#define _BARBAR_t 300#define _RBRACE_t 301#define ARG 302#define STRING 303const short yylhs[] = { -1, 0, 0, 2, 2, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 13, 14, 3, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 15, 10, 10, 10, 6, 6, 4, 16, 16, 5, 18, 5, 17, 17, 17, 11, 11, 19, 19, 19, 19, 19, 19, 19, 12, 12,};const short yylen[] = { 2, 0, 1, 0, 1, 1, 2, 4, 6, 3, 3, 3, 4, 6, 3, 3, 3, 7, 5, 5, 7, 5, 6, 3, 0, 0, 9, 1, 1, 1, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 0, 2, 4, 0, 3, 1, 1, 3, 1, 0, 2, 1, 0, 4, 2, 4, 4, 0, 2, 1, 1, 1, 1, 1, 1, 2, 0, 2,};const short yydefred[] = { 0, 57, 62, 54, 54, 0, 0, 54, 54, 0, 54, 0, 54, 0, 0, 56, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 6, 28, 27, 29, 0, 54, 0, 0, 54, 0, 54, 0, 69, 66, 0, 68, 67, 65, 64, 0, 63, 14, 55, 15, 54, 43, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 54, 23, 16, 0, 0, 0, 0, 9, 30, 0, 54, 11, 0, 0, 59, 58, 70, 54, 0, 0, 44, 42, 0, 0, 0, 34, 35, 0, 36, 37, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 54, 52, 12, 54, 54, 72, 24, 0, 0, 0, 49, 0, 0, 18, 46, 21, 0, 61, 60, 0, 0, 0, 8, 22, 0, 13, 25, 17, 20, 47, 0, 26,};const short yydgoto[] = { 16, 37, 38, 18, 45, 28, 46, 47, 118, 29, 84, 21, 98, 140, 151, 119, 23, 50, 20, 59,};const short yysindex[] = { -40, 0, 0, 0, 0, -295, -233, 0, 0, -240, 0, -284, 0, -233, -40, 0, 0, 0, -40, -7, -241, 49, -242, -240, -232, -239, -233, -233, -231, -75, -220, -195, 34, -210, -243, -226, -59, 0, -223, 0, 0, 0, 0, -174, 0, -165, -164, 0, -240, 0, -173, 0, 0, -199, 0, 0, 0, 0, -166, 0, 0, 0, 0, 0, 0, -154, 0, -233, -233, -233, -233, -233, -233, -233, -233, -40, -233, -233, 0, -40, 0, 0, 0, -153, -179, -157, -40, 0, 0, -42, 0, 0, -144, -185, 0, 0, 0, 0, -171, -170, 0, 0, -54, 94, 94, 0, 0, -54, 0, 0, -160, 88, 88, 0, -140, -243, -40, -151, -139, -157, -134, 0, 0, 0, 0, 0, 0, 0, -40, -149, -40, 0, -131, -93, 0, 0, 0, -85, 0, 0, -121, -115, 34, 0, 0, -40, 0, 0, 0, 0, 0, -105, 0,};const short yyrindex[] = { 197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -103, 0, 0, 0, 3, -235, 0, 0, 0, -110, 0, 0, 0, 0, -94, 0, 0, 0, 0, 0, -96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -103, 0, 0, 0, 4, 0, 0, 0, -84, 0, -79, -103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -202, -224, -176, 0, 0, -81, 0, 0, 0, -257, -209, 0, 0, -96, -103, 0, 0, -79, 0, 0, 0, 0, 0, 0, 0, 0, -103, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -237, 0, 0, 0, 0, 0, 0, 0,};const short yygindex[] = { 0, 26, -65, -32, 5, 2, -43, 131, 108, 66, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0,};#define YYTABLESIZE 364const short yytable[] = { 81, 19, 19, 5, 3, 40, 94, 25, 22, 24, 110, 32, 30, 31, 113, 33, 19, 35, 34, 51, 19, 120, 49, 60, 26, 61, 17, 51, 27, 54, 54, 1, 1, 62, 19, 38, 38, 54, 38, 1, 3, 40, 40, 40, 39, 78, 63, 122, 48, 89, 93, 132, 92, 41, 66, 82, 33, 33, 33, 83, 33, 15, 15, 141, 3, 143, 33, 54, 99, 15, 79, 101, 85, 80, 38, 38, 38, 19, 87, 36, 150, 19, 139, 39, 39, 114, 39, 1, 19, 41, 41, 41, 64, 65, 88, 125, 33, 33, 33, 90, 95, 91, 126, 96, 67, 68, 69, 124, 100, 97, 149, 115, 70, 71, 72, 73, 74, 15, 19, 116, 117, 123, 39, 39, 39, 130, 137, 127, 128, 138, 19, 142, 19, 102, 103, 104, 105, 106, 107, 108, 109, 129, 111, 112, 19, 76, 77, 19, 53, 53, 53, 133, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 134, 53, 31, 31, 31, 136, 31, 53, 144, 145, 31, 31, 31, 31, 31, 32, 32, 32, 146, 32, 147, 67, 68, 69, 148, 32, 53, 53, 53, 70, 71, 72, 73, 74, 152, 1, 3, 67, 68, 69, 48, 71, 31, 31, 31, 70, 71, 72, 73, 74, 70, 71, 50, 73, 74, 32, 32, 32, 121, 40, 45, 75, 76, 77, 41, 135, 131, 42, 0, 0, 1, 0, 2, 0, 3, 43, 4, 86, 76, 77, 5, 6, 0, 0, 7, 8, 0, 9, 0, 0, 10, 11, 12, 0, 40, 13, 14, 0, 0, 41, 15, 0, 42, 0, 0, 0, 0, 0, 0, 0, 43, 19, 0, 19, 0, 19, 19, 19, 5, 3, 44, 19, 19, 0, 0, 19, 19, 0, 19, 0, 0, 19, 19, 19, 0, 0, 19, 19, 0, 0, 19, 19, 5, 3, 1, 0, 2, 0, 3, 0, 4, 0, 0, 0, 5, 6, 0, 0, 7, 0, 0, 9, 0, 0, 10, 11, 12, 0, 51, 13, 14, 52, 0, 0, 15, 53, 0, 54, 55, 0, 0, 0, 56, 57, 67, 68, 69, 0, 0, 58, 67, 0, 70, 71, 72, 73, 74, 0, 70, 71, 72, 73, 74,};const short yycheck[] = { 32, 0, 0, 0, 0, 262, 49, 302, 3, 4, 75, 9, 7, 8, 79, 10, 14, 12, 302, 265, 18, 86, 20, 265, 257, 23, 0, 273, 261, 264, 265, 272, 272, 265, 32, 259, 260, 272, 262, 272, 277, 298, 299, 300, 18, 265, 285, 90, 289, 44, 48, 116, 47, 262, 285, 265, 258, 259, 260, 302, 262, 302, 302, 128, 301, 130, 268, 302, 63, 302, 265, 66, 298, 268, 298, 299, 300, 75, 301, 13, 145, 79, 125, 259, 260, 80, 262, 272, 86, 298, 299, 300, 26, 27, 268, 93, 298, 299, 300, 264, 273, 265, 97, 302, 258, 259, 260, 292, 262, 275, 142, 264, 266, 267, 268, 269, 270, 302, 116, 298, 277, 265, 298, 299, 300, 265, 121, 298, 298, 124, 128, 280, 130, 67, 68, 69, 70, 71, 72, 73, 74, 301, 76, 77, 142, 299, 300, 145, 258, 259, 260, 302, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 301, 273, 258, 259, 260, 301, 262, 279, 301, 264, 266, 267, 268, 269, 270, 258, 259, 260, 265, 262, 303, 258, 259, 260, 301, 268, 298, 299, 300, 266, 267, 268, 269, 270, 301, 0, 301, 258, 259, 260, 298, 298, 298, 299, 300, 266, 267, 268, 269, 270, 266, 267, 298, 269, 270, 298, 299, 300, 89, 263, 301, 298, 299, 300, 268, 119, 115, 271, -1, -1, 272, -1, 274, -1, 276, 279, 278, 298, 299, 300, 282, 283, -1, -1, 286, 287, -1, 289, -1, -1, 292, 293, 294, -1, 263, 297, 298, -1, -1, 268, 302, -1, 271, -1, -1, -1, -1, -1, -1, -1, 279, 272, -1, 274, -1, 276, 277, 278, 277, 277, 289, 282, 283, -1, -1, 286, 287, -1, 289, -1, -1, 292, 293, 294, -1, -1, 297, 298, -1, -1, 301, 302, 301, 301, 272, -1, 274, -1, 276, -1, 278, -1, -1, -1, 282, 283, -1, -1, 286, -1, -1, 289, -1, -1, 292, 293, 294, -1, 281, 297, 298, 284, -1, -1, 302, 288, -1, 290, 291, -1, -1, -1, 295, 296, 258, 259, 260, -1, -1, 302, 258, -1, 266, 267, 268, 269, 270, -1, 266, 267, 268, 269, 270,};#define YYFINAL 16#ifndef YYDEBUG#define YYDEBUG 0#endif#define YYMAXTOKEN 303#if YYDEBUGconst char * const yyname[] = {"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"_BANG_t","_BANG_EQUALS_t","_AMPER_t","_AMPERAMPER_t","_LPAREN_t","_RPAREN_t","_PLUS_EQUALS_t","_COLON_t","_SEMIC_t","_LANGLE_t","_LANGLE_EQUALS_t","_EQUALS_t","_RANGLE_t","_RANGLE_EQUALS_t","_QUESTION_EQUALS_t","_LBRACKET_t","_RBRACKET_t","ACTIONS_t","BIND_t","BREAK_t","CASE_t","CONTINUE_t","DEFAULT_t","ELSE_t","EXISTING_t","FOR_t","IF_t","IGNORE_t","IN_t","INCLUDE_t","LOCAL_t","MAXLINE_t","ON_t","PIECEMEAL_t","QUIETLY_t","RETURN_t","RULE_t","SWITCH_t","TOGETHER_t","UPDATED_t","WHILE_t","_LBRACE_t","_BAR_t","_BARBAR_t","_RBRACE_t","ARG","STRING",};const char * const yyrule[] = {"$accept : run","run :","run : rules","block :","block : rules","rules : rule","rules : rule rules","rules : LOCAL_t list _SEMIC_t block","rules : LOCAL_t list _EQUALS_t list _SEMIC_t block","rule : _LBRACE_t block _RBRACE_t","rule : INCLUDE_t list _SEMIC_t","rule : arg lol _SEMIC_t","rule : arg assign list _SEMIC_t","rule : arg ON_t list assign list _SEMIC_t","rule : BREAK_t list _SEMIC_t","rule : CONTINUE_t list _SEMIC_t","rule : RETURN_t list _SEMIC_t","rule : FOR_t ARG IN_t list _LBRACE_t block _RBRACE_t","rule : SWITCH_t list _LBRACE_t cases _RBRACE_t","rule : IF_t expr _LBRACE_t block _RBRACE_t","rule : IF_t expr _LBRACE_t block _RBRACE_t ELSE_t rule","rule : WHILE_t expr _LBRACE_t block _RBRACE_t","rule : RULE_t ARG params _LBRACE_t block _RBRACE_t","rule : ON_t arg rule","$$1 :","$$2 :","rule : ACTIONS_t eflags ARG bindlist _LBRACE_t $$1 STRING $$2 _RBRACE_t","assign : _EQUALS_t","assign : _PLUS_EQUALS_t","assign : _QUESTION_EQUALS_t","assign : DEFAULT_t _EQUALS_t","expr : arg","expr : expr _EQUALS_t expr","expr : expr _BANG_EQUALS_t expr","expr : expr _LANGLE_t expr","expr : expr _LANGLE_EQUALS_t expr","expr : expr _RANGLE_t expr","expr : expr _RANGLE_EQUALS_t expr","expr : expr _AMPER_t expr","expr : expr _AMPERAMPER_t expr","expr : expr _BAR_t expr","expr : expr _BARBAR_t expr","expr : arg IN_t list","expr : _BANG_t expr","expr : _LPAREN_t expr _RPAREN_t","cases :","cases : case cases","case : CASE_t ARG _COLON_t block","params :","params : ARG _COLON_t params","params : ARG","lol : list","lol : list _COLON_t lol","list : listp","listp :","listp : listp arg","arg : ARG","$$3 :","arg : _LBRACKET_t $$3 func _RBRACKET_t","func : arg lol","func : ON_t arg arg lol","func : ON_t arg RETURN_t list","eflags :","eflags : eflags eflag","eflag : UPDATED_t","eflag : TOGETHER_t","eflag : IGNORE_t","eflag : QUIETLY_t","eflag : PIECEMEAL_t","eflag : EXISTING_t","eflag : MAXLINE_t ARG","bindlist :","bindlist : BIND_t list",};#endif#ifndef YYSTYPEtypedef int YYSTYPE;#endif#if YYDEBUG#include <stdio.h>#endif#ifdef YYSTACKSIZE#undef YYMAXDEPTH#define YYMAXDEPTH YYSTACKSIZE#else#ifdef YYMAXDEPTH#define YYSTACKSIZE YYMAXDEPTH#else#define YYSTACKSIZE 10000#define YYMAXDEPTH 10000#endif#endif#define YYINITSTACKSIZE 200int yydebug;int yynerrs;int yyerrflag;int yychar;short *yyssp;YYSTYPE *yyvsp;YYSTYPE yyval;YYSTYPE yylval;short *yyss;short *yysslim;YYSTYPE *yyvs;int yystacksize;/* allocate initial stack or double stack size, up to YYMAXDEPTH */static int yygrowstack(){ int newsize, i; short *newss; YYSTYPE *newvs; if ((newsize = yystacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) : (short *)malloc(newsize * sizeof *newss); if (newss == NULL) return -1; yyss = newss; yyssp = newss + i; newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : (YYSTYPE *)malloc(newsize * sizeof *newvs); if (newvs == NULL) return -1; yyvs = newvs; yyvsp = newvs + i; yystacksize = newsize; yysslim = yyss + newsize - 1; return 0;}#define YYABORT goto yyabort#define YYREJECT goto yyabort#define YYACCEPT goto yyaccept#define YYERROR goto yyerrlab#ifndef YYPARSE_PARAM#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG void#define YYPARSE_PARAM_DECL#else /* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG#define YYPARSE_PARAM_DECL#endif /* ANSI-C/C++ */#else /* YYPARSE_PARAM */#ifndef YYPARSE_PARAM_TYPE#define YYPARSE_PARAM_TYPE void *#endif#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM#define YYPARSE_PARAM_DECL#else /* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG YYPARSE_PARAM#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;#endif /* ANSI-C/C++ */#endif /* ! YYPARSE_PARAM */intyyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL{ register int yym, yyn, yystate;#if YYDEBUG register const char *yys; if ((yys = getenv("YYDEBUG"))) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -