diff --git a/RichRail/README.md b/RichRail/README.md index 2c19902..8b35f4e 100644 --- a/RichRail/README.md +++ b/RichRail/README.md @@ -1 +1,57 @@ -RichRail +# ANTLR4 RichRail Starter +A starter project for the RichRail command line DSL. +This project is part of an assignment for +Patterns and Frameworks at the Hogeschool Utrecht. + +# How do I set this up? +* The project uses Java 11, but you can change this in `pom.xml` if need be +* Install packages using Maven (see `pom.xml`) +* This automatically generates + the required classes through ANTLR4 +* For manually updating/regenerating the required classes + based on the grammar, you can let Maven execute the + antlr4:antlr4 command + +# How to start? +`Main.java` is the entry point. This sets up +all the required components. +It requests input, tokenizes it, parses it +and walks over the ParseTree using our custom +`RichRailCli`, which is a Listener that *extends* +the `RichRailBaseListener` generated by ANTLR4. The +Listener listens to `enter` and `exit` events. + +To configure our own actions, we need to override +the relevant methods. + +# What is going on? +ANTLR4 generates Parser, Visitor and Listener +classes based on the `RichRail.g4` grammar +found in `src/main/antlr4/parser`. +These classes contain context and methods needed +for visiting the nodes in the parse tree or +for listening to events when entering or exiting +the nodes in a parse tree. +In this example, a Visitor approach has been used. + +The `RichRailCli` is a custom class that extends +the base listener generated by ANTLR4. In this custom class, +we can overwrite the steps taken when traversing each node +in a certain expression. + +# Where are all the classes? +ANTLR4 generates these class files +in the target directory. You can use the +maven commands defined in the `pom.xml`. + +The generated classes are output to +the `target/generated-sources/antlr4` directory +and reside in the project's `parser` package. +This is due to the standard configuration of ANTLR4, +matching the location of the grammar file (`src/antlr4/parser`). +No further configuration required. + +# Author +Alex Rothuis: [@arothuis](https://twitter.com/arothuis) + +[arothuis.nl](http://arothuis.nl) diff --git a/RichRail/pom.xml b/RichRail/pom.xml new file mode 100644 index 0000000..e75c4a7 --- /dev/null +++ b/RichRail/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + + 11 + 11 + + + nl.arothuis + antlr4-richrail-starter + 1.0-SNAPSHOT + + + + + org.antlr + antlr4-runtime + 4.7.1 + + + + org.antlr + antlr4 + 4.7.1 + + + + + + + org.antlr + antlr4-maven-plugin + 4.7.1 + + + -listener + -visitor + + + + + antlr + + antlr4 + + + + + + + + \ No newline at end of file diff --git a/RichRail/src/main/antlr4/parser/RichRail.g4 b/RichRail/src/main/antlr4/parser/RichRail.g4 new file mode 100644 index 0000000..4a01ecf --- /dev/null +++ b/RichRail/src/main/antlr4/parser/RichRail.g4 @@ -0,0 +1,17 @@ +grammar RichRail; + +// Rules +command : newcommand | addcommand | getcommand | delcommand | remcommand; +newcommand : newtraincommand | newwagoncommand; +newtraincommand : 'new' 'train' ID; +newwagoncommand : 'new' 'wagon' ID ('numseats' NUMBER)?; +addcommand : 'add' ID 'to' ID; +getcommand : 'getnumseats' type id=ID; +delcommand : 'delete' type ID; +remcommand : 'remove' ID 'from' ID; +type : 'train' | 'wagon'; + +// Tokens +ID : ('a'..'z')('a'..'z'|'0'..'9')*; +NUMBER : ('0'..'9')+; +WHITESPACE : [ \t\r\n\u000C] -> skip; \ No newline at end of file diff --git a/RichRail/src/main/java/Main.java b/RichRail/src/main/java/Main.java new file mode 100644 index 0000000..085794a --- /dev/null +++ b/RichRail/src/main/java/Main.java @@ -0,0 +1,28 @@ +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.tree.ParseTree; +import org.antlr.v4.runtime.tree.ParseTreeWalker; +import parser.*; + +public class Main { + public static void main(String[] args) { + CharStream lineStream = CharStreams.fromString("new train tr1"); + + // Tokenize / Lexical analysis + Lexer lexer = new RichRailLexer(lineStream); + CommonTokenStream tokens = new CommonTokenStream(lexer); + + // Create Parse Tree + RichRailParser parser = new RichRailParser(tokens); + ParseTree tree = parser.command(); + + // Create ParseTreeWalker and Custom Listener + ParseTreeWalker walker = new ParseTreeWalker(); + RichRailListener listener = new RichRailCli(); + + // Walk over ParseTree using Custom Listener that listens to enter/exit events + walker.walk(listener, tree); + } +} diff --git a/RichRail/src/main/java/parser/RichRailCli.java b/RichRail/src/main/java/parser/RichRailCli.java new file mode 100644 index 0000000..fde7f9f --- /dev/null +++ b/RichRail/src/main/java/parser/RichRailCli.java @@ -0,0 +1,5 @@ +package parser; + +public class RichRailCli extends RichRailBaseListener { + // Override methods as desired... +} diff --git a/RichRail/target/classes/Main.class b/RichRail/target/classes/Main.class new file mode 100644 index 0000000..b15c28f Binary files /dev/null and b/RichRail/target/classes/Main.class differ diff --git a/RichRail/target/classes/RichRail.tokens b/RichRail/target/classes/RichRail.tokens new file mode 100644 index 0000000..90412bb --- /dev/null +++ b/RichRail/target/classes/RichRail.tokens @@ -0,0 +1,23 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +T__9=10 +ID=11 +NUMBER=12 +WHITESPACE=13 +'new'=1 +'train'=2 +'wagon'=3 +'numseats'=4 +'add'=5 +'to'=6 +'getnumseats'=7 +'delete'=8 +'remove'=9 +'from'=10 diff --git a/RichRail/target/classes/RichRailLexer.tokens b/RichRail/target/classes/RichRailLexer.tokens new file mode 100644 index 0000000..90412bb --- /dev/null +++ b/RichRail/target/classes/RichRailLexer.tokens @@ -0,0 +1,23 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +T__9=10 +ID=11 +NUMBER=12 +WHITESPACE=13 +'new'=1 +'train'=2 +'wagon'=3 +'numseats'=4 +'add'=5 +'to'=6 +'getnumseats'=7 +'delete'=8 +'remove'=9 +'from'=10 diff --git a/RichRail/target/classes/parser/RichRail.interp b/RichRail/target/classes/parser/RichRail.interp new file mode 100644 index 0000000..ef6017f --- /dev/null +++ b/RichRail/target/classes/parser/RichRail.interp @@ -0,0 +1,46 @@ +token literal names: +null +'new' +'train' +'wagon' +'numseats' +'add' +'to' +'getnumseats' +'delete' +'remove' +'from' +null +null +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +null +ID +NUMBER +WHITESPACE + +rule names: +command +newcommand +newtraincommand +newwagoncommand +addcommand +getcommand +delcommand +remcommand +type + + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 15, 63, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 26, 10, 2, 3, 3, 3, 3, 5, 3, 30, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 41, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 2, 2, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 3, 3, 2, 4, 5, 2, 59, 2, 25, 3, 2, 2, 2, 4, 29, 3, 2, 2, 2, 6, 31, 3, 2, 2, 2, 8, 35, 3, 2, 2, 2, 10, 42, 3, 2, 2, 2, 12, 47, 3, 2, 2, 2, 14, 51, 3, 2, 2, 2, 16, 55, 3, 2, 2, 2, 18, 60, 3, 2, 2, 2, 20, 26, 5, 4, 3, 2, 21, 26, 5, 10, 6, 2, 22, 26, 5, 12, 7, 2, 23, 26, 5, 14, 8, 2, 24, 26, 5, 16, 9, 2, 25, 20, 3, 2, 2, 2, 25, 21, 3, 2, 2, 2, 25, 22, 3, 2, 2, 2, 25, 23, 3, 2, 2, 2, 25, 24, 3, 2, 2, 2, 26, 3, 3, 2, 2, 2, 27, 30, 5, 6, 4, 2, 28, 30, 5, 8, 5, 2, 29, 27, 3, 2, 2, 2, 29, 28, 3, 2, 2, 2, 30, 5, 3, 2, 2, 2, 31, 32, 7, 3, 2, 2, 32, 33, 7, 4, 2, 2, 33, 34, 7, 13, 2, 2, 34, 7, 3, 2, 2, 2, 35, 36, 7, 3, 2, 2, 36, 37, 7, 5, 2, 2, 37, 40, 7, 13, 2, 2, 38, 39, 7, 6, 2, 2, 39, 41, 7, 14, 2, 2, 40, 38, 3, 2, 2, 2, 40, 41, 3, 2, 2, 2, 41, 9, 3, 2, 2, 2, 42, 43, 7, 7, 2, 2, 43, 44, 7, 13, 2, 2, 44, 45, 7, 8, 2, 2, 45, 46, 7, 13, 2, 2, 46, 11, 3, 2, 2, 2, 47, 48, 7, 9, 2, 2, 48, 49, 5, 18, 10, 2, 49, 50, 7, 13, 2, 2, 50, 13, 3, 2, 2, 2, 51, 52, 7, 10, 2, 2, 52, 53, 5, 18, 10, 2, 53, 54, 7, 13, 2, 2, 54, 15, 3, 2, 2, 2, 55, 56, 7, 11, 2, 2, 56, 57, 7, 13, 2, 2, 57, 58, 7, 12, 2, 2, 58, 59, 7, 13, 2, 2, 59, 17, 3, 2, 2, 2, 60, 61, 9, 2, 2, 2, 61, 19, 3, 2, 2, 2, 5, 25, 29, 40] \ No newline at end of file diff --git a/RichRail/target/classes/parser/RichRailBaseListener.class b/RichRail/target/classes/parser/RichRailBaseListener.class new file mode 100644 index 0000000..a106eda Binary files /dev/null and b/RichRail/target/classes/parser/RichRailBaseListener.class differ diff --git a/RichRail/target/classes/parser/RichRailBaseVisitor.class b/RichRail/target/classes/parser/RichRailBaseVisitor.class new file mode 100644 index 0000000..8ba8108 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailBaseVisitor.class differ diff --git a/RichRail/target/classes/parser/RichRailCli.class b/RichRail/target/classes/parser/RichRailCli.class new file mode 100644 index 0000000..2e27887 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailCli.class differ diff --git a/RichRail/target/classes/parser/RichRailLexer.class b/RichRail/target/classes/parser/RichRailLexer.class new file mode 100644 index 0000000..303ccf3 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailLexer.class differ diff --git a/RichRail/target/classes/parser/RichRailLexer.interp b/RichRail/target/classes/parser/RichRailLexer.interp new file mode 100644 index 0000000..cb6db30 --- /dev/null +++ b/RichRail/target/classes/parser/RichRailLexer.interp @@ -0,0 +1,56 @@ +token literal names: +null +'new' +'train' +'wagon' +'numseats' +'add' +'to' +'getnumseats' +'delete' +'remove' +'from' +null +null +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +null +ID +NUMBER +WHITESPACE + +rule names: +T__0 +T__1 +T__2 +T__3 +T__4 +T__5 +T__6 +T__7 +T__8 +T__9 +ID +NUMBER +WHITESPACE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 15, 108, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 7, 12, 95, 10, 12, 12, 12, 14, 12, 98, 11, 12, 3, 13, 6, 13, 101, 10, 13, 13, 13, 14, 13, 102, 3, 14, 3, 14, 3, 14, 3, 14, 2, 2, 15, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 3, 2, 4, 4, 2, 50, 59, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 2, 109, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 3, 29, 3, 2, 2, 2, 5, 33, 3, 2, 2, 2, 7, 39, 3, 2, 2, 2, 9, 45, 3, 2, 2, 2, 11, 54, 3, 2, 2, 2, 13, 58, 3, 2, 2, 2, 15, 61, 3, 2, 2, 2, 17, 73, 3, 2, 2, 2, 19, 80, 3, 2, 2, 2, 21, 87, 3, 2, 2, 2, 23, 92, 3, 2, 2, 2, 25, 100, 3, 2, 2, 2, 27, 104, 3, 2, 2, 2, 29, 30, 7, 112, 2, 2, 30, 31, 7, 103, 2, 2, 31, 32, 7, 121, 2, 2, 32, 4, 3, 2, 2, 2, 33, 34, 7, 118, 2, 2, 34, 35, 7, 116, 2, 2, 35, 36, 7, 99, 2, 2, 36, 37, 7, 107, 2, 2, 37, 38, 7, 112, 2, 2, 38, 6, 3, 2, 2, 2, 39, 40, 7, 121, 2, 2, 40, 41, 7, 99, 2, 2, 41, 42, 7, 105, 2, 2, 42, 43, 7, 113, 2, 2, 43, 44, 7, 112, 2, 2, 44, 8, 3, 2, 2, 2, 45, 46, 7, 112, 2, 2, 46, 47, 7, 119, 2, 2, 47, 48, 7, 111, 2, 2, 48, 49, 7, 117, 2, 2, 49, 50, 7, 103, 2, 2, 50, 51, 7, 99, 2, 2, 51, 52, 7, 118, 2, 2, 52, 53, 7, 117, 2, 2, 53, 10, 3, 2, 2, 2, 54, 55, 7, 99, 2, 2, 55, 56, 7, 102, 2, 2, 56, 57, 7, 102, 2, 2, 57, 12, 3, 2, 2, 2, 58, 59, 7, 118, 2, 2, 59, 60, 7, 113, 2, 2, 60, 14, 3, 2, 2, 2, 61, 62, 7, 105, 2, 2, 62, 63, 7, 103, 2, 2, 63, 64, 7, 118, 2, 2, 64, 65, 7, 112, 2, 2, 65, 66, 7, 119, 2, 2, 66, 67, 7, 111, 2, 2, 67, 68, 7, 117, 2, 2, 68, 69, 7, 103, 2, 2, 69, 70, 7, 99, 2, 2, 70, 71, 7, 118, 2, 2, 71, 72, 7, 117, 2, 2, 72, 16, 3, 2, 2, 2, 73, 74, 7, 102, 2, 2, 74, 75, 7, 103, 2, 2, 75, 76, 7, 110, 2, 2, 76, 77, 7, 103, 2, 2, 77, 78, 7, 118, 2, 2, 78, 79, 7, 103, 2, 2, 79, 18, 3, 2, 2, 2, 80, 81, 7, 116, 2, 2, 81, 82, 7, 103, 2, 2, 82, 83, 7, 111, 2, 2, 83, 84, 7, 113, 2, 2, 84, 85, 7, 120, 2, 2, 85, 86, 7, 103, 2, 2, 86, 20, 3, 2, 2, 2, 87, 88, 7, 104, 2, 2, 88, 89, 7, 116, 2, 2, 89, 90, 7, 113, 2, 2, 90, 91, 7, 111, 2, 2, 91, 22, 3, 2, 2, 2, 92, 96, 4, 99, 124, 2, 93, 95, 9, 2, 2, 2, 94, 93, 3, 2, 2, 2, 95, 98, 3, 2, 2, 2, 96, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 24, 3, 2, 2, 2, 98, 96, 3, 2, 2, 2, 99, 101, 4, 50, 59, 2, 100, 99, 3, 2, 2, 2, 101, 102, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 26, 3, 2, 2, 2, 104, 105, 9, 3, 2, 2, 105, 106, 3, 2, 2, 2, 106, 107, 8, 14, 2, 2, 107, 28, 3, 2, 2, 2, 5, 2, 96, 102, 3, 8, 2, 2] \ No newline at end of file diff --git a/RichRail/target/classes/parser/RichRailListener.class b/RichRail/target/classes/parser/RichRailListener.class new file mode 100644 index 0000000..f174105 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailListener.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$AddcommandContext.class b/RichRail/target/classes/parser/RichRailParser$AddcommandContext.class new file mode 100644 index 0000000..8cbde11 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$AddcommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$CommandContext.class b/RichRail/target/classes/parser/RichRailParser$CommandContext.class new file mode 100644 index 0000000..17b1738 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$CommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$DelcommandContext.class b/RichRail/target/classes/parser/RichRailParser$DelcommandContext.class new file mode 100644 index 0000000..50045ac Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$DelcommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$GetcommandContext.class b/RichRail/target/classes/parser/RichRailParser$GetcommandContext.class new file mode 100644 index 0000000..fc2af50 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$GetcommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$NewcommandContext.class b/RichRail/target/classes/parser/RichRailParser$NewcommandContext.class new file mode 100644 index 0000000..f72b00d Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$NewcommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$NewtraincommandContext.class b/RichRail/target/classes/parser/RichRailParser$NewtraincommandContext.class new file mode 100644 index 0000000..7bbe1c9 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$NewtraincommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$NewwagoncommandContext.class b/RichRail/target/classes/parser/RichRailParser$NewwagoncommandContext.class new file mode 100644 index 0000000..f49bdd8 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$NewwagoncommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$RemcommandContext.class b/RichRail/target/classes/parser/RichRailParser$RemcommandContext.class new file mode 100644 index 0000000..9933dce Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$RemcommandContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser$TypeContext.class b/RichRail/target/classes/parser/RichRailParser$TypeContext.class new file mode 100644 index 0000000..a94157b Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser$TypeContext.class differ diff --git a/RichRail/target/classes/parser/RichRailParser.class b/RichRail/target/classes/parser/RichRailParser.class new file mode 100644 index 0000000..b1c8f92 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailParser.class differ diff --git a/RichRail/target/classes/parser/RichRailVisitor.class b/RichRail/target/classes/parser/RichRailVisitor.class new file mode 100644 index 0000000..2d01856 Binary files /dev/null and b/RichRail/target/classes/parser/RichRailVisitor.class differ diff --git a/RichRail/target/generated-sources/antlr4/RichRail.tokens b/RichRail/target/generated-sources/antlr4/RichRail.tokens new file mode 100644 index 0000000..90412bb --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/RichRail.tokens @@ -0,0 +1,23 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +T__9=10 +ID=11 +NUMBER=12 +WHITESPACE=13 +'new'=1 +'train'=2 +'wagon'=3 +'numseats'=4 +'add'=5 +'to'=6 +'getnumseats'=7 +'delete'=8 +'remove'=9 +'from'=10 diff --git a/RichRail/target/generated-sources/antlr4/RichRailLexer.tokens b/RichRail/target/generated-sources/antlr4/RichRailLexer.tokens new file mode 100644 index 0000000..90412bb --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/RichRailLexer.tokens @@ -0,0 +1,23 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +T__9=10 +ID=11 +NUMBER=12 +WHITESPACE=13 +'new'=1 +'train'=2 +'wagon'=3 +'numseats'=4 +'add'=5 +'to'=6 +'getnumseats'=7 +'delete'=8 +'remove'=9 +'from'=10 diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRail.interp b/RichRail/target/generated-sources/antlr4/parser/RichRail.interp new file mode 100644 index 0000000..ef6017f --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRail.interp @@ -0,0 +1,46 @@ +token literal names: +null +'new' +'train' +'wagon' +'numseats' +'add' +'to' +'getnumseats' +'delete' +'remove' +'from' +null +null +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +null +ID +NUMBER +WHITESPACE + +rule names: +command +newcommand +newtraincommand +newwagoncommand +addcommand +getcommand +delcommand +remcommand +type + + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 15, 63, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 26, 10, 2, 3, 3, 3, 3, 5, 3, 30, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 41, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 2, 2, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 3, 3, 2, 4, 5, 2, 59, 2, 25, 3, 2, 2, 2, 4, 29, 3, 2, 2, 2, 6, 31, 3, 2, 2, 2, 8, 35, 3, 2, 2, 2, 10, 42, 3, 2, 2, 2, 12, 47, 3, 2, 2, 2, 14, 51, 3, 2, 2, 2, 16, 55, 3, 2, 2, 2, 18, 60, 3, 2, 2, 2, 20, 26, 5, 4, 3, 2, 21, 26, 5, 10, 6, 2, 22, 26, 5, 12, 7, 2, 23, 26, 5, 14, 8, 2, 24, 26, 5, 16, 9, 2, 25, 20, 3, 2, 2, 2, 25, 21, 3, 2, 2, 2, 25, 22, 3, 2, 2, 2, 25, 23, 3, 2, 2, 2, 25, 24, 3, 2, 2, 2, 26, 3, 3, 2, 2, 2, 27, 30, 5, 6, 4, 2, 28, 30, 5, 8, 5, 2, 29, 27, 3, 2, 2, 2, 29, 28, 3, 2, 2, 2, 30, 5, 3, 2, 2, 2, 31, 32, 7, 3, 2, 2, 32, 33, 7, 4, 2, 2, 33, 34, 7, 13, 2, 2, 34, 7, 3, 2, 2, 2, 35, 36, 7, 3, 2, 2, 36, 37, 7, 5, 2, 2, 37, 40, 7, 13, 2, 2, 38, 39, 7, 6, 2, 2, 39, 41, 7, 14, 2, 2, 40, 38, 3, 2, 2, 2, 40, 41, 3, 2, 2, 2, 41, 9, 3, 2, 2, 2, 42, 43, 7, 7, 2, 2, 43, 44, 7, 13, 2, 2, 44, 45, 7, 8, 2, 2, 45, 46, 7, 13, 2, 2, 46, 11, 3, 2, 2, 2, 47, 48, 7, 9, 2, 2, 48, 49, 5, 18, 10, 2, 49, 50, 7, 13, 2, 2, 50, 13, 3, 2, 2, 2, 51, 52, 7, 10, 2, 2, 52, 53, 5, 18, 10, 2, 53, 54, 7, 13, 2, 2, 54, 15, 3, 2, 2, 2, 55, 56, 7, 11, 2, 2, 56, 57, 7, 13, 2, 2, 57, 58, 7, 12, 2, 2, 58, 59, 7, 13, 2, 2, 59, 17, 3, 2, 2, 2, 60, 61, 9, 2, 2, 2, 61, 19, 3, 2, 2, 2, 5, 25, 29, 40] \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailBaseListener.java b/RichRail/target/generated-sources/antlr4/parser/RichRailBaseListener.java new file mode 100644 index 0000000..4b0d652 --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailBaseListener.java @@ -0,0 +1,147 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link RichRailListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +public class RichRailBaseListener implements RichRailListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCommand(RichRailParser.CommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCommand(RichRailParser.CommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNewcommand(RichRailParser.NewcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNewcommand(RichRailParser.NewcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNewtraincommand(RichRailParser.NewtraincommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNewtraincommand(RichRailParser.NewtraincommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNewwagoncommand(RichRailParser.NewwagoncommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNewwagoncommand(RichRailParser.NewwagoncommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAddcommand(RichRailParser.AddcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAddcommand(RichRailParser.AddcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGetcommand(RichRailParser.GetcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGetcommand(RichRailParser.GetcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterDelcommand(RichRailParser.DelcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitDelcommand(RichRailParser.DelcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRemcommand(RichRailParser.RemcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRemcommand(RichRailParser.RemcommandContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterType(RichRailParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitType(RichRailParser.TypeContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

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

