mantsonu20.sip-parser-antlr.1.0.0.source-code.SipParser Maven / Gradle / Ivy
The newest version!
// Generated from Sip.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 SipParser 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
USER_INFO=1, PORT=2, HOST=3, SIP_SCHEME=4, SIPS_SCHEME=5, ESCAPED=6, CH_SEMICOLON=7;
public static final int
RULE_sipUri = 0, RULE_sipsUri = 1, RULE_coreUri = 2, RULE_hostPort = 3;
public static final String[] ruleNames = {
"sipUri", "sipsUri", "coreUri", "hostPort"
};
private static final String[] _LITERAL_NAMES = {
null, null, null, null, "'sip:'", "'sips:'", null, "';'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "USER_INFO", "PORT", "HOST", "SIP_SCHEME", "SIPS_SCHEME", "ESCAPED",
"CH_SEMICOLON"
};
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 "Sip.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public SipParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class SipUriContext extends ParserRuleContext {
public TerminalNode SIP_SCHEME() { return getToken(SipParser.SIP_SCHEME, 0); }
public CoreUriContext coreUri() {
return getRuleContext(CoreUriContext.class,0);
}
public SipUriContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_sipUri; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).enterSipUri(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).exitSipUri(this);
}
}
public final SipUriContext sipUri() throws RecognitionException {
SipUriContext _localctx = new SipUriContext(_ctx, getState());
enterRule(_localctx, 0, RULE_sipUri);
try {
enterOuterAlt(_localctx, 1);
{
setState(8);
match(SIP_SCHEME);
setState(9);
coreUri();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class SipsUriContext extends ParserRuleContext {
public TerminalNode SIPS_SCHEME() { return getToken(SipParser.SIPS_SCHEME, 0); }
public CoreUriContext coreUri() {
return getRuleContext(CoreUriContext.class,0);
}
public SipsUriContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_sipsUri; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).enterSipsUri(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).exitSipsUri(this);
}
}
public final SipsUriContext sipsUri() throws RecognitionException {
SipsUriContext _localctx = new SipsUriContext(_ctx, getState());
enterRule(_localctx, 2, RULE_sipsUri);
try {
enterOuterAlt(_localctx, 1);
{
setState(11);
match(SIPS_SCHEME);
setState(12);
coreUri();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CoreUriContext extends ParserRuleContext {
public HostPortContext hostPort() {
return getRuleContext(HostPortContext.class,0);
}
public TerminalNode USER_INFO() { return getToken(SipParser.USER_INFO, 0); }
public CoreUriContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_coreUri; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).enterCoreUri(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).exitCoreUri(this);
}
}
public final CoreUriContext coreUri() throws RecognitionException {
CoreUriContext _localctx = new CoreUriContext(_ctx, getState());
enterRule(_localctx, 4, RULE_coreUri);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(15);
_la = _input.LA(1);
if (_la==USER_INFO) {
{
setState(14);
match(USER_INFO);
}
}
setState(17);
hostPort();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class HostPortContext extends ParserRuleContext {
public TerminalNode HOST() { return getToken(SipParser.HOST, 0); }
public TerminalNode PORT() { return getToken(SipParser.PORT, 0); }
public HostPortContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_hostPort; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).enterHostPort(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof SipListener ) ((SipListener)listener).exitHostPort(this);
}
}
public final HostPortContext hostPort() throws RecognitionException {
HostPortContext _localctx = new HostPortContext(_ctx, getState());
enterRule(_localctx, 6, RULE_hostPort);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(19);
match(HOST);
setState(21);
_la = _input.LA(1);
if (_la==PORT) {
{
setState(20);
match(PORT);
}
}
}
}
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\32\4\2\t\2\4\3"+
"\t\3\4\4\t\4\4\5\t\5\3\2\3\2\3\2\3\3\3\3\3\3\3\4\5\4\22\n\4\3\4\3\4\3"+
"\5\3\5\5\5\30\n\5\3\5\2\2\6\2\4\6\b\2\2\27\2\n\3\2\2\2\4\r\3\2\2\2\6\21"+
"\3\2\2\2\b\25\3\2\2\2\n\13\7\6\2\2\13\f\5\6\4\2\f\3\3\2\2\2\r\16\7\7\2"+
"\2\16\17\5\6\4\2\17\5\3\2\2\2\20\22\7\3\2\2\21\20\3\2\2\2\21\22\3\2\2"+
"\2\22\23\3\2\2\2\23\24\5\b\5\2\24\7\3\2\2\2\25\27\7\5\2\2\26\30\7\4\2"+
"\2\27\26\3\2\2\2\27\30\3\2\2\2\30\t\3\2\2\2\4\21\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);
}
}
}