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

mantsonu20.sip-parser-antlr.1.0.0.source-code.UriHeadersParser Maven / Gradle / Ivy

The newest version!
// Generated from UriHeaders.g4 by ANTLR 4.5.3

/**
 *   Copyright 2016 Pratapi Hemant Patel
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *   
 */
package antlr4;

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

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		NAME_OR_VALUE=1, CH_AMPERSAND=2, CH_EQUAL=3, CH_SEMICOLON=4, CH_QUESTION=5, 
		CH_COLON=6, CH_DOT=7;
	public static final int
		RULE_uriHeaders = 0, RULE_uriParameters = 1, RULE_uriParameter = 2, RULE_headers = 3, 
		RULE_header = 4;
	public static final String[] ruleNames = {
		"uriHeaders", "uriParameters", "uriParameter", "headers", "header"
	};

	private static final String[] _LITERAL_NAMES = {
		null, null, "'&'", "'='", "';'", "'?'", "':'", "'.'"
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, "NAME_OR_VALUE", "CH_AMPERSAND", "CH_EQUAL", "CH_SEMICOLON", "CH_QUESTION", 
		"CH_COLON", "CH_DOT"
	};
	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 "UriHeaders.g4"; }

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

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

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

	public UriHeadersParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class UriHeadersContext extends ParserRuleContext {
		public UriParametersContext uriParameters() {
			return getRuleContext(UriParametersContext.class,0);
		}
		public TerminalNode EOF() { return getToken(UriHeadersParser.EOF, 0); }
		public HeadersContext headers() {
			return getRuleContext(HeadersContext.class,0);
		}
		public UriHeadersContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_uriHeaders; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).enterUriHeaders(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).exitUriHeaders(this);
		}
	}

	public final UriHeadersContext uriHeaders() throws RecognitionException {
		UriHeadersContext _localctx = new UriHeadersContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_uriHeaders);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(10);
			uriParameters();
			setState(12);
			_la = _input.LA(1);
			if (_la==CH_QUESTION) {
				{
				setState(11);
				headers();
				}
			}

			setState(14);
			match(EOF);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UriParametersContext extends ParserRuleContext {
		public List CH_SEMICOLON() { return getTokens(UriHeadersParser.CH_SEMICOLON); }
		public TerminalNode CH_SEMICOLON(int i) {
			return getToken(UriHeadersParser.CH_SEMICOLON, i);
		}
		public List uriParameter() {
			return getRuleContexts(UriParameterContext.class);
		}
		public UriParameterContext uriParameter(int i) {
			return getRuleContext(UriParameterContext.class,i);
		}
		public UriParametersContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_uriParameters; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).enterUriParameters(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).exitUriParameters(this);
		}
	}

	public final UriParametersContext uriParameters() throws RecognitionException {
		UriParametersContext _localctx = new UriParametersContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_uriParameters);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(20);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==CH_SEMICOLON) {
				{
				{
				setState(16);
				match(CH_SEMICOLON);
				setState(17);
				uriParameter();
				}
				}
				setState(22);
				_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 UriParameterContext extends ParserRuleContext {
		public List NAME_OR_VALUE() { return getTokens(UriHeadersParser.NAME_OR_VALUE); }
		public TerminalNode NAME_OR_VALUE(int i) {
			return getToken(UriHeadersParser.NAME_OR_VALUE, i);
		}
		public TerminalNode CH_EQUAL() { return getToken(UriHeadersParser.CH_EQUAL, 0); }
		public UriParameterContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_uriParameter; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).enterUriParameter(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).exitUriParameter(this);
		}
	}

	public final UriParameterContext uriParameter() throws RecognitionException {
		UriParameterContext _localctx = new UriParameterContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_uriParameter);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(23);
			match(NAME_OR_VALUE);
			setState(26);
			_la = _input.LA(1);
			if (_la==CH_EQUAL) {
				{
				setState(24);
				match(CH_EQUAL);
				setState(25);
				match(NAME_OR_VALUE);
				}
			}

			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class HeadersContext extends ParserRuleContext {
		public TerminalNode CH_QUESTION() { return getToken(UriHeadersParser.CH_QUESTION, 0); }
		public List header() {
			return getRuleContexts(HeaderContext.class);
		}
		public HeaderContext header(int i) {
			return getRuleContext(HeaderContext.class,i);
		}
		public List CH_AMPERSAND() { return getTokens(UriHeadersParser.CH_AMPERSAND); }
		public TerminalNode CH_AMPERSAND(int i) {
			return getToken(UriHeadersParser.CH_AMPERSAND, i);
		}
		public HeadersContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_headers; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).enterHeaders(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).exitHeaders(this);
		}
	}

	public final HeadersContext headers() throws RecognitionException {
		HeadersContext _localctx = new HeadersContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_headers);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(28);
			match(CH_QUESTION);
			setState(29);
			header();
			setState(34);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==CH_AMPERSAND) {
				{
				{
				setState(30);
				match(CH_AMPERSAND);
				setState(31);
				header();
				}
				}
				setState(36);
				_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 HeaderContext extends ParserRuleContext {
		public List NAME_OR_VALUE() { return getTokens(UriHeadersParser.NAME_OR_VALUE); }
		public TerminalNode NAME_OR_VALUE(int i) {
			return getToken(UriHeadersParser.NAME_OR_VALUE, i);
		}
		public TerminalNode CH_EQUAL() { return getToken(UriHeadersParser.CH_EQUAL, 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 UriHeadersListener ) ((UriHeadersListener)listener).enterHeader(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof UriHeadersListener ) ((UriHeadersListener)listener).exitHeader(this);
		}
	}

	public final HeaderContext header() throws RecognitionException {
		HeaderContext _localctx = new HeaderContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_header);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(37);
			match(NAME_OR_VALUE);
			setState(38);
			match(CH_EQUAL);
			setState(39);
			match(NAME_OR_VALUE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\t,\4\2\t\2\4\3\t"+
		"\3\4\4\t\4\4\5\t\5\4\6\t\6\3\2\3\2\5\2\17\n\2\3\2\3\2\3\3\3\3\7\3\25\n"+
		"\3\f\3\16\3\30\13\3\3\4\3\4\3\4\5\4\35\n\4\3\5\3\5\3\5\3\5\7\5#\n\5\f"+
		"\5\16\5&\13\5\3\6\3\6\3\6\3\6\3\6\2\2\7\2\4\6\b\n\2\2*\2\f\3\2\2\2\4\26"+
		"\3\2\2\2\6\31\3\2\2\2\b\36\3\2\2\2\n\'\3\2\2\2\f\16\5\4\3\2\r\17\5\b\5"+
		"\2\16\r\3\2\2\2\16\17\3\2\2\2\17\20\3\2\2\2\20\21\7\2\2\3\21\3\3\2\2\2"+
		"\22\23\7\6\2\2\23\25\5\6\4\2\24\22\3\2\2\2\25\30\3\2\2\2\26\24\3\2\2\2"+
		"\26\27\3\2\2\2\27\5\3\2\2\2\30\26\3\2\2\2\31\34\7\3\2\2\32\33\7\5\2\2"+
		"\33\35\7\3\2\2\34\32\3\2\2\2\34\35\3\2\2\2\35\7\3\2\2\2\36\37\7\7\2\2"+
		"\37$\5\n\6\2 !\7\4\2\2!#\5\n\6\2\" \3\2\2\2#&\3\2\2\2$\"\3\2\2\2$%\3\2"+
		"\2\2%\t\3\2\2\2&$\3\2\2\2\'(\7\3\2\2()\7\5\2\2)*\7\3\2\2*\13\3\2\2\2\6"+
		"\16\26\34$";
	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