diff --git a/InkBlot.Tests/ContentTextTest.cs b/InkBlot.Tests/ContentTextTest.cs index 06d7e1e..1e804bc 100644 --- a/InkBlot.Tests/ContentTextTest.cs +++ b/InkBlot.Tests/ContentTextTest.cs @@ -11,8 +11,8 @@ public class ContentTextTest [InlineData("Hel\\lo!", "Hello!", 0)] [InlineData("Hel), threads (<-) and tags (#) are supported - [InlineData("Hel->lo!", "", 1)] - [InlineData("Hel<-lo!", "", 1)] + // [InlineData("Hel->lo!", "", 1)] + // [InlineData("Hel<-lo!", "", 1)] [InlineData("Hel#lo!", "", 1)] public void TestBaseContentSuccess(string inkInput, string result, int numErrors) { diff --git a/InkBlot/Generated/InkBlotAntlrGrammar.interp b/InkBlot/Generated/InkBlotAntlrGrammar.interp index 89afa26..fa5d560 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammar.interp +++ b/InkBlot/Generated/InkBlotAntlrGrammar.interp @@ -1,17 +1,76 @@ token literal names: null +'.' +'(' +',' +')' +'-' +'|' null null +null +null +'{' +'}' +null +null +null +null +null +null +null +'<-' +'->' +'->->' +null token symbolic names: null -Whitespace +null +null +null +null +null +null +WS +NL +MULTILINE_WS CONTENT_TEXT_NO_ESCAPE_SIMPLE +INLINE_LOGIC_START +INLINE_LOGIC_END +SEQUENCE_TYPE_SYMBOL_ANNOTATION +ONCE +CYCLE +SHUFFLE +STOPPING +SHUFFLE_ONCE +SHUFFLE_STOPPING +THREAD_ARROW +DIVERT_ARROW +TUNNEL_ARROW +IDENTIFIER rule names: story +topLevelStatements +knotLevelStatements +stitchLevelStatements +innerBlockLevelStatements contentText +mixedTextAndLogic +inlineLogicOrGlueOrTagStart +inlineLogic +innerLogic +multiDivert +divertIdentifierWithArguments +identifier +expression +sequenceTypeAnnotation +innerSequenceObjects +innerMultilineSequenceObjects +singleMultilineSequenceElement +innerInlineSequenceObjects atn: -[4, 1, 2, 12, 2, 0, 7, 0, 2, 1, 7, 1, 1, 0, 4, 0, 6, 8, 0, 11, 0, 12, 0, 7, 1, 1, 1, 1, 1, 1, 0, 0, 2, 0, 2, 0, 0, 10, 0, 5, 1, 0, 0, 0, 2, 9, 1, 0, 0, 0, 4, 6, 3, 2, 1, 0, 5, 4, 1, 0, 0, 0, 6, 7, 1, 0, 0, 0, 7, 5, 1, 0, 0, 0, 7, 8, 1, 0, 0, 0, 8, 1, 1, 0, 0, 0, 9, 10, 5, 2, 0, 0, 10, 3, 1, 0, 0, 0, 1, 7] \ No newline at end of file +[4, 1, 23, 215, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 1, 4, 1, 42, 8, 1, 11, 1, 12, 1, 43, 1, 2, 4, 2, 47, 8, 2, 11, 2, 12, 2, 48, 1, 3, 4, 3, 52, 8, 3, 11, 3, 12, 3, 53, 1, 4, 4, 4, 57, 8, 4, 11, 4, 12, 4, 58, 1, 5, 1, 5, 1, 6, 3, 6, 64, 8, 6, 1, 6, 3, 6, 67, 8, 6, 1, 6, 1, 6, 1, 6, 3, 6, 72, 8, 6, 4, 6, 74, 8, 6, 11, 6, 12, 6, 75, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 3, 8, 84, 8, 8, 1, 8, 1, 8, 1, 8, 1, 9, 3, 9, 90, 8, 9, 1, 9, 1, 9, 1, 9, 1, 10, 3, 10, 96, 8, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 102, 8, 10, 11, 10, 12, 10, 103, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 111, 8, 10, 11, 10, 12, 10, 112, 1, 10, 1, 10, 1, 10, 1, 10, 4, 10, 119, 8, 10, 11, 10, 12, 10, 120, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 127, 8, 10, 1, 11, 3, 11, 130, 8, 11, 1, 11, 1, 11, 3, 11, 134, 8, 11, 1, 11, 1, 11, 3, 11, 138, 8, 11, 1, 11, 1, 11, 3, 11, 142, 8, 11, 5, 11, 144, 8, 11, 10, 11, 12, 11, 147, 9, 11, 1, 11, 3, 11, 150, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 156, 8, 11, 10, 11, 12, 11, 159, 9, 11, 1, 11, 1, 11, 3, 11, 163, 8, 11, 1, 11, 3, 11, 166, 8, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 3, 15, 177, 8, 15, 1, 16, 4, 16, 180, 8, 16, 11, 16, 12, 16, 181, 1, 17, 3, 17, 185, 8, 17, 1, 17, 1, 17, 3, 17, 189, 8, 17, 1, 17, 1, 17, 3, 17, 193, 8, 17, 1, 18, 1, 18, 1, 18, 3, 18, 198, 8, 18, 5, 18, 200, 8, 18, 10, 18, 12, 18, 203, 9, 18, 1, 18, 1, 18, 3, 18, 207, 8, 18, 4, 18, 209, 8, 18, 11, 18, 12, 18, 210, 3, 18, 213, 8, 18, 1, 18, 0, 0, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 1, 1, 0, 13, 19, 234, 0, 38, 1, 0, 0, 0, 2, 41, 1, 0, 0, 0, 4, 46, 1, 0, 0, 0, 6, 51, 1, 0, 0, 0, 8, 56, 1, 0, 0, 0, 10, 60, 1, 0, 0, 0, 12, 63, 1, 0, 0, 0, 14, 79, 1, 0, 0, 0, 16, 81, 1, 0, 0, 0, 18, 89, 1, 0, 0, 0, 20, 95, 1, 0, 0, 0, 22, 129, 1, 0, 0, 0, 24, 167, 1, 0, 0, 0, 26, 169, 1, 0, 0, 0, 28, 171, 1, 0, 0, 0, 30, 176, 1, 0, 0, 0, 32, 179, 1, 0, 0, 0, 34, 184, 1, 0, 0, 0, 36, 212, 1, 0, 0, 0, 38, 39, 3, 2, 1, 0, 39, 1, 1, 0, 0, 0, 40, 42, 3, 10, 5, 0, 41, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 3, 1, 0, 0, 0, 45, 47, 3, 10, 5, 0, 46, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 5, 1, 0, 0, 0, 50, 52, 3, 10, 5, 0, 51, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 7, 1, 0, 0, 0, 55, 57, 3, 10, 5, 0, 56, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 9, 1, 0, 0, 0, 60, 61, 5, 10, 0, 0, 61, 11, 1, 0, 0, 0, 62, 64, 3, 10, 5, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 73, 1, 0, 0, 0, 65, 67, 3, 14, 7, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 74, 3, 10, 5, 0, 69, 71, 3, 14, 7, 0, 70, 72, 3, 10, 5, 0, 71, 70, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 74, 1, 0, 0, 0, 73, 66, 1, 0, 0, 0, 73, 69, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 3, 20, 10, 0, 78, 13, 1, 0, 0, 0, 79, 80, 3, 16, 8, 0, 80, 15, 1, 0, 0, 0, 81, 83, 5, 11, 0, 0, 82, 84, 5, 7, 0, 0, 83, 82, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 86, 3, 18, 9, 0, 86, 87, 5, 12, 0, 0, 87, 17, 1, 0, 0, 0, 88, 90, 5, 7, 0, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 3, 28, 14, 0, 92, 93, 3, 30, 15, 0, 93, 19, 1, 0, 0, 0, 94, 96, 5, 7, 0, 0, 95, 94, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 126, 1, 0, 0, 0, 97, 98, 5, 20, 0, 0, 98, 127, 3, 22, 11, 0, 99, 100, 5, 21, 0, 0, 100, 102, 3, 22, 11, 0, 101, 99, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 106, 5, 22, 0, 0, 106, 107, 3, 22, 11, 0, 107, 127, 1, 0, 0, 0, 108, 109, 5, 21, 0, 0, 109, 111, 3, 22, 11, 0, 110, 108, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 5, 22, 0, 0, 115, 127, 1, 0, 0, 0, 116, 117, 5, 21, 0, 0, 117, 119, 3, 22, 11, 0, 118, 116, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 122, 123, 5, 21, 0, 0, 123, 127, 1, 0, 0, 0, 124, 127, 5, 22, 0, 0, 125, 127, 5, 21, 0, 0, 126, 97, 1, 0, 0, 0, 126, 101, 1, 0, 0, 0, 126, 110, 1, 0, 0, 0, 126, 118, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 125, 1, 0, 0, 0, 127, 21, 1, 0, 0, 0, 128, 130, 5, 7, 0, 0, 129, 128, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 133, 3, 24, 12, 0, 132, 134, 5, 7, 0, 0, 133, 132, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 145, 1, 0, 0, 0, 135, 137, 5, 1, 0, 0, 136, 138, 5, 7, 0, 0, 137, 136, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 141, 3, 24, 12, 0, 140, 142, 5, 7, 0, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 144, 1, 0, 0, 0, 143, 135, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 149, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 148, 150, 5, 7, 0, 0, 149, 148, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 162, 1, 0, 0, 0, 151, 152, 5, 2, 0, 0, 152, 157, 3, 26, 13, 0, 153, 154, 5, 3, 0, 0, 154, 156, 3, 26, 13, 0, 155, 153, 1, 0, 0, 0, 156, 159, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 157, 158, 1, 0, 0, 0, 158, 160, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 160, 161, 5, 4, 0, 0, 161, 163, 1, 0, 0, 0, 162, 151, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 165, 1, 0, 0, 0, 164, 166, 5, 7, 0, 0, 165, 164, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 23, 1, 0, 0, 0, 167, 168, 5, 23, 0, 0, 168, 25, 1, 0, 0, 0, 169, 170, 5, 23, 0, 0, 170, 27, 1, 0, 0, 0, 171, 172, 7, 0, 0, 0, 172, 29, 1, 0, 0, 0, 173, 174, 5, 8, 0, 0, 174, 177, 3, 32, 16, 0, 175, 177, 3, 36, 18, 0, 176, 173, 1, 0, 0, 0, 176, 175, 1, 0, 0, 0, 177, 31, 1, 0, 0, 0, 178, 180, 3, 34, 17, 0, 179, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 33, 1, 0, 0, 0, 183, 185, 5, 7, 0, 0, 184, 183, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 188, 5, 5, 0, 0, 187, 189, 5, 7, 0, 0, 188, 187, 1, 0, 0, 0, 188, 189, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 193, 3, 8, 4, 0, 191, 193, 5, 9, 0, 0, 192, 190, 1, 0, 0, 0, 192, 191, 1, 0, 0, 0, 193, 35, 1, 0, 0, 0, 194, 201, 3, 12, 6, 0, 195, 197, 5, 6, 0, 0, 196, 198, 3, 12, 6, 0, 197, 196, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 200, 1, 0, 0, 0, 199, 195, 1, 0, 0, 0, 200, 203, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 213, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 204, 206, 5, 6, 0, 0, 205, 207, 3, 12, 6, 0, 206, 205, 1, 0, 0, 0, 206, 207, 1, 0, 0, 0, 207, 209, 1, 0, 0, 0, 208, 204, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 208, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 213, 1, 0, 0, 0, 212, 194, 1, 0, 0, 0, 212, 208, 1, 0, 0, 0, 213, 37, 1, 0, 0, 0, 35, 43, 48, 53, 58, 63, 66, 71, 73, 75, 83, 89, 95, 103, 112, 120, 126, 129, 133, 137, 141, 145, 149, 157, 162, 165, 176, 181, 184, 188, 192, 197, 201, 206, 210, 212] \ No newline at end of file diff --git a/InkBlot/Generated/InkBlotAntlrGrammar.tokens b/InkBlot/Generated/InkBlotAntlrGrammar.tokens index b9deb38..1211459 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammar.tokens +++ b/InkBlot/Generated/InkBlotAntlrGrammar.tokens @@ -1,2 +1,34 @@ -Whitespace=1 -CONTENT_TEXT_NO_ESCAPE_SIMPLE=2 +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +WS=7 +NL=8 +MULTILINE_WS=9 +CONTENT_TEXT_NO_ESCAPE_SIMPLE=10 +INLINE_LOGIC_START=11 +INLINE_LOGIC_END=12 +SEQUENCE_TYPE_SYMBOL_ANNOTATION=13 +ONCE=14 +CYCLE=15 +SHUFFLE=16 +STOPPING=17 +SHUFFLE_ONCE=18 +SHUFFLE_STOPPING=19 +THREAD_ARROW=20 +DIVERT_ARROW=21 +TUNNEL_ARROW=22 +IDENTIFIER=23 +'.'=1 +'('=2 +','=3 +')'=4 +'-'=5 +'|'=6 +'{'=11 +'}'=12 +'<-'=20 +'->'=21 +'->->'=22 diff --git a/InkBlot/Generated/InkBlotAntlrGrammarBaseListener.cs b/InkBlot/Generated/InkBlotAntlrGrammarBaseListener.cs index 47037b6..2644bba 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarBaseListener.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarBaseListener.cs @@ -48,6 +48,54 @@ public partial class InkBlotAntlrGrammarBaseListener : IInkBlotAntlrGrammarListe /// The parse tree. public virtual void ExitStory([NotNull] InkBlotAntlrGrammarParser.StoryContext context) { } /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context) { } + /// /// Enter a parse tree produced by . /// The default implementation does nothing. /// @@ -59,6 +107,162 @@ public partial class InkBlotAntlrGrammarBaseListener : IInkBlotAntlrGrammarListe /// /// The parse tree. public virtual void ExitContentText([NotNull] InkBlotAntlrGrammarParser.ContentTextContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context) { } + /// + /// Enter a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void EnterInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context) { } + /// + /// Exit a parse tree produced by . + /// The default implementation does nothing. + /// + /// The parse tree. + public virtual void ExitInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context) { } /// /// The default implementation does nothing. diff --git a/InkBlot/Generated/InkBlotAntlrGrammarBaseVisitor.cs b/InkBlot/Generated/InkBlotAntlrGrammarBaseVisitor.cs index dd7c679..a3d009a 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarBaseVisitor.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarBaseVisitor.cs @@ -45,6 +45,46 @@ public partial class InkBlotAntlrGrammarBaseVisitor : AbstractParseTreeV /// The visitor result. public virtual Result VisitStory([NotNull] InkBlotAntlrGrammarParser.StoryContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling @@ -54,4 +94,134 @@ public partial class InkBlotAntlrGrammarBaseVisitor : AbstractParseTreeV /// The parse tree. /// The visitor result. public virtual Result VisitContentText([NotNull] InkBlotAntlrGrammarParser.ContentTextContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context) { return VisitChildren(context); } } diff --git a/InkBlot/Generated/InkBlotAntlrGrammarLexer.cs b/InkBlot/Generated/InkBlotAntlrGrammarLexer.cs index 7809d29..b497f61 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarLexer.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarLexer.cs @@ -33,7 +33,11 @@ public partial class InkBlotAntlrGrammarLexer : Lexer { protected static DFA[] decisionToDFA; protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); public const int - Whitespace=1, CONTENT_TEXT_NO_ESCAPE_SIMPLE=2; + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, WS=7, NL=8, MULTILINE_WS=9, + CONTENT_TEXT_NO_ESCAPE_SIMPLE=10, INLINE_LOGIC_START=11, INLINE_LOGIC_END=12, + SEQUENCE_TYPE_SYMBOL_ANNOTATION=13, ONCE=14, CYCLE=15, SHUFFLE=16, STOPPING=17, + SHUFFLE_ONCE=18, SHUFFLE_STOPPING=19, THREAD_ARROW=20, DIVERT_ARROW=21, + TUNNEL_ARROW=22, IDENTIFIER=23; public static string[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -43,7 +47,11 @@ public partial class InkBlotAntlrGrammarLexer : Lexer { }; public static readonly string[] ruleNames = { - "Whitespace", "CONTENT_TEXT_NO_ESCAPE_SIMPLE" + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "WS", "NL", "MULTILINE_WS", + "CONTENT_TEXT_NO_ESCAPE_SIMPLE", "INLINE_LOGIC_START", "INLINE_LOGIC_END", + "SEQUENCE_TYPE_SYMBOL_ANNOTATION", "ONCE", "CYCLE", "SHUFFLE", "STOPPING", + "SHUFFLE_ONCE", "SHUFFLE_STOPPING", "THREAD_ARROW", "DIVERT_ARROW", "TUNNEL_ARROW", + "IDENTIFIER" }; @@ -57,9 +65,16 @@ public partial class InkBlotAntlrGrammarLexer : Lexer { } private static readonly string[] _LiteralNames = { + null, "'.'", "'('", "','", "')'", "'-'", "'|'", null, null, null, null, + "'{'", "'}'", null, null, null, null, null, null, null, "'<-'", "'->'", + "'->->'" }; private static readonly string[] _SymbolicNames = { - null, "Whitespace", "CONTENT_TEXT_NO_ESCAPE_SIMPLE" + null, null, null, null, null, null, null, "WS", "NL", "MULTILINE_WS", + "CONTENT_TEXT_NO_ESCAPE_SIMPLE", "INLINE_LOGIC_START", "INLINE_LOGIC_END", + "SEQUENCE_TYPE_SYMBOL_ANNOTATION", "ONCE", "CYCLE", "SHUFFLE", "STOPPING", + "SHUFFLE_ONCE", "SHUFFLE_STOPPING", "THREAD_ARROW", "DIVERT_ARROW", "TUNNEL_ARROW", + "IDENTIFIER" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); @@ -90,7 +105,7 @@ public partial class InkBlotAntlrGrammarLexer : Lexer { } public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 1 : return CONTENT_TEXT_NO_ESCAPE_SIMPLE_sempred(_localctx, predIndex); + case 9 : return CONTENT_TEXT_NO_ESCAPE_SIMPLE_sempred(_localctx, predIndex); } return true; } @@ -103,14 +118,72 @@ public partial class InkBlotAntlrGrammarLexer : Lexer { } private static int[] _serializedATN = { - 4,0,2,21,6,-1,2,0,7,0,2,1,7,1,1,0,4,0,7,8,0,11,0,12,0,8,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,4,1,18,8,1,11,1,12,1,19,0,0,2,1,1,3,2,1,0,3,2,0,9,9,32,32, - 5,0,10,10,13,13,35,60,92,92,123,125,1,0,0,65535,25,0,1,1,0,0,0,0,3,1,0, - 0,0,1,6,1,0,0,0,3,17,1,0,0,0,5,7,7,0,0,0,6,5,1,0,0,0,7,8,1,0,0,0,8,6,1, - 0,0,0,8,9,1,0,0,0,9,2,1,0,0,0,10,18,8,1,0,0,11,12,5,92,0,0,12,18,7,2,0, - 0,13,14,5,45,0,0,14,18,4,1,0,0,15,16,5,60,0,0,16,18,4,1,1,0,17,10,1,0, - 0,0,17,11,1,0,0,0,17,13,1,0,0,0,17,15,1,0,0,0,18,19,1,0,0,0,19,17,1,0, - 0,0,19,20,1,0,0,0,20,4,1,0,0,0,4,0,8,17,19,0 + 4,0,23,200,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14, + 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21, + 7,21,2,22,7,22,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,4,6, + 61,8,6,11,6,12,6,62,1,7,3,7,66,8,7,1,7,3,7,69,8,7,1,7,1,7,1,8,4,8,74,8, + 8,11,8,12,8,75,1,9,1,9,1,9,1,9,1,9,1,9,1,9,4,9,85,8,9,11,9,12,9,86,1,10, + 1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,3,13,101,8,13,1, + 13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,112,8,14,1,14,1,14,1,15, + 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,3,15,125,8,15,1,15,1,15,1,16,1, + 16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,3,16,139,8,16,1,16,1,16,1,17, + 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, + 3,17,158,8,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,3,18,181,8,18,1,18,1,18, + 1,19,1,19,1,19,1,20,1,20,1,20,1,21,1,21,1,21,1,21,1,21,1,22,4,22,197,8, + 22,11,22,12,22,198,0,0,23,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10, + 21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22, + 45,23,1,0,5,2,0,9,9,32,32,5,0,10,10,13,13,35,60,92,92,123,125,1,0,0,65535, + 4,0,32,33,36,36,38,38,126,126,4,0,48,57,65,90,95,95,97,122,214,0,1,1,0, + 0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13, + 1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0, + 0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35, + 1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0, + 0,1,47,1,0,0,0,3,49,1,0,0,0,5,51,1,0,0,0,7,53,1,0,0,0,9,55,1,0,0,0,11, + 57,1,0,0,0,13,60,1,0,0,0,15,65,1,0,0,0,17,73,1,0,0,0,19,84,1,0,0,0,21, + 88,1,0,0,0,23,90,1,0,0,0,25,92,1,0,0,0,27,94,1,0,0,0,29,104,1,0,0,0,31, + 115,1,0,0,0,33,128,1,0,0,0,35,142,1,0,0,0,37,161,1,0,0,0,39,184,1,0,0, + 0,41,187,1,0,0,0,43,190,1,0,0,0,45,196,1,0,0,0,47,48,5,46,0,0,48,2,1,0, + 0,0,49,50,5,40,0,0,50,4,1,0,0,0,51,52,5,44,0,0,52,6,1,0,0,0,53,54,5,41, + 0,0,54,8,1,0,0,0,55,56,5,45,0,0,56,10,1,0,0,0,57,58,5,124,0,0,58,12,1, + 0,0,0,59,61,7,0,0,0,60,59,1,0,0,0,61,62,1,0,0,0,62,60,1,0,0,0,62,63,1, + 0,0,0,63,14,1,0,0,0,64,66,3,13,6,0,65,64,1,0,0,0,65,66,1,0,0,0,66,68,1, + 0,0,0,67,69,5,13,0,0,68,67,1,0,0,0,68,69,1,0,0,0,69,70,1,0,0,0,70,71,5, + 10,0,0,71,16,1,0,0,0,72,74,3,15,7,0,73,72,1,0,0,0,74,75,1,0,0,0,75,73, + 1,0,0,0,75,76,1,0,0,0,76,18,1,0,0,0,77,85,8,1,0,0,78,79,5,92,0,0,79,85, + 7,2,0,0,80,81,5,45,0,0,81,85,4,9,0,0,82,83,5,60,0,0,83,85,4,9,1,0,84,77, + 1,0,0,0,84,78,1,0,0,0,84,80,1,0,0,0,84,82,1,0,0,0,85,86,1,0,0,0,86,84, + 1,0,0,0,86,87,1,0,0,0,87,20,1,0,0,0,88,89,5,123,0,0,89,22,1,0,0,0,90,91, + 5,125,0,0,91,24,1,0,0,0,92,93,7,3,0,0,93,26,1,0,0,0,94,95,5,111,0,0,95, + 96,5,110,0,0,96,97,5,99,0,0,97,98,5,101,0,0,98,100,1,0,0,0,99,101,3,13, + 6,0,100,99,1,0,0,0,100,101,1,0,0,0,101,102,1,0,0,0,102,103,5,58,0,0,103, + 28,1,0,0,0,104,105,5,99,0,0,105,106,5,121,0,0,106,107,5,99,0,0,107,108, + 5,108,0,0,108,109,5,101,0,0,109,111,1,0,0,0,110,112,3,13,6,0,111,110,1, + 0,0,0,111,112,1,0,0,0,112,113,1,0,0,0,113,114,5,58,0,0,114,30,1,0,0,0, + 115,116,5,115,0,0,116,117,5,104,0,0,117,118,5,117,0,0,118,119,5,102,0, + 0,119,120,5,102,0,0,120,121,5,108,0,0,121,122,5,101,0,0,122,124,1,0,0, + 0,123,125,3,13,6,0,124,123,1,0,0,0,124,125,1,0,0,0,125,126,1,0,0,0,126, + 127,5,58,0,0,127,32,1,0,0,0,128,129,5,115,0,0,129,130,5,116,0,0,130,131, + 5,111,0,0,131,132,5,112,0,0,132,133,5,112,0,0,133,134,5,105,0,0,134,135, + 5,110,0,0,135,136,5,103,0,0,136,138,1,0,0,0,137,139,3,13,6,0,138,137,1, + 0,0,0,138,139,1,0,0,0,139,140,1,0,0,0,140,141,5,58,0,0,141,34,1,0,0,0, + 142,143,5,115,0,0,143,144,5,104,0,0,144,145,5,117,0,0,145,146,5,102,0, + 0,146,147,5,102,0,0,147,148,5,108,0,0,148,149,5,101,0,0,149,150,1,0,0, + 0,150,151,3,13,6,0,151,152,5,111,0,0,152,153,5,110,0,0,153,154,5,99,0, + 0,154,155,5,101,0,0,155,157,1,0,0,0,156,158,3,13,6,0,157,156,1,0,0,0,157, + 158,1,0,0,0,158,159,1,0,0,0,159,160,5,58,0,0,160,36,1,0,0,0,161,162,5, + 115,0,0,162,163,5,104,0,0,163,164,5,117,0,0,164,165,5,102,0,0,165,166, + 5,102,0,0,166,167,5,108,0,0,167,168,5,101,0,0,168,169,1,0,0,0,169,170, + 3,13,6,0,170,171,5,115,0,0,171,172,5,116,0,0,172,173,5,111,0,0,173,174, + 5,112,0,0,174,175,5,112,0,0,175,176,5,105,0,0,176,177,5,110,0,0,177,178, + 5,103,0,0,178,180,1,0,0,0,179,181,3,13,6,0,180,179,1,0,0,0,180,181,1,0, + 0,0,181,182,1,0,0,0,182,183,5,58,0,0,183,38,1,0,0,0,184,185,5,60,0,0,185, + 186,5,45,0,0,186,40,1,0,0,0,187,188,5,45,0,0,188,189,5,62,0,0,189,42,1, + 0,0,0,190,191,5,45,0,0,191,192,5,62,0,0,192,193,5,45,0,0,193,194,5,62, + 0,0,194,44,1,0,0,0,195,197,7,4,0,0,196,195,1,0,0,0,197,198,1,0,0,0,198, + 196,1,0,0,0,198,199,1,0,0,0,199,46,1,0,0,0,14,0,62,65,68,75,84,86,100, + 111,124,138,157,180,198,0 }; public static readonly ATN _ATN = diff --git a/InkBlot/Generated/InkBlotAntlrGrammarLexer.interp b/InkBlot/Generated/InkBlotAntlrGrammarLexer.interp index d65f157..5da2512 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarLexer.interp +++ b/InkBlot/Generated/InkBlotAntlrGrammarLexer.interp @@ -1,16 +1,79 @@ token literal names: null +'.' +'(' +',' +')' +'-' +'|' null null +null +null +'{' +'}' +null +null +null +null +null +null +null +'<-' +'->' +'->->' +null token symbolic names: null -Whitespace +null +null +null +null +null +null +WS +NL +MULTILINE_WS CONTENT_TEXT_NO_ESCAPE_SIMPLE +INLINE_LOGIC_START +INLINE_LOGIC_END +SEQUENCE_TYPE_SYMBOL_ANNOTATION +ONCE +CYCLE +SHUFFLE +STOPPING +SHUFFLE_ONCE +SHUFFLE_STOPPING +THREAD_ARROW +DIVERT_ARROW +TUNNEL_ARROW +IDENTIFIER rule names: -Whitespace +T__0 +T__1 +T__2 +T__3 +T__4 +T__5 +WS +NL +MULTILINE_WS CONTENT_TEXT_NO_ESCAPE_SIMPLE +INLINE_LOGIC_START +INLINE_LOGIC_END +SEQUENCE_TYPE_SYMBOL_ANNOTATION +ONCE +CYCLE +SHUFFLE +STOPPING +SHUFFLE_ONCE +SHUFFLE_STOPPING +THREAD_ARROW +DIVERT_ARROW +TUNNEL_ARROW +IDENTIFIER channel names: DEFAULT_TOKEN_CHANNEL @@ -20,4 +83,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 2, 21, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 1, 0, 4, 0, 7, 8, 0, 11, 0, 12, 0, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 18, 8, 1, 11, 1, 12, 1, 19, 0, 0, 2, 1, 1, 3, 2, 1, 0, 3, 2, 0, 9, 9, 32, 32, 5, 0, 10, 10, 13, 13, 35, 60, 92, 92, 123, 125, 1, 0, 0, 65535, 25, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 1, 6, 1, 0, 0, 0, 3, 17, 1, 0, 0, 0, 5, 7, 7, 0, 0, 0, 6, 5, 1, 0, 0, 0, 7, 8, 1, 0, 0, 0, 8, 6, 1, 0, 0, 0, 8, 9, 1, 0, 0, 0, 9, 2, 1, 0, 0, 0, 10, 18, 8, 1, 0, 0, 11, 12, 5, 92, 0, 0, 12, 18, 7, 2, 0, 0, 13, 14, 5, 45, 0, 0, 14, 18, 4, 1, 0, 0, 15, 16, 5, 60, 0, 0, 16, 18, 4, 1, 1, 0, 17, 10, 1, 0, 0, 0, 17, 11, 1, 0, 0, 0, 17, 13, 1, 0, 0, 0, 17, 15, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 17, 1, 0, 0, 0, 19, 20, 1, 0, 0, 0, 20, 4, 1, 0, 0, 0, 4, 0, 8, 17, 19, 0] \ No newline at end of file +[4, 0, 23, 200, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 4, 6, 61, 8, 6, 11, 6, 12, 6, 62, 1, 7, 3, 7, 66, 8, 7, 1, 7, 3, 7, 69, 8, 7, 1, 7, 1, 7, 1, 8, 4, 8, 74, 8, 8, 11, 8, 12, 8, 75, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 4, 9, 85, 8, 9, 11, 9, 12, 9, 86, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 101, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 112, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 125, 8, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 139, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 158, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 181, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 4, 22, 197, 8, 22, 11, 22, 12, 22, 198, 0, 0, 23, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 1, 0, 5, 2, 0, 9, 9, 32, 32, 5, 0, 10, 10, 13, 13, 35, 60, 92, 92, 123, 125, 1, 0, 0, 65535, 4, 0, 32, 33, 36, 36, 38, 38, 126, 126, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 214, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 1, 47, 1, 0, 0, 0, 3, 49, 1, 0, 0, 0, 5, 51, 1, 0, 0, 0, 7, 53, 1, 0, 0, 0, 9, 55, 1, 0, 0, 0, 11, 57, 1, 0, 0, 0, 13, 60, 1, 0, 0, 0, 15, 65, 1, 0, 0, 0, 17, 73, 1, 0, 0, 0, 19, 84, 1, 0, 0, 0, 21, 88, 1, 0, 0, 0, 23, 90, 1, 0, 0, 0, 25, 92, 1, 0, 0, 0, 27, 94, 1, 0, 0, 0, 29, 104, 1, 0, 0, 0, 31, 115, 1, 0, 0, 0, 33, 128, 1, 0, 0, 0, 35, 142, 1, 0, 0, 0, 37, 161, 1, 0, 0, 0, 39, 184, 1, 0, 0, 0, 41, 187, 1, 0, 0, 0, 43, 190, 1, 0, 0, 0, 45, 196, 1, 0, 0, 0, 47, 48, 5, 46, 0, 0, 48, 2, 1, 0, 0, 0, 49, 50, 5, 40, 0, 0, 50, 4, 1, 0, 0, 0, 51, 52, 5, 44, 0, 0, 52, 6, 1, 0, 0, 0, 53, 54, 5, 41, 0, 0, 54, 8, 1, 0, 0, 0, 55, 56, 5, 45, 0, 0, 56, 10, 1, 0, 0, 0, 57, 58, 5, 124, 0, 0, 58, 12, 1, 0, 0, 0, 59, 61, 7, 0, 0, 0, 60, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 14, 1, 0, 0, 0, 64, 66, 3, 13, 6, 0, 65, 64, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 68, 1, 0, 0, 0, 67, 69, 5, 13, 0, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 5, 10, 0, 0, 71, 16, 1, 0, 0, 0, 72, 74, 3, 15, 7, 0, 73, 72, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 18, 1, 0, 0, 0, 77, 85, 8, 1, 0, 0, 78, 79, 5, 92, 0, 0, 79, 85, 7, 2, 0, 0, 80, 81, 5, 45, 0, 0, 81, 85, 4, 9, 0, 0, 82, 83, 5, 60, 0, 0, 83, 85, 4, 9, 1, 0, 84, 77, 1, 0, 0, 0, 84, 78, 1, 0, 0, 0, 84, 80, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 20, 1, 0, 0, 0, 88, 89, 5, 123, 0, 0, 89, 22, 1, 0, 0, 0, 90, 91, 5, 125, 0, 0, 91, 24, 1, 0, 0, 0, 92, 93, 7, 3, 0, 0, 93, 26, 1, 0, 0, 0, 94, 95, 5, 111, 0, 0, 95, 96, 5, 110, 0, 0, 96, 97, 5, 99, 0, 0, 97, 98, 5, 101, 0, 0, 98, 100, 1, 0, 0, 0, 99, 101, 3, 13, 6, 0, 100, 99, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 5, 58, 0, 0, 103, 28, 1, 0, 0, 0, 104, 105, 5, 99, 0, 0, 105, 106, 5, 121, 0, 0, 106, 107, 5, 99, 0, 0, 107, 108, 5, 108, 0, 0, 108, 109, 5, 101, 0, 0, 109, 111, 1, 0, 0, 0, 110, 112, 3, 13, 6, 0, 111, 110, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 114, 5, 58, 0, 0, 114, 30, 1, 0, 0, 0, 115, 116, 5, 115, 0, 0, 116, 117, 5, 104, 0, 0, 117, 118, 5, 117, 0, 0, 118, 119, 5, 102, 0, 0, 119, 120, 5, 102, 0, 0, 120, 121, 5, 108, 0, 0, 121, 122, 5, 101, 0, 0, 122, 124, 1, 0, 0, 0, 123, 125, 3, 13, 6, 0, 124, 123, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 127, 5, 58, 0, 0, 127, 32, 1, 0, 0, 0, 128, 129, 5, 115, 0, 0, 129, 130, 5, 116, 0, 0, 130, 131, 5, 111, 0, 0, 131, 132, 5, 112, 0, 0, 132, 133, 5, 112, 0, 0, 133, 134, 5, 105, 0, 0, 134, 135, 5, 110, 0, 0, 135, 136, 5, 103, 0, 0, 136, 138, 1, 0, 0, 0, 137, 139, 3, 13, 6, 0, 138, 137, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 141, 5, 58, 0, 0, 141, 34, 1, 0, 0, 0, 142, 143, 5, 115, 0, 0, 143, 144, 5, 104, 0, 0, 144, 145, 5, 117, 0, 0, 145, 146, 5, 102, 0, 0, 146, 147, 5, 102, 0, 0, 147, 148, 5, 108, 0, 0, 148, 149, 5, 101, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 3, 13, 6, 0, 151, 152, 5, 111, 0, 0, 152, 153, 5, 110, 0, 0, 153, 154, 5, 99, 0, 0, 154, 155, 5, 101, 0, 0, 155, 157, 1, 0, 0, 0, 156, 158, 3, 13, 6, 0, 157, 156, 1, 0, 0, 0, 157, 158, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 5, 58, 0, 0, 160, 36, 1, 0, 0, 0, 161, 162, 5, 115, 0, 0, 162, 163, 5, 104, 0, 0, 163, 164, 5, 117, 0, 0, 164, 165, 5, 102, 0, 0, 165, 166, 5, 102, 0, 0, 166, 167, 5, 108, 0, 0, 167, 168, 5, 101, 0, 0, 168, 169, 1, 0, 0, 0, 169, 170, 3, 13, 6, 0, 170, 171, 5, 115, 0, 0, 171, 172, 5, 116, 0, 0, 172, 173, 5, 111, 0, 0, 173, 174, 5, 112, 0, 0, 174, 175, 5, 112, 0, 0, 175, 176, 5, 105, 0, 0, 176, 177, 5, 110, 0, 0, 177, 178, 5, 103, 0, 0, 178, 180, 1, 0, 0, 0, 179, 181, 3, 13, 6, 0, 180, 179, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 183, 5, 58, 0, 0, 183, 38, 1, 0, 0, 0, 184, 185, 5, 60, 0, 0, 185, 186, 5, 45, 0, 0, 186, 40, 1, 0, 0, 0, 187, 188, 5, 45, 0, 0, 188, 189, 5, 62, 0, 0, 189, 42, 1, 0, 0, 0, 190, 191, 5, 45, 0, 0, 191, 192, 5, 62, 0, 0, 192, 193, 5, 45, 0, 0, 193, 194, 5, 62, 0, 0, 194, 44, 1, 0, 0, 0, 195, 197, 7, 4, 0, 0, 196, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 46, 1, 0, 0, 0, 14, 0, 62, 65, 68, 75, 84, 86, 100, 111, 124, 138, 157, 180, 198, 0] \ No newline at end of file diff --git a/InkBlot/Generated/InkBlotAntlrGrammarLexer.tokens b/InkBlot/Generated/InkBlotAntlrGrammarLexer.tokens index b9deb38..1211459 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarLexer.tokens +++ b/InkBlot/Generated/InkBlotAntlrGrammarLexer.tokens @@ -1,2 +1,34 @@ -Whitespace=1 -CONTENT_TEXT_NO_ESCAPE_SIMPLE=2 +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +WS=7 +NL=8 +MULTILINE_WS=9 +CONTENT_TEXT_NO_ESCAPE_SIMPLE=10 +INLINE_LOGIC_START=11 +INLINE_LOGIC_END=12 +SEQUENCE_TYPE_SYMBOL_ANNOTATION=13 +ONCE=14 +CYCLE=15 +SHUFFLE=16 +STOPPING=17 +SHUFFLE_ONCE=18 +SHUFFLE_STOPPING=19 +THREAD_ARROW=20 +DIVERT_ARROW=21 +TUNNEL_ARROW=22 +IDENTIFIER=23 +'.'=1 +'('=2 +','=3 +')'=4 +'-'=5 +'|'=6 +'{'=11 +'}'=12 +'<-'=20 +'->'=21 +'->->'=22 diff --git a/InkBlot/Generated/InkBlotAntlrGrammarListener.cs b/InkBlot/Generated/InkBlotAntlrGrammarListener.cs index 100d7fb..3b9e95a 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarListener.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarListener.cs @@ -41,6 +41,46 @@ public interface IInkBlotAntlrGrammarListener : IParseTreeListener { /// The parse tree. void ExitStory([NotNull] InkBlotAntlrGrammarParser.StoryContext context); /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context); + /// /// Enter a parse tree produced by . /// /// The parse tree. @@ -50,4 +90,134 @@ public interface IInkBlotAntlrGrammarListener : IParseTreeListener { /// /// The parse tree. void ExitContentText([NotNull] InkBlotAntlrGrammarParser.ContentTextContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context); + /// + /// Enter a parse tree produced by . + /// + /// The parse tree. + void EnterInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context); + /// + /// Exit a parse tree produced by . + /// + /// The parse tree. + void ExitInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context); } diff --git a/InkBlot/Generated/InkBlotAntlrGrammarParser.cs b/InkBlot/Generated/InkBlotAntlrGrammarParser.cs index ece8885..a49f6dd 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarParser.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarParser.cs @@ -36,17 +36,38 @@ public partial class InkBlotAntlrGrammarParser : Parser { protected static DFA[] decisionToDFA; protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); public const int - Whitespace=1, CONTENT_TEXT_NO_ESCAPE_SIMPLE=2; + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, WS=7, NL=8, MULTILINE_WS=9, + CONTENT_TEXT_NO_ESCAPE_SIMPLE=10, INLINE_LOGIC_START=11, INLINE_LOGIC_END=12, + SEQUENCE_TYPE_SYMBOL_ANNOTATION=13, ONCE=14, CYCLE=15, SHUFFLE=16, STOPPING=17, + SHUFFLE_ONCE=18, SHUFFLE_STOPPING=19, THREAD_ARROW=20, DIVERT_ARROW=21, + TUNNEL_ARROW=22, IDENTIFIER=23; public const int - RULE_story = 0, RULE_contentText = 1; + RULE_story = 0, RULE_topLevelStatements = 1, RULE_knotLevelStatements = 2, + RULE_stitchLevelStatements = 3, RULE_innerBlockLevelStatements = 4, RULE_contentText = 5, + RULE_mixedTextAndLogic = 6, RULE_inlineLogicOrGlueOrTagStart = 7, RULE_inlineLogic = 8, + RULE_innerLogic = 9, RULE_multiDivert = 10, RULE_divertIdentifierWithArguments = 11, + RULE_identifier = 12, RULE_expression = 13, RULE_sequenceTypeAnnotation = 14, + RULE_innerSequenceObjects = 15, RULE_innerMultilineSequenceObjects = 16, + RULE_singleMultilineSequenceElement = 17, RULE_innerInlineSequenceObjects = 18; public static readonly string[] ruleNames = { - "story", "contentText" + "story", "topLevelStatements", "knotLevelStatements", "stitchLevelStatements", + "innerBlockLevelStatements", "contentText", "mixedTextAndLogic", "inlineLogicOrGlueOrTagStart", + "inlineLogic", "innerLogic", "multiDivert", "divertIdentifierWithArguments", + "identifier", "expression", "sequenceTypeAnnotation", "innerSequenceObjects", + "innerMultilineSequenceObjects", "singleMultilineSequenceElement", "innerInlineSequenceObjects" }; private static readonly string[] _LiteralNames = { + null, "'.'", "'('", "','", "')'", "'-'", "'|'", null, null, null, null, + "'{'", "'}'", null, null, null, null, null, null, null, "'<-'", "'->'", + "'->->'" }; private static readonly string[] _SymbolicNames = { - null, "Whitespace", "CONTENT_TEXT_NO_ESCAPE_SIMPLE" + null, null, null, null, null, null, null, "WS", "NL", "MULTILINE_WS", + "CONTENT_TEXT_NO_ESCAPE_SIMPLE", "INLINE_LOGIC_START", "INLINE_LOGIC_END", + "SEQUENCE_TYPE_SYMBOL_ANNOTATION", "ONCE", "CYCLE", "SHUFFLE", "STOPPING", + "SHUFFLE_ONCE", "SHUFFLE_STOPPING", "THREAD_ARROW", "DIVERT_ARROW", "TUNNEL_ARROW", + "IDENTIFIER" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); @@ -81,11 +102,8 @@ public partial class InkBlotAntlrGrammarParser : Parser { } public partial class StoryContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public TopLevelStatementsContext topLevelStatements() { + return GetRuleContext(0); } public StoryContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) @@ -114,21 +132,268 @@ public partial class InkBlotAntlrGrammarParser : Parser { public StoryContext story() { StoryContext _localctx = new StoryContext(Context, State); EnterRule(_localctx, 0, RULE_story); + try { + EnterOuterAlt(_localctx, 1); + { + State = 38; + topLevelStatements(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class TopLevelStatementsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { + return GetRuleContext(i); + } + public TopLevelStatementsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_topLevelStatements; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterTopLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitTopLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitTopLevelStatements(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public TopLevelStatementsContext topLevelStatements() { + TopLevelStatementsContext _localctx = new TopLevelStatementsContext(Context, State); + EnterRule(_localctx, 2, RULE_topLevelStatements); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 5; + State = 41; ErrorHandler.Sync(this); _la = TokenStream.LA(1); do { { { - State = 4; + State = 40; contentText(); } } - State = 7; + State = 43; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==CONTENT_TEXT_NO_ESCAPE_SIMPLE ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class KnotLevelStatementsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { + return GetRuleContext(i); + } + public KnotLevelStatementsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_knotLevelStatements; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterKnotLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitKnotLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitKnotLevelStatements(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public KnotLevelStatementsContext knotLevelStatements() { + KnotLevelStatementsContext _localctx = new KnotLevelStatementsContext(Context, State); + EnterRule(_localctx, 4, RULE_knotLevelStatements); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 46; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 45; + contentText(); + } + } + State = 48; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==CONTENT_TEXT_NO_ESCAPE_SIMPLE ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class StitchLevelStatementsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { + return GetRuleContext(i); + } + public StitchLevelStatementsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_stitchLevelStatements; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterStitchLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitStitchLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitStitchLevelStatements(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public StitchLevelStatementsContext stitchLevelStatements() { + StitchLevelStatementsContext _localctx = new StitchLevelStatementsContext(Context, State); + EnterRule(_localctx, 6, RULE_stitchLevelStatements); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 51; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 50; + contentText(); + } + } + State = 53; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==CONTENT_TEXT_NO_ESCAPE_SIMPLE ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InnerBlockLevelStatementsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { + return GetRuleContext(i); + } + public InnerBlockLevelStatementsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_innerBlockLevelStatements; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInnerBlockLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInnerBlockLevelStatements(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInnerBlockLevelStatements(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InnerBlockLevelStatementsContext innerBlockLevelStatements() { + InnerBlockLevelStatementsContext _localctx = new InnerBlockLevelStatementsContext(Context, State); + EnterRule(_localctx, 8, RULE_innerBlockLevelStatements); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 56; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 55; + contentText(); + } + } + State = 58; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } while ( _la==CONTENT_TEXT_NO_ESCAPE_SIMPLE ); @@ -173,11 +438,11 @@ public partial class InkBlotAntlrGrammarParser : Parser { [RuleVersion(0)] public ContentTextContext contentText() { ContentTextContext _localctx = new ContentTextContext(Context, State); - EnterRule(_localctx, 2, RULE_contentText); + EnterRule(_localctx, 10, RULE_contentText); try { EnterOuterAlt(_localctx, 1); { - State = 9; + State = 60; Match(CONTENT_TEXT_NO_ESCAPE_SIMPLE); } } @@ -192,10 +457,1215 @@ public partial class InkBlotAntlrGrammarParser : Parser { return _localctx; } + public partial class MixedTextAndLogicContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public MultiDivertContext multiDivert() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext[] contentText() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ContentTextContext contentText(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public InlineLogicOrGlueOrTagStartContext[] inlineLogicOrGlueOrTagStart() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public InlineLogicOrGlueOrTagStartContext inlineLogicOrGlueOrTagStart(int i) { + return GetRuleContext(i); + } + public MixedTextAndLogicContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_mixedTextAndLogic; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterMixedTextAndLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitMixedTextAndLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitMixedTextAndLogic(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MixedTextAndLogicContext mixedTextAndLogic() { + MixedTextAndLogicContext _localctx = new MixedTextAndLogicContext(Context, State); + EnterRule(_localctx, 12, RULE_mixedTextAndLogic); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 63; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) { + case 1: + { + State = 62; + contentText(); + } + break; + } + State = 73; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + State = 73; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,7,Context) ) { + case 1: + { + State = 66; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==INLINE_LOGIC_START) { + { + State = 65; + inlineLogicOrGlueOrTagStart(); + } + } + + State = 68; + contentText(); + } + break; + case 2: + { + State = 69; + inlineLogicOrGlueOrTagStart(); + State = 71; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,6,Context) ) { + case 1: + { + State = 70; + contentText(); + } + break; + } + } + break; + } + } + State = 75; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==CONTENT_TEXT_NO_ESCAPE_SIMPLE || _la==INLINE_LOGIC_START ); + State = 77; + multiDivert(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InlineLogicOrGlueOrTagStartContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public InlineLogicContext inlineLogic() { + return GetRuleContext(0); + } + public InlineLogicOrGlueOrTagStartContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_inlineLogicOrGlueOrTagStart; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInlineLogicOrGlueOrTagStart(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInlineLogicOrGlueOrTagStart(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInlineLogicOrGlueOrTagStart(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InlineLogicOrGlueOrTagStartContext inlineLogicOrGlueOrTagStart() { + InlineLogicOrGlueOrTagStartContext _localctx = new InlineLogicOrGlueOrTagStartContext(Context, State); + EnterRule(_localctx, 14, RULE_inlineLogicOrGlueOrTagStart); + try { + EnterOuterAlt(_localctx, 1); + { + State = 79; + inlineLogic(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InlineLogicContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INLINE_LOGIC_START() { return GetToken(InkBlotAntlrGrammarParser.INLINE_LOGIC_START, 0); } + [System.Diagnostics.DebuggerNonUserCode] public InnerLogicContext innerLogic() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INLINE_LOGIC_END() { return GetToken(InkBlotAntlrGrammarParser.INLINE_LOGIC_END, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS() { return GetToken(InkBlotAntlrGrammarParser.WS, 0); } + public InlineLogicContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_inlineLogic; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInlineLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInlineLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInlineLogic(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InlineLogicContext inlineLogic() { + InlineLogicContext _localctx = new InlineLogicContext(Context, State); + EnterRule(_localctx, 16, RULE_inlineLogic); + try { + EnterOuterAlt(_localctx, 1); + { + State = 81; + Match(INLINE_LOGIC_START); + State = 83; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,9,Context) ) { + case 1: + { + State = 82; + Match(WS); + } + break; + } + State = 85; + innerLogic(); + State = 86; + Match(INLINE_LOGIC_END); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InnerLogicContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public SequenceTypeAnnotationContext sequenceTypeAnnotation() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public InnerSequenceObjectsContext innerSequenceObjects() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS() { return GetToken(InkBlotAntlrGrammarParser.WS, 0); } + public InnerLogicContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_innerLogic; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInnerLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInnerLogic(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInnerLogic(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InnerLogicContext innerLogic() { + InnerLogicContext _localctx = new InnerLogicContext(Context, State); + EnterRule(_localctx, 18, RULE_innerLogic); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 89; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 88; + Match(WS); + } + } + + State = 91; + sequenceTypeAnnotation(); + State = 92; + innerSequenceObjects(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MultiDivertContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode THREAD_ARROW() { return GetToken(InkBlotAntlrGrammarParser.THREAD_ARROW, 0); } + [System.Diagnostics.DebuggerNonUserCode] public DivertIdentifierWithArgumentsContext[] divertIdentifierWithArguments() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public DivertIdentifierWithArgumentsContext divertIdentifierWithArguments(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TUNNEL_ARROW() { return GetToken(InkBlotAntlrGrammarParser.TUNNEL_ARROW, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DIVERT_ARROW() { return GetTokens(InkBlotAntlrGrammarParser.DIVERT_ARROW); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DIVERT_ARROW(int i) { + return GetToken(InkBlotAntlrGrammarParser.DIVERT_ARROW, i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS() { return GetToken(InkBlotAntlrGrammarParser.WS, 0); } + public MultiDivertContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_multiDivert; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterMultiDivert(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitMultiDivert(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitMultiDivert(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public MultiDivertContext multiDivert() { + MultiDivertContext _localctx = new MultiDivertContext(Context, State); + EnterRule(_localctx, 20, RULE_multiDivert); + int _la; + try { + int _alt; + EnterOuterAlt(_localctx, 1); + { + State = 95; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 94; + Match(WS); + } + } + + State = 126; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,15,Context) ) { + case 1: + { + State = 97; + Match(THREAD_ARROW); + State = 98; + divertIdentifierWithArguments(); + } + break; + case 2: + { + State = 101; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 99; + Match(DIVERT_ARROW); + State = 100; + divertIdentifierWithArguments(); + } + } + State = 103; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==DIVERT_ARROW ); + State = 105; + Match(TUNNEL_ARROW); + State = 106; + divertIdentifierWithArguments(); + } + break; + case 3: + { + State = 110; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 108; + Match(DIVERT_ARROW); + State = 109; + divertIdentifierWithArguments(); + } + } + State = 112; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==DIVERT_ARROW ); + State = 114; + Match(TUNNEL_ARROW); + } + break; + case 4: + { + State = 118; + ErrorHandler.Sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + State = 116; + Match(DIVERT_ARROW); + State = 117; + divertIdentifierWithArguments(); + } + } + break; + default: + throw new NoViableAltException(this); + } + State = 120; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,14,Context); + } while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ); + State = 122; + Match(DIVERT_ARROW); + } + break; + case 5: + { + State = 124; + Match(TUNNEL_ARROW); + } + break; + case 6: + { + State = 125; + Match(DIVERT_ARROW); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class DivertIdentifierWithArgumentsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public IdentifierContext[] identifier() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public IdentifierContext identifier(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] WS() { return GetTokens(InkBlotAntlrGrammarParser.WS); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS(int i) { + return GetToken(InkBlotAntlrGrammarParser.WS, i); + } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext[] expression() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression(int i) { + return GetRuleContext(i); + } + public DivertIdentifierWithArgumentsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_divertIdentifierWithArguments; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterDivertIdentifierWithArguments(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitDivertIdentifierWithArguments(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitDivertIdentifierWithArguments(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public DivertIdentifierWithArgumentsContext divertIdentifierWithArguments() { + DivertIdentifierWithArgumentsContext _localctx = new DivertIdentifierWithArgumentsContext(Context, State); + EnterRule(_localctx, 22, RULE_divertIdentifierWithArguments); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 129; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 128; + Match(WS); + } + } + + State = 131; + identifier(); + State = 133; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,17,Context) ) { + case 1: + { + State = 132; + Match(WS); + } + break; + } + State = 145; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==T__0) { + { + { + State = 135; + Match(T__0); + State = 137; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 136; + Match(WS); + } + } + + State = 139; + identifier(); + State = 141; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,19,Context) ) { + case 1: + { + State = 140; + Match(WS); + } + break; + } + } + } + State = 147; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + State = 149; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,21,Context) ) { + case 1: + { + State = 148; + Match(WS); + } + break; + } + State = 162; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==T__1) { + { + State = 151; + Match(T__1); + State = 152; + expression(); + State = 157; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==T__2) { + { + { + State = 153; + Match(T__2); + State = 154; + expression(); + } + } + State = 159; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + State = 160; + Match(T__3); + } + } + + State = 165; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 164; + Match(WS); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class IdentifierContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IDENTIFIER() { return GetToken(InkBlotAntlrGrammarParser.IDENTIFIER, 0); } + public IdentifierContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_identifier; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterIdentifier(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitIdentifier(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitIdentifier(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public IdentifierContext identifier() { + IdentifierContext _localctx = new IdentifierContext(Context, State); + EnterRule(_localctx, 24, RULE_identifier); + try { + EnterOuterAlt(_localctx, 1); + { + State = 167; + Match(IDENTIFIER); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ExpressionContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IDENTIFIER() { return GetToken(InkBlotAntlrGrammarParser.IDENTIFIER, 0); } + public ExpressionContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_expression; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterExpression(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitExpression(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitExpression(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public ExpressionContext expression() { + ExpressionContext _localctx = new ExpressionContext(Context, State); + EnterRule(_localctx, 26, RULE_expression); + try { + EnterOuterAlt(_localctx, 1); + { + State = 169; + Match(IDENTIFIER); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SequenceTypeAnnotationContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SEQUENCE_TYPE_SYMBOL_ANNOTATION() { return GetToken(InkBlotAntlrGrammarParser.SEQUENCE_TYPE_SYMBOL_ANNOTATION, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ONCE() { return GetToken(InkBlotAntlrGrammarParser.ONCE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CYCLE() { return GetToken(InkBlotAntlrGrammarParser.CYCLE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SHUFFLE() { return GetToken(InkBlotAntlrGrammarParser.SHUFFLE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STOPPING() { return GetToken(InkBlotAntlrGrammarParser.STOPPING, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SHUFFLE_ONCE() { return GetToken(InkBlotAntlrGrammarParser.SHUFFLE_ONCE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SHUFFLE_STOPPING() { return GetToken(InkBlotAntlrGrammarParser.SHUFFLE_STOPPING, 0); } + public SequenceTypeAnnotationContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_sequenceTypeAnnotation; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterSequenceTypeAnnotation(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitSequenceTypeAnnotation(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitSequenceTypeAnnotation(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SequenceTypeAnnotationContext sequenceTypeAnnotation() { + SequenceTypeAnnotationContext _localctx = new SequenceTypeAnnotationContext(Context, State); + EnterRule(_localctx, 28, RULE_sequenceTypeAnnotation); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 171; + _la = TokenStream.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 1040384L) != 0)) ) { + ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InnerSequenceObjectsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(InkBlotAntlrGrammarParser.NL, 0); } + [System.Diagnostics.DebuggerNonUserCode] public InnerMultilineSequenceObjectsContext innerMultilineSequenceObjects() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public InnerInlineSequenceObjectsContext innerInlineSequenceObjects() { + return GetRuleContext(0); + } + public InnerSequenceObjectsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_innerSequenceObjects; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInnerSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInnerSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInnerSequenceObjects(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InnerSequenceObjectsContext innerSequenceObjects() { + InnerSequenceObjectsContext _localctx = new InnerSequenceObjectsContext(Context, State); + EnterRule(_localctx, 30, RULE_innerSequenceObjects); + try { + State = 176; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case NL: + EnterOuterAlt(_localctx, 1); + { + State = 173; + Match(NL); + State = 174; + innerMultilineSequenceObjects(); + } + break; + case T__5: + case CONTENT_TEXT_NO_ESCAPE_SIMPLE: + case INLINE_LOGIC_START: + EnterOuterAlt(_localctx, 2); + { + State = 175; + innerInlineSequenceObjects(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InnerMultilineSequenceObjectsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public SingleMultilineSequenceElementContext[] singleMultilineSequenceElement() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public SingleMultilineSequenceElementContext singleMultilineSequenceElement(int i) { + return GetRuleContext(i); + } + public InnerMultilineSequenceObjectsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_innerMultilineSequenceObjects; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInnerMultilineSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInnerMultilineSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInnerMultilineSequenceObjects(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InnerMultilineSequenceObjectsContext innerMultilineSequenceObjects() { + InnerMultilineSequenceObjectsContext _localctx = new InnerMultilineSequenceObjectsContext(Context, State); + EnterRule(_localctx, 32, RULE_innerMultilineSequenceObjects); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 179; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 178; + singleMultilineSequenceElement(); + } + } + State = 181; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==T__4 || _la==WS ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class SingleMultilineSequenceElementContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public InnerBlockLevelStatementsContext innerBlockLevelStatements() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MULTILINE_WS() { return GetToken(InkBlotAntlrGrammarParser.MULTILINE_WS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] WS() { return GetTokens(InkBlotAntlrGrammarParser.WS); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS(int i) { + return GetToken(InkBlotAntlrGrammarParser.WS, i); + } + public SingleMultilineSequenceElementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_singleMultilineSequenceElement; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterSingleMultilineSequenceElement(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitSingleMultilineSequenceElement(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitSingleMultilineSequenceElement(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public SingleMultilineSequenceElementContext singleMultilineSequenceElement() { + SingleMultilineSequenceElementContext _localctx = new SingleMultilineSequenceElementContext(Context, State); + EnterRule(_localctx, 34, RULE_singleMultilineSequenceElement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 184; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 183; + Match(WS); + } + } + + State = 186; + Match(T__4); + State = 188; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==WS) { + { + State = 187; + Match(WS); + } + } + + State = 192; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case CONTENT_TEXT_NO_ESCAPE_SIMPLE: + { + State = 190; + innerBlockLevelStatements(); + } + break; + case MULTILINE_WS: + { + State = 191; + Match(MULTILINE_WS); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class InnerInlineSequenceObjectsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public MixedTextAndLogicContext[] mixedTextAndLogic() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public MixedTextAndLogicContext mixedTextAndLogic(int i) { + return GetRuleContext(i); + } + public InnerInlineSequenceObjectsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_innerInlineSequenceObjects; } } + [System.Diagnostics.DebuggerNonUserCode] + public override void EnterRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.EnterInnerInlineSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override void ExitRule(IParseTreeListener listener) { + IInkBlotAntlrGrammarListener typedListener = listener as IInkBlotAntlrGrammarListener; + if (typedListener != null) typedListener.ExitInnerInlineSequenceObjects(this); + } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IInkBlotAntlrGrammarVisitor typedVisitor = visitor as IInkBlotAntlrGrammarVisitor; + if (typedVisitor != null) return typedVisitor.VisitInnerInlineSequenceObjects(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public InnerInlineSequenceObjectsContext innerInlineSequenceObjects() { + InnerInlineSequenceObjectsContext _localctx = new InnerInlineSequenceObjectsContext(Context, State); + EnterRule(_localctx, 36, RULE_innerInlineSequenceObjects); + int _la; + try { + State = 212; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case CONTENT_TEXT_NO_ESCAPE_SIMPLE: + case INLINE_LOGIC_START: + EnterOuterAlt(_localctx, 1); + { + { + State = 194; + mixedTextAndLogic(); + State = 201; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==T__5) { + { + { + State = 195; + Match(T__5); + State = 197; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==CONTENT_TEXT_NO_ESCAPE_SIMPLE || _la==INLINE_LOGIC_START) { + { + State = 196; + mixedTextAndLogic(); + } + } + + } + } + State = 203; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + break; + case T__5: + EnterOuterAlt(_localctx, 2); + { + State = 208; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + do { + { + { + State = 204; + Match(T__5); + State = 206; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==CONTENT_TEXT_NO_ESCAPE_SIMPLE || _la==INLINE_LOGIC_START) { + { + State = 205; + mixedTextAndLogic(); + } + } + + } + } + State = 210; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } while ( _la==T__5 ); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + private static int[] _serializedATN = { - 4,1,2,12,2,0,7,0,2,1,7,1,1,0,4,0,6,8,0,11,0,12,0,7,1,1,1,1,1,1,0,0,2,0, - 2,0,0,10,0,5,1,0,0,0,2,9,1,0,0,0,4,6,3,2,1,0,5,4,1,0,0,0,6,7,1,0,0,0,7, - 5,1,0,0,0,7,8,1,0,0,0,8,1,1,0,0,0,9,10,5,2,0,0,10,3,1,0,0,0,1,7 + 4,1,23,215,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7, + 7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14, + 2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,1,0,1,0,1,1,4,1,42,8,1,11,1,12, + 1,43,1,2,4,2,47,8,2,11,2,12,2,48,1,3,4,3,52,8,3,11,3,12,3,53,1,4,4,4,57, + 8,4,11,4,12,4,58,1,5,1,5,1,6,3,6,64,8,6,1,6,3,6,67,8,6,1,6,1,6,1,6,3,6, + 72,8,6,4,6,74,8,6,11,6,12,6,75,1,6,1,6,1,7,1,7,1,8,1,8,3,8,84,8,8,1,8, + 1,8,1,8,1,9,3,9,90,8,9,1,9,1,9,1,9,1,10,3,10,96,8,10,1,10,1,10,1,10,1, + 10,4,10,102,8,10,11,10,12,10,103,1,10,1,10,1,10,1,10,1,10,4,10,111,8,10, + 11,10,12,10,112,1,10,1,10,1,10,1,10,4,10,119,8,10,11,10,12,10,120,1,10, + 1,10,1,10,1,10,3,10,127,8,10,1,11,3,11,130,8,11,1,11,1,11,3,11,134,8,11, + 1,11,1,11,3,11,138,8,11,1,11,1,11,3,11,142,8,11,5,11,144,8,11,10,11,12, + 11,147,9,11,1,11,3,11,150,8,11,1,11,1,11,1,11,1,11,5,11,156,8,11,10,11, + 12,11,159,9,11,1,11,1,11,3,11,163,8,11,1,11,3,11,166,8,11,1,12,1,12,1, + 13,1,13,1,14,1,14,1,15,1,15,1,15,3,15,177,8,15,1,16,4,16,180,8,16,11,16, + 12,16,181,1,17,3,17,185,8,17,1,17,1,17,3,17,189,8,17,1,17,1,17,3,17,193, + 8,17,1,18,1,18,1,18,3,18,198,8,18,5,18,200,8,18,10,18,12,18,203,9,18,1, + 18,1,18,3,18,207,8,18,4,18,209,8,18,11,18,12,18,210,3,18,213,8,18,1,18, + 0,0,19,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,0,1,1,0,13, + 19,234,0,38,1,0,0,0,2,41,1,0,0,0,4,46,1,0,0,0,6,51,1,0,0,0,8,56,1,0,0, + 0,10,60,1,0,0,0,12,63,1,0,0,0,14,79,1,0,0,0,16,81,1,0,0,0,18,89,1,0,0, + 0,20,95,1,0,0,0,22,129,1,0,0,0,24,167,1,0,0,0,26,169,1,0,0,0,28,171,1, + 0,0,0,30,176,1,0,0,0,32,179,1,0,0,0,34,184,1,0,0,0,36,212,1,0,0,0,38,39, + 3,2,1,0,39,1,1,0,0,0,40,42,3,10,5,0,41,40,1,0,0,0,42,43,1,0,0,0,43,41, + 1,0,0,0,43,44,1,0,0,0,44,3,1,0,0,0,45,47,3,10,5,0,46,45,1,0,0,0,47,48, + 1,0,0,0,48,46,1,0,0,0,48,49,1,0,0,0,49,5,1,0,0,0,50,52,3,10,5,0,51,50, + 1,0,0,0,52,53,1,0,0,0,53,51,1,0,0,0,53,54,1,0,0,0,54,7,1,0,0,0,55,57,3, + 10,5,0,56,55,1,0,0,0,57,58,1,0,0,0,58,56,1,0,0,0,58,59,1,0,0,0,59,9,1, + 0,0,0,60,61,5,10,0,0,61,11,1,0,0,0,62,64,3,10,5,0,63,62,1,0,0,0,63,64, + 1,0,0,0,64,73,1,0,0,0,65,67,3,14,7,0,66,65,1,0,0,0,66,67,1,0,0,0,67,68, + 1,0,0,0,68,74,3,10,5,0,69,71,3,14,7,0,70,72,3,10,5,0,71,70,1,0,0,0,71, + 72,1,0,0,0,72,74,1,0,0,0,73,66,1,0,0,0,73,69,1,0,0,0,74,75,1,0,0,0,75, + 73,1,0,0,0,75,76,1,0,0,0,76,77,1,0,0,0,77,78,3,20,10,0,78,13,1,0,0,0,79, + 80,3,16,8,0,80,15,1,0,0,0,81,83,5,11,0,0,82,84,5,7,0,0,83,82,1,0,0,0,83, + 84,1,0,0,0,84,85,1,0,0,0,85,86,3,18,9,0,86,87,5,12,0,0,87,17,1,0,0,0,88, + 90,5,7,0,0,89,88,1,0,0,0,89,90,1,0,0,0,90,91,1,0,0,0,91,92,3,28,14,0,92, + 93,3,30,15,0,93,19,1,0,0,0,94,96,5,7,0,0,95,94,1,0,0,0,95,96,1,0,0,0,96, + 126,1,0,0,0,97,98,5,20,0,0,98,127,3,22,11,0,99,100,5,21,0,0,100,102,3, + 22,11,0,101,99,1,0,0,0,102,103,1,0,0,0,103,101,1,0,0,0,103,104,1,0,0,0, + 104,105,1,0,0,0,105,106,5,22,0,0,106,107,3,22,11,0,107,127,1,0,0,0,108, + 109,5,21,0,0,109,111,3,22,11,0,110,108,1,0,0,0,111,112,1,0,0,0,112,110, + 1,0,0,0,112,113,1,0,0,0,113,114,1,0,0,0,114,115,5,22,0,0,115,127,1,0,0, + 0,116,117,5,21,0,0,117,119,3,22,11,0,118,116,1,0,0,0,119,120,1,0,0,0,120, + 118,1,0,0,0,120,121,1,0,0,0,121,122,1,0,0,0,122,123,5,21,0,0,123,127,1, + 0,0,0,124,127,5,22,0,0,125,127,5,21,0,0,126,97,1,0,0,0,126,101,1,0,0,0, + 126,110,1,0,0,0,126,118,1,0,0,0,126,124,1,0,0,0,126,125,1,0,0,0,127,21, + 1,0,0,0,128,130,5,7,0,0,129,128,1,0,0,0,129,130,1,0,0,0,130,131,1,0,0, + 0,131,133,3,24,12,0,132,134,5,7,0,0,133,132,1,0,0,0,133,134,1,0,0,0,134, + 145,1,0,0,0,135,137,5,1,0,0,136,138,5,7,0,0,137,136,1,0,0,0,137,138,1, + 0,0,0,138,139,1,0,0,0,139,141,3,24,12,0,140,142,5,7,0,0,141,140,1,0,0, + 0,141,142,1,0,0,0,142,144,1,0,0,0,143,135,1,0,0,0,144,147,1,0,0,0,145, + 143,1,0,0,0,145,146,1,0,0,0,146,149,1,0,0,0,147,145,1,0,0,0,148,150,5, + 7,0,0,149,148,1,0,0,0,149,150,1,0,0,0,150,162,1,0,0,0,151,152,5,2,0,0, + 152,157,3,26,13,0,153,154,5,3,0,0,154,156,3,26,13,0,155,153,1,0,0,0,156, + 159,1,0,0,0,157,155,1,0,0,0,157,158,1,0,0,0,158,160,1,0,0,0,159,157,1, + 0,0,0,160,161,5,4,0,0,161,163,1,0,0,0,162,151,1,0,0,0,162,163,1,0,0,0, + 163,165,1,0,0,0,164,166,5,7,0,0,165,164,1,0,0,0,165,166,1,0,0,0,166,23, + 1,0,0,0,167,168,5,23,0,0,168,25,1,0,0,0,169,170,5,23,0,0,170,27,1,0,0, + 0,171,172,7,0,0,0,172,29,1,0,0,0,173,174,5,8,0,0,174,177,3,32,16,0,175, + 177,3,36,18,0,176,173,1,0,0,0,176,175,1,0,0,0,177,31,1,0,0,0,178,180,3, + 34,17,0,179,178,1,0,0,0,180,181,1,0,0,0,181,179,1,0,0,0,181,182,1,0,0, + 0,182,33,1,0,0,0,183,185,5,7,0,0,184,183,1,0,0,0,184,185,1,0,0,0,185,186, + 1,0,0,0,186,188,5,5,0,0,187,189,5,7,0,0,188,187,1,0,0,0,188,189,1,0,0, + 0,189,192,1,0,0,0,190,193,3,8,4,0,191,193,5,9,0,0,192,190,1,0,0,0,192, + 191,1,0,0,0,193,35,1,0,0,0,194,201,3,12,6,0,195,197,5,6,0,0,196,198,3, + 12,6,0,197,196,1,0,0,0,197,198,1,0,0,0,198,200,1,0,0,0,199,195,1,0,0,0, + 200,203,1,0,0,0,201,199,1,0,0,0,201,202,1,0,0,0,202,213,1,0,0,0,203,201, + 1,0,0,0,204,206,5,6,0,0,205,207,3,12,6,0,206,205,1,0,0,0,206,207,1,0,0, + 0,207,209,1,0,0,0,208,204,1,0,0,0,209,210,1,0,0,0,210,208,1,0,0,0,210, + 211,1,0,0,0,211,213,1,0,0,0,212,194,1,0,0,0,212,208,1,0,0,0,213,37,1,0, + 0,0,35,43,48,53,58,63,66,71,73,75,83,89,95,103,112,120,126,129,133,137, + 141,145,149,157,162,165,176,181,184,188,192,197,201,206,210,212 }; public static readonly ATN _ATN = diff --git a/InkBlot/Generated/InkBlotAntlrGrammarVisitor.cs b/InkBlot/Generated/InkBlotAntlrGrammarVisitor.cs index bcca54b..6876b78 100644 --- a/InkBlot/Generated/InkBlotAntlrGrammarVisitor.cs +++ b/InkBlot/Generated/InkBlotAntlrGrammarVisitor.cs @@ -38,9 +38,111 @@ public interface IInkBlotAntlrGrammarVisitor : IParseTreeVisitor /// The visitor result. Result VisitStory([NotNull] InkBlotAntlrGrammarParser.StoryContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitTopLevelStatements([NotNull] InkBlotAntlrGrammarParser.TopLevelStatementsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitKnotLevelStatements([NotNull] InkBlotAntlrGrammarParser.KnotLevelStatementsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitStitchLevelStatements([NotNull] InkBlotAntlrGrammarParser.StitchLevelStatementsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInnerBlockLevelStatements([NotNull] InkBlotAntlrGrammarParser.InnerBlockLevelStatementsContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. /// The visitor result. Result VisitContentText([NotNull] InkBlotAntlrGrammarParser.ContentTextContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMixedTextAndLogic([NotNull] InkBlotAntlrGrammarParser.MixedTextAndLogicContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInlineLogicOrGlueOrTagStart([NotNull] InkBlotAntlrGrammarParser.InlineLogicOrGlueOrTagStartContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInlineLogic([NotNull] InkBlotAntlrGrammarParser.InlineLogicContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInnerLogic([NotNull] InkBlotAntlrGrammarParser.InnerLogicContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitMultiDivert([NotNull] InkBlotAntlrGrammarParser.MultiDivertContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitDivertIdentifierWithArguments([NotNull] InkBlotAntlrGrammarParser.DivertIdentifierWithArgumentsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitIdentifier([NotNull] InkBlotAntlrGrammarParser.IdentifierContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitExpression([NotNull] InkBlotAntlrGrammarParser.ExpressionContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSequenceTypeAnnotation([NotNull] InkBlotAntlrGrammarParser.SequenceTypeAnnotationContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInnerSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerSequenceObjectsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInnerMultilineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerMultilineSequenceObjectsContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitSingleMultilineSequenceElement([NotNull] InkBlotAntlrGrammarParser.SingleMultilineSequenceElementContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitInnerInlineSequenceObjects([NotNull] InkBlotAntlrGrammarParser.InnerInlineSequenceObjectsContext context); } diff --git a/InkBlot/InkBlotAntlrGrammar.g4 b/InkBlot/InkBlotAntlrGrammar.g4 index 84d5509..a8a8eec 100644 --- a/InkBlot/InkBlotAntlrGrammar.g4 +++ b/InkBlot/InkBlotAntlrGrammar.g4 @@ -2,6 +2,138 @@ grammar InkBlotAntlrGrammar; import InkBlotAntlrLexer; -story: contentText+ ; +/* + * STORY + */ -contentText: CONTENT_TEXT_NO_ESCAPE_SIMPLE ; \ No newline at end of file +story: topLevelStatements ; + +/* + * STATEMENTS FOR THE VARIOUS LEVELS + */ + +topLevelStatements: + contentText+ + ; + + knotLevelStatements: + contentText+ + ; + + stitchLevelStatements: + contentText+ + ; + + innerBlockLevelStatements: + contentText+ + ; + +/* + * STATEMENTS + */ + +contentText: CONTENT_TEXT_NO_ESCAPE_SIMPLE ; + +mixedTextAndLogic: + // TODO: ~ is not allowed as first symbol of this (see InkParser_Content => MixedTextAndLog), let's implement it in the C# side? + // like in innerInlineSequenceObjects, a bit of a chaos to avoid having completely empty entries + contentText? (inlineLogicOrGlueOrTagStart? contentText | inlineLogicOrGlueOrTagStart contentText?)+ + // TODO: this is valid only when not parsing a choice, see above for the code where this logic is implemented + multiDivert + // TODO: management of tag ftw O_O + ; + +inlineLogicOrGlueOrTagStart: + inlineLogic + // TODO: glue, tag start + ; + +inlineLogic: + INLINE_LOGIC_START + WS? + innerLogic + INLINE_LOGIC_END + ; + +innerLogic: + WS? + sequenceTypeAnnotation innerSequenceObjects + // TODO: the rest of InkParser_Logic => InnerLogic + ; + +multiDivert: + WS? + ( + THREAD_ARROW divertIdentifierWithArguments + // here be dragons: trying to express the various "Possible patterns" of InkParser_Divert => MultiDivert + | (DIVERT_ARROW divertIdentifierWithArguments)+ TUNNEL_ARROW divertIdentifierWithArguments + | (DIVERT_ARROW divertIdentifierWithArguments)+ TUNNEL_ARROW + | (DIVERT_ARROW divertIdentifierWithArguments)+ DIVERT_ARROW + | TUNNEL_ARROW + | DIVERT_ARROW // TODO: this is only valid in default choices ( https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#fallback-choices ) + ) + ; + +divertIdentifierWithArguments: + WS? identifier WS? ('.' WS? identifier WS? )* + WS? + ( + '(' + expression (',' expression)* + ')' + )? + WS? + ; + +identifier: + // TODO: reject numbers-only identifier - see InkParser_Logic => Identifier + IDENTIFIER + ; + +expression: + // TODO: temporary stuff here + IDENTIFIER + ; + +// all possible symbols or word(s) for sequencing +sequenceTypeAnnotation: + SEQUENCE_TYPE_SYMBOL_ANNOTATION + | ONCE + | CYCLE + | SHUFFLE + | STOPPING + | SHUFFLE_ONCE + | SHUFFLE_STOPPING + ; + +/* a list of sequence objects, either compressed in a single line (e.g.: {a|b|c}) or expanded in multiple lines (e.g.: +{\n- a\n- b\n- c} +*/ +innerSequenceObjects: + NL innerMultilineSequenceObjects + | innerInlineSequenceObjects + ; + +innerMultilineSequenceObjects: + singleMultilineSequenceElement+ + ; + +singleMultilineSequenceElement: + WS? + /* TODO: how to express this? and why is it here? InkParser_Sequences => SingleMultilineSequenceElement + if (ParseString ("->") != null) + return null; + */ + '-' + WS? + ( + innerBlockLevelStatements + | MULTILINE_WS + ) + ; + +innerInlineSequenceObjects: + // it's a bit chaotic, in order to allow for empty mixedTextAndLogic, but always require at least one entry + (mixedTextAndLogic ('|' mixedTextAndLogic?)*) + | ('|' mixedTextAndLogic?)+ + ; \ No newline at end of file diff --git a/InkBlot/InkBlotAntlrLexer.g4 b/InkBlot/InkBlotAntlrLexer.g4 index de170d8..3bfc3be 100644 --- a/InkBlot/InkBlotAntlrLexer.g4 +++ b/InkBlot/InkBlotAntlrLexer.g4 @@ -1,6 +1,11 @@ lexer grammar InkBlotAntlrLexer; -Whitespace: [ \t]+ ; +// classic "white space" and "new line" - ink's new line also allows for some whitespace at start +WS: [ \t]+ ; +NL: WS? '\r'? '\n' ; + +// one or more (potential whitespace followed by) newline(s); used e.g. for block sequencing +MULTILINE_WS: NL+ ; // see InkParser_Content.cs, ContentTextNoEscape and ContentTextAllowingEcapeChar for the escape case // this works for the base case where we're not parsing a string, nor a choice @@ -19,4 +24,24 @@ CONTENT_TEXT_NO_ESCAPE_SIMPLE: | '-' { InputStream.LA(1) != '>' }? // same for threads (<-) and glue (<>) | '<' { InputStream.LA(1) != '-' && InputStream.LA(1) != '>' }? - )+ ; \ No newline at end of file + )+ ; + +INLINE_LOGIC_START: '{' ; +INLINE_LOGIC_END: '}' ; + +// All symbols for sequencing: either using the short-hand symbols (https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#types-of-alternatives) +// or using the multiline blocks (https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#multiline-blocks) +SEQUENCE_TYPE_SYMBOL_ANNOTATION: [!&~$ ] ; +ONCE: 'once' WS? ':' ; +CYCLE: 'cycle' WS? ':' ; +SHUFFLE: 'shuffle' WS? ':' ; +STOPPING: 'stopping' WS? ':' ; +SHUFFLE_ONCE: 'shuffle' WS 'once' WS? ':' ; +SHUFFLE_STOPPING: 'shuffle' WS 'stopping' WS? ':' ; + +THREAD_ARROW: '<-' ; +DIVERT_ARROW: '->' ; +TUNNEL_ARROW: '->->' ; + +// TODO: add all extra character ranges from InkParser_CharacterRanges (LatinBasic, LatinExtendedA, ...) +IDENTIFIER: [A-Za-z0-9_]+; \ No newline at end of file diff --git a/InkBlot/ParserErrorListener.cs b/InkBlot/ParserErrorListener.cs index fac862d..53073b3 100644 --- a/InkBlot/ParserErrorListener.cs +++ b/InkBlot/ParserErrorListener.cs @@ -1,5 +1,8 @@ using System.Text; using Antlr4.Runtime; +using Antlr4.Runtime.Atn; +using Antlr4.Runtime.Dfa; +using Antlr4.Runtime.Sharpen; namespace InkBlot; @@ -55,4 +58,14 @@ internal sealed class ParserErrorListener : BaseErrorListener Diagnostics.Add(diagnostic); } + + // TODO: better to use a "if test" of some kind? +#if DEBUG + public override void ReportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, bool exact, + BitSet ambigAlts, + ATNConfigSet configs) + { + throw new InvalidOperationException("found ambiguity"); + } +#endif } \ No newline at end of file diff --git a/InkBlot/Visitor/ListenerStory.cs b/InkBlot/Visitor/ListenerStory.cs index 3d2a423..e2f97f5 100644 --- a/InkBlot/Visitor/ListenerStory.cs +++ b/InkBlot/Visitor/ListenerStory.cs @@ -10,11 +10,10 @@ public partial class Listener public override void ExitStory(InkBlotAntlrGrammarParser.StoryContext context) { - var storyNodes = context.children.Select(child => child switch - { - InkBlotAntlrGrammarParser.ContentTextContext contentText => new Content(GetContentText(contentText)), - _ => throw new InvalidOperationException($"unknown context of type {child.GetType()}") - }); + var storyNodes = context + .topLevelStatements() + .contentText() + .Select(child => new Content(GetContentText(child))); _story = new Story(storyNodes); } } \ No newline at end of file