1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-10 10:29:36 +00:00

A bit more subpix work. Some font-work and a KickC parser start.

This commit is contained in:
jespergravgaard 2017-05-01 00:11:51 +02:00
commit 04d4f32ad9
23 changed files with 683 additions and 0 deletions

15
.idea/compiler.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
</component>
</project>

6
.idea/encodings.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,20 @@
<component name="libraryTable">
<library name="org.antlr:antlr4:4.7" type="repository">
<properties maven-id="org.antlr:antlr4:4.7" />
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/antlr4-4.7.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/antlr4-runtime-4.7.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/antlr-runtime-3.5.2.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/ST4-4.0.8.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/org.abego.treelayout.core-1.0.3.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.json-1.0.4.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/icu4j-58.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/lib/antlr4-4.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/antlr4-4.7-sources.jar!/" />
</SOURCES>
</library>
</component>

50
.idea/misc.xml Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>Android Lint</id>
</State>
<State>
<id>Compiler issuesJava</id>
</State>
<State>
<id>GPath inspectionsGroovy</id>
</State>
<State>
<id>Groovy</id>
</State>
<State>
<id>Internationalization issues</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>Performance issuesJava</id>
</State>
<State>
<id>Portability issuesJava</id>
</State>
<State>
<id>Properties Files</id>
</State>
<State>
<id>Properties FilesJava</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SvnConfiguration" myUseAcceleration="nothing">
<configuration>$USER_HOME$/.subversion</configuration>
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/kickc.iml" filepath="$PROJECT_DIR$/kickc.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

12
kickc.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="org.antlr:antlr4:4.7" level="project" />
</component>
</module>

BIN
lib/ST4-4.0.8.jar Normal file

Binary file not shown.

BIN
lib/antlr-runtime-3.5.2.jar Normal file

Binary file not shown.

BIN
lib/antlr4-4.7-javadoc.jar Normal file

Binary file not shown.

BIN
lib/antlr4-4.7-sources.jar Normal file

Binary file not shown.

BIN
lib/antlr4-4.7.jar Normal file

Binary file not shown.

BIN
lib/antlr4-runtime-4.7.jar Normal file

Binary file not shown.

BIN
lib/icu4j-58.2.jar Normal file

Binary file not shown.

BIN
lib/javax.json-1.0.4.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -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}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExpr(KickCParser.ExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExpr(KickCParser.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) { }
}

View File

@ -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] = "<INVALID>";
}
}
}
@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);
}
}
}

View File

@ -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

View File

@ -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);
}

View File

@ -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] = "<INVALID>";
}
}
}
@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<ExprContext> 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);
}
}
}