nescparser.java

来自「plugin for eclipse」· Java 代码 · 共 2,369 行 · 第 1/5 页

JAVA
2,369
字号
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_13);
			} else {
			  throw ex;
			}
		}
		returnAST = interfaceDescriptionItem_AST;
	}
	
	public final void declaration() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode declaration_AST = null;
		TNode ds_AST = null;
		AST ds1 = null;
		
		try {      // for error handling
			declSpecifiers();
			ds_AST = (TNode)returnAST;
			astFactory.addASTChild(currentAST, returnAST);
			if ( inputState.guessing==0 ) {
				ds1 = astFactory.dupList(ds_AST);
			}
			{
			switch ( LA(1)) {
			case ID:
			case STAR:
			case LPAREN:
			{
				initDeclList(ds1);
				astFactory.addASTChild(currentAST, returnAST);
				break;
			}
			case SEMI:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			{
			int _cnt3064=0;
			_loop3064:
			do {
				if ((LA(1)==SEMI) && (_tokenSet_14.member(LA(2)))) {
					TNode tmp23_AST = null;
					tmp23_AST = (TNode)astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp23_AST);
					match(SEMI);
				}
				else {
					if ( _cnt3064>=1 ) { break _loop3064; } else {throw new NoViableAltException(LT(1), getFilename());}
				}
				
				_cnt3064++;
			} while (true);
			}
			if ( inputState.guessing==0 ) {
				declaration_AST = (TNode)currentAST.root;
				declaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclaration)).add(declaration_AST));
				currentAST.root = declaration_AST;
				currentAST.child = declaration_AST!=null &&declaration_AST.getFirstChild()!=null ?
					declaration_AST.getFirstChild() : declaration_AST;
				currentAST.advanceChildToEnd();
			}
			declaration_AST = (TNode)currentAST.root;
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_14);
			} else {
			  throw ex;
			}
		}
		returnAST = declaration_AST;
	}
	
	public final void interfaceIdentifier() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode interfaceIdentifier_AST = null;
		Token  i = null;
		TNode i_AST = null;
		Token  r = null;
		TNode r_AST = null;
		
		try {      // for error handling
			i = LT(1);
			i_AST = (TNode)astFactory.create(i);
			astFactory.makeASTRoot(currentAST, i_AST);
			match(ID);
			{
			switch ( LA(1)) {
			case LITERAL_as:
			{
				TNode tmp24_AST = null;
				tmp24_AST = (TNode)astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp24_AST);
				match(LITERAL_as);
				r = LT(1);
				r_AST = (TNode)astFactory.create(r);
				astFactory.addASTChild(currentAST, r_AST);
				match(ID);
				break;
			}
			case SEMI:
			case LBRACKET:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			if ( inputState.guessing==0 ) {
				interfaceIdentifier_AST = (TNode)currentAST.root;
				
						String inputFileName = i.getText()+".nc";			
				
						AST interfaceFileAST = null;
				
						ParserMessage container = new ParserMessage(ParserMessage.INFO, "Interface file: "+inputFileName, new CodeLocation((CToken)i), null);
						getParserContext().addMsg(container);
						getParserContext().pushMessages(container);
						try {
							interfaceFileAST = getParserContext().getAST(inputFileName);
							// add its AST as an attribute to the file name ID node
							interfaceIdentifier_AST.setAttribute("interfaceFileAST", interfaceFileAST);
				
						} catch(ParserMessage m) {
							getParserContext().addMsg(m);		
						} finally {
							getParserContext().popMessages();				
						}
				
				
				
			}
			interfaceIdentifier_AST = (TNode)currentAST.root;
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_15);
			} else {
			  throw ex;
			}
		}
		returnAST = interfaceIdentifier_AST;
	}
	
	public final void interfaceParameters() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode interfaceParameters_AST = null;
		
		try {      // for error handling
			TNode tmp25_AST = null;
			tmp25_AST = (TNode)astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp25_AST);
			match(LBRACKET);
			parameterTypeList();
			astFactory.addASTChild(currentAST, returnAST);
			TNode tmp26_AST = null;
			tmp26_AST = (TNode)astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp26_AST);
			match(RBRACKET);
			interfaceParameters_AST = (TNode)currentAST.root;
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_5);
			} else {
			  throw ex;
			}
		}
		returnAST = interfaceParameters_AST;
	}
	
	public final void parameterTypeList() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode parameterTypeList_AST = null;
		
		try {      // for error handling
			parameterDeclaration();
			astFactory.addASTChild(currentAST, returnAST);
			{
			_loop3046:
			do {
				if ((LA(1)==SEMI||LA(1)==COMMA) && (_tokenSet_7.member(LA(2)))) {
					{
					switch ( LA(1)) {
					case COMMA:
					{
						TNode tmp27_AST = null;
						tmp27_AST = (TNode)astFactory.create(LT(1));
						astFactory.addASTChild(currentAST, tmp27_AST);
						match(COMMA);
						break;
					}
					case SEMI:
					{
						TNode tmp28_AST = null;
						tmp28_AST = (TNode)astFactory.create(LT(1));
						astFactory.addASTChild(currentAST, tmp28_AST);
						match(SEMI);
						break;
					}
					default:
					{
						throw new NoViableAltException(LT(1), getFilename());
					}
					}
					}
					parameterDeclaration();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop3046;
				}
				
			} while (true);
			}
			{
			if ((LA(1)==SEMI||LA(1)==COMMA) && (LA(2)==VARARGS)) {
				{
				switch ( LA(1)) {
				case COMMA:
				{
					TNode tmp29_AST = null;
					tmp29_AST = (TNode)astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp29_AST);
					match(COMMA);
					break;
				}
				case SEMI:
				{
					TNode tmp30_AST = null;
					tmp30_AST = (TNode)astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp30_AST);
					match(SEMI);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				TNode tmp31_AST = null;
				tmp31_AST = (TNode)astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp31_AST);
				match(VARARGS);
			}
			else if ((_tokenSet_16.member(LA(1))) && (_tokenSet_17.member(LA(2)))) {
			}
			else {
				throw new NoViableAltException(LT(1), getFilename());
			}
			
			}
			parameterTypeList_AST = (TNode)currentAST.root;
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_16);
			} else {
			  throw ex;
			}
		}
		returnAST = parameterTypeList_AST;
	}
	
	public final void componentList() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode componentList_AST = null;
		
		try {      // for error handling
			TNode tmp32_AST = null;
			tmp32_AST = (TNode)astFactory.create(LT(1));
			astFactory.makeASTRoot(currentAST, tmp32_AST);
			match(LITERAL_components);
			aliasedComponentName();
			astFactory.addASTChild(currentAST, returnAST);
			{
			_loop2895:
			do {
				if ((LA(1)==COMMA)) {
					match(COMMA);
					aliasedComponentName();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop2895;
				}
				
			} while (true);
			}
			{
			int _cnt2897=0;
			_loop2897:
			do {
				if ((LA(1)==SEMI)) {
					TNode tmp34_AST = null;
					tmp34_AST = (TNode)astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp34_AST);
					match(SEMI);
				}
				else {
					if ( _cnt2897>=1 ) { break _loop2897; } else {throw new NoViableAltException(LT(1), getFilename());}
				}
				
				_cnt2897++;
			} while (true);
			}
			if ( inputState.guessing==0 ) {
				componentList_AST = (TNode)currentAST.root;
				componentList_AST.setType(NComponentList);
			}
			componentList_AST = (TNode)currentAST.root;
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				recover(ex,_tokenSet_18);
			} else {
			  throw ex;
			}
		}
		returnAST = componentList_AST;
	}
	
	public final void connectionList() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		TNode connectionList_AST = null;
		
		try {      // for error handling
			{
			_loop2909:
			do {
				if ((LA(1)==ID)) {
					{
					boolean synPredMatched2904 = false;
					if (((LA(1)==ID) && (_tokenSet_19.member(LA(2))))) {
						int _m2904 = mark();
						synPredMatched2904 = true;
						inputState.guessing++;
						try {
							{
							endpoint();
							match(ASSIGN);
							}
						}
						catch (RecognitionException pe) {
							synPredMatched2904 = false;
						}
						rewind(_m2904);
inputState.guessing--;
					}
					if ( synPredMatched2904 ) {
						endpoint();
						astFactory.addASTChild(currentAST, returnAST);
						TNode tmp35_AST = null;
						tmp35_AST = (TNode)astFactory.create(LT(1));
						astFactory.addASTChild(currentAST, tmp35_AST);
						match(ASSIGN);
						endpoint();
						astFactory.addASTChild(currentAST, returnAST);
					}
					else {
						boolean synPredMatched2906 = false;
						if (((LA(1)==ID) && (_tokenSet_20.member(LA(2))))) {
							int _m2906 = mark();
							synPredMatched2906 = true;
							inputState.guessing++;
							try {
								{
								endpoint();
								match(PTR);
								}
							}
							catch (RecognitionException pe) {
								synPredMatched2906 = false;
							}
							rewind(_m2906);
inputState.guessing--;
						}
						if ( synPredMatched2906 ) {
							endpoint();
							astFactory.addASTChild(currentAST, returnAST);
							TNode tmp36_AST = null;
							tmp36_AST = (TNode)astFactory.create(LT(1));
							astFactory.addASTChild(currentAST, tmp36_AST);
							match(PTR);
							endpoint();
							astFactory.addASTChild(currentAST, returnAST);
						}
						else if ((LA(1)==ID) && (_tokenSet_21.member(LA(2)))) {
							endpoint();
							astFactory.addASTChild(currentAST, returnAST);
							TNode tmp37_AST = null;
							tmp37_AST = (TNode)astFactory.create(LT(1));
							astFactory.addASTChild(currentAST, tmp37_AST);
							match(BACKPTR);
							endpoint();
							astFactory.addASTChild(currentAST, returnAST);
						}
						else {
							throw new NoViableAltException(LT(1), getFilename());
						}
						}
						}
						{
						int _cnt2908=0;
						_loop2908:
						do {
							if ((LA(1)==SEMI)) {
								TNode tmp38_AST = null;
								tmp38_AST = (TNode)astFactory.create(LT(1));
								astFactory.addASTChild(currentAST, tmp38_AST);
								match(SEMI);
							}
							else {
								if ( _cnt2908>=1 ) { break _loop2908; } else {throw new NoViableAltException(LT(1), getFilename());}
							}
							
							_cnt2908++;
						} while (true);
						}
					}
					else {
						break _loop2909;
					}
					
				} while (true);
				}
				if ( inputState.guessing==0 ) {
					connectionList_AST = (TNode)currentAST.root;
					connectionList_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NConnectionList)).add(connectionList_AST));
					currentAST.root = connectionList_AST;
					currentAST.child = connectionList_AST!=null &&connectionList_AST.getFirstChild()!=null ?
						connectionList_AST.getFirstChild() : connectionList_AST;
					currentAST.advanceChildToEnd();
				}
				connectionList_AST = (TNode)currentAST.root;
			}
			catch (RecognitionException ex) {
				if (inputState.guessing==0) {
					reportError(ex);
					recover(ex,_tokenSet_22);
				} else {
				  throw ex;
				}
			}
			returnAST = connectionList_AST;
		}

⌨️ 快捷键说明

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