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

eu.mihosoft.vmf.vmftext.grammar.vmftextcomments.VMFTextCommentsParser Maven / Gradle / Ivy

The newest version!
// Generated from /Users/miho/EigeneApps/VMF-Text/src/main/resources/eu/mihosoft/vmf/vmftext/antlr/VMFTextComments.g4 by ANTLR 4.7
package eu.mihosoft.vmf.vmftext.grammar.vmftextcomments;
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 VMFTextCommentsParser 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
		STRING_DOUBLE=1, STRING_SINGLE=2, VMF_TEXT_MULTILINE_COMMENT=3, UNKNOWN=4;
	public static final int
		RULE_program = 0, RULE_vmfTextComment = 1, RULE_string = 2, RULE_stringDoubleQuotes = 3, 
		RULE_stringSingleQuote = 4, RULE_unknowns = 5;
	public static final String[] ruleNames = {
		"program", "vmfTextComment", "string", "stringDoubleQuotes", "stringSingleQuote", 
		"unknowns"
	};

	private static final String[] _LITERAL_NAMES = {
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, "STRING_DOUBLE", "STRING_SINGLE", "VMF_TEXT_MULTILINE_COMMENT", 
		"UNKNOWN"
	};
	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 "VMFTextComments.g4"; }

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

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

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

	public VMFTextCommentsParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class ProgramContext extends ParserRuleContext {
		public VmfTextCommentContext vmfTextComment;
		public List comments = new ArrayList();
		public List string() {
			return getRuleContexts(StringContext.class);
		}
		public StringContext string(int i) {
			return getRuleContext(StringContext.class,i);
		}
		public List unknowns() {
			return getRuleContexts(UnknownsContext.class);
		}
		public UnknownsContext unknowns(int i) {
			return getRuleContext(UnknownsContext.class,i);
		}
		public List vmfTextComment() {
			return getRuleContexts(VmfTextCommentContext.class);
		}
		public VmfTextCommentContext vmfTextComment(int i) {
			return getRuleContext(VmfTextCommentContext.class,i);
		}
		public ProgramContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_program; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterProgram(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitProgram(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitProgram(this);
			else return visitor.visitChildren(this);
		}
	}

	public final ProgramContext program() throws RecognitionException {
		ProgramContext _localctx = new ProgramContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_program);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(17);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING_DOUBLE) | (1L << STRING_SINGLE) | (1L << VMF_TEXT_MULTILINE_COMMENT) | (1L << UNKNOWN))) != 0)) {
				{
				setState(15);
				_errHandler.sync(this);
				switch (_input.LA(1)) {
				case VMF_TEXT_MULTILINE_COMMENT:
					{
					setState(12);
					((ProgramContext)_localctx).vmfTextComment = vmfTextComment();
					((ProgramContext)_localctx).comments.add(((ProgramContext)_localctx).vmfTextComment);
					}
					break;
				case STRING_DOUBLE:
				case STRING_SINGLE:
					{
					setState(13);
					string();
					}
					break;
				case UNKNOWN:
					{
					setState(14);
					unknowns();
					}
					break;
				default:
					throw new NoViableAltException(this);
				}
				}
				setState(19);
				_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 VmfTextCommentContext extends ParserRuleContext {
		public Token text;
		public TerminalNode VMF_TEXT_MULTILINE_COMMENT() { return getToken(VMFTextCommentsParser.VMF_TEXT_MULTILINE_COMMENT, 0); }
		public VmfTextCommentContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_vmfTextComment; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterVmfTextComment(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitVmfTextComment(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitVmfTextComment(this);
			else return visitor.visitChildren(this);
		}
	}

	public final VmfTextCommentContext vmfTextComment() throws RecognitionException {
		VmfTextCommentContext _localctx = new VmfTextCommentContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_vmfTextComment);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(20);
			((VmfTextCommentContext)_localctx).text = match(VMF_TEXT_MULTILINE_COMMENT);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class StringContext extends ParserRuleContext {
		public StringDoubleQuotesContext stringDoubleQuotes() {
			return getRuleContext(StringDoubleQuotesContext.class,0);
		}
		public StringSingleQuoteContext stringSingleQuote() {
			return getRuleContext(StringSingleQuoteContext.class,0);
		}
		public StringContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_string; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterString(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitString(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitString(this);
			else return visitor.visitChildren(this);
		}
	}

	public final StringContext string() throws RecognitionException {
		StringContext _localctx = new StringContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_string);
		try {
			setState(24);
			_errHandler.sync(this);
			switch (_input.LA(1)) {
			case STRING_DOUBLE:
				enterOuterAlt(_localctx, 1);
				{
				setState(22);
				stringDoubleQuotes();
				}
				break;
			case STRING_SINGLE:
				enterOuterAlt(_localctx, 2);
				{
				setState(23);
				stringSingleQuote();
				}
				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 class StringDoubleQuotesContext extends ParserRuleContext {
		public TerminalNode STRING_DOUBLE() { return getToken(VMFTextCommentsParser.STRING_DOUBLE, 0); }
		public StringDoubleQuotesContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_stringDoubleQuotes; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterStringDoubleQuotes(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitStringDoubleQuotes(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitStringDoubleQuotes(this);
			else return visitor.visitChildren(this);
		}
	}

	public final StringDoubleQuotesContext stringDoubleQuotes() throws RecognitionException {
		StringDoubleQuotesContext _localctx = new StringDoubleQuotesContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_stringDoubleQuotes);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(26);
			match(STRING_DOUBLE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class StringSingleQuoteContext extends ParserRuleContext {
		public TerminalNode STRING_SINGLE() { return getToken(VMFTextCommentsParser.STRING_SINGLE, 0); }
		public StringSingleQuoteContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_stringSingleQuote; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterStringSingleQuote(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitStringSingleQuote(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitStringSingleQuote(this);
			else return visitor.visitChildren(this);
		}
	}

	public final StringSingleQuoteContext stringSingleQuote() throws RecognitionException {
		StringSingleQuoteContext _localctx = new StringSingleQuoteContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_stringSingleQuote);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(28);
			match(STRING_SINGLE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UnknownsContext extends ParserRuleContext {
		public List UNKNOWN() { return getTokens(VMFTextCommentsParser.UNKNOWN); }
		public TerminalNode UNKNOWN(int i) {
			return getToken(VMFTextCommentsParser.UNKNOWN, i);
		}
		public UnknownsContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_unknowns; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).enterUnknowns(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof VMFTextCommentsListener ) ((VMFTextCommentsListener)listener).exitUnknowns(this);
		}
		@Override
		public  T accept(ParseTreeVisitor visitor) {
			if ( visitor instanceof VMFTextCommentsVisitor ) return ((VMFTextCommentsVisitor)visitor).visitUnknowns(this);
			else return visitor.visitChildren(this);
		}
	}

	public final UnknownsContext unknowns() throws RecognitionException {
		UnknownsContext _localctx = new UnknownsContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_unknowns);
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(31); 
			_errHandler.sync(this);
			_alt = 1;
			do {
				switch (_alt) {
				case 1:
					{
					{
					setState(30);
					match(UNKNOWN);
					}
					}
					break;
				default:
					throw new NoViableAltException(this);
				}
				setState(33); 
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
			} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
			}
		}
		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\6&\4\2\t\2\4\3\t"+
		"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\3\2\3\2\3\2\7\2\22\n\2\f\2\16\2\25"+
		"\13\2\3\3\3\3\3\4\3\4\5\4\33\n\4\3\5\3\5\3\6\3\6\3\7\6\7\"\n\7\r\7\16"+
		"\7#\3\7\2\2\b\2\4\6\b\n\f\2\2\2$\2\23\3\2\2\2\4\26\3\2\2\2\6\32\3\2\2"+
		"\2\b\34\3\2\2\2\n\36\3\2\2\2\f!\3\2\2\2\16\22\5\4\3\2\17\22\5\6\4\2\20"+
		"\22\5\f\7\2\21\16\3\2\2\2\21\17\3\2\2\2\21\20\3\2\2\2\22\25\3\2\2\2\23"+
		"\21\3\2\2\2\23\24\3\2\2\2\24\3\3\2\2\2\25\23\3\2\2\2\26\27\7\5\2\2\27"+
		"\5\3\2\2\2\30\33\5\b\5\2\31\33\5\n\6\2\32\30\3\2\2\2\32\31\3\2\2\2\33"+
		"\7\3\2\2\2\34\35\7\3\2\2\35\t\3\2\2\2\36\37\7\4\2\2\37\13\3\2\2\2 \"\7"+
		"\6\2\2! \3\2\2\2\"#\3\2\2\2#!\3\2\2\2#$\3\2\2\2$\r\3\2\2\2\6\21\23\32"+
		"#";
	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 - 2024 Weber Informatics LLC | Privacy Policy