All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.hql.testing.internal.GrammarTestParser Maven / Gradle / Ivy

There is a newer version: 1.5.0.Final
Show newest version
// Generated from /home/sanne/workspaces/hibernate/hibernate-jpql-parser/testing/src/main/antlr4-gradle/GrammarTest.g4 by ANTLR 4.0

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2013, Red Hat, Inc. or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Inc.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.hibernate.hql.testing.internal;

import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GrammarTestParser extends Parser {
	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__7=1, T__6=2, T__5=3, T__4=4, T__3=5, T__2=6, T__1=7, T__0=8, TEST_RESULT=9, 
		ID=10, PACKAGE_ID=11, WS=12, TEST_GROUP_NAME=13, STRING_LITERAL=14, AST=15, 
		MULTI_LINE=16, COMMENT=17;
	public static final String[] tokenNames = {
		"", "'@header'", "'package'", "'->'", "'{'", "'gunit'", "':'", 
		"'}'", "';'", "TEST_RESULT", "ID", "PACKAGE_ID", "WS", "TEST_GROUP_NAME", 
		"STRING_LITERAL", "AST", "MULTI_LINE", "COMMENT"
	};
	public static final int
		RULE_grammarTest = 0, RULE_header = 1, RULE_pakkage = 2, RULE_testGroup = 3, 
		RULE_testSubGroup = 4, RULE_test = 5, RULE_statement = 6, RULE_outcome = 7;
	public static final String[] ruleNames = {
		"grammarTest", "header", "pakkage", "testGroup", "testSubGroup", "test", 
		"statement", "outcome"
	};

	@Override
	public String getGrammarFileName() { return "GrammarTest.g4"; }

	@Override
	public String[] getTokenNames() { return tokenNames; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public ATN getATN() { return _ATN; }

	public GrammarTestParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class GrammarTestContext extends ParserRuleContext {
		public TerminalNode ID() { return getToken(GrammarTestParser.ID, 0); }
		public TestGroupContext testGroup(int i) {
			return getRuleContext(TestGroupContext.class,i);
		}
		public List testGroup() {
			return getRuleContexts(TestGroupContext.class);
		}
		public HeaderContext header() {
			return getRuleContext(HeaderContext.class,0);
		}
		public GrammarTestContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_grammarTest; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterGrammarTest(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitGrammarTest(this);
		}
	}

	public final GrammarTestContext grammarTest() throws RecognitionException {
		GrammarTestContext _localctx = new GrammarTestContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_grammarTest);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(16); match(5);
			setState(17); match(ID);
			setState(18); match(8);
			setState(19); header();
			setState(21); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(20); testGroup();
				}
				}
				setState(23); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==ID );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class HeaderContext extends ParserRuleContext {
		public PakkageContext pakkage() {
			return getRuleContext(PakkageContext.class,0);
		}
		public HeaderContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_header; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterHeader(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitHeader(this);
		}
	}

	public final HeaderContext header() throws RecognitionException {
		HeaderContext _localctx = new HeaderContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_header);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(25); match(1);
			setState(26); match(4);
			setState(27); pakkage();
			setState(28); match(7);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class PakkageContext extends ParserRuleContext {
		public TerminalNode PACKAGE_ID() { return getToken(GrammarTestParser.PACKAGE_ID, 0); }
		public PakkageContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_pakkage; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterPakkage(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitPakkage(this);
		}
	}

	public final PakkageContext pakkage() throws RecognitionException {
		PakkageContext _localctx = new PakkageContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_pakkage);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(30); match(2);
			setState(31); match(PACKAGE_ID);
			setState(32); match(8);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class TestGroupContext extends ParserRuleContext {
		public TestSubGroupContext testSubGroup(int i) {
			return getRuleContext(TestSubGroupContext.class,i);
		}
		public List test() {
			return getRuleContexts(TestContext.class);
		}
		public TerminalNode ID() { return getToken(GrammarTestParser.ID, 0); }
		public List testSubGroup() {
			return getRuleContexts(TestSubGroupContext.class);
		}
		public TestContext test(int i) {
			return getRuleContext(TestContext.class,i);
		}
		public TestGroupContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_testGroup; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterTestGroup(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitTestGroup(this);
		}
	}

	public final TestGroupContext testGroup() throws RecognitionException {
		TestGroupContext _localctx = new TestGroupContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_testGroup);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(34); match(ID);
			setState(35); match(6);
			setState(39);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==STRING_LITERAL || _la==MULTI_LINE) {
				{
				{
				setState(36); test();
				}
				}
				setState(41);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			setState(45);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==TEST_GROUP_NAME) {
				{
				{
				setState(42); testSubGroup();
				}
				}
				setState(47);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class TestSubGroupContext extends ParserRuleContext {
		public List test() {
			return getRuleContexts(TestContext.class);
		}
		public TerminalNode TEST_GROUP_NAME() { return getToken(GrammarTestParser.TEST_GROUP_NAME, 0); }
		public TestContext test(int i) {
			return getRuleContext(TestContext.class,i);
		}
		public TestSubGroupContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_testSubGroup; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterTestSubGroup(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitTestSubGroup(this);
		}
	}

	public final TestSubGroupContext testSubGroup() throws RecognitionException {
		TestSubGroupContext _localctx = new TestSubGroupContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_testSubGroup);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(48); match(TEST_GROUP_NAME);
			setState(50); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(49); test();
				}
				}
				setState(52); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==STRING_LITERAL || _la==MULTI_LINE );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class TestContext extends ParserRuleContext {
		public StatementContext statement() {
			return getRuleContext(StatementContext.class,0);
		}
		public OutcomeContext outcome() {
			return getRuleContext(OutcomeContext.class,0);
		}
		public TestContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_test; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterTest(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitTest(this);
		}
	}

	public final TestContext test() throws RecognitionException {
		TestContext _localctx = new TestContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_test);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(54); statement();
			setState(55); outcome();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class StatementContext extends ParserRuleContext {
		public TerminalNode MULTI_LINE() { return getToken(GrammarTestParser.MULTI_LINE, 0); }
		public TerminalNode STRING_LITERAL() { return getToken(GrammarTestParser.STRING_LITERAL, 0); }
		public StatementContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_statement; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterStatement(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitStatement(this);
		}
	}

	public final StatementContext statement() throws RecognitionException {
		StatementContext _localctx = new StatementContext(_ctx, getState());
		enterRule(_localctx, 12, RULE_statement);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(57);
			_la = _input.LA(1);
			if ( !(_la==STRING_LITERAL || _la==MULTI_LINE) ) {
			_errHandler.recoverInline(this);
			}
			consume();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class OutcomeContext extends ParserRuleContext {
		public OutcomeContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_outcome; }
	 
		public OutcomeContext() { }
		public void copyFrom(OutcomeContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class TestResultContext extends OutcomeContext {
		public TerminalNode TEST_RESULT() { return getToken(GrammarTestParser.TEST_RESULT, 0); }
		public TestResultContext(OutcomeContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterTestResult(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitTestResult(this);
		}
	}
	public static class ExpectedAstContext extends OutcomeContext {
		public TerminalNode AST() { return getToken(GrammarTestParser.AST, 0); }
		public ExpectedAstContext(OutcomeContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).enterExpectedAst(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof GrammarTestListener ) ((GrammarTestListener)listener).exitExpectedAst(this);
		}
	}

	public final OutcomeContext outcome() throws RecognitionException {
		OutcomeContext _localctx = new OutcomeContext(_ctx, getState());
		enterRule(_localctx, 14, RULE_outcome);
		try {
			setState(62);
			switch (_input.LA(1)) {
			case TEST_RESULT:
				_localctx = new TestResultContext(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(59); match(TEST_RESULT);
				}
				break;
			case 3:
				_localctx = new ExpectedAstContext(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(60); match(3);
				setState(61); match(AST);
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\2\3\23C\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t"+
		"\t\3\2\3\2\3\2\3\2\3\2\6\2\30\n\2\r\2\16\2\31\3\3\3\3\3\3\3\3\3\3\3\4"+
		"\3\4\3\4\3\4\3\5\3\5\3\5\7\5(\n\5\f\5\16\5+\13\5\3\5\7\5.\n\5\f\5\16\5"+
		"\61\13\5\3\6\3\6\6\6\65\n\6\r\6\16\6\66\3\7\3\7\3\7\3\b\3\b\3\t\3\t\3"+
		"\t\5\tA\n\t\3\t\2\n\2\4\6\b\n\f\16\20\2\3\4\20\20\22\22?\2\22\3\2\2\2"+
		"\4\33\3\2\2\2\6 \3\2\2\2\b$\3\2\2\2\n\62\3\2\2\2\f8\3\2\2\2\16;\3\2\2"+
		"\2\20@\3\2\2\2\22\23\7\7\2\2\23\24\7\f\2\2\24\25\7\n\2\2\25\27\5\4\3\2"+
		"\26\30\5\b\5\2\27\26\3\2\2\2\30\31\3\2\2\2\31\27\3\2\2\2\31\32\3\2\2\2"+
		"\32\3\3\2\2\2\33\34\7\3\2\2\34\35\7\6\2\2\35\36\5\6\4\2\36\37\7\t\2\2"+
		"\37\5\3\2\2\2 !\7\4\2\2!\"\7\r\2\2\"#\7\n\2\2#\7\3\2\2\2$%\7\f\2\2%)\7"+
		"\b\2\2&(\5\f\7\2\'&\3\2\2\2(+\3\2\2\2)\'\3\2\2\2)*\3\2\2\2*/\3\2\2\2+"+
		")\3\2\2\2,.\5\n\6\2-,\3\2\2\2.\61\3\2\2\2/-\3\2\2\2/\60\3\2\2\2\60\t\3"+
		"\2\2\2\61/\3\2\2\2\62\64\7\17\2\2\63\65\5\f\7\2\64\63\3\2\2\2\65\66\3"+
		"\2\2\2\66\64\3\2\2\2\66\67\3\2\2\2\67\13\3\2\2\289\5\16\b\29:\5\20\t\2"+
		":\r\3\2\2\2;<\t\2\2\2<\17\3\2\2\2=A\7\13\2\2>?\7\5\2\2?A\7\21\2\2@=\3"+
		"\2\2\2@>\3\2\2\2A\21\3\2\2\2\7\31)/\66@";
	public static final ATN _ATN =
		ATNSimulator.deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy