⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 awktab.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
/*  A Bison parser, made from awk.y  */#define YYBISON 1  /* Identify Bison output.  */#define	FUNC_CALL	258#define	NAME	259#define	REGEXP	260#define	ERROR	261#define	YNUMBER	262#define	YSTRING	263#define	RELOP	264#define	APPEND_OP	265#define	ASSIGNOP	266#define	MATCHOP	267#define	NEWLINE	268#define	CONCAT_OP	269#define	LEX_BEGIN	270#define	LEX_END	271#define	LEX_IF	272#define	LEX_ELSE	273#define	LEX_RETURN	274#define	LEX_DELETE	275#define	LEX_WHILE	276#define	LEX_DO	277#define	LEX_FOR	278#define	LEX_BREAK	279#define	LEX_CONTINUE	280#define	LEX_PRINT	281#define	LEX_PRINTF	282#define	LEX_NEXT	283#define	LEX_EXIT	284#define	LEX_FUNCTION	285#define	LEX_GETLINE	286#define	LEX_IN	287#define	LEX_AND	288#define	LEX_OR	289#define	INCREMENT	290#define	DECREMENT	291#define	LEX_BUILTIN	292#define	LEX_LENGTH	293#define	UNARY	294#line 26 "awk.y"#ifdef DEBUG#define YYDEBUG 12#endif#include "awk.h"static void yyerror (); /* va_alist */static char *get_src_buf P((void));static int yylex P((void));static NODE *node_common P((NODETYPE op));static NODE *snode P((NODE *subn, NODETYPE op, int sindex));static NODE *mkrangenode P((NODE *cpair));static NODE *make_for_loop P((NODE *init, NODE *cond, NODE *incr));static NODE *append_right P((NODE *list, NODE *new));static void func_install P((NODE *params, NODE *def));static void pop_var P((NODE *np, int freeit));static void pop_params P((NODE *params));static NODE *make_param P((char *name));static NODE *mk_rexp P((NODE *exp));static int want_assign;		/* lexical scanning kludge */static int want_regexp;		/* lexical scanning kludge */static int can_return;		/* lexical scanning kludge */static int io_allowed = 1;	/* lexical scanning kludge */static char *lexptr;		/* pointer to next char during parsing */static char *lexend;static char *lexptr_begin;	/* keep track of where we were for error msgs */static char *lexeme;		/* beginning of lexeme for debugging */static char *thisline = NULL;#define YYDEBUG_LEXER_TEXT (lexeme)static int param_counter;static char *tokstart = NULL;static char *token = NULL;static char *tokend;NODE *variables[HASHSIZE];extern char *source;extern int sourceline;extern struct src *srcfiles;extern int numfiles;extern int errcount;extern NODE *begin_block;extern NODE *end_block;#line 73 "awk.y"typedef union {	long lval;	AWKNUM fval;	NODE *nodeval;	NODETYPE nodetypeval;	char *sval;	NODE *(*ptrval)();} YYSTYPE;#ifndef YYLTYPEtypedef  struct yyltype    {      int timestamp;      int first_line;      int first_column;      int last_line;      int last_column;      char *text;   }  yyltype;#define YYLTYPE yyltype#endif#include <stdio.h>#ifndef __STDC__#define const#endif#define	YYFINAL		306#define	YYFLAG		-32768#define	YYNTBASE	61#define YYTRANSLATE(x) ((unsigned)(x) <= 294 ? yytranslate[x] : 106)static const char yytranslate[] = {     0,     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,    49,     2,     2,    52,    48,     2,     2,    53,    54,    46,    44,    60,    45,     2,    47,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,    40,    59,    41,     2,    42,    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,    55,     2,    56,    51,     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,    57,    43,    58,     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,     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,     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,     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,     1,     2,     3,     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,    37,    38,    50};#if YYDEBUG != 0static const short yyprhs[] = {     0,     0,     4,     6,     9,    11,    14,    15,    19,    20,    24,    27,    30,    33,    35,    38,    41,    43,    45,    47,    49,    51,    52,    60,    65,    67,    71,    72,    77,    83,    88,    90,    93,    95,    98,   100,   103,   106,   109,   113,   115,   122,   131,   140,   151,   161,   164,   167,   174,   179,   183,   187,   188,   193,   200,   203,   205,   207,   214,   224,   226,   229,   230,   232,   233,   236,   237,   240,   243,   246,   247,   249,   251,   255,   257,   260,   264,   265,   267,   268,   270,   272,   276,   278,   281,   285,   289,   290,   292,   294,   298,   300,   303,   307,   311,   312,   317,   323,   328,   332,   336,   340,   344,   346,   349,   353,   357,   361,   365,   371,   373,   376,   377,   382,   386,   390,   394,   396,   399,   403,   407,   411,   417,   419,   422,   424,   428,   432,   436,   440,   444,   448,   451,   454,   457,   461,   466,   471,   473,   478,   480,   483,   486,   488,   490,   493,   496,   497,   499,   501,   506,   509,   512,   515,   517,   518,   520,   522};#endifstatic const short yyrhs[] = {    82,    62,    82,     0,    63,     0,    62,    63,     0,     1,     0,    62,     1,     0,     0,    15,    64,    74,     0,     0,    16,    65,    74,     0,    15,    76,     0,    16,    76,     0,    71,    74,     0,    74,     0,    71,    76,     0,    68,    70,     0,     4,     0,     3,     0,    67,     0,    37,     0,    38,     0,     0,    30,    69,    66,    53,    85,   102,    82,     0,   100,    75,   101,   103,     0,    92,     0,    92,   105,    92,     0,     0,    47,    73,     5,    47,     0,   100,    75,   101,   103,    82,     0,   100,   101,   103,    82,     0,    77,     0,    75,    77,     0,     1,     0,    75,     1,     0,    81,     0,   104,    82,     0,   104,    82,     0,   100,   101,     0,   100,    75,   101,     0,    80,     0,    21,    53,    92,   102,    82,    77,     0,    22,    82,    77,    21,    53,    92,   102,    82,     0,    23,    53,     4,    32,     4,   102,    82,    77,     0,    23,    53,    87,   104,    92,   104,    87,   102,    82,    77,     0,    23,    53,    87,   104,   104,    87,   102,    82,    77,     0,    24,    76,     0,    25,    76,     0,    79,    53,    91,   102,    84,    76,     0,    79,    88,    84,    76,     0,    28,    87,    76,     0,    29,    87,    76,     0,     0,    19,    78,    87,    76,     0,    20,     4,    55,    91,    56,    76,     0,    92,    76,     0,    26,     0,    27,     0,    17,    53,    92,   102,    82,    77,     0,    17,    53,    92,   102,    82,    77,    18,    82,    77,     0,    13,     0,    81,    13,     0,     0,    81,     0,     0,    41,    96,     0,     0,    42,    92,     0,    10,    92,     0,    43,    92,     0,     0,    86,     0,     4,     0,    86,   105,     4,     0,     1,     0,    86,     1,     0,    86,   105,     1,     0,     0,    92,     0,     0,    89,     0,    94,     0,    89,   105,    94,     0,     1,     0,    89,     1,     0,    89,     1,    94,     0,    89,   105,     1,     0,     0,    91,     0,    92,     0,    91,   105,    92,     0,     1,     0,    91,     1,     0,    91,     1,    92,     0,    91,   105,     1,     0,     0,    99,    11,    93,    92,     0,    53,    91,   102,    32,     4,     0,    92,    43,    31,    98,     0,    31,    98,    83,     0,    92,    33,    92,     0,    92,    34,    92,     0,    92,    12,    92,     0,    72,     0,    49,    72,     0,    92,    32,     4,     0,    92,     9,    92,     0,    92,    41,    92,     0,    92,    42,    92,     0,    92,    39,    92,    40,    92,     0,    96,     0,    92,    96,     0,     0,    99,    11,    95,    94,     0,    94,    33,    94,     0,    94,    34,    94,     0,    31,    98,    83,     0,    72,     0,    49,    72,     0,    94,    12,    94,     0,    94,    32,     4,     0,    94,     9,    94,     0,    94,    39,    94,    40,    94,     0,    96,     0,    94,    96,     0,    97,     0,    96,    51,    96,     0,    96,    46,    96,     0,    96,    47,    96,     0,    96,    48,    96,     0,    96,    44,    96,     0,    96,    45,    96,     0,    99,    35,     0,    99,    36,     0,    49,    96,     0,    53,    92,   102,     0,    37,    53,    90,   102,     0,    38,    53,    90,   102,     0,    38,     0,     3,    53,    90,   102,     0,    99,     0,    35,    99,     0,    36,    99,     0,     7,     0,     8,     0,    45,    96,     0,    44,    96,     0,     0,    99,     0,     4,     0,     4,    55,    91,    56,     0,    52,    97,     0,    57,    82,     0,    58,    82,     0,    54,     0,     0,   104,     0,    59,     0,    60,    82,     0};#if YYDEBUG != 0static const short yyrline[] = { 0,   133,   138,   146,   162,   163,   167,   169,   183,   185,   199,   205,   211,   213,   215,   228,   237,   239,   241,   251,   252,   256,   260,   268,   277,   279,   288,   290,   308,   310,   315,   317,   325,   327,   332,   333,   337,   339,   341,   343,   345,   347,   349,   354,   358,   363,   366,   369,   371,   382,   400,   402,   404,   406,   408,   413,   415,   420,   425,   432,   434,   438,   439,   443,   445,   450,   452,   454,   456,   461,   463,   468,   470,   472,   474,   476,   482,   484,   489,   491,   496,   498,   504,   506,   508,   510,   515,   517,   522,   524,   530,   532,   534,   536,   541,   544,   549,   551,   556,   562,   564,   566,   572,   574,   582,   584,   590,   592,   594,   596,   598,   603,   606,   607,   609,   611,   617,   619,   621,   623,   625,   627,   629,   631,   636,   638,   640,   642,   644,   646,   648,   650,   652,   657,   659,   661,   664,   666,   674,   678,   679,   681,   683,   685,   688,   695,   700,   702,   707,   709,   717,   722,   726,   730,   734,   735,   739,   742};static const char * const yytname[] = {   "$","error","$illegal.","FUNC_CALL","NAME","REGEXP","ERROR","YNUMBER","YSTRING","RELOP","APPEND_OP","ASSIGNOP","MATCHOP","NEWLINE","CONCAT_OP","LEX_BEGIN","LEX_END","LEX_IF","LEX_ELSE","LEX_RETURN","LEX_DELETE","LEX_WHILE","LEX_DO","LEX_FOR","LEX_BREAK","LEX_CONTINUE","LEX_PRINT","LEX_PRINTF","LEX_NEXT","LEX_EXIT","LEX_FUNCTION","LEX_GETLINE","LEX_IN","LEX_AND","LEX_OR","INCREMENT","DECREMENT","LEX_BUILTIN","LEX_LENGTH","'?'","':'","'<'","'>'","'|'","'+'","'-'","'*'","'/'","'%'","'!'","UNARY","'^'","'$'","'('","')'","'['","']'","'{'","'}'","';'","','","start","program","rule","@1","@2","func_name","lex_builtin","function_prologue","@3","function_body","pattern","regexp","@4","action","statements","statement_term","statement","@5","print","if_statement","nls","opt_nls","input_redir","output_redir","opt_param_list","param_list","opt_exp","opt_rexpression_list","rexpression_list","opt_expression_list","expression_list","exp","@6","rexp","@7","simp_exp","non_post_simp_exp","opt_variable","variable","l_brace","r_brace","r_paren","opt_semi","semi","comma",""};#endifstatic const short yyr1[] = {     0,    61,    62,    62,    62,    62,    64,    63,    65,    63,    63,    63,    63,    63,    63,    63,    66,    66,    66,    67,    67,    69,    68,    70,    71,    71,    73,    72,    74,    74,    75,    75,    75,    75,    76,    76,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    77,    78,    77,    77,    77,    79,    79,    80,    80,    81,    81,    82,    82,    83,    83,    84,    84,    84,    84,    85,    85,    86,    86,    86,    86,    86,    87,    87,    88,    88,    89,    89,    89,    89,    89,    89,    90,    90,    91,    91,    91,    91,    91,    91,    93,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    92,    95,    94,    94,    94,    94,    94,    94,    94,    94,    94,    94,    94,    94,    96,    96,    96,    96,    96,    96,    96,    96,    96,    97,    97,    97,    97,    97,    97,    97,    97,    97,    97,    97,    97,    97,    98,    98,    99,    99,    99,   100,   101,   102,   103,   103,   104,   105};static const short yyr2[] = {     0,     3,     1,     2,     1,     2,     0,     3,     0,     3,     2,     2,     2,     1,     2,     2,     1,     1,     1,     1,     1,     0,     7,     4,     1,     3,     0,     4,     5,     4,     1,     2,     1,     2,     1,     2,     2,     2,     3,     1,     6,     8,     8,    10,     9,     2,     2,     6,     4,     3,     3,     0,     4,     6,     2,     1,     1,     6,     9,     1,     2,     0,     1,     0,     2,     0,     2,     2,     2,     0,     1,     1,     3,     1,     2,     3,     0,     1,     0,     1,     1,     3,     1,     2,     3,     3,     0,     1,     1,     3,     1,     2,     3,     3,     0,     4,     5,     4,     3,     3,     3,     3,     1,     2,     3,     3,     3,     3,     5,     1,     2,     0,     4,     3,     3,     3,     1,     2,     3,     3,     3,     5,     1,     2,     1,     3,     3,     3,     3,     3,     3,     2,     2,     2,     3,     4,     4,     1,     4,     1,     2,     2,     1,     1,     2,     2,     0,     1,     1,     4,     2,     2,     2,     1,     0,     1,     1,     2};static const short yydefact[] = {    61,    59,    62,     0,    60,     4,     0,   148,   142,   143,     6,     8,    21,   146,     0,     0,     0,   137,     0,     0,    26,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -