📄 parser.c
字号:
/*Copyright (c) 2000, Red Hat, Inc.This file is part of Source-Navigator.Source-Navigator is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License as publishedby the Free Software Foundation; either version 2, or (at your option)any later version.Source-Navigator is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith Source-Navigator; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330, Boston,MA 02111-1307, USA.*//* $Id: Parser.c,v 1.1.1.1 2002/04/18 23:41:53 mdejong Exp $ */#include "Parser.h"#ifdef __cplusplusextern "C" {#include "Reuse.h"#include "rMemory.h"#include "General.h"#include "DynArray.h"#ifndef NO_RECOVER#include "Sets.h"#endif#if ! defined NO_RECOVER | defined YYReParse#include "Errors.h"#endif#if defined YYDEBUG | defined lex_interface#include "Position.h"#endif#include <stdio.h>#include <string.h>}#else#include "Reuse.h"#include "rMemory.h"#include "General.h"#include "DynArray.h"#ifndef NO_RECOVER#include "Sets.h"#endif#if ! defined NO_RECOVER | defined YYReParse#include "Errors.h"#endif#if defined YYDEBUG | defined lex_interface#include "Position.h"#endif#include <stdio.h>#endif#ifdef lex_interface#define GetToken yylex extern int yylex ARGS ((void));#ifndef AttributeDef#include "Position.h" typedef struct { tPosition Position; } tScanAttribute; tScanAttribute Attribute = {{ 0, 0 }};#endif#ifndef ErrorAttributeDef#define ErrorAttribute(Token, RepairAttribute)#endif#ifndef yyGetAttribute#define yyGetAttribute(yyAttrStackPtr, a) * yyAttrStackPtr = yylval#endif#else#include "Scanner.h"#ifndef yyGetAttribute#define yyGetAttribute(yyAttrStackPtr, a) (yyAttrStackPtr)->Scan = a#endif#endiftypedef unsigned short yyStateRange ;typedef unsigned short yySymbolRange ;typedef struct { yyStateRange Check, Next; } yytComb;typedef enum {yyNT0_intern = 105,yyNTGoal = 106,yyNTType = 107,yyNTPrimitiveType = 108,yyNTReferenceType = 109,yyNTClassOrInterfaceType = 110,yyNTClassType = 111,yyNTInterfaceType = 112,yyNTArrayType = 113,yyNTName = 114,yyNTCompilationUnit = 115,yyNTImportDeclarations = 116,yyNTTypeDeclarations = 117,yyNTPackageDeclaration = 118,yyNTImportDeclaration = 119,yyNTTypeDeclaration = 120,yyNTModifiers = 121,yyNTModifier = 122,yyNTClassDeclaration = 123,yyNTxx_ClassDeclaration_1_3 = 124,yyNTxx_ClassDeclaration_2_4 = 125,yyNTSuper = 126,yyNTInterfaces = 127,yyNTInterfaceTypeList = 128,yyNTClassBody = 129,yyNTClassBodyDeclarations = 130,yyNTClassBodyDeclaration = 131,yyNTget_type_1 = 132,yyNTget_type_2 = 133,yyNTFieldDeclaration = 134,yyNTVariableDeclarators = 135,yyNTVariableDeclarator = 136,yyNTVariableDeclaratorId = 137,yyNTLocalVariableDeclaration = 138,yyNTxx_LocalVariableDeclaration_1_2 = 139,yyNTxx_LocalVariableDeclaration_2_3 = 140,yyNTLocalVariableDeclarators = 141,yyNTLocalVariableDeclarator = 142,yyNTMethodDeclaration = 143,yyNTMethodHeader = 144,yyNTMethodDeclarator = 145,yyNTMethodBody = 146,yyNTFormalParameterListOpt = 147,yyNTFormalParameterList = 148,yyNTFormalParameter = 149,yyNTThrowsOpt = 150,yyNTClassTypeList = 151,yyNTClassInitializer = 152,yyNTConstructorDeclaration = 153,yyNTConstructorDeclarator = 154,yyNTConstructorBody = 155,yyNTExplicitConstructorInvocation = 156,yyNTInterfaceDeclaration = 157,yyNTxx_InterfaceDeclaration_1_3 = 158,yyNTxx_InterfaceDeclaration_2_4 = 159,yyNTExtendsInterfacesOpt = 160,yyNTExtendsInterfaces = 161,yyNTInterfaceBody = 162,yyNTInterfaceMemberDeclarations = 163,yyNTInterfaceMemberDeclaration = 164,yyNTVariableInitializerOpt = 165,yyNTVariableInitializer = 166,yyNTArrayInitializer = 167,yyNTVariableInitializersOpt = 168,yyNTVariableInitializers = 169,yyNTCommaOpt = 170,yyNTArrayInitializerOpt = 171,yyNTBlock = 172,yyNTBlockStatements = 173,yyNTBlockStatement = 174,yyNTStatement = 175,yyNTStatementNoShortIf = 176,yyNTStatementWithoutTrailingSubstatement = 177,yyNTStatementExpression = 178,yyNTSwitchBlock = 179,yyNTSwitchBlockStatementGroups = 180,yyNTSwitchBlockStatementGroup = 181,yyNTSwitchLabels = 182,yyNTSwitchLabel = 183,yyNTForInit = 184,yyNTExpressionOpt = 185,yyNTForUpdate = 186,yyNTStatementExpressionList = 187,yyNTCatchesOpt = 188,yyNTCatches = 189,yyNTCatchClause = 190,yyNTFinally = 191,yyNTPrimary = 192,yyNTxx_Primary_13_6 = 193,yyNTPrimaryNoNewArray = 194,yyNTClassInstanceCreationExpression = 195,yyNTFieldAccess = 196,yyNTMethodInvocation = 197,yyNTArrayAccess = 198,yyNTDimExprs = 199,yyNTDimExpr = 200,yyNTDims = 201,yyNTArgumentListOpt = 202,yyNTArgumentList = 203,yyNTcExpression = 204,yyNTExpression = 205,yyNTAssignment = 206,yyNTLeftHandSide = 207,yyNTAssignmentOperator = 208} yytNonterminal;typedef struct { short yyMode; rbool yyActions, yyMessages; } yytControl;static yytControl yyControl = { 0, rtrue, rtrue }; rbool Parser_Debug = rfalse;#define yyFirstTerminal 0#define yyLastTerminal 104#define yySetSize 105#define yyFirstSymbol 0#define yyLastSymbol 208#define yyTTableMax 3769#define yyNTableMax 513#define yyStartState 1#define yyFirstReadState 1#define yyLastReadState 407#define yyFirstReadReduceState 408#define yyLastReadReduceState 492#define yyFirstReduceState 493#define yyLastReduceState 836#define yyLastState 836#define yyLastStopState 493#define YYTDefault#define YYNDefault#define yyFirstFinalState yyFirstReadReduceState#define ErrorMessages(Messages) yyControl.yyMessages = Messages#define SemActions(Actions) yyControl.yyActions = Actions#ifdef YYGetLook#define GetLookahead(k) yyGetLookahead ((k) - 1, yyTerminal)#define GetAttribute(k, a) xxGetAttribute ((k) - 1, yyTerminal, a)static int yyGetLookahead ARGS ((int yyk, yySymbolRange yyToken));static void xxGetAttribute ARGS ((int yyk, yySymbolRange yyToken, tScanAttribute * yyAttribute));#endif/* line 19 "Parser.lrk" */#include "stdlib.h"#include "StringM.h"#include "Tree.h"#include "Eval.h"#include "Trafo.h"#include "deftab.h"#include "sn.h"#define NIL (char *) NULLextern FILE * cross_ref_fp; FILE * yyin; FILE * hlfp; int hl; char * current_file; tIdent i_anonymous;static tString current_ident, current_class;static char current_string [256];static char ret_buffer [1024];static char arg_types_buffer [1024];static char args_buffer [1024];static unsigned long current_attr;static tTree current_type;#define SHARE#ifdef SHAREstatic tTree snocatch , snodecl , snoexpression , snoexpression_l , snofield , snoimport , snostatement ,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -