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

📄 oaaprologparser.java

📁 SRI international 发布的OAA框架软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				astFactory.addASTChild(currentAST, returnAST);
			}
			else {
				break _loop43;
			}
			
		} while (true);
		}
		colonExpression_AST = (AST)currentAST.root;
		returnAST = colonExpression_AST;
	}
	
	public final void plusMinusExpression() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST plusMinusExpression_AST = null;
		
		multiplicativeExpression();
		astFactory.addASTChild(currentAST, returnAST);
		{
		_loop47:
		do {
			if ((LA(1)==PLUS||LA(1)==MINUS)) {
				{
				switch ( LA(1)) {
				case PLUS:
				{
					IclASTStruct tmp30_AST = null;
					tmp30_AST = new IclASTStruct(LT(1));
					astFactory.makeASTRoot(currentAST, tmp30_AST);
					match(PLUS);
					break;
				}
				case MINUS:
				{
					IclASTStruct tmp31_AST = null;
					tmp31_AST = new IclASTStruct(LT(1));
					astFactory.makeASTRoot(currentAST, tmp31_AST);
					match(MINUS);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				multiplicativeExpression();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else {
				break _loop47;
			}
			
		} while (true);
		}
		plusMinusExpression_AST = (AST)currentAST.root;
		returnAST = plusMinusExpression_AST;
	}
	
	public final void multiplicativeExpression() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST multiplicativeExpression_AST = null;
		
		unaryExpression();
		astFactory.addASTChild(currentAST, returnAST);
		{
		_loop51:
		do {
			if ((LA(1)==STAR||LA(1)==DIV)) {
				{
				switch ( LA(1)) {
				case STAR:
				{
					IclASTStruct tmp32_AST = null;
					tmp32_AST = new IclASTStruct(LT(1));
					astFactory.makeASTRoot(currentAST, tmp32_AST);
					match(STAR);
					break;
				}
				case DIV:
				{
					IclASTStruct tmp33_AST = null;
					tmp33_AST = new IclASTStruct(LT(1));
					astFactory.makeASTRoot(currentAST, tmp33_AST);
					match(DIV);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				unaryExpression();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else {
				break _loop51;
			}
			
		} while (true);
		}
		multiplicativeExpression_AST = (AST)currentAST.root;
		returnAST = multiplicativeExpression_AST;
	}
	
	public final void unaryExpression() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST unaryExpression_AST = null;
		int sign = 1;
		
		if ((_tokenSet_0.member(LA(1))) && (LA(2)==LPAREN)) {
			normalStruct();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==ICLDATAQ_LITERAL) && (LA(2)==LPAREN)) {
			icldataqStruct();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==PLUS) && (LA(2)==NUM_INT)) {
			LT(1);
			match(PLUS);
			IclASTInt tmp35_AST = null;
			tmp35_AST = new IclASTInt(LT(1));
			astFactory.makeASTRoot(currentAST, tmp35_AST);
			match(NUM_INT);
			currentAST.root.setType(INT);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==PLUS) && (LA(2)==NUM_FLOAT)) {
			LT(1);
			match(PLUS);
			IclASTFloat tmp37_AST = null;
			tmp37_AST = new IclASTFloat(LT(1));
			astFactory.makeASTRoot(currentAST, tmp37_AST);
			match(NUM_FLOAT);
			currentAST.root.setType(FLOAT);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==MINUS) && (LA(2)==NUM_INT)) {
			LT(1);
			match(MINUS);
			sign = -1;
			IclASTInt tmp39_AST = null;
			tmp39_AST = new IclASTInt(LT(1));
			astFactory.makeASTRoot(currentAST, tmp39_AST);
			match(NUM_INT);
			currentAST.root.setType(INT); ((IclASTInt)(currentAST.root)).setSign(sign);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==MINUS) && (LA(2)==NUM_FLOAT)) {
			LT(1);
			match(MINUS);
			sign = -1;
			IclASTFloat tmp41_AST = null;
			tmp41_AST = new IclASTFloat(LT(1));
			astFactory.makeASTRoot(currentAST, tmp41_AST);
			match(NUM_FLOAT);
			currentAST.root.setType(FLOAT);((IclASTFloat)(currentAST.root)).setSign(sign);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==PLUS) && (_tokenSet_1.member(LA(2)))) {
			IclASTStruct tmp42_AST = null;
			tmp42_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp42_AST);
			match(PLUS);
			unaryExpression();
			astFactory.addASTChild(currentAST, returnAST);
			currentAST.root.setType(STRUCT);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((LA(1)==MINUS) && (_tokenSet_1.member(LA(2)))) {
			IclASTStruct tmp43_AST = null;
			tmp43_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp43_AST);
			match(MINUS);
			unaryExpression();
			astFactory.addASTChild(currentAST, returnAST);
			currentAST.root.setType(STRUCT);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) {
			unaryExpressionNotPlusMinus();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpression_AST = (AST)currentAST.root;
		}
		else {
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		returnAST = unaryExpression_AST;
	}
	
	public final void normalStruct() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST normalStruct_AST = null;
		
		{
		switch ( LA(1)) {
		case BANG:
		{
			IclASTStruct tmp44_AST = null;
			tmp44_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp44_AST);
			match(BANG);
			break;
		}
		case SEMI:
		{
			IclASTStruct tmp45_AST = null;
			tmp45_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp45_AST);
			match(SEMI);
			break;
		}
		case STRING_LITERAL:
		{
			IclASTStruct tmp46_AST = null;
			tmp46_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp46_AST);
			match(STRING_LITERAL);
			break;
		}
		case SPECIAL_CHAR_LITERAL:
		{
			IclASTStruct tmp47_AST = null;
			tmp47_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp47_AST);
			match(SPECIAL_CHAR_LITERAL);
			break;
		}
		case IDENT:
		{
			IclASTStruct tmp48_AST = null;
			tmp48_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp48_AST);
			match(IDENT);
			break;
		}
		case PLUS:
		{
			IclASTStruct tmp49_AST = null;
			tmp49_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp49_AST);
			match(PLUS);
			break;
		}
		case MINUS:
		{
			IclASTStruct tmp50_AST = null;
			tmp50_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp50_AST);
			match(MINUS);
			break;
		}
		case STAR:
		{
			IclASTStruct tmp51_AST = null;
			tmp51_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp51_AST);
			match(STAR);
			break;
		}
		case DIV:
		{
			IclASTStruct tmp52_AST = null;
			tmp52_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp52_AST);
			match(DIV);
			break;
		}
		case EQUAL:
		{
			IclASTStruct tmp53_AST = null;
			tmp53_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp53_AST);
			match(EQUAL);
			break;
		}
		case TURNSTILE:
		{
			IclASTStruct tmp54_AST = null;
			tmp54_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp54_AST);
			match(TURNSTILE);
			break;
		}
		case COLON:
		{
			IclASTStruct tmp55_AST = null;
			tmp55_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp55_AST);
			match(COLON);
			break;
		}
		case DBL_COLON:
		{
			IclASTStruct tmp56_AST = null;
			tmp56_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp56_AST);
			match(DBL_COLON);
			break;
		}
		case BACKSLASH:
		{
			IclASTStruct tmp57_AST = null;
			tmp57_AST = new IclASTStruct(LT(1));
			astFactory.makeASTRoot(currentAST, tmp57_AST);
			match(BACKSLASH);
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		LT(1);
		match(LPAREN);
		commaSeparatedStructs();
		astFactory.addASTChild(currentAST, returnAST);
		LT(1);
		match(RPAREN);
		currentAST.root.setType(STRUCT);
		normalStruct_AST = (AST)currentAST.root;
		returnAST = normalStruct_AST;
	}
	
	public final void unaryExpressionNotPlusMinus() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST unaryExpressionNotPlusMinus_AST = null;
		
		switch ( LA(1)) {
		case LBRACK:
		{
			list();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		case LBRACE:
		case LPAREN:
		{
			group();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		case VARIABLE:
		{
			var();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		case NUM_INT:
		{
			IclASTInt tmp60_AST = null;
			tmp60_AST = new IclASTInt(LT(1));
			astFactory.addASTChild(currentAST, tmp60_AST);
			match(NUM_INT);
			currentAST.root.setType(INT);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		case NUM_FLOAT:
		{
			IclASTFloat tmp61_AST = null;
			tmp61_AST = new IclASTFloat(LT(1));
			astFactory.addASTChild(currentAST, tmp61_AST);
			match(NUM_FLOAT);
			currentAST.root.setType(FLOAT);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		case TERM_LITERAL:
		case ICLDATAQ_LITERAL:
		case TURNSTILE:
		case SEMI:
		case EQUAL:
		case PLUS:
		case MINUS:
		case STAR:
		case DIV:
		case BANG:
		case STRING_LITERAL:
		case SPECIAL_CHAR_LITERAL:
		case IDENT:
		{
			str();
			astFactory.addASTChild(currentAST, returnAST);
			unaryExpressionNotPlusMinus_AST = (AST)currentAST.root;
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		returnAST = unaryExpressionNotPlusMinus_AST;
	}
	
	public final void str() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST str_AST = null;
		
		switch ( LA(1)) {
		case BANG:
		{
			IclASTStr tmp62_AST = null;
			tmp62_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp62_AST);
			match(BANG);
			str_AST = (AST)currentAST.root;
			break;
		}
		case SEMI:
		{
			IclASTStr tmp63_AST = null;
			tmp63_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp63_AST);
			match(SEMI);
			str_AST = (AST)currentAST.root;
			break;
		}
		case STRING_LITERAL:
		{
			IclASTStr tmp64_AST = null;
			tmp64_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp64_AST);
			match(STRING_LITERAL);
			str_AST = (AST)currentAST.root;
			break;
		}
		case SPECIAL_CHAR_LITERAL:
		{
			IclASTStr tmp65_AST = null;
			tmp65_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp65_AST);
			match(SPECIAL_CHAR_LITERAL);
			str_AST = (AST)currentAST.root;
			break;
		}
		case STAR:
		{
			IclASTStr tmp66_AST = null;
			tmp66_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp66_AST);
			match(STAR);
			str_AST = (AST)currentAST.root;
			break;
		}
		case PLUS:
		{
			IclASTStr tmp67_AST = null;
			tmp67_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp67_AST);
			match(PLUS);
			str_AST = (AST)currentAST.root;
			break;
		}
		case MINUS:
		{
			IclASTStr tmp68_AST = null;
			tmp68_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp68_AST);
			match(MINUS);
			str_AST = (AST)currentAST.root;
			break;
		}
		case DIV:
		{
			IclASTStr tmp69_AST = null;
			tmp69_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp69_AST);
			match(DIV);
			str_AST = (AST)currentAST.root;
			break;
		}
		case EQUAL:
		{
			IclASTStr tmp70_AST = null;
			tmp70_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp70_AST);
			match(EQUAL);
			str_AST = (AST)currentAST.root;
			break;
		}
		case TURNSTILE:
		{
			IclASTStr tmp71_AST = null;
			tmp71_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp71_AST);
			match(TURNSTILE);
			str_AST = (AST)currentAST.root;
			break;
		}
		case IDENT:
		{
			IclASTStr tmp72_AST = null;
			tmp72_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp72_AST);
			match(IDENT);
			str_AST = (AST)currentAST.root;
			break;
		}
		case TERM_LITERAL:
		{
			IclASTStr tmp73_AST = null;
			tmp73_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp73_AST);
			match(TERM_LITERAL);
			str_AST = (AST)currentAST.root;
			break;
		}
		case ICLDATAQ_LITERAL:
		{
			IclASTStr tmp74_AST = null;
			tmp74_AST = new IclASTStr(LT(1));
			astFactory.addASTChild(currentAST, tmp74_AST);
			match(ICLDATAQ_LITERAL);
			currentAST.root.setType(STR);
			str_AST = (AST)currentAST.root;
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		returnAST = str_AST;
	}
	
	public final void icldataqShortStruct() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST icldataqShortStruct_AST = null;
		
		IclASTDataQ tmp75_AST = null;
		tmp75_AST = new IclASTDataQ(LT(1));
		astFactory.makeASTRoot(currentAST, tmp75_AST);
		match(DBLQUOTED);
		currentAST.root.setType(ICLDATAQ);
		icldataqShortStruct_AST = (AST)currentAST.root;
		returnAST = icldataqShortStruct_AST;
	}
	
	public final void icldataqLongStruct() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST icldataqLongStruct_AST = null;
		Token  rawlen = null;
		AST rawlen_AST = null;
		Token  numquotes = null;
		AST numquotes_AST = null;
		
		rawlen = LT(1);
		rawlen_AST = (AST)astFactory.create(rawlen);
		match(NUM_INT);
		LT(1);
		match(COMMA);
		numquotes = LT(1);
		numquotes_AST = (AST)astFactory.create(numquotes);
		match(NUM_INT);
		LT(1);
		match(COMMA);
		IclASTDataQ tmp78_AST = null;
		tmp78_AST = new IclASTDataQ(LT(1));
		astFactory.makeASTRoot(currentAST, tmp78_AST);
		match(DBLQUOTED);
		currentAST.root.setType(ICLDATAQ); ((IclASTDataQ)(currentAST.root)).setRawLen(rawlen); ((IclASTDataQ)(currentAST.root)).setNumQuotes(numquotes);
		icldataqLongStruct_AST = (AST)currentAST.root;
		returnAST = icldataqLongStruct_AST;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"GROUP",
		"LIST",
		"VAR",
		"STRUCT",
		"ICLDATAQ",
		"STR",
		"INT",
		"FLOAT",
		"DOT",
		"\"term\"",
		"\").\"",
		"\"icldataq\"",
		",",
		"|",
		"{",
		"}",
		"(",
		")",
		"[",
		"]",
		"variable",
		"TURNSTILE",
		";",
		"BACKSLASH",
		"EQUAL",
		"COLON",
		"DBL_COLON",
		"PLUS",
		"MINUS",
		"STAR",
		"DIV",
		"number",
		"NUM_FLOAT",
		"double quoted data",
		"!",
		"string literal",
		"special character literal",
		"atom",
		"\\\"",
		"~",
		"WS",
		"exponent",
		"signed exponent"
	};
	
	private static final long _tokenSet_0_data_[] = { 4157494788096L, 0L };
	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
	private static final long _tokenSet_1_data_[] = { 4260596326400L, 0L };
	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
	private static final long _tokenSet_2_data_[] = { 4258851495936L, 0L };
	public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
	private static final long _tokenSet_3_data_[] = { 4260607537154L, 0L };
	public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
	
	}

⌨️ 快捷键说明

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