mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-26 12:49:21 +00:00
Moved test grammar into Maven also.
This commit is contained in:
parent
81af78010c
commit
8a222b1865
@ -8,6 +8,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/antlr4" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/target/generated-test-sources/antlr4" isTestSource="true" generated="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
18
pom.xml
18
pom.xml
@ -130,11 +130,23 @@
|
||||
<goals>
|
||||
<goal>antlr4</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<visitor>true</visitor>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>antlr-test</id>
|
||||
<goals>
|
||||
<goal>antlr4</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<visitor>true</visitor>
|
||||
<sourceDirectory>src/test/antlr4</sourceDirectory>
|
||||
<outputDirectory>${project.build.directory}/generated-test-sources/antlr4</outputDirectory>
|
||||
<generateTestSources>true</generateTestSources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<visitor>true</visitor>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -1,14 +0,0 @@
|
||||
T__0=1
|
||||
T__1=2
|
||||
T__2=3
|
||||
T__3=4
|
||||
T__4=5
|
||||
SIMPLETYPE=6
|
||||
IDENTIFIER=7
|
||||
TYPEIDENTIFIER=8
|
||||
WHITESPACE=9
|
||||
'typedef'=1
|
||||
';'=2
|
||||
'('=3
|
||||
')'=4
|
||||
'&'=5
|
@ -1,163 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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 TypedefListener},
|
||||
* which can be extended to create a listener which only needs to handle a subset
|
||||
* of the available methods.
|
||||
*/
|
||||
public class TypedefBaseListener implements TypedefListener {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterStmtSeq(TypedefParser.StmtSeqContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitStmtSeq(TypedefParser.StmtSeqContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterStmtTypeDef(TypedefParser.StmtTypeDefContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitStmtTypeDef(TypedefParser.StmtTypeDefContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterStmtExpr(TypedefParser.StmtExprContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitStmtExpr(TypedefParser.StmtExprContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterExprValueName(TypedefParser.ExprValueNameContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitExprValueName(TypedefParser.ExprValueNameContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterExprCast(TypedefParser.ExprCastContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitExprCast(TypedefParser.ExprCastContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterExprAnd(TypedefParser.ExprAndContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitExprAnd(TypedefParser.ExprAndContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterExprAddressOf(TypedefParser.ExprAddressOfContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitExprAddressOf(TypedefParser.ExprAddressOfContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterExprParenthesis(TypedefParser.ExprParenthesisContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitExprParenthesis(TypedefParser.ExprParenthesisContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterTypeNameTypedef(TypedefParser.TypeNameTypedefContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitTypeNameTypedef(TypedefParser.TypeNameTypedefContext 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) { }
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of {@link TypedefVisitor},
|
||||
* 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 TypedefBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements TypedefVisitor<T> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStmtSeq(TypedefParser.StmtSeqContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStmtTypeDef(TypedefParser.StmtTypeDefContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStmtExpr(TypedefParser.StmtExprContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprValueName(TypedefParser.ExprValueNameContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprCast(TypedefParser.ExprCastContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprAnd(TypedefParser.ExprAndContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprAddressOf(TypedefParser.ExprAddressOfContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprParenthesis(TypedefParser.ExprParenthesisContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitTypeNameTypedef(TypedefParser.TypeNameTypedefContext ctx) { return visitChildren(ctx); }
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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 TypedefLexer extends Lexer {
|
||||
static { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); }
|
||||
|
||||
protected static final DFA[] _decisionToDFA;
|
||||
protected static final PredictionContextCache _sharedContextCache =
|
||||
new PredictionContextCache();
|
||||
public static final int
|
||||
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, SIMPLETYPE=6, IDENTIFIER=7, TYPEIDENTIFIER=8,
|
||||
WHITESPACE=9;
|
||||
public static String[] channelNames = {
|
||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||
};
|
||||
|
||||
public static String[] modeNames = {
|
||||
"DEFAULT_MODE"
|
||||
};
|
||||
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
"T__0", "T__1", "T__2", "T__3", "T__4", "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
|
||||
"WHITESPACE"
|
||||
};
|
||||
}
|
||||
public static final String[] ruleNames = makeRuleNames();
|
||||
|
||||
private static String[] makeLiteralNames() {
|
||||
return new String[] {
|
||||
null, "'typedef'", "';'", "'('", "')'", "'&'"
|
||||
};
|
||||
}
|
||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||
private static String[] makeSymbolicNames() {
|
||||
return new String[] {
|
||||
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
|
||||
"WHITESPACE"
|
||||
};
|
||||
}
|
||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #VOCABULARY} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String[] tokenNames;
|
||||
static {
|
||||
tokenNames = new String[_SYMBOLIC_NAMES.length];
|
||||
for (int i = 0; i < tokenNames.length; i++) {
|
||||
tokenNames[i] = VOCABULARY.getLiteralName(i);
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = VOCABULARY.getSymbolicName(i);
|
||||
}
|
||||
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = "<INVALID>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String[] getTokenNames() {
|
||||
return tokenNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Vocabulary getVocabulary() {
|
||||
return VOCABULARY;
|
||||
}
|
||||
|
||||
|
||||
List<String> typedefs;
|
||||
|
||||
public TypedefLexer(CharStream input, List<String> typedefs) {
|
||||
this(input);
|
||||
this.typedefs = typedefs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public TypedefLexer(CharStream input) {
|
||||
super(input);
|
||||
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGrammarFileName() { return "Typedef.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; }
|
||||
|
||||
@Override
|
||||
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
|
||||
switch (ruleIndex) {
|
||||
case 6:
|
||||
return IDENTIFIER_sempred((RuleContext)_localctx, predIndex);
|
||||
case 7:
|
||||
return TYPEIDENTIFIER_sempred((RuleContext)_localctx, predIndex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private boolean IDENTIFIER_sempred(RuleContext _localctx, int predIndex) {
|
||||
switch (predIndex) {
|
||||
case 0:
|
||||
return !typedefs.contains(getText());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private boolean TYPEIDENTIFIER_sempred(RuleContext _localctx, int predIndex) {
|
||||
switch (predIndex) {
|
||||
case 1:
|
||||
return typedefs.contains(getText());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final String _serializedATN =
|
||||
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\13C\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\3\2\3\2"+
|
||||
"\3\2\3\2\3\2\3\2\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\7\3"+
|
||||
"\7\3\7\3\7\3\7\5\7-\n\7\3\b\6\b\60\n\b\r\b\16\b\61\3\b\3\b\3\t\6\t\67"+
|
||||
"\n\t\r\t\16\t8\3\t\3\t\3\n\6\n>\n\n\r\n\16\n?\3\n\3\n\2\2\13\3\3\5\4\7"+
|
||||
"\5\t\6\13\7\r\b\17\t\21\n\23\13\3\2\4\5\2C\\aac|\5\2\13\f\17\17\"\"\2"+
|
||||
"F\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\21\3\2\2\2\2\23\3\2\2\2\3\25\3\2\2\2\5\35\3\2\2\2"+
|
||||
"\7\37\3\2\2\2\t!\3\2\2\2\13#\3\2\2\2\r,\3\2\2\2\17/\3\2\2\2\21\66\3\2"+
|
||||
"\2\2\23=\3\2\2\2\25\26\7v\2\2\26\27\7{\2\2\27\30\7r\2\2\30\31\7g\2\2\31"+
|
||||
"\32\7f\2\2\32\33\7g\2\2\33\34\7h\2\2\34\4\3\2\2\2\35\36\7=\2\2\36\6\3"+
|
||||
"\2\2\2\37 \7*\2\2 \b\3\2\2\2!\"\7+\2\2\"\n\3\2\2\2#$\7(\2\2$\f\3\2\2\2"+
|
||||
"%&\7e\2\2&\'\7j\2\2\'(\7c\2\2(-\7t\2\2)*\7k\2\2*+\7p\2\2+-\7v\2\2,%\3"+
|
||||
"\2\2\2,)\3\2\2\2-\16\3\2\2\2.\60\t\2\2\2/.\3\2\2\2\60\61\3\2\2\2\61/\3"+
|
||||
"\2\2\2\61\62\3\2\2\2\62\63\3\2\2\2\63\64\6\b\2\2\64\20\3\2\2\2\65\67\t"+
|
||||
"\2\2\2\66\65\3\2\2\2\678\3\2\2\28\66\3\2\2\289\3\2\2\29:\3\2\2\2:;\6\t"+
|
||||
"\3\2;\22\3\2\2\2<>\t\3\2\2=<\3\2\2\2>?\3\2\2\2?=\3\2\2\2?@\3\2\2\2@A\3"+
|
||||
"\2\2\2AB\b\n\2\2B\24\3\2\2\2\7\2,\618?\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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
T__0=1
|
||||
T__1=2
|
||||
T__2=3
|
||||
T__3=4
|
||||
T__4=5
|
||||
SIMPLETYPE=6
|
||||
IDENTIFIER=7
|
||||
TYPEIDENTIFIER=8
|
||||
WHITESPACE=9
|
||||
'typedef'=1
|
||||
';'=2
|
||||
'('=3
|
||||
')'=4
|
||||
'&'=5
|
@ -1,132 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
||||
|
||||
/**
|
||||
* This interface defines a complete listener for a parse tree produced by
|
||||
* {@link TypedefParser}.
|
||||
*/
|
||||
public interface TypedefListener extends ParseTreeListener {
|
||||
/**
|
||||
* Enter a parse tree produced by {@link TypedefParser#stmtSeq}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterStmtSeq(TypedefParser.StmtSeqContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by {@link TypedefParser#stmtSeq}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitStmtSeq(TypedefParser.StmtSeqContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code stmtTypeDef}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterStmtTypeDef(TypedefParser.StmtTypeDefContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code stmtTypeDef}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitStmtTypeDef(TypedefParser.StmtTypeDefContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code stmtExpr}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterStmtExpr(TypedefParser.StmtExprContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code stmtExpr}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitStmtExpr(TypedefParser.StmtExprContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code exprValueName}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterExprValueName(TypedefParser.ExprValueNameContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code exprValueName}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitExprValueName(TypedefParser.ExprValueNameContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code exprCast}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterExprCast(TypedefParser.ExprCastContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code exprCast}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitExprCast(TypedefParser.ExprCastContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code exprAnd}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterExprAnd(TypedefParser.ExprAndContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code exprAnd}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitExprAnd(TypedefParser.ExprAndContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code exprAddressOf}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterExprAddressOf(TypedefParser.ExprAddressOfContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code exprAddressOf}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitExprAddressOf(TypedefParser.ExprAddressOfContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code exprParenthesis}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterExprParenthesis(TypedefParser.ExprParenthesisContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code exprParenthesis}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitExprParenthesis(TypedefParser.ExprParenthesisContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code typeNameSimple}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code typeNameSimple}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code typeNameTypedef}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterTypeNameTypedef(TypedefParser.TypeNameTypedefContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code typeNameTypedef}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitTypeNameTypedef(TypedefParser.TypeNameTypedefContext ctx);
|
||||
}
|
@ -1,608 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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 TypedefParser extends Parser {
|
||||
static { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); }
|
||||
|
||||
protected static final DFA[] _decisionToDFA;
|
||||
protected static final PredictionContextCache _sharedContextCache =
|
||||
new PredictionContextCache();
|
||||
public static final int
|
||||
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, SIMPLETYPE=6, IDENTIFIER=7, TYPEIDENTIFIER=8,
|
||||
WHITESPACE=9;
|
||||
public static final int
|
||||
RULE_stmtSeq = 0, RULE_stmt = 1, RULE_expr = 2, RULE_typeName = 3;
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
"stmtSeq", "stmt", "expr", "typeName"
|
||||
};
|
||||
}
|
||||
public static final String[] ruleNames = makeRuleNames();
|
||||
|
||||
private static String[] makeLiteralNames() {
|
||||
return new String[] {
|
||||
null, "'typedef'", "';'", "'('", "')'", "'&'"
|
||||
};
|
||||
}
|
||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||
private static String[] makeSymbolicNames() {
|
||||
return new String[] {
|
||||
null, null, null, null, null, null, "SIMPLETYPE", "IDENTIFIER", "TYPEIDENTIFIER",
|
||||
"WHITESPACE"
|
||||
};
|
||||
}
|
||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #VOCABULARY} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String[] tokenNames;
|
||||
static {
|
||||
tokenNames = new String[_SYMBOLIC_NAMES.length];
|
||||
for (int i = 0; i < tokenNames.length; i++) {
|
||||
tokenNames[i] = VOCABULARY.getLiteralName(i);
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = VOCABULARY.getSymbolicName(i);
|
||||
}
|
||||
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = "<INVALID>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String[] getTokenNames() {
|
||||
return tokenNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Vocabulary getVocabulary() {
|
||||
return VOCABULARY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGrammarFileName() { return "Typedef.g4"; }
|
||||
|
||||
@Override
|
||||
public String[] getRuleNames() { return ruleNames; }
|
||||
|
||||
@Override
|
||||
public String getSerializedATN() { return _serializedATN; }
|
||||
|
||||
@Override
|
||||
public ATN getATN() { return _ATN; }
|
||||
|
||||
|
||||
List<String> typedefs;
|
||||
|
||||
public TypedefParser(TokenStream input, List<String> typedefs) {
|
||||
this(input);
|
||||
this.typedefs = typedefs;
|
||||
}
|
||||
|
||||
|
||||
public TypedefParser(TokenStream input) {
|
||||
super(input);
|
||||
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
|
||||
}
|
||||
|
||||
public static class StmtSeqContext extends ParserRuleContext {
|
||||
public List<StmtContext> stmt() {
|
||||
return getRuleContexts(StmtContext.class);
|
||||
}
|
||||
public StmtContext stmt(int i) {
|
||||
return getRuleContext(StmtContext.class,i);
|
||||
}
|
||||
public StmtSeqContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@Override public int getRuleIndex() { return RULE_stmtSeq; }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterStmtSeq(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitStmtSeq(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitStmtSeq(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final StmtSeqContext stmtSeq() throws RecognitionException {
|
||||
StmtSeqContext _localctx = new StmtSeqContext(_ctx, getState());
|
||||
enterRule(_localctx, 0, RULE_stmtSeq);
|
||||
int _la;
|
||||
try {
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(11);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__2) | (1L << T__4) | (1L << IDENTIFIER))) != 0)) {
|
||||
{
|
||||
{
|
||||
setState(8);
|
||||
stmt();
|
||||
}
|
||||
}
|
||||
setState(13);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RecognitionException re) {
|
||||
_localctx.exception = re;
|
||||
_errHandler.reportError(this, re);
|
||||
_errHandler.recover(this, re);
|
||||
}
|
||||
finally {
|
||||
exitRule();
|
||||
}
|
||||
return _localctx;
|
||||
}
|
||||
|
||||
public static class StmtContext extends ParserRuleContext {
|
||||
public StmtContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@Override public int getRuleIndex() { return RULE_stmt; }
|
||||
|
||||
public StmtContext() { }
|
||||
public void copyFrom(StmtContext ctx) {
|
||||
super.copyFrom(ctx);
|
||||
}
|
||||
}
|
||||
public static class StmtExprContext extends StmtContext {
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public StmtExprContext(StmtContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterStmtExpr(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitStmtExpr(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitStmtExpr(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class StmtTypeDefContext extends StmtContext {
|
||||
public Token IDENTIFIER;
|
||||
public TypeNameContext typeName() {
|
||||
return getRuleContext(TypeNameContext.class,0);
|
||||
}
|
||||
public TerminalNode IDENTIFIER() { return getToken(TypedefParser.IDENTIFIER, 0); }
|
||||
public StmtTypeDefContext(StmtContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterStmtTypeDef(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitStmtTypeDef(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitStmtTypeDef(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final StmtContext stmt() throws RecognitionException {
|
||||
StmtContext _localctx = new StmtContext(_ctx, getState());
|
||||
enterRule(_localctx, 2, RULE_stmt);
|
||||
try {
|
||||
setState(23);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case T__0:
|
||||
_localctx = new StmtTypeDefContext(_localctx);
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(14);
|
||||
match(T__0);
|
||||
setState(15);
|
||||
typeName();
|
||||
setState(16);
|
||||
((StmtTypeDefContext)_localctx).IDENTIFIER = match(IDENTIFIER);
|
||||
setState(17);
|
||||
match(T__1);
|
||||
typedefs.add((((StmtTypeDefContext)_localctx).IDENTIFIER!=null?((StmtTypeDefContext)_localctx).IDENTIFIER.getText():null));
|
||||
}
|
||||
break;
|
||||
case T__2:
|
||||
case T__4:
|
||||
case IDENTIFIER:
|
||||
_localctx = new StmtExprContext(_localctx);
|
||||
enterOuterAlt(_localctx, 2);
|
||||
{
|
||||
setState(20);
|
||||
expr(0);
|
||||
setState(21);
|
||||
match(T__1);
|
||||
}
|
||||
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 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 ExprValueNameContext extends ExprContext {
|
||||
public TerminalNode IDENTIFIER() { return getToken(TypedefParser.IDENTIFIER, 0); }
|
||||
public ExprValueNameContext(ExprContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterExprValueName(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitExprValueName(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitExprValueName(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class ExprCastContext extends ExprContext {
|
||||
public TypeNameContext typeName() {
|
||||
return getRuleContext(TypeNameContext.class,0);
|
||||
}
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public ExprCastContext(ExprContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterExprCast(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitExprCast(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitExprCast(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class ExprAndContext extends ExprContext {
|
||||
public List<ExprContext> expr() {
|
||||
return getRuleContexts(ExprContext.class);
|
||||
}
|
||||
public ExprContext expr(int i) {
|
||||
return getRuleContext(ExprContext.class,i);
|
||||
}
|
||||
public ExprAndContext(ExprContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterExprAnd(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitExprAnd(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitExprAnd(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class ExprAddressOfContext extends ExprContext {
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public ExprAddressOfContext(ExprContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterExprAddressOf(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitExprAddressOf(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitExprAddressOf(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class ExprParenthesisContext extends ExprContext {
|
||||
public ExprContext expr() {
|
||||
return getRuleContext(ExprContext.class,0);
|
||||
}
|
||||
public ExprParenthesisContext(ExprContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterExprParenthesis(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitExprParenthesis(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitExprParenthesis(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 = 4;
|
||||
enterRecursionRule(_localctx, 4, RULE_expr, _p);
|
||||
try {
|
||||
int _alt;
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(38);
|
||||
_errHandler.sync(this);
|
||||
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
|
||||
case 1:
|
||||
{
|
||||
_localctx = new ExprCastContext(_localctx);
|
||||
_ctx = _localctx;
|
||||
_prevctx = _localctx;
|
||||
|
||||
setState(26);
|
||||
match(T__2);
|
||||
setState(27);
|
||||
typeName();
|
||||
setState(28);
|
||||
match(T__3);
|
||||
setState(29);
|
||||
expr(5);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
_localctx = new ExprValueNameContext(_localctx);
|
||||
_ctx = _localctx;
|
||||
_prevctx = _localctx;
|
||||
setState(31);
|
||||
match(IDENTIFIER);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
_localctx = new ExprParenthesisContext(_localctx);
|
||||
_ctx = _localctx;
|
||||
_prevctx = _localctx;
|
||||
setState(32);
|
||||
match(T__2);
|
||||
setState(33);
|
||||
expr(0);
|
||||
setState(34);
|
||||
match(T__3);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
_localctx = new ExprAddressOfContext(_localctx);
|
||||
_ctx = _localctx;
|
||||
_prevctx = _localctx;
|
||||
setState(36);
|
||||
match(T__4);
|
||||
setState(37);
|
||||
expr(2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_ctx.stop = _input.LT(-1);
|
||||
setState(45);
|
||||
_errHandler.sync(this);
|
||||
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
|
||||
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
|
||||
if ( _alt==1 ) {
|
||||
if ( _parseListeners!=null ) triggerExitRuleEvent();
|
||||
_prevctx = _localctx;
|
||||
{
|
||||
{
|
||||
_localctx = new ExprAndContext(new ExprContext(_parentctx, _parentState));
|
||||
pushNewRecursionContext(_localctx, _startState, RULE_expr);
|
||||
setState(40);
|
||||
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
|
||||
setState(41);
|
||||
match(T__4);
|
||||
setState(42);
|
||||
expr(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(47);
|
||||
_errHandler.sync(this);
|
||||
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RecognitionException re) {
|
||||
_localctx.exception = re;
|
||||
_errHandler.reportError(this, re);
|
||||
_errHandler.recover(this, re);
|
||||
}
|
||||
finally {
|
||||
unrollRecursionContexts(_parentctx);
|
||||
}
|
||||
return _localctx;
|
||||
}
|
||||
|
||||
public static class TypeNameContext extends ParserRuleContext {
|
||||
public TypeNameContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@Override public int getRuleIndex() { return RULE_typeName; }
|
||||
|
||||
public TypeNameContext() { }
|
||||
public void copyFrom(TypeNameContext ctx) {
|
||||
super.copyFrom(ctx);
|
||||
}
|
||||
}
|
||||
public static class TypeNameTypedefContext extends TypeNameContext {
|
||||
public TerminalNode TYPEIDENTIFIER() { return getToken(TypedefParser.TYPEIDENTIFIER, 0); }
|
||||
public TypeNameTypedefContext(TypeNameContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterTypeNameTypedef(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitTypeNameTypedef(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitTypeNameTypedef(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
public static class TypeNameSimpleContext extends TypeNameContext {
|
||||
public TerminalNode SIMPLETYPE() { return getToken(TypedefParser.SIMPLETYPE, 0); }
|
||||
public TypeNameSimpleContext(TypeNameContext ctx) { copyFrom(ctx); }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).enterTypeNameSimple(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof TypedefListener ) ((TypedefListener)listener).exitTypeNameSimple(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof TypedefVisitor ) return ((TypedefVisitor<? extends T>)visitor).visitTypeNameSimple(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final TypeNameContext typeName() throws RecognitionException {
|
||||
TypeNameContext _localctx = new TypeNameContext(_ctx, getState());
|
||||
enterRule(_localctx, 6, RULE_typeName);
|
||||
try {
|
||||
setState(50);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case SIMPLETYPE:
|
||||
_localctx = new TypeNameSimpleContext(_localctx);
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(48);
|
||||
match(SIMPLETYPE);
|
||||
}
|
||||
break;
|
||||
case TYPEIDENTIFIER:
|
||||
_localctx = new TypeNameTypedefContext(_localctx);
|
||||
enterOuterAlt(_localctx, 2);
|
||||
{
|
||||
setState(49);
|
||||
match(TYPEIDENTIFIER);
|
||||
}
|
||||
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 boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
|
||||
switch (ruleIndex) {
|
||||
case 2:
|
||||
return expr_sempred((ExprContext)_localctx, predIndex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private boolean expr_sempred(ExprContext _localctx, int predIndex) {
|
||||
switch (predIndex) {
|
||||
case 0:
|
||||
return precpred(_ctx, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final String _serializedATN =
|
||||
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\13\67\4\2\t\2\4\3"+
|
||||
"\t\3\4\4\t\4\4\5\t\5\3\2\7\2\f\n\2\f\2\16\2\17\13\2\3\3\3\3\3\3\3\3\3"+
|
||||
"\3\3\3\3\3\3\3\3\3\5\3\32\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4"+
|
||||
"\3\4\3\4\3\4\5\4)\n\4\3\4\3\4\3\4\7\4.\n\4\f\4\16\4\61\13\4\3\5\3\5\5"+
|
||||
"\5\65\n\5\3\5\2\3\6\6\2\4\6\b\2\2\29\2\r\3\2\2\2\4\31\3\2\2\2\6(\3\2\2"+
|
||||
"\2\b\64\3\2\2\2\n\f\5\4\3\2\13\n\3\2\2\2\f\17\3\2\2\2\r\13\3\2\2\2\r\16"+
|
||||
"\3\2\2\2\16\3\3\2\2\2\17\r\3\2\2\2\20\21\7\3\2\2\21\22\5\b\5\2\22\23\7"+
|
||||
"\t\2\2\23\24\7\4\2\2\24\25\b\3\1\2\25\32\3\2\2\2\26\27\5\6\4\2\27\30\7"+
|
||||
"\4\2\2\30\32\3\2\2\2\31\20\3\2\2\2\31\26\3\2\2\2\32\5\3\2\2\2\33\34\b"+
|
||||
"\4\1\2\34\35\7\5\2\2\35\36\5\b\5\2\36\37\7\6\2\2\37 \5\6\4\7 )\3\2\2\2"+
|
||||
"!)\7\t\2\2\"#\7\5\2\2#$\5\6\4\2$%\7\6\2\2%)\3\2\2\2&\'\7\7\2\2\')\5\6"+
|
||||
"\4\4(\33\3\2\2\2(!\3\2\2\2(\"\3\2\2\2(&\3\2\2\2)/\3\2\2\2*+\f\3\2\2+,"+
|
||||
"\7\7\2\2,.\5\6\4\4-*\3\2\2\2.\61\3\2\2\2/-\3\2\2\2/\60\3\2\2\2\60\7\3"+
|
||||
"\2\2\2\61/\3\2\2\2\62\65\7\b\2\2\63\65\7\n\2\2\64\62\3\2\2\2\64\63\3\2"+
|
||||
"\2\2\65\t\3\2\2\2\7\r\31(/\64";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
// Generated from /Users/jespergravgaard/c64/kickc/src/test/java/dk/camelot64/kickc/parsing/typedef/Typedef.g4 by ANTLR 4.9.2
|
||||
package dk.camelot64.kickc.parsing.typedef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This interface defines a complete generic visitor for a parse tree produced
|
||||
* by {@link TypedefParser}.
|
||||
*
|
||||
* @param <T> The return type of the visit operation. Use {@link Void} for
|
||||
* operations with no return type.
|
||||
*/
|
||||
public interface TypedefVisitor<T> extends ParseTreeVisitor<T> {
|
||||
/**
|
||||
* Visit a parse tree produced by {@link TypedefParser#stmtSeq}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStmtSeq(TypedefParser.StmtSeqContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code stmtTypeDef}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStmtTypeDef(TypedefParser.StmtTypeDefContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code stmtExpr}
|
||||
* labeled alternative in {@link TypedefParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStmtExpr(TypedefParser.StmtExprContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code exprValueName}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprValueName(TypedefParser.ExprValueNameContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code exprCast}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprCast(TypedefParser.ExprCastContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code exprAnd}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprAnd(TypedefParser.ExprAndContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code exprAddressOf}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprAddressOf(TypedefParser.ExprAddressOfContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code exprParenthesis}
|
||||
* labeled alternative in {@link TypedefParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprParenthesis(TypedefParser.ExprParenthesisContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code typeNameSimple}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitTypeNameSimple(TypedefParser.TypeNameSimpleContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code typeNameTypedef}
|
||||
* labeled alternative in {@link TypedefParser#typeName}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitTypeNameTypedef(TypedefParser.TypeNameTypedefContext ctx);
|
||||
}
|
Loading…
Reference in New Issue
Block a user