The default implementation does nothing.

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

The default implementation does nothing.

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

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailBaseVisitor.java b/RichRail/target/generated-sources/antlr4/parser/RichRailBaseVisitor.java new file mode 100644 index 0000000..252f5ad --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailBaseVisitor.java @@ -0,0 +1,77 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link RichRailVisitor}, + * 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 RichRailBaseVisitor extends AbstractParseTreeVisitor implements RichRailVisitor { + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitCommand(RichRailParser.CommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitNewcommand(RichRailParser.NewcommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitNewtraincommand(RichRailParser.NewtraincommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitNewwagoncommand(RichRailParser.NewwagoncommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitAddcommand(RichRailParser.AddcommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitGetcommand(RichRailParser.GetcommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitDelcommand(RichRailParser.DelcommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitRemcommand(RichRailParser.RemcommandContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

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

+ */ + @Override public T visitType(RichRailParser.TypeContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.interp b/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.interp new file mode 100644 index 0000000..cb6db30 --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.interp @@ -0,0 +1,56 @@ +token literal names: +null +'new' +'train' +'wagon' +'numseats' +'add' +'to' +'getnumseats' +'delete' +'remove' +'from' +null +null +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +null +ID +NUMBER +WHITESPACE + +rule names: +T__0 +T__1 +T__2 +T__3 +T__4 +T__5 +T__6 +T__7 +T__8 +T__9 +ID +NUMBER +WHITESPACE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 15, 108, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 7, 12, 95, 10, 12, 12, 12, 14, 12, 98, 11, 12, 3, 13, 6, 13, 101, 10, 13, 13, 13, 14, 13, 102, 3, 14, 3, 14, 3, 14, 3, 14, 2, 2, 15, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 3, 2, 4, 4, 2, 50, 59, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 2, 109, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 3, 29, 3, 2, 2, 2, 5, 33, 3, 2, 2, 2, 7, 39, 3, 2, 2, 2, 9, 45, 3, 2, 2, 2, 11, 54, 3, 2, 2, 2, 13, 58, 3, 2, 2, 2, 15, 61, 3, 2, 2, 2, 17, 73, 3, 2, 2, 2, 19, 80, 3, 2, 2, 2, 21, 87, 3, 2, 2, 2, 23, 92, 3, 2, 2, 2, 25, 100, 3, 2, 2, 2, 27, 104, 3, 2, 2, 2, 29, 30, 7, 112, 2, 2, 30, 31, 7, 103, 2, 2, 31, 32, 7, 121, 2, 2, 32, 4, 3, 2, 2, 2, 33, 34, 7, 118, 2, 2, 34, 35, 7, 116, 2, 2, 35, 36, 7, 99, 2, 2, 36, 37, 7, 107, 2, 2, 37, 38, 7, 112, 2, 2, 38, 6, 3, 2, 2, 2, 39, 40, 7, 121, 2, 2, 40, 41, 7, 99, 2, 2, 41, 42, 7, 105, 2, 2, 42, 43, 7, 113, 2, 2, 43, 44, 7, 112, 2, 2, 44, 8, 3, 2, 2, 2, 45, 46, 7, 112, 2, 2, 46, 47, 7, 119, 2, 2, 47, 48, 7, 111, 2, 2, 48, 49, 7, 117, 2, 2, 49, 50, 7, 103, 2, 2, 50, 51, 7, 99, 2, 2, 51, 52, 7, 118, 2, 2, 52, 53, 7, 117, 2, 2, 53, 10, 3, 2, 2, 2, 54, 55, 7, 99, 2, 2, 55, 56, 7, 102, 2, 2, 56, 57, 7, 102, 2, 2, 57, 12, 3, 2, 2, 2, 58, 59, 7, 118, 2, 2, 59, 60, 7, 113, 2, 2, 60, 14, 3, 2, 2, 2, 61, 62, 7, 105, 2, 2, 62, 63, 7, 103, 2, 2, 63, 64, 7, 118, 2, 2, 64, 65, 7, 112, 2, 2, 65, 66, 7, 119, 2, 2, 66, 67, 7, 111, 2, 2, 67, 68, 7, 117, 2, 2, 68, 69, 7, 103, 2, 2, 69, 70, 7, 99, 2, 2, 70, 71, 7, 118, 2, 2, 71, 72, 7, 117, 2, 2, 72, 16, 3, 2, 2, 2, 73, 74, 7, 102, 2, 2, 74, 75, 7, 103, 2, 2, 75, 76, 7, 110, 2, 2, 76, 77, 7, 103, 2, 2, 77, 78, 7, 118, 2, 2, 78, 79, 7, 103, 2, 2, 79, 18, 3, 2, 2, 2, 80, 81, 7, 116, 2, 2, 81, 82, 7, 103, 2, 2, 82, 83, 7, 111, 2, 2, 83, 84, 7, 113, 2, 2, 84, 85, 7, 120, 2, 2, 85, 86, 7, 103, 2, 2, 86, 20, 3, 2, 2, 2, 87, 88, 7, 104, 2, 2, 88, 89, 7, 116, 2, 2, 89, 90, 7, 113, 2, 2, 90, 91, 7, 111, 2, 2, 91, 22, 3, 2, 2, 2, 92, 96, 4, 99, 124, 2, 93, 95, 9, 2, 2, 2, 94, 93, 3, 2, 2, 2, 95, 98, 3, 2, 2, 2, 96, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 24, 3, 2, 2, 2, 98, 96, 3, 2, 2, 2, 99, 101, 4, 50, 59, 2, 100, 99, 3, 2, 2, 2, 101, 102, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 26, 3, 2, 2, 2, 104, 105, 9, 3, 2, 2, 105, 106, 3, 2, 2, 2, 106, 107, 8, 14, 2, 2, 107, 28, 3, 2, 2, 2, 5, 2, 96, 102, 3, 8, 2, 2] \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.java b/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.java new file mode 100644 index 0000000..69750dd --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailLexer.java @@ -0,0 +1,135 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class RichRailLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, ID=11, NUMBER=12, WHITESPACE=13; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + public static final String[] ruleNames = { + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", + "T__9", "ID", "NUMBER", "WHITESPACE" + }; + + private static final String[] _LITERAL_NAMES = { + null, "'new'", "'train'", "'wagon'", "'numseats'", "'add'", "'to'", "'getnumseats'", + "'delete'", "'remove'", "'from'" + }; + private static final String[] _SYMBOLIC_NAMES = { + null, null, null, null, null, null, null, null, null, null, null, "ID", + "NUMBER", "WHITESPACE" + }; + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public RichRailLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "RichRail.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\17l\b\1\4\2\t\2\4"+ + "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ + "\13\4\f\t\f\4\r\t\r\4\16\t\16\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3"+ + "\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3"+ + "\6\3\6\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t"+ + "\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3"+ + "\13\3\13\3\f\3\f\7\f_\n\f\f\f\16\fb\13\f\3\r\6\re\n\r\r\r\16\rf\3\16\3"+ + "\16\3\16\3\16\2\2\17\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27"+ + "\r\31\16\33\17\3\2\4\4\2\62;c|\5\2\13\f\16\17\"\"\2m\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\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3"+ + "\2\2\2\3\35\3\2\2\2\5!\3\2\2\2\7\'\3\2\2\2\t-\3\2\2\2\13\66\3\2\2\2\r"+ + ":\3\2\2\2\17=\3\2\2\2\21I\3\2\2\2\23P\3\2\2\2\25W\3\2\2\2\27\\\3\2\2\2"+ + "\31d\3\2\2\2\33h\3\2\2\2\35\36\7p\2\2\36\37\7g\2\2\37 \7y\2\2 \4\3\2\2"+ + "\2!\"\7v\2\2\"#\7t\2\2#$\7c\2\2$%\7k\2\2%&\7p\2\2&\6\3\2\2\2\'(\7y\2\2"+ + "()\7c\2\2)*\7i\2\2*+\7q\2\2+,\7p\2\2,\b\3\2\2\2-.\7p\2\2./\7w\2\2/\60"+ + "\7o\2\2\60\61\7u\2\2\61\62\7g\2\2\62\63\7c\2\2\63\64\7v\2\2\64\65\7u\2"+ + "\2\65\n\3\2\2\2\66\67\7c\2\2\678\7f\2\289\7f\2\29\f\3\2\2\2:;\7v\2\2;"+ + "<\7q\2\2<\16\3\2\2\2=>\7i\2\2>?\7g\2\2?@\7v\2\2@A\7p\2\2AB\7w\2\2BC\7"+ + "o\2\2CD\7u\2\2DE\7g\2\2EF\7c\2\2FG\7v\2\2GH\7u\2\2H\20\3\2\2\2IJ\7f\2"+ + "\2JK\7g\2\2KL\7n\2\2LM\7g\2\2MN\7v\2\2NO\7g\2\2O\22\3\2\2\2PQ\7t\2\2Q"+ + "R\7g\2\2RS\7o\2\2ST\7q\2\2TU\7x\2\2UV\7g\2\2V\24\3\2\2\2WX\7h\2\2XY\7"+ + "t\2\2YZ\7q\2\2Z[\7o\2\2[\26\3\2\2\2\\`\4c|\2]_\t\2\2\2^]\3\2\2\2_b\3\2"+ + "\2\2`^\3\2\2\2`a\3\2\2\2a\30\3\2\2\2b`\3\2\2\2ce\4\62;\2dc\3\2\2\2ef\3"+ + "\2\2\2fd\3\2\2\2fg\3\2\2\2g\32\3\2\2\2hi\t\3\2\2ij\3\2\2\2jk\b\16\2\2"+ + "k\34\3\2\2\2\5\2`f\3\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailListener.java b/RichRail/target/generated-sources/antlr4/parser/RichRailListener.java new file mode 100644 index 0000000..076d09d --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailListener.java @@ -0,0 +1,100 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link RichRailParser}. + */ +public interface RichRailListener extends ParseTreeListener { + /** + * Enter a parse tree produced by {@link RichRailParser#command}. + * @param ctx the parse tree + */ + void enterCommand(RichRailParser.CommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#command}. + * @param ctx the parse tree + */ + void exitCommand(RichRailParser.CommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#newcommand}. + * @param ctx the parse tree + */ + void enterNewcommand(RichRailParser.NewcommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#newcommand}. + * @param ctx the parse tree + */ + void exitNewcommand(RichRailParser.NewcommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#newtraincommand}. + * @param ctx the parse tree + */ + void enterNewtraincommand(RichRailParser.NewtraincommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#newtraincommand}. + * @param ctx the parse tree + */ + void exitNewtraincommand(RichRailParser.NewtraincommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#newwagoncommand}. + * @param ctx the parse tree + */ + void enterNewwagoncommand(RichRailParser.NewwagoncommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#newwagoncommand}. + * @param ctx the parse tree + */ + void exitNewwagoncommand(RichRailParser.NewwagoncommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#addcommand}. + * @param ctx the parse tree + */ + void enterAddcommand(RichRailParser.AddcommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#addcommand}. + * @param ctx the parse tree + */ + void exitAddcommand(RichRailParser.AddcommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#getcommand}. + * @param ctx the parse tree + */ + void enterGetcommand(RichRailParser.GetcommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#getcommand}. + * @param ctx the parse tree + */ + void exitGetcommand(RichRailParser.GetcommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#delcommand}. + * @param ctx the parse tree + */ + void enterDelcommand(RichRailParser.DelcommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#delcommand}. + * @param ctx the parse tree + */ + void exitDelcommand(RichRailParser.DelcommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#remcommand}. + * @param ctx the parse tree + */ + void enterRemcommand(RichRailParser.RemcommandContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#remcommand}. + * @param ctx the parse tree + */ + void exitRemcommand(RichRailParser.RemcommandContext ctx); + /** + * Enter a parse tree produced by {@link RichRailParser#type}. + * @param ctx the parse tree + */ + void enterType(RichRailParser.TypeContext ctx); + /** + * Exit a parse tree produced by {@link RichRailParser#type}. + * @param ctx the parse tree + */ + void exitType(RichRailParser.TypeContext ctx); +} \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailParser.java b/RichRail/target/generated-sources/antlr4/parser/RichRailParser.java new file mode 100644 index 0000000..c4adf8f --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailParser.java @@ -0,0 +1,622 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; +import java.util.List; +import java.util.Iterator; +import java.util.ArrayList; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class RichRailParser extends Parser { + static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, ID=11, NUMBER=12, WHITESPACE=13; + public static final int + RULE_command = 0, RULE_newcommand = 1, RULE_newtraincommand = 2, RULE_newwagoncommand = 3, + RULE_addcommand = 4, RULE_getcommand = 5, RULE_delcommand = 6, RULE_remcommand = 7, + RULE_type = 8; + public static final String[] ruleNames = { + "command", "newcommand", "newtraincommand", "newwagoncommand", "addcommand", + "getcommand", "delcommand", "remcommand", "type" + }; + + private static final String[] _LITERAL_NAMES = { + null, "'new'", "'train'", "'wagon'", "'numseats'", "'add'", "'to'", "'getnumseats'", + "'delete'", "'remove'", "'from'" + }; + private static final String[] _SYMBOLIC_NAMES = { + null, null, null, null, null, null, null, null, null, null, null, "ID", + "NUMBER", "WHITESPACE" + }; + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "RichRail.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public RichRailParser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + public static class CommandContext extends ParserRuleContext { + public NewcommandContext newcommand() { + return getRuleContext(NewcommandContext.class,0); + } + public AddcommandContext addcommand() { + return getRuleContext(AddcommandContext.class,0); + } + public GetcommandContext getcommand() { + return getRuleContext(GetcommandContext.class,0); + } + public DelcommandContext delcommand() { + return getRuleContext(DelcommandContext.class,0); + } + public RemcommandContext remcommand() { + return getRuleContext(RemcommandContext.class,0); + } + public CommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_command; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterCommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitCommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitCommand(this); + else return visitor.visitChildren(this); + } + } + + public final CommandContext command() throws RecognitionException { + CommandContext _localctx = new CommandContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_command); + try { + setState(23); + _errHandler.sync(this); + switch (_input.LA(1)) { + case T__0: + enterOuterAlt(_localctx, 1); + { + setState(18); + newcommand(); + } + break; + case T__4: + enterOuterAlt(_localctx, 2); + { + setState(19); + addcommand(); + } + break; + case T__6: + enterOuterAlt(_localctx, 3); + { + setState(20); + getcommand(); + } + break; + case T__7: + enterOuterAlt(_localctx, 4); + { + setState(21); + delcommand(); + } + break; + case T__8: + enterOuterAlt(_localctx, 5); + { + setState(22); + remcommand(); + } + 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 NewcommandContext extends ParserRuleContext { + public NewtraincommandContext newtraincommand() { + return getRuleContext(NewtraincommandContext.class,0); + } + public NewwagoncommandContext newwagoncommand() { + return getRuleContext(NewwagoncommandContext.class,0); + } + public NewcommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_newcommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterNewcommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitNewcommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitNewcommand(this); + else return visitor.visitChildren(this); + } + } + + public final NewcommandContext newcommand() throws RecognitionException { + NewcommandContext _localctx = new NewcommandContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_newcommand); + try { + setState(27); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(25); + newtraincommand(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(26); + newwagoncommand(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class NewtraincommandContext extends ParserRuleContext { + public TerminalNode ID() { return getToken(RichRailParser.ID, 0); } + public NewtraincommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_newtraincommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterNewtraincommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitNewtraincommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitNewtraincommand(this); + else return visitor.visitChildren(this); + } + } + + public final NewtraincommandContext newtraincommand() throws RecognitionException { + NewtraincommandContext _localctx = new NewtraincommandContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_newtraincommand); + try { + enterOuterAlt(_localctx, 1); + { + setState(29); + match(T__0); + setState(30); + match(T__1); + setState(31); + match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class NewwagoncommandContext extends ParserRuleContext { + public TerminalNode ID() { return getToken(RichRailParser.ID, 0); } + public TerminalNode NUMBER() { return getToken(RichRailParser.NUMBER, 0); } + public NewwagoncommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_newwagoncommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterNewwagoncommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitNewwagoncommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitNewwagoncommand(this); + else return visitor.visitChildren(this); + } + } + + public final NewwagoncommandContext newwagoncommand() throws RecognitionException { + NewwagoncommandContext _localctx = new NewwagoncommandContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_newwagoncommand); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(33); + match(T__0); + setState(34); + match(T__2); + setState(35); + match(ID); + setState(38); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==T__3) { + { + setState(36); + match(T__3); + setState(37); + match(NUMBER); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class AddcommandContext extends ParserRuleContext { + public List ID() { return getTokens(RichRailParser.ID); } + public TerminalNode ID(int i) { + return getToken(RichRailParser.ID, i); + } + public AddcommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_addcommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterAddcommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitAddcommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitAddcommand(this); + else return visitor.visitChildren(this); + } + } + + public final AddcommandContext addcommand() throws RecognitionException { + AddcommandContext _localctx = new AddcommandContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_addcommand); + try { + enterOuterAlt(_localctx, 1); + { + setState(40); + match(T__4); + setState(41); + match(ID); + setState(42); + match(T__5); + setState(43); + match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class GetcommandContext extends ParserRuleContext { + public Token id; + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public TerminalNode ID() { return getToken(RichRailParser.ID, 0); } + public GetcommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_getcommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterGetcommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitGetcommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitGetcommand(this); + else return visitor.visitChildren(this); + } + } + + public final GetcommandContext getcommand() throws RecognitionException { + GetcommandContext _localctx = new GetcommandContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_getcommand); + try { + enterOuterAlt(_localctx, 1); + { + setState(45); + match(T__6); + setState(46); + type(); + setState(47); + ((GetcommandContext)_localctx).id = match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class DelcommandContext extends ParserRuleContext { + public TypeContext type() { + return getRuleContext(TypeContext.class,0); + } + public TerminalNode ID() { return getToken(RichRailParser.ID, 0); } + public DelcommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_delcommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterDelcommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitDelcommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitDelcommand(this); + else return visitor.visitChildren(this); + } + } + + public final DelcommandContext delcommand() throws RecognitionException { + DelcommandContext _localctx = new DelcommandContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_delcommand); + try { + enterOuterAlt(_localctx, 1); + { + setState(49); + match(T__7); + setState(50); + type(); + setState(51); + match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class RemcommandContext extends ParserRuleContext { + public List ID() { return getTokens(RichRailParser.ID); } + public TerminalNode ID(int i) { + return getToken(RichRailParser.ID, i); + } + public RemcommandContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_remcommand; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterRemcommand(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitRemcommand(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitRemcommand(this); + else return visitor.visitChildren(this); + } + } + + public final RemcommandContext remcommand() throws RecognitionException { + RemcommandContext _localctx = new RemcommandContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_remcommand); + try { + enterOuterAlt(_localctx, 1); + { + setState(53); + match(T__8); + setState(54); + match(ID); + setState(55); + match(T__9); + setState(56); + match(ID); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class TypeContext extends ParserRuleContext { + public TypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_type; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).enterType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof RichRailListener ) ((RichRailListener)listener).exitType(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof RichRailVisitor ) return ((RichRailVisitor)visitor).visitType(this); + else return visitor.visitChildren(this); + } + } + + public final TypeContext type() throws RecognitionException { + TypeContext _localctx = new TypeContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(58); + _la = _input.LA(1); + if ( !(_la==T__1 || _la==T__2) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\17?\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\5\2\32\n\2\3\3\3\3\5\3\36\n\3\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5"+ + "\3\5\5\5)\n\5\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\t"+ + "\3\t\3\t\3\t\3\t\3\n\3\n\3\n\2\2\13\2\4\6\b\n\f\16\20\22\2\3\3\2\4\5\2"+ + ";\2\31\3\2\2\2\4\35\3\2\2\2\6\37\3\2\2\2\b#\3\2\2\2\n*\3\2\2\2\f/\3\2"+ + "\2\2\16\63\3\2\2\2\20\67\3\2\2\2\22<\3\2\2\2\24\32\5\4\3\2\25\32\5\n\6"+ + "\2\26\32\5\f\7\2\27\32\5\16\b\2\30\32\5\20\t\2\31\24\3\2\2\2\31\25\3\2"+ + "\2\2\31\26\3\2\2\2\31\27\3\2\2\2\31\30\3\2\2\2\32\3\3\2\2\2\33\36\5\6"+ + "\4\2\34\36\5\b\5\2\35\33\3\2\2\2\35\34\3\2\2\2\36\5\3\2\2\2\37 \7\3\2"+ + "\2 !\7\4\2\2!\"\7\r\2\2\"\7\3\2\2\2#$\7\3\2\2$%\7\5\2\2%(\7\r\2\2&\'\7"+ + "\6\2\2\')\7\16\2\2(&\3\2\2\2()\3\2\2\2)\t\3\2\2\2*+\7\7\2\2+,\7\r\2\2"+ + ",-\7\b\2\2-.\7\r\2\2.\13\3\2\2\2/\60\7\t\2\2\60\61\5\22\n\2\61\62\7\r"+ + "\2\2\62\r\3\2\2\2\63\64\7\n\2\2\64\65\5\22\n\2\65\66\7\r\2\2\66\17\3\2"+ + "\2\2\678\7\13\2\289\7\r\2\29:\7\f\2\2:;\7\r\2\2;\21\3\2\2\2<=\t\2\2\2"+ + "=\23\3\2\2\2\5\31\35("; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/RichRail/target/generated-sources/antlr4/parser/RichRailVisitor.java b/RichRail/target/generated-sources/antlr4/parser/RichRailVisitor.java new file mode 100644 index 0000000..40d2bbb --- /dev/null +++ b/RichRail/target/generated-sources/antlr4/parser/RichRailVisitor.java @@ -0,0 +1,67 @@ +// Generated from parser/RichRail.g4 by ANTLR 4.7.1 +package parser; +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by {@link RichRailParser}. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public interface RichRailVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by {@link RichRailParser#command}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitCommand(RichRailParser.CommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#newcommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNewcommand(RichRailParser.NewcommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#newtraincommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNewtraincommand(RichRailParser.NewtraincommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#newwagoncommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNewwagoncommand(RichRailParser.NewwagoncommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#addcommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAddcommand(RichRailParser.AddcommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#getcommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitGetcommand(RichRailParser.GetcommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#delcommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDelcommand(RichRailParser.DelcommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#remcommand}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRemcommand(RichRailParser.RemcommandContext ctx); + /** + * Visit a parse tree produced by {@link RichRailParser#type}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitType(RichRailParser.TypeContext ctx); +} \ No newline at end of file