mirror of
https://github.com/mudabbir-ahmad/MYOL-TB2-prog3-Py.git
synced 2026-10-07 19:40:21 +00:00
253 lines
7.3 KiB
Java
253 lines
7.3 KiB
Java
// Generated from Hello.g4 by ANTLR 4.13.2
|
|
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", "CheckReturnValue", "this-escape"})
|
|
public class HelloParser extends Parser {
|
|
static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); }
|
|
|
|
protected static final DFA[] _decisionToDFA;
|
|
protected static final PredictionContextCache _sharedContextCache =
|
|
new PredictionContextCache();
|
|
public static final int
|
|
T__0=1, T__1=2, ID=3, WS=4;
|
|
public static final int
|
|
RULE_greeting = 0, RULE_greet = 1, RULE_start = 2;
|
|
private static String[] makeRuleNames() {
|
|
return new String[] {
|
|
"greeting", "greet", "start"
|
|
};
|
|
}
|
|
public static final String[] ruleNames = makeRuleNames();
|
|
|
|
private static String[] makeLiteralNames() {
|
|
return new String[] {
|
|
null, "'hello'", "'hi'"
|
|
};
|
|
}
|
|
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
|
private static String[] makeSymbolicNames() {
|
|
return new String[] {
|
|
null, null, null, "ID", "WS"
|
|
};
|
|
}
|
|
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
|
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] = "<INVALID>";
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
@Deprecated
|
|
public String[] getTokenNames() {
|
|
return tokenNames;
|
|
}
|
|
|
|
@Override
|
|
|
|
public Vocabulary getVocabulary() {
|
|
return VOCABULARY;
|
|
}
|
|
|
|
@Override
|
|
public String getGrammarFileName() { return "Hello.g4"; }
|
|
|
|
@Override
|
|
public String[] getRuleNames() { return ruleNames; }
|
|
|
|
@Override
|
|
public String getSerializedATN() { return _serializedATN; }
|
|
|
|
@Override
|
|
public ATN getATN() { return _ATN; }
|
|
|
|
public HelloParser(TokenStream input) {
|
|
super(input);
|
|
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
|
|
}
|
|
|
|
@SuppressWarnings("CheckReturnValue")
|
|
public static class GreetingContext extends ParserRuleContext {
|
|
public List<GreetContext> greet() {
|
|
return getRuleContexts(GreetContext.class);
|
|
}
|
|
public GreetContext greet(int i) {
|
|
return getRuleContext(GreetContext.class,i);
|
|
}
|
|
public GreetingContext(ParserRuleContext parent, int invokingState) {
|
|
super(parent, invokingState);
|
|
}
|
|
@Override public int getRuleIndex() { return RULE_greeting; }
|
|
@Override
|
|
public void enterRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).enterGreeting(this);
|
|
}
|
|
@Override
|
|
public void exitRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).exitGreeting(this);
|
|
}
|
|
}
|
|
|
|
public final GreetingContext greeting() throws RecognitionException {
|
|
GreetingContext _localctx = new GreetingContext(_ctx, getState());
|
|
enterRule(_localctx, 0, RULE_greeting);
|
|
int _la;
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
{
|
|
setState(7);
|
|
_errHandler.sync(this);
|
|
_la = _input.LA(1);
|
|
do {
|
|
{
|
|
{
|
|
setState(6);
|
|
greet();
|
|
}
|
|
}
|
|
setState(9);
|
|
_errHandler.sync(this);
|
|
_la = _input.LA(1);
|
|
} while ( _la==T__0 || _la==T__1 );
|
|
}
|
|
}
|
|
catch (RecognitionException re) {
|
|
_localctx.exception = re;
|
|
_errHandler.reportError(this, re);
|
|
_errHandler.recover(this, re);
|
|
}
|
|
finally {
|
|
exitRule();
|
|
}
|
|
return _localctx;
|
|
}
|
|
|
|
@SuppressWarnings("CheckReturnValue")
|
|
public static class GreetContext extends ParserRuleContext {
|
|
public GreetContext(ParserRuleContext parent, int invokingState) {
|
|
super(parent, invokingState);
|
|
}
|
|
@Override public int getRuleIndex() { return RULE_greet; }
|
|
@Override
|
|
public void enterRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).enterGreet(this);
|
|
}
|
|
@Override
|
|
public void exitRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).exitGreet(this);
|
|
}
|
|
}
|
|
|
|
public final GreetContext greet() throws RecognitionException {
|
|
GreetContext _localctx = new GreetContext(_ctx, getState());
|
|
enterRule(_localctx, 2, RULE_greet);
|
|
int _la;
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
{
|
|
setState(11);
|
|
_la = _input.LA(1);
|
|
if ( !(_la==T__0 || _la==T__1) ) {
|
|
_errHandler.recoverInline(this);
|
|
}
|
|
else {
|
|
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
|
|
_errHandler.reportMatch(this);
|
|
consume();
|
|
}
|
|
}
|
|
}
|
|
catch (RecognitionException re) {
|
|
_localctx.exception = re;
|
|
_errHandler.reportError(this, re);
|
|
_errHandler.recover(this, re);
|
|
}
|
|
finally {
|
|
exitRule();
|
|
}
|
|
return _localctx;
|
|
}
|
|
|
|
@SuppressWarnings("CheckReturnValue")
|
|
public static class StartContext extends ParserRuleContext {
|
|
public TerminalNode ID() { return getToken(HelloParser.ID, 0); }
|
|
public StartContext(ParserRuleContext parent, int invokingState) {
|
|
super(parent, invokingState);
|
|
}
|
|
@Override public int getRuleIndex() { return RULE_start; }
|
|
@Override
|
|
public void enterRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).enterStart(this);
|
|
}
|
|
@Override
|
|
public void exitRule(ParseTreeListener listener) {
|
|
if ( listener instanceof HelloListener ) ((HelloListener)listener).exitStart(this);
|
|
}
|
|
}
|
|
|
|
public final StartContext start() throws RecognitionException {
|
|
StartContext _localctx = new StartContext(_ctx, getState());
|
|
enterRule(_localctx, 4, RULE_start);
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
{
|
|
setState(13);
|
|
match(T__0);
|
|
setState(14);
|
|
match(ID);
|
|
}
|
|
}
|
|
catch (RecognitionException re) {
|
|
_localctx.exception = re;
|
|
_errHandler.reportError(this, re);
|
|
_errHandler.recover(this, re);
|
|
}
|
|
finally {
|
|
exitRule();
|
|
}
|
|
return _localctx;
|
|
}
|
|
|
|
public static final String _serializedATN =
|
|
"\u0004\u0001\u0004\u0011\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001"+
|
|
"\u0002\u0002\u0007\u0002\u0001\u0000\u0004\u0000\b\b\u0000\u000b\u0000"+
|
|
"\f\u0000\t\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+
|
|
"\u0001\u0002\u0000\u0000\u0003\u0000\u0002\u0004\u0000\u0001\u0001\u0000"+
|
|
"\u0001\u0002\u000e\u0000\u0007\u0001\u0000\u0000\u0000\u0002\u000b\u0001"+
|
|
"\u0000\u0000\u0000\u0004\r\u0001\u0000\u0000\u0000\u0006\b\u0003\u0002"+
|
|
"\u0001\u0000\u0007\u0006\u0001\u0000\u0000\u0000\b\t\u0001\u0000\u0000"+
|
|
"\u0000\t\u0007\u0001\u0000\u0000\u0000\t\n\u0001\u0000\u0000\u0000\n\u0001"+
|
|
"\u0001\u0000\u0000\u0000\u000b\f\u0007\u0000\u0000\u0000\f\u0003\u0001"+
|
|
"\u0000\u0000\u0000\r\u000e\u0005\u0001\u0000\u0000\u000e\u000f\u0005\u0003"+
|
|
"\u0000\u0000\u000f\u0005\u0001\u0000\u0000\u0000\u0001\t";
|
|
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);
|
|
}
|
|
}
|
|
} |