commit 04d4f32ad94cf3bb3d7eb9e24f3b082aaf121c89 Author: jespergravgaard Date: Mon May 1 00:11:51 2017 +0200 A bit more subpix work. Some font-work and a KickC parser start. diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000..40ed93785 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..97626ba45 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/org_antlr_antlr4_4_7.xml b/.idea/libraries/org_antlr_antlr4_4_7.xml new file mode 100644 index 000000000..0c3377830 --- /dev/null +++ b/.idea/libraries/org_antlr_antlr4_4_7.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..ab8dd2af1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + Android Lint + + + Compiler issuesJava + + + GPath inspectionsGroovy + + + Groovy + + + Internationalization issues + + + Java + + + Performance issuesJava + + + Portability issuesJava + + + Properties Files + + + Properties FilesJava + + + + + + + + + + $USER_HOME$/.subversion + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..2664a42ec --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..6c0b86358 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kickc.iml b/kickc.iml new file mode 100644 index 000000000..a9ed1a094 --- /dev/null +++ b/kickc.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/ST4-4.0.8.jar b/lib/ST4-4.0.8.jar new file mode 100644 index 000000000..144828ba8 Binary files /dev/null and b/lib/ST4-4.0.8.jar differ diff --git a/lib/antlr-runtime-3.5.2.jar b/lib/antlr-runtime-3.5.2.jar new file mode 100644 index 000000000..d48e3e867 Binary files /dev/null and b/lib/antlr-runtime-3.5.2.jar differ diff --git a/lib/antlr4-4.7-javadoc.jar b/lib/antlr4-4.7-javadoc.jar new file mode 100644 index 000000000..315d2562a Binary files /dev/null and b/lib/antlr4-4.7-javadoc.jar differ diff --git a/lib/antlr4-4.7-sources.jar b/lib/antlr4-4.7-sources.jar new file mode 100644 index 000000000..a8bb7ea2f Binary files /dev/null and b/lib/antlr4-4.7-sources.jar differ diff --git a/lib/antlr4-4.7.jar b/lib/antlr4-4.7.jar new file mode 100644 index 000000000..dccc844ae Binary files /dev/null and b/lib/antlr4-4.7.jar differ diff --git a/lib/antlr4-runtime-4.7.jar b/lib/antlr4-runtime-4.7.jar new file mode 100644 index 000000000..5c3bf7d35 Binary files /dev/null and b/lib/antlr4-runtime-4.7.jar differ diff --git a/lib/icu4j-58.2.jar b/lib/icu4j-58.2.jar new file mode 100644 index 000000000..71aca7454 Binary files /dev/null and b/lib/icu4j-58.2.jar differ diff --git a/lib/javax.json-1.0.4.jar b/lib/javax.json-1.0.4.jar new file mode 100644 index 000000000..09967d815 Binary files /dev/null and b/lib/javax.json-1.0.4.jar differ diff --git a/lib/org.abego.treelayout.core-1.0.3.jar b/lib/org.abego.treelayout.core-1.0.3.jar new file mode 100644 index 000000000..d78492b6c Binary files /dev/null and b/lib/org.abego.treelayout.core-1.0.3.jar differ diff --git a/src/dk/camelot64/kickc/parser/KickC.g4 b/src/dk/camelot64/kickc/parser/KickC.g4 new file mode 100644 index 000000000..fd8598eee --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickC.g4 @@ -0,0 +1,21 @@ +// Define a grammar called Hello +grammar KickC; +expr : + NUMBER | + NAME | + '(' expr ')' | + ('+' | '-') expr | + expr ( '*' | '/' ) expr | + expr ( '+' | '-' ) expr ; +NAME : NAME_START NAME_CHAR* ; +fragment NAME_START : [a-zA-Z_]; +fragment NAME_CHAR : [a-zA-Z0-9_]; +NUMBER : FLOAT | DECINTEGER | HEXINTEGER | BININTEGER ; +FLOAT : (DECDIGIT)* '.' DECDIGIT+; +DECINTEGER : DECDIGIT+ ; +fragment DECDIGIT : [0-9]; +HEXINTEGER : '0' [xX] HEXDIGIT+ | '$' HEXDIGIT+ ; +fragment HEXDIGIT : [0-9a-fA-F]; +BININTEGER : '0' [bB] BINDIGIT+ | '%' BINDIGIT+ ; +fragment BINDIGIT : [0-1]; +WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines \ No newline at end of file diff --git a/src/dk/camelot64/kickc/parser/KickC.tokens b/src/dk/camelot64/kickc/parser/KickC.tokens new file mode 100644 index 000000000..d7768208a --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickC.tokens @@ -0,0 +1,18 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +NAME=7 +FLOAT=8 +HEXINTEGER=9 +DECINTEGER=10 +BININTEGER=11 +WS=12 +'('=1 +')'=2 +'+'=3 +'-'=4 +'*'=5 +'/'=6 diff --git a/src/dk/camelot64/kickc/parser/KickCBaseListener.java b/src/dk/camelot64/kickc/parser/KickCBaseListener.java new file mode 100644 index 000000000..6378979b4 --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickCBaseListener.java @@ -0,0 +1,51 @@ +// Generated from /Users/jespergravgaard/c64/src/kickc/src/dk/camelot64/kickc/parser/KickC.g4 by ANTLR 4.7 +package dk.camelot64.kickc.parser; + +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 KickCListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +public class KickCBaseListener implements KickCListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExpr(KickCParser.ExprContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExpr(KickCParser.ExprContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/parser/KickCLexer.java b/src/dk/camelot64/kickc/parser/KickCLexer.java new file mode 100644 index 000000000..45fca390f --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickCLexer.java @@ -0,0 +1,141 @@ +// Generated from /Users/jespergravgaard/c64/src/kickc/src/dk/camelot64/kickc/parser/KickC.g4 by ANTLR 4.7 +package dk.camelot64.kickc.parser; +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 KickCLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, NAME=7, FLOAT=8, HEXINTEGER=9, + DECINTEGER=10, BININTEGER=11, WS=12; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + public static final String[] ruleNames = { + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "NAME", "NAME_START", + "NAME_CHAR", "FLOAT", "HEXINTEGER", "HEXDIGIT", "DECINTEGER", "DECDIGIT", + "BININTEGER", "BINDIGIT", "WS" + }; + + private static final String[] _LITERAL_NAMES = { + null, "'('", "')'", "'+'", "'-'", "'*'", "'/'" + }; + private static final String[] _SYMBOLIC_NAMES = { + null, null, null, null, null, null, null, "NAME", "FLOAT", "HEXINTEGER", + "DECINTEGER", "BININTEGER", "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] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public KickCLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "KickC.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\16x\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\4\t\t\t\4\n\t\n\4\13\t"+ + "\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ + "\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\7\b\64\n\b\f"+ + "\b\16\b\67\13\b\3\t\3\t\3\n\3\n\3\13\7\13>\n\13\f\13\16\13A\13\13\3\13"+ + "\3\13\6\13E\n\13\r\13\16\13F\3\f\3\f\3\f\6\fL\n\f\r\f\16\fM\3\f\3\f\6"+ + "\fR\n\f\r\f\16\fS\5\fV\n\f\3\r\3\r\3\16\6\16[\n\16\r\16\16\16\\\3\17\3"+ + "\17\3\20\3\20\3\20\6\20d\n\20\r\20\16\20e\3\20\3\20\6\20j\n\20\r\20\16"+ + "\20k\5\20n\n\20\3\21\3\21\3\22\6\22s\n\22\r\22\16\22t\3\22\3\22\2\2\23"+ + "\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\2\23\2\25\n\27\13\31\2\33\f\35\2\37"+ + "\r!\2#\16\3\2\n\5\2C\\aac|\6\2\62;C\\aac|\4\2ZZzz\5\2\62;CHch\3\2\62;"+ + "\4\2DDdd\3\2\62\63\5\2\13\f\17\17\"\"\2}\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\2\25\3\2\2\2"+ + "\2\27\3\2\2\2\2\33\3\2\2\2\2\37\3\2\2\2\2#\3\2\2\2\3%\3\2\2\2\5\'\3\2"+ + "\2\2\7)\3\2\2\2\t+\3\2\2\2\13-\3\2\2\2\r/\3\2\2\2\17\61\3\2\2\2\218\3"+ + "\2\2\2\23:\3\2\2\2\25?\3\2\2\2\27U\3\2\2\2\31W\3\2\2\2\33Z\3\2\2\2\35"+ + "^\3\2\2\2\37m\3\2\2\2!o\3\2\2\2#r\3\2\2\2%&\7*\2\2&\4\3\2\2\2\'(\7+\2"+ + "\2(\6\3\2\2\2)*\7-\2\2*\b\3\2\2\2+,\7/\2\2,\n\3\2\2\2-.\7,\2\2.\f\3\2"+ + "\2\2/\60\7\61\2\2\60\16\3\2\2\2\61\65\5\21\t\2\62\64\5\23\n\2\63\62\3"+ + "\2\2\2\64\67\3\2\2\2\65\63\3\2\2\2\65\66\3\2\2\2\66\20\3\2\2\2\67\65\3"+ + "\2\2\289\t\2\2\29\22\3\2\2\2:;\t\3\2\2;\24\3\2\2\2<>\5\35\17\2=<\3\2\2"+ + "\2>A\3\2\2\2?=\3\2\2\2?@\3\2\2\2@B\3\2\2\2A?\3\2\2\2BD\7\60\2\2CE\5\35"+ + "\17\2DC\3\2\2\2EF\3\2\2\2FD\3\2\2\2FG\3\2\2\2G\26\3\2\2\2HI\7\62\2\2I"+ + "K\t\4\2\2JL\5\31\r\2KJ\3\2\2\2LM\3\2\2\2MK\3\2\2\2MN\3\2\2\2NV\3\2\2\2"+ + "OQ\7&\2\2PR\5\31\r\2QP\3\2\2\2RS\3\2\2\2SQ\3\2\2\2ST\3\2\2\2TV\3\2\2\2"+ + "UH\3\2\2\2UO\3\2\2\2V\30\3\2\2\2WX\t\5\2\2X\32\3\2\2\2Y[\5\35\17\2ZY\3"+ + "\2\2\2[\\\3\2\2\2\\Z\3\2\2\2\\]\3\2\2\2]\34\3\2\2\2^_\t\6\2\2_\36\3\2"+ + "\2\2`a\7\62\2\2ac\t\7\2\2bd\5!\21\2cb\3\2\2\2de\3\2\2\2ec\3\2\2\2ef\3"+ + "\2\2\2fn\3\2\2\2gi\7\'\2\2hj\5!\21\2ih\3\2\2\2jk\3\2\2\2ki\3\2\2\2kl\3"+ + "\2\2\2ln\3\2\2\2m`\3\2\2\2mg\3\2\2\2n \3\2\2\2op\t\b\2\2p\"\3\2\2\2qs"+ + "\t\t\2\2rq\3\2\2\2st\3\2\2\2tr\3\2\2\2tu\3\2\2\2uv\3\2\2\2vw\b\22\2\2"+ + "w$\3\2\2\2\16\2\65?FMSU\\ekmt\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); + } + } +} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/parser/KickCLexer.tokens b/src/dk/camelot64/kickc/parser/KickCLexer.tokens new file mode 100644 index 000000000..d7768208a --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickCLexer.tokens @@ -0,0 +1,18 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +NAME=7 +FLOAT=8 +HEXINTEGER=9 +DECINTEGER=10 +BININTEGER=11 +WS=12 +'('=1 +')'=2 +'+'=3 +'-'=4 +'*'=5 +'/'=6 diff --git a/src/dk/camelot64/kickc/parser/KickCListener.java b/src/dk/camelot64/kickc/parser/KickCListener.java new file mode 100644 index 000000000..3e3673d08 --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickCListener.java @@ -0,0 +1,20 @@ +// Generated from /Users/jespergravgaard/c64/src/kickc/src/dk/camelot64/kickc/parser/KickC.g4 by ANTLR 4.7 +package dk.camelot64.kickc.parser; +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link KickCParser}. + */ +public interface KickCListener extends ParseTreeListener { + /** + * Enter a parse tree produced by {@link KickCParser#expr}. + * @param ctx the parse tree + */ + void enterExpr(KickCParser.ExprContext ctx); + /** + * Exit a parse tree produced by {@link KickCParser#expr}. + * @param ctx the parse tree + */ + void exitExpr(KickCParser.ExprContext ctx); +} \ No newline at end of file diff --git a/src/dk/camelot64/kickc/parser/KickCParser.java b/src/dk/camelot64/kickc/parser/KickCParser.java new file mode 100644 index 000000000..2f74a77df --- /dev/null +++ b/src/dk/camelot64/kickc/parser/KickCParser.java @@ -0,0 +1,297 @@ +// Generated from /Users/jespergravgaard/c64/src/kickc/src/dk/camelot64/kickc/parser/KickC.g4 by ANTLR 4.7 +package dk.camelot64.kickc.parser; +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 KickCParser 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 + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, NAME=7, FLOAT=8, HEXINTEGER=9, + DECINTEGER=10, BININTEGER=11, WS=12; + 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, null, null, null, null, null, null, "NAME", "FLOAT", "HEXINTEGER", + "DECINTEGER", "BININTEGER", "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] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "KickC.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public KickCParser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + public static class ExprContext extends ParserRuleContext { + public TerminalNode DECINTEGER() { return getToken(KickCParser.DECINTEGER, 0); } + public TerminalNode HEXINTEGER() { return getToken(KickCParser.HEXINTEGER, 0); } + public TerminalNode BININTEGER() { return getToken(KickCParser.BININTEGER, 0); } + public TerminalNode FLOAT() { return getToken(KickCParser.FLOAT, 0); } + public TerminalNode NAME() { return getToken(KickCParser.NAME, 0); } + public List expr() { + return getRuleContexts(ExprContext.class); + } + public ExprContext expr(int i) { + return getRuleContext(ExprContext.class,i); + } + 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 KickCListener ) ((KickCListener)listener).enterExpr(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof KickCListener ) ((KickCListener)listener).exitExpr(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); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(14); + _errHandler.sync(this); + switch (_input.LA(1)) { + case DECINTEGER: + { + setState(3); + match(DECINTEGER); + } + break; + case HEXINTEGER: + { + setState(4); + match(HEXINTEGER); + } + break; + case BININTEGER: + { + setState(5); + match(BININTEGER); + } + break; + case FLOAT: + { + setState(6); + match(FLOAT); + } + break; + case NAME: + { + setState(7); + match(NAME); + } + break; + case T__0: + { + setState(8); + match(T__0); + setState(9); + expr(0); + setState(10); + match(T__1); + } + break; + case T__2: + case T__3: + { + setState(12); + _la = _input.LA(1); + if ( !(_la==T__2 || _la==T__3) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(13); + expr(3); + } + break; + default: + throw new NoViableAltException(this); + } + _ctx.stop = _input.LT(-1); + setState(24); + _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(22); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { + case 1: + { + _localctx = new ExprContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expr); + setState(16); + if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(17); + _la = _input.LA(1); + if ( !(_la==T__4 || _la==T__5) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(18); + expr(3); + } + break; + case 2: + { + _localctx = new ExprContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expr); + setState(19); + if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(20); + _la = _input.LA(1); + if ( !(_la==T__2 || _la==T__3) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(21); + expr(2); + } + break; + } + } + } + setState(26); + _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, 2); + case 1: + return precpred(_ctx, 1); + } + return true; + } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\16\36\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\5\2\21\n\2\3\2\3\2\3\2\3"+ + "\2\3\2\3\2\7\2\31\n\2\f\2\16\2\34\13\2\3\2\2\3\2\3\2\2\4\3\2\5\6\3\2\7"+ + "\b\2$\2\20\3\2\2\2\4\5\b\2\1\2\5\21\7\f\2\2\6\21\7\13\2\2\7\21\7\r\2\2"+ + "\b\21\7\n\2\2\t\21\7\t\2\2\n\13\7\3\2\2\13\f\5\2\2\2\f\r\7\4\2\2\r\21"+ + "\3\2\2\2\16\17\t\2\2\2\17\21\5\2\2\5\20\4\3\2\2\2\20\6\3\2\2\2\20\7\3"+ + "\2\2\2\20\b\3\2\2\2\20\t\3\2\2\2\20\n\3\2\2\2\20\16\3\2\2\2\21\32\3\2"+ + "\2\2\22\23\f\4\2\2\23\24\t\3\2\2\24\31\5\2\2\5\25\26\f\3\2\2\26\27\t\2"+ + "\2\2\27\31\5\2\2\4\30\22\3\2\2\2\30\25\3\2\2\2\31\34\3\2\2\2\32\30\3\2"+ + "\2\2\32\33\3\2\2\2\33\3\3\2\2\2\34\32\3\2\2\2\5\20\30\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); + } + } +} \ No newline at end of file