From e2358de27cc186e385af639f77778db00ad1431b Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 10 Mar 2020 20:26:12 +0100 Subject: [PATCH] ver --- .gitignore | 11 +- .idea/misc.xml | 1 + compiler/build.gradle | 4 +- compiler/res/version.txt | 2 +- parser/build.gradle | 2 +- parser/src/output.txt | 1 + parser/src/prog8/parser/prog8BaseVisitor.java | 499 ++++++++++++++++++ parser/src/prog8/parser/prog8Lexer.java | 2 +- parser/src/prog8/parser/prog8Parser.java | 347 +++++++++++- parser/src/prog8/parser/prog8Visitor.java | 429 +++++++++++++++ 10 files changed, 1286 insertions(+), 12 deletions(-) create mode 100644 parser/src/output.txt create mode 100644 parser/src/prog8/parser/prog8BaseVisitor.java create mode 100644 parser/src/prog8/parser/prog8Visitor.java diff --git a/.gitignore b/.gitignore index e165fcb0a..b238cacbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ .idea/workspace.xml .idea/discord.xml -/build/ -/dist/ -/output/ +build/ +dist/ +output/ .*cache/ *.directory *.prg @@ -12,8 +12,8 @@ *.vice-mon-list docs/build out/ -**/*.interp -**/*.tokens +parser/**/*.interp +parser/**/*.tokens *.py[cod] *.egg @@ -28,5 +28,4 @@ parsetab.py .attach_pid* .gradle -build/ /prog8compiler.jar diff --git a/.idea/misc.xml b/.idea/misc.xml index 998cdfe24..8902fec2e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,6 +12,7 @@ diff --git a/compiler/build.gradle b/compiler/build.gradle index f6de8fb26..6e5d63d06 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -1,11 +1,11 @@ buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.70" } } plugins { - // id "org.jetbrains.kotlin.jvm" version "1.3.61" + // id "org.jetbrains.kotlin.jvm" version "1.3.70" id 'application' id 'org.jetbrains.dokka' version "0.9.18" id 'com.github.johnrengelman.shadow' version '5.2.0' diff --git a/compiler/res/version.txt b/compiler/res/version.txt index bfe79d0bd..d456f7459 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -1.70 +1.80 diff --git a/parser/build.gradle b/parser/build.gradle index 06759b3c7..61e319369 100644 --- a/parser/build.gradle +++ b/parser/build.gradle @@ -34,7 +34,7 @@ compileJava { generateGrammarSource { outputDirectory = file("src/prog8/parser") - arguments += ["-no-listener","-no-visitor"] + arguments += ["-no-listener","-visitor"] } sourceSets { diff --git a/parser/src/output.txt b/parser/src/output.txt new file mode 100644 index 000000000..d8b4b8fa3 --- /dev/null +++ b/parser/src/output.txt @@ -0,0 +1 @@ +generated parser code goes here diff --git a/parser/src/prog8/parser/prog8BaseVisitor.java b/parser/src/prog8/parser/prog8BaseVisitor.java new file mode 100644 index 000000000..a5026d740 --- /dev/null +++ b/parser/src/prog8/parser/prog8BaseVisitor.java @@ -0,0 +1,499 @@ +// Generated from /home/irmen/Projects/prog8/parser/antlr/prog8.g4 by ANTLR 4.8 + +package prog8.parser; + +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link prog8Visitor}, + * which can be extended to create a visitor which only needs to handle a subset + * of the available methods. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public class prog8BaseVisitor extends AbstractParseTreeVisitor implements prog8Visitor { + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitModule(prog8Parser.ModuleContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitModulestatement(prog8Parser.ModulestatementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBlock(prog8Parser.BlockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStatement(prog8Parser.StatementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitLabeldef(prog8Parser.LabeldefContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitUnconditionaljump(prog8Parser.UnconditionaljumpContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitDirective(prog8Parser.DirectiveContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitDirectivearg(prog8Parser.DirectiveargContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitVardecl(prog8Parser.VardeclContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStructvardecl(prog8Parser.StructvardeclContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitVarinitializer(prog8Parser.VarinitializerContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStructvarinitializer(prog8Parser.StructvarinitializerContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitConstdecl(prog8Parser.ConstdeclContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitMemoryvardecl(prog8Parser.MemoryvardeclContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStructdecl(prog8Parser.StructdeclContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitDatatype(prog8Parser.DatatypeContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitArrayindex(prog8Parser.ArrayindexContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAssignment(prog8Parser.AssignmentContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAugassignment(prog8Parser.AugassignmentContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAssign_target(prog8Parser.Assign_targetContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitPostincrdecr(prog8Parser.PostincrdecrContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitExpression(prog8Parser.ExpressionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitTypecast(prog8Parser.TypecastContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitArrayindexed(prog8Parser.ArrayindexedContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitDirectmemory(prog8Parser.DirectmemoryContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAddressof(prog8Parser.AddressofContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFunctioncall(prog8Parser.FunctioncallContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFunctioncall_stmt(prog8Parser.Functioncall_stmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitExpression_list(prog8Parser.Expression_listContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitReturnstmt(prog8Parser.ReturnstmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBreakstmt(prog8Parser.BreakstmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitContinuestmt(prog8Parser.ContinuestmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIdentifier(prog8Parser.IdentifierContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitScoped_identifier(prog8Parser.Scoped_identifierContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRegister(prog8Parser.RegisterContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRegisterorpair(prog8Parser.RegisterorpairContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStatusregister(prog8Parser.StatusregisterContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIntegerliteral(prog8Parser.IntegerliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWordsuffix(prog8Parser.WordsuffixContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBooleanliteral(prog8Parser.BooleanliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitArrayliteral(prog8Parser.ArrayliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStructliteral(prog8Parser.StructliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStringliteral(prog8Parser.StringliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitCharliteral(prog8Parser.CharliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFloatliteral(prog8Parser.FloatliteralContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitLiteralvalue(prog8Parser.LiteralvalueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitInlineasm(prog8Parser.InlineasmContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitSubroutine(prog8Parser.SubroutineContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitSub_return_part(prog8Parser.Sub_return_partContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStatement_block(prog8Parser.Statement_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitSub_params(prog8Parser.Sub_paramsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitSub_returns(prog8Parser.Sub_returnsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsubroutine(prog8Parser.AsmsubroutineContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_address(prog8Parser.Asmsub_addressContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_params(prog8Parser.Asmsub_paramsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_param(prog8Parser.Asmsub_paramContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_clobbers(prog8Parser.Asmsub_clobbersContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitClobber(prog8Parser.ClobberContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_returns(prog8Parser.Asmsub_returnsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAsmsub_return(prog8Parser.Asmsub_returnContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIf_stmt(prog8Parser.If_stmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitElse_part(prog8Parser.Else_partContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBranch_stmt(prog8Parser.Branch_stmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBranchcondition(prog8Parser.BranchconditionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitForloop(prog8Parser.ForloopContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWhileloop(prog8Parser.WhileloopContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRepeatloop(prog8Parser.RepeatloopContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWhenstmt(prog8Parser.WhenstmtContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWhen_choice(prog8Parser.When_choiceContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/parser/src/prog8/parser/prog8Lexer.java b/parser/src/prog8/parser/prog8Lexer.java index 666b858b0..f19bd0784 100644 --- a/parser/src/prog8/parser/prog8Lexer.java +++ b/parser/src/prog8/parser/prog8Lexer.java @@ -1,4 +1,4 @@ -// Generated from prog8.g4 by ANTLR 4.8 +// Generated from /home/irmen/Projects/prog8/parser/antlr/prog8.g4 by ANTLR 4.8 package prog8.parser; diff --git a/parser/src/prog8/parser/prog8Parser.java b/parser/src/prog8/parser/prog8Parser.java index 33d49e8c8..42aa83c66 100644 --- a/parser/src/prog8/parser/prog8Parser.java +++ b/parser/src/prog8/parser/prog8Parser.java @@ -1,4 +1,4 @@ -// Generated from prog8.g4 by ANTLR 4.8 +// Generated from /home/irmen/Projects/prog8/parser/antlr/prog8.g4 by ANTLR 4.8 package prog8.parser; @@ -184,6 +184,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_module; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitModule(this); + else return visitor.visitChildren(this); + } } public final ModuleContext module() throws RecognitionException { @@ -257,6 +262,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_modulestatement; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitModulestatement(this); + else return visitor.visitChildren(this); + } } public final ModulestatementContext modulestatement() throws RecognitionException { @@ -319,6 +329,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_block; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitBlock(this); + else return visitor.visitChildren(this); + } } public final BlockContext block() throws RecognitionException { @@ -440,6 +455,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_statement; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStatement(this); + else return visitor.visitChildren(this); + } } public final StatementContext statement() throws RecognitionException { @@ -652,6 +672,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_labeldef; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitLabeldef(this); + else return visitor.visitChildren(this); + } } public final LabeldefContext labeldef() throws RecognitionException { @@ -688,6 +713,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_unconditionaljump; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitUnconditionaljump(this); + else return visitor.visitChildren(this); + } } public final UnconditionaljumpContext unconditionaljump() throws RecognitionException { @@ -743,6 +773,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_directive; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitDirective(this); + else return visitor.visitChildren(this); + } } public final DirectiveContext directive() throws RecognitionException { @@ -830,6 +865,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_directivearg; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitDirectivearg(this); + else return visitor.visitChildren(this); + } } public final DirectiveargContext directivearg() throws RecognitionException { @@ -894,6 +934,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_vardecl; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitVardecl(this); + else return visitor.visitChildren(this); + } } public final VardeclContext vardecl() throws RecognitionException { @@ -963,6 +1008,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_structvardecl; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStructvardecl(this); + else return visitor.visitChildren(this); + } } public final StructvardeclContext structvardecl() throws RecognitionException { @@ -999,6 +1049,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_varinitializer; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitVarinitializer(this); + else return visitor.visitChildren(this); + } } public final VarinitializerContext varinitializer() throws RecognitionException { @@ -1037,6 +1092,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_structvarinitializer; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStructvarinitializer(this); + else return visitor.visitChildren(this); + } } public final StructvarinitializerContext structvarinitializer() throws RecognitionException { @@ -1072,6 +1132,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_constdecl; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitConstdecl(this); + else return visitor.visitChildren(this); + } } public final ConstdeclContext constdecl() throws RecognitionException { @@ -1106,6 +1171,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_memoryvardecl; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitMemoryvardecl(this); + else return visitor.visitChildren(this); + } } public final MemoryvardeclContext memoryvardecl() throws RecognitionException { @@ -1149,6 +1219,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_structdecl; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStructdecl(this); + else return visitor.visitChildren(this); + } } public final StructdeclContext structdecl() throws RecognitionException { @@ -1219,6 +1294,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_datatype; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitDatatype(this); + else return visitor.visitChildren(this); + } } public final DatatypeContext datatype() throws RecognitionException { @@ -1259,6 +1339,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_arrayindex; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitArrayindex(this); + else return visitor.visitChildren(this); + } } public final ArrayindexContext arrayindex() throws RecognitionException { @@ -1297,6 +1382,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_assignment; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAssignment(this); + else return visitor.visitChildren(this); + } } public final AssignmentContext assignment() throws RecognitionException { @@ -1336,6 +1426,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_augassignment; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAugassignment(this); + else return visitor.visitChildren(this); + } } public final AugassignmentContext augassignment() throws RecognitionException { @@ -1390,6 +1485,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_assign_target; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAssign_target(this); + else return visitor.visitChildren(this); + } } public final Assign_targetContext assign_target() throws RecognitionException { @@ -1449,6 +1549,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_postincrdecr; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitPostincrdecr(this); + else return visitor.visitChildren(this); + } } public final PostincrdecrContext postincrdecr() throws RecognitionException { @@ -1531,6 +1636,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expression; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitExpression(this); + else return visitor.visitChildren(this); + } } public final ExpressionContext expression() throws RecognitionException { @@ -2159,6 +2269,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_typecast; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitTypecast(this); + else return visitor.visitChildren(this); + } } public final TypecastContext typecast() throws RecognitionException { @@ -2195,6 +2310,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_arrayindexed; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitArrayindexed(this); + else return visitor.visitChildren(this); + } } public final ArrayindexedContext arrayindexed() throws RecognitionException { @@ -2228,6 +2348,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_directmemory; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitDirectmemory(this); + else return visitor.visitChildren(this); + } } public final DirectmemoryContext directmemory() throws RecognitionException { @@ -2266,6 +2391,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_addressof; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAddressof(this); + else return visitor.visitChildren(this); + } } public final AddressofContext addressof() throws RecognitionException { @@ -2302,6 +2432,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_functioncall; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitFunctioncall(this); + else return visitor.visitChildren(this); + } } public final FunctioncallContext functioncall() throws RecognitionException { @@ -2352,6 +2487,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_functioncall_stmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitFunctioncall_stmt(this); + else return visitor.visitChildren(this); + } } public final Functioncall_stmtContext functioncall_stmt() throws RecognitionException { @@ -2415,6 +2555,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expression_list; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitExpression_list(this); + else return visitor.visitChildren(this); + } } public final Expression_listContext expression_list() throws RecognitionException { @@ -2473,6 +2618,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_returnstmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitReturnstmt(this); + else return visitor.visitChildren(this); + } } public final ReturnstmtContext returnstmt() throws RecognitionException { @@ -2511,6 +2661,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_breakstmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitBreakstmt(this); + else return visitor.visitChildren(this); + } } public final BreakstmtContext breakstmt() throws RecognitionException { @@ -2539,6 +2694,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_continuestmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitContinuestmt(this); + else return visitor.visitChildren(this); + } } public final ContinuestmtContext continuestmt() throws RecognitionException { @@ -2568,6 +2728,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_identifier; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitIdentifier(this); + else return visitor.visitChildren(this); + } } public final IdentifierContext identifier() throws RecognitionException { @@ -2600,6 +2765,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_scoped_identifier; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitScoped_identifier(this); + else return visitor.visitChildren(this); + } } public final Scoped_identifierContext scoped_identifier() throws RecognitionException { @@ -2647,6 +2817,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_register; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitRegister(this); + else return visitor.visitChildren(this); + } } public final RegisterContext register() throws RecognitionException { @@ -2684,6 +2859,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_registerorpair; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitRegisterorpair(this); + else return visitor.visitChildren(this); + } } public final RegisterorpairContext registerorpair() throws RecognitionException { @@ -2721,6 +2901,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_statusregister; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStatusregister(this); + else return visitor.visitChildren(this); + } } public final StatusregisterContext statusregister() throws RecognitionException { @@ -2765,6 +2950,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_integerliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitIntegerliteral(this); + else return visitor.visitChildren(this); + } } public final IntegerliteralContext integerliteral() throws RecognitionException { @@ -2813,6 +3003,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_wordsuffix; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitWordsuffix(this); + else return visitor.visitChildren(this); + } } public final WordsuffixContext wordsuffix() throws RecognitionException { @@ -2841,6 +3036,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_booleanliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitBooleanliteral(this); + else return visitor.visitChildren(this); + } } public final BooleanliteralContext booleanliteral() throws RecognitionException { @@ -2888,6 +3088,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_arrayliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitArrayliteral(this); + else return visitor.visitChildren(this); + } } public final ArrayliteralContext arrayliteral() throws RecognitionException { @@ -2977,6 +3182,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_structliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStructliteral(this); + else return visitor.visitChildren(this); + } } public final StructliteralContext structliteral() throws RecognitionException { @@ -3057,6 +3267,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_stringliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStringliteral(this); + else return visitor.visitChildren(this); + } } public final StringliteralContext stringliteral() throws RecognitionException { @@ -3086,6 +3301,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_charliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitCharliteral(this); + else return visitor.visitChildren(this); + } } public final CharliteralContext charliteral() throws RecognitionException { @@ -3115,6 +3335,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_floatliteral; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitFloatliteral(this); + else return visitor.visitChildren(this); + } } public final FloatliteralContext floatliteral() throws RecognitionException { @@ -3164,6 +3389,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_literalvalue; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitLiteralvalue(this); + else return visitor.visitChildren(this); + } } public final LiteralvalueContext literalvalue() throws RecognitionException { @@ -3246,6 +3476,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_inlineasm; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitInlineasm(this); + else return visitor.visitChildren(this); + } } public final InlineasmContext inlineasm() throws RecognitionException { @@ -3289,6 +3524,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_subroutine; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitSubroutine(this); + else return visitor.visitChildren(this); + } } public final SubroutineContext subroutine() throws RecognitionException { @@ -3353,6 +3593,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_sub_return_part; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitSub_return_part(this); + else return visitor.visitChildren(this); + } } public final Sub_return_partContext sub_return_part() throws RecognitionException { @@ -3393,6 +3638,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_statement_block; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitStatement_block(this); + else return visitor.visitChildren(this); + } } public final Statement_blockContext statement_block() throws RecognitionException { @@ -3512,6 +3762,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_sub_params; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitSub_params(this); + else return visitor.visitChildren(this); + } } public final Sub_paramsContext sub_params() throws RecognitionException { @@ -3577,6 +3832,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_sub_returns; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitSub_returns(this); + else return visitor.visitChildren(this); + } } public final Sub_returnsContext sub_returns() throws RecognitionException { @@ -3651,6 +3911,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsubroutine; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsubroutine(this); + else return visitor.visitChildren(this); + } } public final AsmsubroutineContext asmsubroutine() throws RecognitionException { @@ -3748,6 +4013,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_address; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_address(this); + else return visitor.visitChildren(this); + } } public final Asmsub_addressContext asmsub_address() throws RecognitionException { @@ -3788,6 +4058,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_params; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_params(this); + else return visitor.visitChildren(this); + } } public final Asmsub_paramsContext asmsub_params() throws RecognitionException { @@ -3853,6 +4128,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_param; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_param(this); + else return visitor.visitChildren(this); + } } public final Asmsub_paramContext asmsub_param() throws RecognitionException { @@ -3918,6 +4198,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_clobbers; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_clobbers(this); + else return visitor.visitChildren(this); + } } public final Asmsub_clobbersContext asmsub_clobbers() throws RecognitionException { @@ -3967,6 +4252,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_clobber; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitClobber(this); + else return visitor.visitChildren(this); + } } public final ClobberContext clobber() throws RecognitionException { @@ -4022,6 +4312,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_returns; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_returns(this); + else return visitor.visitChildren(this); + } } public final Asmsub_returnsContext asmsub_returns() throws RecognitionException { @@ -4089,6 +4384,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_asmsub_return; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitAsmsub_return(this); + else return visitor.visitChildren(this); + } } public final Asmsub_returnContext asmsub_return() throws RecognitionException { @@ -4167,6 +4467,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_if_stmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitIf_stmt(this); + else return visitor.visitChildren(this); + } } public final If_stmtContext if_stmt() throws RecognitionException { @@ -4301,6 +4606,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_else_part; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitElse_part(this); + else return visitor.visitChildren(this); + } } public final Else_partContext else_part() throws RecognitionException { @@ -4422,6 +4732,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_branch_stmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitBranch_stmt(this); + else return visitor.visitChildren(this); + } } public final Branch_stmtContext branch_stmt() throws RecognitionException { @@ -4549,6 +4864,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_branchcondition; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitBranchcondition(this); + else return visitor.visitChildren(this); + } } public final BranchconditionContext branchcondition() throws RecognitionException { @@ -4602,6 +4922,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_forloop; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitForloop(this); + else return visitor.visitChildren(this); + } } public final ForloopContext forloop() throws RecognitionException { @@ -4741,6 +5066,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_whileloop; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitWhileloop(this); + else return visitor.visitChildren(this); + } } public final WhileloopContext whileloop() throws RecognitionException { @@ -4858,6 +5188,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_repeatloop; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitRepeatloop(this); + else return visitor.visitChildren(this); + } } public final RepeatloopContext repeatloop() throws RecognitionException { @@ -4980,6 +5315,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_whenstmt; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitWhenstmt(this); + else return visitor.visitChildren(this); + } } public final WhenstmtContext whenstmt() throws RecognitionException { @@ -5085,6 +5425,11 @@ public class prog8Parser extends Parser { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_when_choice; } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof prog8Visitor ) return ((prog8Visitor)visitor).visitWhen_choice(this); + else return visitor.visitChildren(this); + } } public final When_choiceContext when_choice() throws RecognitionException { diff --git a/parser/src/prog8/parser/prog8Visitor.java b/parser/src/prog8/parser/prog8Visitor.java new file mode 100644 index 000000000..a5933a01f --- /dev/null +++ b/parser/src/prog8/parser/prog8Visitor.java @@ -0,0 +1,429 @@ +// Generated from /home/irmen/Projects/prog8/parser/antlr/prog8.g4 by ANTLR 4.8 + +package prog8.parser; + +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by {@link prog8Parser}. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public interface prog8Visitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by {@link prog8Parser#module}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitModule(prog8Parser.ModuleContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#modulestatement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitModulestatement(prog8Parser.ModulestatementContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBlock(prog8Parser.BlockContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#statement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStatement(prog8Parser.StatementContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#labeldef}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitLabeldef(prog8Parser.LabeldefContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#unconditionaljump}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitUnconditionaljump(prog8Parser.UnconditionaljumpContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#directive}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDirective(prog8Parser.DirectiveContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#directivearg}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDirectivearg(prog8Parser.DirectiveargContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#vardecl}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitVardecl(prog8Parser.VardeclContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#structvardecl}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStructvardecl(prog8Parser.StructvardeclContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#varinitializer}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitVarinitializer(prog8Parser.VarinitializerContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#structvarinitializer}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStructvarinitializer(prog8Parser.StructvarinitializerContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#constdecl}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitConstdecl(prog8Parser.ConstdeclContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#memoryvardecl}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitMemoryvardecl(prog8Parser.MemoryvardeclContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#structdecl}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStructdecl(prog8Parser.StructdeclContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#datatype}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDatatype(prog8Parser.DatatypeContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#arrayindex}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitArrayindex(prog8Parser.ArrayindexContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#assignment}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssignment(prog8Parser.AssignmentContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#augassignment}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAugassignment(prog8Parser.AugassignmentContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#assign_target}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssign_target(prog8Parser.Assign_targetContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#postincrdecr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitPostincrdecr(prog8Parser.PostincrdecrContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#expression}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitExpression(prog8Parser.ExpressionContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#typecast}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitTypecast(prog8Parser.TypecastContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#arrayindexed}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitArrayindexed(prog8Parser.ArrayindexedContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#directmemory}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDirectmemory(prog8Parser.DirectmemoryContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#addressof}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAddressof(prog8Parser.AddressofContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#functioncall}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFunctioncall(prog8Parser.FunctioncallContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#functioncall_stmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFunctioncall_stmt(prog8Parser.Functioncall_stmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#expression_list}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitExpression_list(prog8Parser.Expression_listContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#returnstmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitReturnstmt(prog8Parser.ReturnstmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#breakstmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBreakstmt(prog8Parser.BreakstmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#continuestmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitContinuestmt(prog8Parser.ContinuestmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#identifier}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIdentifier(prog8Parser.IdentifierContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#scoped_identifier}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitScoped_identifier(prog8Parser.Scoped_identifierContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#register}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRegister(prog8Parser.RegisterContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#registerorpair}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRegisterorpair(prog8Parser.RegisterorpairContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#statusregister}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStatusregister(prog8Parser.StatusregisterContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#integerliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIntegerliteral(prog8Parser.IntegerliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#wordsuffix}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWordsuffix(prog8Parser.WordsuffixContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#booleanliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBooleanliteral(prog8Parser.BooleanliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#arrayliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitArrayliteral(prog8Parser.ArrayliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#structliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStructliteral(prog8Parser.StructliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#stringliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStringliteral(prog8Parser.StringliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#charliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitCharliteral(prog8Parser.CharliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#floatliteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFloatliteral(prog8Parser.FloatliteralContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#literalvalue}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitLiteralvalue(prog8Parser.LiteralvalueContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#inlineasm}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitInlineasm(prog8Parser.InlineasmContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#subroutine}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitSubroutine(prog8Parser.SubroutineContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#sub_return_part}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitSub_return_part(prog8Parser.Sub_return_partContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#statement_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStatement_block(prog8Parser.Statement_blockContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#sub_params}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitSub_params(prog8Parser.Sub_paramsContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#sub_returns}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitSub_returns(prog8Parser.Sub_returnsContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsubroutine}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsubroutine(prog8Parser.AsmsubroutineContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_address}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_address(prog8Parser.Asmsub_addressContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_params}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_params(prog8Parser.Asmsub_paramsContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_param}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_param(prog8Parser.Asmsub_paramContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_clobbers}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_clobbers(prog8Parser.Asmsub_clobbersContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#clobber}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitClobber(prog8Parser.ClobberContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_returns}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_returns(prog8Parser.Asmsub_returnsContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#asmsub_return}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsmsub_return(prog8Parser.Asmsub_returnContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#if_stmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIf_stmt(prog8Parser.If_stmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#else_part}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitElse_part(prog8Parser.Else_partContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#branch_stmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBranch_stmt(prog8Parser.Branch_stmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#branchcondition}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBranchcondition(prog8Parser.BranchconditionContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#forloop}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitForloop(prog8Parser.ForloopContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#whileloop}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWhileloop(prog8Parser.WhileloopContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#repeatloop}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRepeatloop(prog8Parser.RepeatloopContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#whenstmt}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWhenstmt(prog8Parser.WhenstmtContext ctx); + /** + * Visit a parse tree produced by {@link prog8Parser#when_choice}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWhen_choice(prog8Parser.When_choiceContext ctx); +} \ No newline at end of file