| @@ -0,0 +1,324 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block2/cc/antlr\Sentence.g4 by ANTLR 4.5.1 | ||
| package pp.block2.cc.antlr; | ||
| 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 SentenceParser extends Parser { | ||
| static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } | ||
|
|
||
| protected static final DFA[] _decisionToDFA; | ||
| protected static final PredictionContextCache _sharedContextCache = | ||
| new PredictionContextCache(); | ||
| public static final int | ||
| NOUN=1, VERB=2, ADJECTIVE=3, ENDMARK=4, WS=5, TYPO=6; | ||
| public static final int | ||
| RULE_sentence = 0, RULE_subject = 1, RULE_object = 2, RULE_modifier = 3; | ||
| public static final String[] ruleNames = { | ||
| "sentence", "subject", "object", "modifier" | ||
| }; | ||
|
|
||
| private static final String[] _LITERAL_NAMES = { | ||
| null, null, "'love'", null, "'.'" | ||
| }; | ||
| private static final String[] _SYMBOLIC_NAMES = { | ||
| null, "NOUN", "VERB", "ADJECTIVE", "ENDMARK", "WS", "TYPO" | ||
| }; | ||
| 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 "Sentence.g4"; } | ||
|
|
||
| @Override | ||
| public String[] getRuleNames() { return ruleNames; } | ||
|
|
||
| @Override | ||
| public String getSerializedATN() { return _serializedATN; } | ||
|
|
||
| @Override | ||
| public ATN getATN() { return _ATN; } | ||
|
|
||
| public SentenceParser(TokenStream input) { | ||
| super(input); | ||
| _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); | ||
| } | ||
| public static class SentenceContext extends ParserRuleContext { | ||
| public SubjectContext subject() { | ||
| return getRuleContext(SubjectContext.class,0); | ||
| } | ||
| public TerminalNode VERB() { return getToken(SentenceParser.VERB, 0); } | ||
| public ObjectContext object() { | ||
| return getRuleContext(ObjectContext.class,0); | ||
| } | ||
| public TerminalNode ENDMARK() { return getToken(SentenceParser.ENDMARK, 0); } | ||
| public SentenceContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_sentence; } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).enterSentence(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).exitSentence(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof SentenceVisitor ) return ((SentenceVisitor<? extends T>)visitor).visitSentence(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final SentenceContext sentence() throws RecognitionException { | ||
| SentenceContext _localctx = new SentenceContext(_ctx, getState()); | ||
| enterRule(_localctx, 0, RULE_sentence); | ||
| try { | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(8); | ||
| subject(); | ||
| setState(9); | ||
| match(VERB); | ||
| setState(10); | ||
| object(); | ||
| setState(11); | ||
| match(ENDMARK); | ||
| } | ||
| } | ||
| catch (RecognitionException re) { | ||
| _localctx.exception = re; | ||
| _errHandler.reportError(this, re); | ||
| _errHandler.recover(this, re); | ||
| } | ||
| finally { | ||
| exitRule(); | ||
| } | ||
| return _localctx; | ||
| } | ||
|
|
||
| public static class SubjectContext extends ParserRuleContext { | ||
| public ModifierContext modifier() { | ||
| return getRuleContext(ModifierContext.class,0); | ||
| } | ||
| public SubjectContext subject() { | ||
| return getRuleContext(SubjectContext.class,0); | ||
| } | ||
| public TerminalNode NOUN() { return getToken(SentenceParser.NOUN, 0); } | ||
| public SubjectContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_subject; } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).enterSubject(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).exitSubject(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof SentenceVisitor ) return ((SentenceVisitor<? extends T>)visitor).visitSubject(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final SubjectContext subject() throws RecognitionException { | ||
| SubjectContext _localctx = new SubjectContext(_ctx, getState()); | ||
| enterRule(_localctx, 2, RULE_subject); | ||
| try { | ||
| setState(17); | ||
| switch (_input.LA(1)) { | ||
| case ADJECTIVE: | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(13); | ||
| modifier(); | ||
| setState(14); | ||
| subject(); | ||
| } | ||
| break; | ||
| case NOUN: | ||
| enterOuterAlt(_localctx, 2); | ||
| { | ||
| setState(16); | ||
| match(NOUN); | ||
| } | ||
| 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 ObjectContext extends ParserRuleContext { | ||
| public ModifierContext modifier() { | ||
| return getRuleContext(ModifierContext.class,0); | ||
| } | ||
| public ObjectContext object() { | ||
| return getRuleContext(ObjectContext.class,0); | ||
| } | ||
| public TerminalNode NOUN() { return getToken(SentenceParser.NOUN, 0); } | ||
| public ObjectContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_object; } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).enterObject(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).exitObject(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof SentenceVisitor ) return ((SentenceVisitor<? extends T>)visitor).visitObject(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final ObjectContext object() throws RecognitionException { | ||
| ObjectContext _localctx = new ObjectContext(_ctx, getState()); | ||
| enterRule(_localctx, 4, RULE_object); | ||
| try { | ||
| setState(23); | ||
| switch (_input.LA(1)) { | ||
| case ADJECTIVE: | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(19); | ||
| modifier(); | ||
| setState(20); | ||
| object(); | ||
| } | ||
| break; | ||
| case NOUN: | ||
| enterOuterAlt(_localctx, 2); | ||
| { | ||
| setState(22); | ||
| match(NOUN); | ||
| } | ||
| 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 ModifierContext extends ParserRuleContext { | ||
| public TerminalNode ADJECTIVE() { return getToken(SentenceParser.ADJECTIVE, 0); } | ||
| public ModifierContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_modifier; } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).enterModifier(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof SentenceListener ) ((SentenceListener)listener).exitModifier(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof SentenceVisitor ) return ((SentenceVisitor<? extends T>)visitor).visitModifier(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final ModifierContext modifier() throws RecognitionException { | ||
| ModifierContext _localctx = new ModifierContext(_ctx, getState()); | ||
| enterRule(_localctx, 6, RULE_modifier); | ||
| try { | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(25); | ||
| match(ADJECTIVE); | ||
| } | ||
| } | ||
| 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\b\36\4\2\t\2\4\3"+ | ||
| "\t\3\4\4\t\4\4\5\t\5\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\5\3\24\n\3\3"+ | ||
| "\4\3\4\3\4\3\4\5\4\32\n\4\3\5\3\5\3\5\2\2\6\2\4\6\b\2\2\33\2\n\3\2\2\2"+ | ||
| "\4\23\3\2\2\2\6\31\3\2\2\2\b\33\3\2\2\2\n\13\5\4\3\2\13\f\7\4\2\2\f\r"+ | ||
| "\5\6\4\2\r\16\7\6\2\2\16\3\3\2\2\2\17\20\5\b\5\2\20\21\5\4\3\2\21\24\3"+ | ||
| "\2\2\2\22\24\7\3\2\2\23\17\3\2\2\2\23\22\3\2\2\2\24\5\3\2\2\2\25\26\5"+ | ||
| "\b\5\2\26\27\5\6\4\2\27\32\3\2\2\2\30\32\7\3\2\2\31\25\3\2\2\2\31\30\3"+ | ||
| "\2\2\2\32\7\3\2\2\2\33\34\7\5\2\2\34\t\3\2\2\2\4\23\31"; | ||
| 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); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,37 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block2/cc/antlr\Sentence.g4 by ANTLR 4.5.1 | ||
| package pp.block2.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.ParseTreeVisitor; | ||
|
|
||
| /** | ||
| * This interface defines a complete generic visitor for a parse tree produced | ||
| * by {@link SentenceParser}. | ||
| * | ||
| * @param <T> The return type of the visit operation. Use {@link Void} for | ||
| * operations with no return type. | ||
| */ | ||
| public interface SentenceVisitor<T> extends ParseTreeVisitor<T> { | ||
| /** | ||
| * Visit a parse tree produced by {@link SentenceParser#sentence}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitSentence(SentenceParser.SentenceContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by {@link SentenceParser#subject}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitSubject(SentenceParser.SubjectContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by {@link SentenceParser#object}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitObject(SentenceParser.ObjectContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by {@link SentenceParser#modifier}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitModifier(SentenceParser.ModifierContext ctx); | ||
| } |
| @@ -0,0 +1,13 @@ | ||
| TIMES=1 | ||
| PLUS=2 | ||
| MINUS=3 | ||
| LPAR=4 | ||
| RPAR=5 | ||
| NUMBER=6 | ||
| WS=7 | ||
| Minus=8 | ||
| '*'=1 | ||
| '+'=2 | ||
| '-'=3 | ||
| '('=4 | ||
| ')'=5 |
| @@ -0,0 +1,12 @@ | ||
| TIMES=1 | ||
| PLUS=2 | ||
| MINUS=3 | ||
| LPAR=4 | ||
| RPAR=5 | ||
| NUMBER=6 | ||
| WS=7 | ||
| '*'=1 | ||
| '+'=2 | ||
| '-'=3 | ||
| '('=4 | ||
| ')'=5 |
| @@ -0,0 +1,51 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
|
|
||
| import org.antlr.v4.runtime.ParserRuleContext; | ||
| import org.antlr.v4.runtime.tree.ErrorNode; | ||
| import org.antlr.v4.runtime.tree.TerminalNode; | ||
|
|
||
| /** | ||
| * This class provides an empty implementation of {@link CalcAttrListener}, | ||
| * which can be extended to create a listener which only needs to handle a subset | ||
| * of the available methods. | ||
| */ | ||
| public class CalcAttrBaseListener implements CalcAttrListener { | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterExpr(CalcAttrParser.ExprContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitExpr(CalcAttrParser.ExprContext ctx) { } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterEveryRule(ParserRuleContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitEveryRule(ParserRuleContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void visitTerminal(TerminalNode node) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void visitErrorNode(ErrorNode node) { } | ||
| } |
| @@ -0,0 +1,21 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; | ||
|
|
||
| /** | ||
| * This class provides an empty implementation of {@link CalcAttrVisitor}, | ||
| * which can be extended to create a visitor which only needs to handle a subset | ||
| * of the available methods. | ||
| * | ||
| * @param <T> The return type of the visit operation. Use {@link Void} for | ||
| * operations with no return type. | ||
| */ | ||
| public class CalcAttrBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements CalcAttrVisitor<T> { | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitExpr(CalcAttrParser.ExprContext ctx) { return visitChildren(ctx); } | ||
| } |
| @@ -0,0 +1,114 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.Lexer; | ||
| import org.antlr.v4.runtime.CharStream; | ||
| import org.antlr.v4.runtime.Token; | ||
| import org.antlr.v4.runtime.TokenStream; | ||
| import org.antlr.v4.runtime.*; | ||
| import org.antlr.v4.runtime.atn.*; | ||
| import org.antlr.v4.runtime.dfa.DFA; | ||
| import org.antlr.v4.runtime.misc.*; | ||
|
|
||
| @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) | ||
| public class CalcAttrLexer extends Lexer { | ||
| static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } | ||
|
|
||
| protected static final DFA[] _decisionToDFA; | ||
| protected static final PredictionContextCache _sharedContextCache = | ||
| new PredictionContextCache(); | ||
| public static final int | ||
| TIMES=1, PLUS=2, MINUS=3, LPAR=4, RPAR=5, NUMBER=6, WS=7; | ||
| public static String[] modeNames = { | ||
| "DEFAULT_MODE" | ||
| }; | ||
|
|
||
| public static final String[] ruleNames = { | ||
| "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS" | ||
| }; | ||
|
|
||
| private static final String[] _LITERAL_NAMES = { | ||
| null, "'*'", "'+'", "'-'", "'('", "')'" | ||
| }; | ||
| private static final String[] _SYMBOLIC_NAMES = { | ||
| null, "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS" | ||
| }; | ||
| 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; | ||
| } | ||
|
|
||
|
|
||
| private int getValue(String text) { | ||
| return Integer.parseInt(text); | ||
| } | ||
|
|
||
|
|
||
| public CalcAttrLexer(CharStream input) { | ||
| super(input); | ||
| _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); | ||
| } | ||
|
|
||
| @Override | ||
| public String getGrammarFileName() { return "CalcAttr.g4"; } | ||
|
|
||
| @Override | ||
| public String[] getRuleNames() { return ruleNames; } | ||
|
|
||
| @Override | ||
| public String getSerializedATN() { return _serializedATN; } | ||
|
|
||
| @Override | ||
| public String[] getModeNames() { return modeNames; } | ||
|
|
||
| @Override | ||
| public ATN getATN() { return _ATN; } | ||
|
|
||
| public static final String _serializedATN = | ||
| "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\t$\b\1\4\2\t\2\4"+ | ||
| "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\3\3\3\3\4\3\4"+ | ||
| "\3\5\3\5\3\6\3\6\3\7\6\7\35\n\7\r\7\16\7\36\3\b\3\b\3\b\3\b\2\2\t\3\3"+ | ||
| "\5\4\7\5\t\6\13\7\r\b\17\t\3\2\4\3\2\62;\5\2\13\f\17\17\"\"$\2\3\3\2\2"+ | ||
| "\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3"+ | ||
| "\2\2\2\3\21\3\2\2\2\5\23\3\2\2\2\7\25\3\2\2\2\t\27\3\2\2\2\13\31\3\2\2"+ | ||
| "\2\r\34\3\2\2\2\17 \3\2\2\2\21\22\7,\2\2\22\4\3\2\2\2\23\24\7-\2\2\24"+ | ||
| "\6\3\2\2\2\25\26\7/\2\2\26\b\3\2\2\2\27\30\7*\2\2\30\n\3\2\2\2\31\32\7"+ | ||
| "+\2\2\32\f\3\2\2\2\33\35\t\2\2\2\34\33\3\2\2\2\35\36\3\2\2\2\36\34\3\2"+ | ||
| "\2\2\36\37\3\2\2\2\37\16\3\2\2\2 !\t\3\2\2!\"\3\2\2\2\"#\b\b\2\2#\20\3"+ | ||
| "\2\2\2\4\2\36\3\b\2\2"; | ||
| 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); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,12 @@ | ||
| TIMES=1 | ||
| PLUS=2 | ||
| MINUS=3 | ||
| LPAR=4 | ||
| RPAR=5 | ||
| NUMBER=6 | ||
| WS=7 | ||
| '*'=1 | ||
| '+'=2 | ||
| '-'=3 | ||
| '('=4 | ||
| ')'=5 |
| @@ -0,0 +1,20 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.ParseTreeListener; | ||
|
|
||
| /** | ||
| * This interface defines a complete listener for a parse tree produced by | ||
| * {@link CalcAttrParser}. | ||
| */ | ||
| public interface CalcAttrListener extends ParseTreeListener { | ||
| /** | ||
| * Enter a parse tree produced by {@link CalcAttrParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterExpr(CalcAttrParser.ExprContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by {@link CalcAttrParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitExpr(CalcAttrParser.ExprContext ctx); | ||
| } |
| @@ -0,0 +1,269 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| 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 CalcAttrParser extends Parser { | ||
| static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } | ||
|
|
||
| protected static final DFA[] _decisionToDFA; | ||
| protected static final PredictionContextCache _sharedContextCache = | ||
| new PredictionContextCache(); | ||
| public static final int | ||
| TIMES=1, PLUS=2, MINUS=3, LPAR=4, RPAR=5, NUMBER=6, WS=7; | ||
| public static final int | ||
| RULE_expr = 0; | ||
| public static final String[] ruleNames = { | ||
| "expr" | ||
| }; | ||
|
|
||
| private static final String[] _LITERAL_NAMES = { | ||
| null, "'*'", "'+'", "'-'", "'('", "')'" | ||
| }; | ||
| private static final String[] _SYMBOLIC_NAMES = { | ||
| null, "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS" | ||
| }; | ||
| 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 "CalcAttr.g4"; } | ||
|
|
||
| @Override | ||
| public String[] getRuleNames() { return ruleNames; } | ||
|
|
||
| @Override | ||
| public String getSerializedATN() { return _serializedATN; } | ||
|
|
||
| @Override | ||
| public ATN getATN() { return _ATN; } | ||
|
|
||
|
|
||
| private int getValue(String text) { | ||
| return Integer.parseInt(text); | ||
| } | ||
|
|
||
| public CalcAttrParser(TokenStream input) { | ||
| super(input); | ||
| _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); | ||
| } | ||
| public static class ExprContext extends ParserRuleContext { | ||
| public int val; | ||
| public ExprContext e0; | ||
| public ExprContext e; | ||
| public Token NUMBER; | ||
| public ExprContext e1; | ||
| public TerminalNode MINUS() { return getToken(CalcAttrParser.MINUS, 0); } | ||
| public List<ExprContext> expr() { | ||
| return getRuleContexts(ExprContext.class); | ||
| } | ||
| public ExprContext expr(int i) { | ||
| return getRuleContext(ExprContext.class,i); | ||
| } | ||
| public TerminalNode LPAR() { return getToken(CalcAttrParser.LPAR, 0); } | ||
| public TerminalNode RPAR() { return getToken(CalcAttrParser.RPAR, 0); } | ||
| public TerminalNode NUMBER() { return getToken(CalcAttrParser.NUMBER, 0); } | ||
| public TerminalNode TIMES() { return getToken(CalcAttrParser.TIMES, 0); } | ||
| public TerminalNode PLUS() { return getToken(CalcAttrParser.PLUS, 0); } | ||
| public ExprContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_expr; } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcAttrListener ) ((CalcAttrListener)listener).enterExpr(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcAttrListener ) ((CalcAttrListener)listener).exitExpr(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcAttrVisitor ) return ((CalcAttrVisitor<? extends T>)visitor).visitExpr(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final ExprContext expr() throws RecognitionException { | ||
| return expr(0); | ||
| } | ||
|
|
||
| private ExprContext expr(int _p) throws RecognitionException { | ||
| ParserRuleContext _parentctx = _ctx; | ||
| int _parentState = getState(); | ||
| ExprContext _localctx = new ExprContext(_ctx, _parentState); | ||
| ExprContext _prevctx = _localctx; | ||
| int _startState = 0; | ||
| enterRecursionRule(_localctx, 0, RULE_expr, _p); | ||
| try { | ||
| int _alt; | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(15); | ||
| switch (_input.LA(1)) { | ||
| case MINUS: | ||
| { | ||
| setState(3); | ||
| match(MINUS); | ||
| setState(4); | ||
| ((ExprContext)_localctx).e = expr(1); | ||
| ((ExprContext)_localctx).val = ((ExprContext)_localctx).e.val * -1; | ||
| } | ||
| break; | ||
| case LPAR: | ||
| { | ||
| setState(7); | ||
| match(LPAR); | ||
| setState(8); | ||
| ((ExprContext)_localctx).e = expr(0); | ||
| setState(9); | ||
| match(RPAR); | ||
| ((ExprContext)_localctx).val = ((ExprContext)_localctx).e.val; | ||
| } | ||
| break; | ||
| case NUMBER: | ||
| { | ||
| System.out.println("Evaluating NUMBER"); | ||
| setState(13); | ||
| ((ExprContext)_localctx).NUMBER = match(NUMBER); | ||
| ((ExprContext)_localctx).val = getValue((((ExprContext)_localctx).NUMBER!=null?((ExprContext)_localctx).NUMBER.getText():null)); | ||
| } | ||
| break; | ||
| default: | ||
| throw new NoViableAltException(this); | ||
| } | ||
| _ctx.stop = _input.LT(-1); | ||
| setState(29); | ||
| _errHandler.sync(this); | ||
| _alt = getInterpreter().adaptivePredict(_input,2,_ctx); | ||
| while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { | ||
| if ( _alt==1 ) { | ||
| if ( _parseListeners!=null ) triggerExitRuleEvent(); | ||
| _prevctx = _localctx; | ||
| { | ||
| setState(27); | ||
| switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { | ||
| case 1: | ||
| { | ||
| _localctx = new ExprContext(_parentctx, _parentState); | ||
| _localctx.e0 = _prevctx; | ||
| _localctx.e0 = _prevctx; | ||
| pushNewRecursionContext(_localctx, _startState, RULE_expr); | ||
| setState(17); | ||
| if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); | ||
| setState(18); | ||
| match(TIMES); | ||
| setState(19); | ||
| ((ExprContext)_localctx).e1 = expr(6); | ||
| ((ExprContext)_localctx).val = ((ExprContext)_localctx).e0.val * ((ExprContext)_localctx).e1.val; | ||
| } | ||
| break; | ||
| case 2: | ||
| { | ||
| _localctx = new ExprContext(_parentctx, _parentState); | ||
| _localctx.e0 = _prevctx; | ||
| _localctx.e0 = _prevctx; | ||
| pushNewRecursionContext(_localctx, _startState, RULE_expr); | ||
| setState(22); | ||
| if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); | ||
| setState(23); | ||
| match(PLUS); | ||
| setState(24); | ||
| ((ExprContext)_localctx).e1 = expr(5); | ||
| ((ExprContext)_localctx).val = ((ExprContext)_localctx).e0.val + ((ExprContext)_localctx).e1.val; | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| setState(31); | ||
| _errHandler.sync(this); | ||
| _alt = getInterpreter().adaptivePredict(_input,2,_ctx); | ||
| } | ||
| } | ||
| } | ||
| catch (RecognitionException re) { | ||
| _localctx.exception = re; | ||
| _errHandler.reportError(this, re); | ||
| _errHandler.recover(this, re); | ||
| } | ||
| finally { | ||
| unrollRecursionContexts(_parentctx); | ||
| } | ||
| return _localctx; | ||
| } | ||
|
|
||
| public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { | ||
| switch (ruleIndex) { | ||
| case 0: | ||
| return expr_sempred((ExprContext)_localctx, predIndex); | ||
| } | ||
| return true; | ||
| } | ||
| private boolean expr_sempred(ExprContext _localctx, int predIndex) { | ||
| switch (predIndex) { | ||
| case 0: | ||
| return precpred(_ctx, 5); | ||
| case 1: | ||
| return precpred(_ctx, 4); | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| public static final String _serializedATN = | ||
| "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\t#\4\2\t\2\3\2\3"+ | ||
| "\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5\2\22\n\2\3\2\3\2\3\2"+ | ||
| "\3\2\3\2\3\2\3\2\3\2\3\2\3\2\7\2\36\n\2\f\2\16\2!\13\2\3\2\2\3\2\3\2\2"+ | ||
| "\2%\2\21\3\2\2\2\4\5\b\2\1\2\5\6\7\5\2\2\6\7\5\2\2\3\7\b\b\2\1\2\b\22"+ | ||
| "\3\2\2\2\t\n\7\6\2\2\n\13\5\2\2\2\13\f\7\7\2\2\f\r\b\2\1\2\r\22\3\2\2"+ | ||
| "\2\16\17\b\2\1\2\17\20\7\b\2\2\20\22\b\2\1\2\21\4\3\2\2\2\21\t\3\2\2\2"+ | ||
| "\21\16\3\2\2\2\22\37\3\2\2\2\23\24\f\7\2\2\24\25\7\3\2\2\25\26\5\2\2\b"+ | ||
| "\26\27\b\2\1\2\27\36\3\2\2\2\30\31\f\6\2\2\31\32\7\4\2\2\32\33\5\2\2\7"+ | ||
| "\33\34\b\2\1\2\34\36\3\2\2\2\35\23\3\2\2\2\35\30\3\2\2\2\36!\3\2\2\2\37"+ | ||
| "\35\3\2\2\2\37 \3\2\2\2 \3\3\2\2\2!\37\3\2\2\2\5\21\35\37"; | ||
| 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); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,19 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\CalcAttr.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.ParseTreeVisitor; | ||
|
|
||
| /** | ||
| * This interface defines a complete generic visitor for a parse tree produced | ||
| * by {@link CalcAttrParser}. | ||
| * | ||
| * @param <T> The return type of the visit operation. Use {@link Void} for | ||
| * operations with no return type. | ||
| */ | ||
| public interface CalcAttrVisitor<T> extends ParseTreeVisitor<T> { | ||
| /** | ||
| * Visit a parse tree produced by {@link CalcAttrParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitExpr(CalcAttrParser.ExprContext ctx); | ||
| } |
| @@ -0,0 +1,99 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
|
|
||
| import org.antlr.v4.runtime.ParserRuleContext; | ||
| import org.antlr.v4.runtime.tree.ErrorNode; | ||
| import org.antlr.v4.runtime.tree.TerminalNode; | ||
|
|
||
| /** | ||
| * This class provides an empty implementation of {@link CalcListener}, | ||
| * which can be extended to create a listener which only needs to handle a subset | ||
| * of the available methods. | ||
| */ | ||
| public class CalcBaseListener implements CalcListener { | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterPar(CalcParser.ParContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitPar(CalcParser.ParContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterMinus(CalcParser.MinusContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitMinus(CalcParser.MinusContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterNumber(CalcParser.NumberContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitNumber(CalcParser.NumberContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterTimes(CalcParser.TimesContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitTimes(CalcParser.TimesContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterPlus(CalcParser.PlusContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitPlus(CalcParser.PlusContext ctx) { } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void enterEveryRule(ParserRuleContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void exitEveryRule(ParserRuleContext ctx) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void visitTerminal(TerminalNode node) { } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation does nothing.</p> | ||
| */ | ||
| @Override public void visitErrorNode(ErrorNode node) { } | ||
| } |
| @@ -0,0 +1,49 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; | ||
|
|
||
| /** | ||
| * This class provides an empty implementation of {@link CalcVisitor}, | ||
| * which can be extended to create a visitor which only needs to handle a subset | ||
| * of the available methods. | ||
| * | ||
| * @param <T> The return type of the visit operation. Use {@link Void} for | ||
| * operations with no return type. | ||
| */ | ||
| public class CalcBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements CalcVisitor<T> { | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitPar(CalcParser.ParContext ctx) { return visitChildren(ctx); } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitMinus(CalcParser.MinusContext ctx) { return visitChildren(ctx); } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitNumber(CalcParser.NumberContext ctx) { return visitChildren(ctx); } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitTimes(CalcParser.TimesContext ctx) { return visitChildren(ctx); } | ||
| /** | ||
| * {@inheritDoc} | ||
| * | ||
| * <p>The default implementation returns the result of calling | ||
| * {@link #visitChildren} on {@code ctx}.</p> | ||
| */ | ||
| @Override public T visitPlus(CalcParser.PlusContext ctx) { return visitChildren(ctx); } | ||
| } |
| @@ -0,0 +1,109 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.Lexer; | ||
| import org.antlr.v4.runtime.CharStream; | ||
| import org.antlr.v4.runtime.Token; | ||
| import org.antlr.v4.runtime.TokenStream; | ||
| import org.antlr.v4.runtime.*; | ||
| import org.antlr.v4.runtime.atn.*; | ||
| import org.antlr.v4.runtime.dfa.DFA; | ||
| import org.antlr.v4.runtime.misc.*; | ||
|
|
||
| @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) | ||
| public class CalcLexer extends Lexer { | ||
| static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } | ||
|
|
||
| protected static final DFA[] _decisionToDFA; | ||
| protected static final PredictionContextCache _sharedContextCache = | ||
| new PredictionContextCache(); | ||
| public static final int | ||
| TIMES=1, PLUS=2, MINUS=3, LPAR=4, RPAR=5, NUMBER=6, WS=7; | ||
| public static String[] modeNames = { | ||
| "DEFAULT_MODE" | ||
| }; | ||
|
|
||
| public static final String[] ruleNames = { | ||
| "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS" | ||
| }; | ||
|
|
||
| private static final String[] _LITERAL_NAMES = { | ||
| null, "'*'", "'+'", "'-'", "'('", "')'" | ||
| }; | ||
| private static final String[] _SYMBOLIC_NAMES = { | ||
| null, "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS" | ||
| }; | ||
| 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; | ||
| } | ||
|
|
||
|
|
||
| public CalcLexer(CharStream input) { | ||
| super(input); | ||
| _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); | ||
| } | ||
|
|
||
| @Override | ||
| public String getGrammarFileName() { return "Calc.g4"; } | ||
|
|
||
| @Override | ||
| public String[] getRuleNames() { return ruleNames; } | ||
|
|
||
| @Override | ||
| public String getSerializedATN() { return _serializedATN; } | ||
|
|
||
| @Override | ||
| public String[] getModeNames() { return modeNames; } | ||
|
|
||
| @Override | ||
| public ATN getATN() { return _ATN; } | ||
|
|
||
| public static final String _serializedATN = | ||
| "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\t$\b\1\4\2\t\2\4"+ | ||
| "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\3\3\3\3\4\3\4"+ | ||
| "\3\5\3\5\3\6\3\6\3\7\6\7\35\n\7\r\7\16\7\36\3\b\3\b\3\b\3\b\2\2\t\3\3"+ | ||
| "\5\4\7\5\t\6\13\7\r\b\17\t\3\2\4\3\2\62;\5\2\13\f\17\17\"\"$\2\3\3\2\2"+ | ||
| "\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3"+ | ||
| "\2\2\2\3\21\3\2\2\2\5\23\3\2\2\2\7\25\3\2\2\2\t\27\3\2\2\2\13\31\3\2\2"+ | ||
| "\2\r\34\3\2\2\2\17 \3\2\2\2\21\22\7,\2\2\22\4\3\2\2\2\23\24\7-\2\2\24"+ | ||
| "\6\3\2\2\2\25\26\7/\2\2\26\b\3\2\2\2\27\30\7*\2\2\30\n\3\2\2\2\31\32\7"+ | ||
| "+\2\2\32\f\3\2\2\2\33\35\t\2\2\2\34\33\3\2\2\2\35\36\3\2\2\2\36\34\3\2"+ | ||
| "\2\2\36\37\3\2\2\2\37\16\3\2\2\2 !\t\3\2\2!\"\3\2\2\2\"#\b\b\2\2#\20\3"+ | ||
| "\2\2\2\4\2\36\3\b\2\2"; | ||
| 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); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,12 @@ | ||
| TIMES=1 | ||
| PLUS=2 | ||
| MINUS=3 | ||
| LPAR=4 | ||
| RPAR=5 | ||
| NUMBER=6 | ||
| WS=7 | ||
| '*'=1 | ||
| '+'=2 | ||
| '-'=3 | ||
| '('=4 | ||
| ')'=5 |
| @@ -0,0 +1,70 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.ParseTreeListener; | ||
|
|
||
| /** | ||
| * This interface defines a complete listener for a parse tree produced by | ||
| * {@link CalcParser}. | ||
| */ | ||
| public interface CalcListener extends ParseTreeListener { | ||
| /** | ||
| * Enter a parse tree produced by the {@code par} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterPar(CalcParser.ParContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by the {@code par} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitPar(CalcParser.ParContext ctx); | ||
| /** | ||
| * Enter a parse tree produced by the {@code minus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterMinus(CalcParser.MinusContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by the {@code minus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitMinus(CalcParser.MinusContext ctx); | ||
| /** | ||
| * Enter a parse tree produced by the {@code number} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterNumber(CalcParser.NumberContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by the {@code number} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitNumber(CalcParser.NumberContext ctx); | ||
| /** | ||
| * Enter a parse tree produced by the {@code times} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterTimes(CalcParser.TimesContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by the {@code times} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitTimes(CalcParser.TimesContext ctx); | ||
| /** | ||
| * Enter a parse tree produced by the {@code plus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void enterPlus(CalcParser.PlusContext ctx); | ||
| /** | ||
| * Exit a parse tree produced by the {@code plus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| */ | ||
| void exitPlus(CalcParser.PlusContext ctx); | ||
| } |
| @@ -0,0 +1,341 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| 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 CalcParser extends Parser { | ||
| static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); } | ||
|
|
||
| protected static final DFA[] _decisionToDFA; | ||
| protected static final PredictionContextCache _sharedContextCache = | ||
| new PredictionContextCache(); | ||
| public static final int | ||
| TIMES=1, PLUS=2, MINUS=3, LPAR=4, RPAR=5, NUMBER=6, WS=7, Minus=8; | ||
| public static final int | ||
| RULE_expr = 0; | ||
| public static final String[] ruleNames = { | ||
| "expr" | ||
| }; | ||
|
|
||
| private static final String[] _LITERAL_NAMES = { | ||
| null, "'*'", "'+'", "'-'", "'('", "')'" | ||
| }; | ||
| private static final String[] _SYMBOLIC_NAMES = { | ||
| null, "TIMES", "PLUS", "MINUS", "LPAR", "RPAR", "NUMBER", "WS", "Minus" | ||
| }; | ||
| 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 "Calc.g4"; } | ||
|
|
||
| @Override | ||
| public String[] getRuleNames() { return ruleNames; } | ||
|
|
||
| @Override | ||
| public String getSerializedATN() { return _serializedATN; } | ||
|
|
||
| @Override | ||
| public ATN getATN() { return _ATN; } | ||
|
|
||
| public CalcParser(TokenStream input) { | ||
| super(input); | ||
| _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); | ||
| } | ||
| public static class ExprContext extends ParserRuleContext { | ||
| public ExprContext(ParserRuleContext parent, int invokingState) { | ||
| super(parent, invokingState); | ||
| } | ||
| @Override public int getRuleIndex() { return RULE_expr; } | ||
|
|
||
| public ExprContext() { } | ||
| public void copyFrom(ExprContext ctx) { | ||
| super.copyFrom(ctx); | ||
| } | ||
| } | ||
| public static class ParContext extends ExprContext { | ||
| public TerminalNode LPAR() { return getToken(CalcParser.LPAR, 0); } | ||
| public ExprContext expr() { | ||
| return getRuleContext(ExprContext.class,0); | ||
| } | ||
| public TerminalNode RPAR() { return getToken(CalcParser.RPAR, 0); } | ||
| public ParContext(ExprContext ctx) { copyFrom(ctx); } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).enterPar(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).exitPar(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcVisitor ) return ((CalcVisitor<? extends T>)visitor).visitPar(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
| public static class MinusContext extends ExprContext { | ||
| public TerminalNode Minus() { return getToken(CalcParser.Minus, 0); } | ||
| public ExprContext expr() { | ||
| return getRuleContext(ExprContext.class,0); | ||
| } | ||
| public MinusContext(ExprContext ctx) { copyFrom(ctx); } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).enterMinus(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).exitMinus(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcVisitor ) return ((CalcVisitor<? extends T>)visitor).visitMinus(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
| public static class NumberContext extends ExprContext { | ||
| public TerminalNode NUMBER() { return getToken(CalcParser.NUMBER, 0); } | ||
| public NumberContext(ExprContext ctx) { copyFrom(ctx); } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).enterNumber(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).exitNumber(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcVisitor ) return ((CalcVisitor<? extends T>)visitor).visitNumber(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
| public static class TimesContext extends ExprContext { | ||
| public List<ExprContext> expr() { | ||
| return getRuleContexts(ExprContext.class); | ||
| } | ||
| public ExprContext expr(int i) { | ||
| return getRuleContext(ExprContext.class,i); | ||
| } | ||
| public TerminalNode TIMES() { return getToken(CalcParser.TIMES, 0); } | ||
| public TimesContext(ExprContext ctx) { copyFrom(ctx); } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).enterTimes(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).exitTimes(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcVisitor ) return ((CalcVisitor<? extends T>)visitor).visitTimes(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
| public static class PlusContext extends ExprContext { | ||
| public List<ExprContext> expr() { | ||
| return getRuleContexts(ExprContext.class); | ||
| } | ||
| public ExprContext expr(int i) { | ||
| return getRuleContext(ExprContext.class,i); | ||
| } | ||
| public TerminalNode PLUS() { return getToken(CalcParser.PLUS, 0); } | ||
| public PlusContext(ExprContext ctx) { copyFrom(ctx); } | ||
| @Override | ||
| public void enterRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).enterPlus(this); | ||
| } | ||
| @Override | ||
| public void exitRule(ParseTreeListener listener) { | ||
| if ( listener instanceof CalcListener ) ((CalcListener)listener).exitPlus(this); | ||
| } | ||
| @Override | ||
| public <T> T accept(ParseTreeVisitor<? extends T> visitor) { | ||
| if ( visitor instanceof CalcVisitor ) return ((CalcVisitor<? extends T>)visitor).visitPlus(this); | ||
| else return visitor.visitChildren(this); | ||
| } | ||
| } | ||
|
|
||
| public final ExprContext expr() throws RecognitionException { | ||
| return expr(0); | ||
| } | ||
|
|
||
| private ExprContext expr(int _p) throws RecognitionException { | ||
| ParserRuleContext _parentctx = _ctx; | ||
| int _parentState = getState(); | ||
| ExprContext _localctx = new ExprContext(_ctx, _parentState); | ||
| ExprContext _prevctx = _localctx; | ||
| int _startState = 0; | ||
| enterRecursionRule(_localctx, 0, RULE_expr, _p); | ||
| try { | ||
| int _alt; | ||
| enterOuterAlt(_localctx, 1); | ||
| { | ||
| setState(10); | ||
| switch (_input.LA(1)) { | ||
| case Minus: | ||
| { | ||
| _localctx = new MinusContext(_localctx); | ||
| _ctx = _localctx; | ||
| _prevctx = _localctx; | ||
|
|
||
| setState(3); | ||
| match(Minus); | ||
| setState(4); | ||
| expr(1); | ||
| } | ||
| break; | ||
| case LPAR: | ||
| { | ||
| _localctx = new ParContext(_localctx); | ||
| _ctx = _localctx; | ||
| _prevctx = _localctx; | ||
| setState(5); | ||
| match(LPAR); | ||
| setState(6); | ||
| expr(0); | ||
| setState(7); | ||
| match(RPAR); | ||
| } | ||
| break; | ||
| case NUMBER: | ||
| { | ||
| _localctx = new NumberContext(_localctx); | ||
| _ctx = _localctx; | ||
| _prevctx = _localctx; | ||
| setState(9); | ||
| match(NUMBER); | ||
| } | ||
| break; | ||
| default: | ||
| throw new NoViableAltException(this); | ||
| } | ||
| _ctx.stop = _input.LT(-1); | ||
| setState(20); | ||
| _errHandler.sync(this); | ||
| _alt = getInterpreter().adaptivePredict(_input,2,_ctx); | ||
| while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { | ||
| if ( _alt==1 ) { | ||
| if ( _parseListeners!=null ) triggerExitRuleEvent(); | ||
| _prevctx = _localctx; | ||
| { | ||
| setState(18); | ||
| switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { | ||
| case 1: | ||
| { | ||
| _localctx = new TimesContext(new ExprContext(_parentctx, _parentState)); | ||
| pushNewRecursionContext(_localctx, _startState, RULE_expr); | ||
| setState(12); | ||
| if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); | ||
| setState(13); | ||
| match(TIMES); | ||
| setState(14); | ||
| expr(6); | ||
| } | ||
| break; | ||
| case 2: | ||
| { | ||
| _localctx = new PlusContext(new ExprContext(_parentctx, _parentState)); | ||
| pushNewRecursionContext(_localctx, _startState, RULE_expr); | ||
| setState(15); | ||
| if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); | ||
| setState(16); | ||
| match(PLUS); | ||
| setState(17); | ||
| expr(5); | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| setState(22); | ||
| _errHandler.sync(this); | ||
| _alt = getInterpreter().adaptivePredict(_input,2,_ctx); | ||
| } | ||
| } | ||
| } | ||
| catch (RecognitionException re) { | ||
| _localctx.exception = re; | ||
| _errHandler.reportError(this, re); | ||
| _errHandler.recover(this, re); | ||
| } | ||
| finally { | ||
| unrollRecursionContexts(_parentctx); | ||
| } | ||
| return _localctx; | ||
| } | ||
|
|
||
| public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { | ||
| switch (ruleIndex) { | ||
| case 0: | ||
| return expr_sempred((ExprContext)_localctx, predIndex); | ||
| } | ||
| return true; | ||
| } | ||
| private boolean expr_sempred(ExprContext _localctx, int predIndex) { | ||
| switch (predIndex) { | ||
| case 0: | ||
| return precpred(_ctx, 5); | ||
| case 1: | ||
| return precpred(_ctx, 4); | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| public static final String _serializedATN = | ||
| "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\n\32\4\2\t\2\3\2"+ | ||
| "\3\2\3\2\3\2\3\2\3\2\3\2\3\2\5\2\r\n\2\3\2\3\2\3\2\3\2\3\2\3\2\7\2\25"+ | ||
| "\n\2\f\2\16\2\30\13\2\3\2\2\3\2\3\2\2\2\34\2\f\3\2\2\2\4\5\b\2\1\2\5\6"+ | ||
| "\7\n\2\2\6\r\5\2\2\3\7\b\7\6\2\2\b\t\5\2\2\2\t\n\7\7\2\2\n\r\3\2\2\2\13"+ | ||
| "\r\7\b\2\2\f\4\3\2\2\2\f\7\3\2\2\2\f\13\3\2\2\2\r\26\3\2\2\2\16\17\f\7"+ | ||
| "\2\2\17\20\7\3\2\2\20\25\5\2\2\b\21\22\f\6\2\2\22\23\7\4\2\2\23\25\5\2"+ | ||
| "\2\7\24\16\3\2\2\2\24\21\3\2\2\2\25\30\3\2\2\2\26\24\3\2\2\2\26\27\3\2"+ | ||
| "\2\2\27\3\3\2\2\2\30\26\3\2\2\2\5\f\24\26"; | ||
| 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); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,48 @@ | ||
| // Generated from C:/Users/Bas/Documents/GitHub/module8/src/pp/block3/cc/antlr\Calc.g4 by ANTLR 4.5.1 | ||
| package pp.block3.cc.antlr; | ||
| import org.antlr.v4.runtime.tree.ParseTreeVisitor; | ||
|
|
||
| /** | ||
| * This interface defines a complete generic visitor for a parse tree produced | ||
| * by {@link CalcParser}. | ||
| * | ||
| * @param <T> The return type of the visit operation. Use {@link Void} for | ||
| * operations with no return type. | ||
| */ | ||
| public interface CalcVisitor<T> extends ParseTreeVisitor<T> { | ||
| /** | ||
| * Visit a parse tree produced by the {@code par} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitPar(CalcParser.ParContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by the {@code minus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitMinus(CalcParser.MinusContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by the {@code number} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitNumber(CalcParser.NumberContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by the {@code times} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitTimes(CalcParser.TimesContext ctx); | ||
| /** | ||
| * Visit a parse tree produced by the {@code plus} | ||
| * labeled alternative in {@link CalcParser#expr}. | ||
| * @param ctx the parse tree | ||
| * @return the visitor result | ||
| */ | ||
| T visitPlus(CalcParser.PlusContext ctx); | ||
| } |