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

com.github.pukkaone.jarinvoke.parser.JarInvokeParser Maven / Gradle / Ivy

// Generated from JarInvoke.g4 by ANTLR 4.7

package com.github.pukkaone.jarinvoke.parser;

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 JarInvokeParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__0=1, ASSIGN=2, COMMA=3, DOT=4, PAREN_OPEN=5, PAREN_CLOSE=6, STRING_LITERAL=7, 
		WHITESPACE=8, INVOKE=9, LOAD=10, IDENTIFIER=11;
	public static final int
		RULE_translationUnit = 0, RULE_statement = 1, RULE_invokeExpression = 2, 
		RULE_loadStatement = 3, RULE_requireStatement = 4;
	public static final String[] ruleNames = {
		"translationUnit", "statement", "invokeExpression", "loadStatement", "requireStatement"
	};

	private static final String[] _LITERAL_NAMES = {
		null, "'require'", "'='", "','", "'.'", "'('", "')'", null, null, "'invoke'", 
		"'load'"
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, null, "ASSIGN", "COMMA", "DOT", "PAREN_OPEN", "PAREN_CLOSE", "STRING_LITERAL", 
		"WHITESPACE", "INVOKE", "LOAD", "IDENTIFIER"
	};
	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

	/**
	 * @deprecated Use {@link #VOCABULARY} instead.
	 */
	@Deprecated
	public static final String[] tokenNames;
	static {
		tokenNames = new String[_SYMBOLIC_NAMES.length];
		for (int i = 0; i < tokenNames.length; i++) {
			tokenNames[i] = VOCABULARY.getLiteralName(i);
			if (tokenNames[i] == null) {
				tokenNames[i] = VOCABULARY.getSymbolicName(i);
			}

			if (tokenNames[i] == null) {
				tokenNames[i] = "";
			}
		}
	}

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

	@Override

	public Vocabulary getVocabulary() {
		return VOCABULARY;
	}

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

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

	@Override
	public String getSerializedATN() { return _serializedATN; }

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

	public JarInvokeParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class TranslationUnitContext extends ParserRuleContext {
		public TerminalNode EOF() { return getToken(JarInvokeParser.EOF, 0); }
		public List statement() {
			return getRuleContexts(StatementContext.class);
		}
		public StatementContext statement(int i) {
			return getRuleContext(StatementContext.class,i);
		}
		public TranslationUnitContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_translationUnit; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).enterTranslationUnit(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).exitTranslationUnit(this);
		}
	}

	public final TranslationUnitContext translationUnit() throws RecognitionException {
		TranslationUnitContext _localctx = new TranslationUnitContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_translationUnit);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(13);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==IDENTIFIER) {
				{
				{
				setState(10);
				statement();
				}
				}
				setState(15);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			setState(16);
			match(EOF);
			}
		}
		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 InvokeExpressionContext invokeExpression() {
			return getRuleContext(InvokeExpressionContext.class,0);
		}
		public LoadStatementContext loadStatement() {
			return getRuleContext(LoadStatementContext.class,0);
		}
		public RequireStatementContext requireStatement() {
			return getRuleContext(RequireStatementContext.class,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 JarInvokeListener ) ((JarInvokeListener)listener).enterStatement(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).exitStatement(this);
		}
	}

	public final StatementContext statement() throws RecognitionException {
		StatementContext _localctx = new StatementContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_statement);
		try {
			setState(21);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(18);
				invokeExpression();
				}
				break;
			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(19);
				loadStatement();
				}
				break;
			case 3:
				enterOuterAlt(_localctx, 3);
				{
				setState(20);
				requireStatement();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class InvokeExpressionContext extends ParserRuleContext {
		public TerminalNode IDENTIFIER() { return getToken(JarInvokeParser.IDENTIFIER, 0); }
		public List STRING_LITERAL() { return getTokens(JarInvokeParser.STRING_LITERAL); }
		public TerminalNode STRING_LITERAL(int i) {
			return getToken(JarInvokeParser.STRING_LITERAL, i);
		}
		public InvokeExpressionContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_invokeExpression; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).enterInvokeExpression(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).exitInvokeExpression(this);
		}
	}

	public final InvokeExpressionContext invokeExpression() throws RecognitionException {
		InvokeExpressionContext _localctx = new InvokeExpressionContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_invokeExpression);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(23);
			match(IDENTIFIER);
			setState(24);
			match(DOT);
			setState(25);
			match(INVOKE);
			setState(26);
			match(PAREN_OPEN);
			setState(27);
			match(STRING_LITERAL);
			setState(28);
			match(COMMA);
			setState(29);
			match(STRING_LITERAL);
			setState(30);
			match(PAREN_CLOSE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class LoadStatementContext extends ParserRuleContext {
		public TerminalNode IDENTIFIER() { return getToken(JarInvokeParser.IDENTIFIER, 0); }
		public List STRING_LITERAL() { return getTokens(JarInvokeParser.STRING_LITERAL); }
		public TerminalNode STRING_LITERAL(int i) {
			return getToken(JarInvokeParser.STRING_LITERAL, i);
		}
		public LoadStatementContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_loadStatement; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).enterLoadStatement(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).exitLoadStatement(this);
		}
	}

	public final LoadStatementContext loadStatement() throws RecognitionException {
		LoadStatementContext _localctx = new LoadStatementContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_loadStatement);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(32);
			match(IDENTIFIER);
			setState(33);
			match(ASSIGN);
			setState(34);
			match(LOAD);
			setState(35);
			match(PAREN_OPEN);
			setState(36);
			match(STRING_LITERAL);
			setState(37);
			match(COMMA);
			setState(38);
			match(STRING_LITERAL);
			setState(39);
			match(PAREN_CLOSE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class RequireStatementContext extends ParserRuleContext {
		public TerminalNode IDENTIFIER() { return getToken(JarInvokeParser.IDENTIFIER, 0); }
		public List STRING_LITERAL() { return getTokens(JarInvokeParser.STRING_LITERAL); }
		public TerminalNode STRING_LITERAL(int i) {
			return getToken(JarInvokeParser.STRING_LITERAL, i);
		}
		public RequireStatementContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_requireStatement; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).enterRequireStatement(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof JarInvokeListener ) ((JarInvokeListener)listener).exitRequireStatement(this);
		}
	}

	public final RequireStatementContext requireStatement() throws RecognitionException {
		RequireStatementContext _localctx = new RequireStatementContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_requireStatement);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(41);
			match(IDENTIFIER);
			setState(42);
			match(ASSIGN);
			setState(43);
			match(T__0);
			setState(44);
			match(PAREN_OPEN);
			setState(45);
			match(STRING_LITERAL);
			setState(46);
			match(COMMA);
			setState(47);
			match(STRING_LITERAL);
			setState(48);
			match(PAREN_CLOSE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\r\65\4\2\t\2\4\3"+
		"\t\3\4\4\t\4\4\5\t\5\4\6\t\6\3\2\7\2\16\n\2\f\2\16\2\21\13\2\3\2\3\2\3"+
		"\3\3\3\3\3\5\3\30\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5"+
		"\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\2\2\7"+
		"\2\4\6\b\n\2\2\2\62\2\17\3\2\2\2\4\27\3\2\2\2\6\31\3\2\2\2\b\"\3\2\2\2"+
		"\n+\3\2\2\2\f\16\5\4\3\2\r\f\3\2\2\2\16\21\3\2\2\2\17\r\3\2\2\2\17\20"+
		"\3\2\2\2\20\22\3\2\2\2\21\17\3\2\2\2\22\23\7\2\2\3\23\3\3\2\2\2\24\30"+
		"\5\6\4\2\25\30\5\b\5\2\26\30\5\n\6\2\27\24\3\2\2\2\27\25\3\2\2\2\27\26"+
		"\3\2\2\2\30\5\3\2\2\2\31\32\7\r\2\2\32\33\7\6\2\2\33\34\7\13\2\2\34\35"+
		"\7\7\2\2\35\36\7\t\2\2\36\37\7\5\2\2\37 \7\t\2\2 !\7\b\2\2!\7\3\2\2\2"+
		"\"#\7\r\2\2#$\7\4\2\2$%\7\f\2\2%&\7\7\2\2&\'\7\t\2\2\'(\7\5\2\2()\7\t"+
		"\2\2)*\7\b\2\2*\t\3\2\2\2+,\7\r\2\2,-\7\4\2\2-.\7\3\2\2./\7\7\2\2/\60"+
		"\7\t\2\2\60\61\7\5\2\2\61\62\7\t\2\2\62\63\7\b\2\2\63\13\3\2\2\2\4\17"+
		"\27";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy