Hopefully correct handling of whitespaces after expressions (ignored). Hopefully Correct handling of empty lines after (ignored). Comments now have to respect indentation level

This commit is contained in:
The other zerg 2022-09-27 02:52:13 +02:00
parent 29fd400027
commit cd3f610a10
8 changed files with 529 additions and 311 deletions

View File

@ -1,9 +1,17 @@
## Multiline comment
owo
uwu ##
(x1 :#) f2
333 + 433
x2 <- x1 * 2
-x2
() f
a <- 5
#aa + ba
ca <- aa + ba
print ca

View File

@ -45,16 +45,11 @@ INT: DEC_DIGIT+ ;
DEC: DEC_DIGIT* '.' DEC_DIGIT+ ;
BOOL: [01] ;
num: INT | DEC | BOOL;
STR: '\'' .*? '\'' ;
waifuFile
: NL* func* NL* EOF
;
TYPE: COLON .+? ;
num: INT | DEC | BOOL;
sign
: ADD
| SUB
@ -67,14 +62,16 @@ operator: SUB | ADD | MULT | DIV | MOD ;
literal: INT | DEC | BOOL | STR ;
// func
func: functionDeclaration NL functionBody ;
func: functionDeclaration NL functionBody (NL* | EOF);
functionDeclaration: LPAREN functionParam* RPAREN (WS TYPE)? WS ID;
functionDeclaration: LPAREN functionParam* RPAREN (WS TYPE)? WS ID WS*;
functionParam: ID WS TYPE ;
functionBody: ((INDENT expr | SingleLineComment | MultiLineComment) NL)+ ;
functionBody: (INDENT expr) (WS* NL INDENT expr)*;
functionCall: ID WS expr (WS expr)* ;
emptyExpr: WS*;
// expr
expr: literal
| ID
@ -85,5 +82,9 @@ expr: literal
| MultiLineComment
| SingleLineComment
| functionCall
| emptyExpr
;
waifuFile
: (WS | NL)* (expr NL)* (WS | NL)* func*
;

File diff suppressed because one or more lines are too long

View File

@ -49,18 +49,6 @@ public partial class Waifu2BaseListener : IWaifu2Listener {
/// <param name="context">The parse tree.</param>
public virtual void ExitNum([NotNull] Waifu2Parser.NumContext context) { }
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void EnterWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { }
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void ExitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { }
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.sign"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
@ -169,6 +157,18 @@ public partial class Waifu2BaseListener : IWaifu2Listener {
/// <param name="context">The parse tree.</param>
public virtual void ExitFunctionCall([NotNull] Waifu2Parser.FunctionCallContext context) { }
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void EnterEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context) { }
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void ExitEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context) { }
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.expr"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
@ -180,6 +180,18 @@ public partial class Waifu2BaseListener : IWaifu2Listener {
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void ExitExpr([NotNull] Waifu2Parser.ExprContext context) { }
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void EnterWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { }
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>The default implementation does nothing.</para>
/// </summary>
/// <param name="context">The parse tree.</param>
public virtual void ExitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { }
/// <inheritdoc/>
/// <remarks>The default implementation does nothing.</remarks>

View File

@ -46,16 +46,6 @@ public partial class Waifu2BaseVisitor<Result> : AbstractParseTreeVisitor<Result
/// <return>The visitor result.</return>
public virtual Result VisitNum([NotNull] Waifu2Parser.NumContext context) { return VisitChildren(context); }
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
/// on <paramref name="context"/>.
/// </para>
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
public virtual Result VisitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { return VisitChildren(context); }
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.sign"/>.
/// <para>
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
@ -146,6 +136,16 @@ public partial class Waifu2BaseVisitor<Result> : AbstractParseTreeVisitor<Result
/// <return>The visitor result.</return>
public virtual Result VisitFunctionCall([NotNull] Waifu2Parser.FunctionCallContext context) { return VisitChildren(context); }
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// <para>
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
/// on <paramref name="context"/>.
/// </para>
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
public virtual Result VisitEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context) { return VisitChildren(context); }
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.expr"/>.
/// <para>
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
@ -155,5 +155,15 @@ public partial class Waifu2BaseVisitor<Result> : AbstractParseTreeVisitor<Result
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
public virtual Result VisitExpr([NotNull] Waifu2Parser.ExprContext context) { return VisitChildren(context); }
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// <para>
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
/// on <paramref name="context"/>.
/// </para>
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
public virtual Result VisitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context) { return VisitChildren(context); }
}
} // namespace waifu

View File

@ -42,16 +42,6 @@ public interface IWaifu2Listener : IParseTreeListener {
/// <param name="context">The parse tree.</param>
void ExitNum([NotNull] Waifu2Parser.NumContext context);
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void EnterWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void ExitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.sign"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
@ -142,6 +132,16 @@ public interface IWaifu2Listener : IParseTreeListener {
/// <param name="context">The parse tree.</param>
void ExitFunctionCall([NotNull] Waifu2Parser.FunctionCallContext context);
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void EnterEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context);
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void ExitEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context);
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.expr"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
@ -151,5 +151,15 @@ public interface IWaifu2Listener : IParseTreeListener {
/// </summary>
/// <param name="context">The parse tree.</param>
void ExitExpr([NotNull] Waifu2Parser.ExprContext context);
/// <summary>
/// Enter a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void EnterWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
/// <summary>
/// Exit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
void ExitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
}
} // namespace waifu

View File

@ -41,12 +41,13 @@ public partial class Waifu2Parser : Parser {
MOD=8, DIV=9, ADD=10, SUB=11, ASSIGN=12, LPAREN=13, RPAREN=14, COLON=15,
HASH=16, INT=17, DEC=18, BOOL=19, STR=20, TYPE=21;
public const int
RULE_num = 0, RULE_waifuFile = 1, RULE_sign = 2, RULE_value = 3, RULE_operator = 4,
RULE_literal = 5, RULE_func = 6, RULE_functionDeclaration = 7, RULE_functionParam = 8,
RULE_functionBody = 9, RULE_functionCall = 10, RULE_expr = 11;
RULE_num = 0, RULE_sign = 1, RULE_value = 2, RULE_operator = 3, RULE_literal = 4,
RULE_func = 5, RULE_functionDeclaration = 6, RULE_functionParam = 7, RULE_functionBody = 8,
RULE_functionCall = 9, RULE_emptyExpr = 10, RULE_expr = 11, RULE_waifuFile = 12;
public static readonly string[] ruleNames = {
"num", "waifuFile", "sign", "value", "operator", "literal", "func", "functionDeclaration",
"functionParam", "functionBody", "functionCall", "expr"
"num", "sign", "value", "operator", "literal", "func", "functionDeclaration",
"functionParam", "functionBody", "functionCall", "emptyExpr", "expr",
"waifuFile"
};
private static readonly string[] _LiteralNames = {
@ -125,7 +126,7 @@ public partial class Waifu2Parser : Parser {
try {
EnterOuterAlt(_localctx, 1);
{
State = 24;
State = 26;
_la = TokenStream.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << DEC) | (1L << BOOL))) != 0)) ) {
ErrorHandler.RecoverInline(this);
@ -147,109 +148,6 @@ public partial class Waifu2Parser : Parser {
return _localctx;
}
public partial class WaifuFileContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(Waifu2Parser.Eof, 0); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(Waifu2Parser.NL); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
return GetToken(Waifu2Parser.NL, i);
}
[System.Diagnostics.DebuggerNonUserCode] public FuncContext[] func() {
return GetRuleContexts<FuncContext>();
}
[System.Diagnostics.DebuggerNonUserCode] public FuncContext func(int i) {
return GetRuleContext<FuncContext>(i);
}
public WaifuFileContext(ParserRuleContext parent, int invokingState)
: base(parent, invokingState)
{
}
public override int RuleIndex { get { return RULE_waifuFile; } }
[System.Diagnostics.DebuggerNonUserCode]
public override void EnterRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.EnterWaifuFile(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override void ExitRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.ExitWaifuFile(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
IWaifu2Visitor<TResult> typedVisitor = visitor as IWaifu2Visitor<TResult>;
if (typedVisitor != null) return typedVisitor.VisitWaifuFile(this);
else return visitor.VisitChildren(this);
}
}
[RuleVersion(0)]
public WaifuFileContext waifuFile() {
WaifuFileContext _localctx = new WaifuFileContext(Context, State);
EnterRule(_localctx, 2, RULE_waifuFile);
int _la;
try {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 29;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,0,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 26;
Match(NL);
}
}
}
State = 31;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,0,Context);
}
State = 35;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==LPAREN) {
{
{
State = 32;
func();
}
}
State = 37;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
State = 41;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==NL) {
{
{
State = 38;
Match(NL);
}
}
State = 43;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
State = 44;
Match(Eof);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
ErrorHandler.ReportError(this, re);
ErrorHandler.Recover(this, re);
}
finally {
ExitRule();
}
return _localctx;
}
public partial class SignContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ADD() { return GetToken(Waifu2Parser.ADD, 0); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SUB() { return GetToken(Waifu2Parser.SUB, 0); }
@ -279,12 +177,12 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public SignContext sign() {
SignContext _localctx = new SignContext(Context, State);
EnterRule(_localctx, 4, RULE_sign);
EnterRule(_localctx, 2, RULE_sign);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 46;
State = 28;
_la = TokenStream.LA(1);
if ( !(_la==ADD || _la==SUB) ) {
ErrorHandler.RecoverInline(this);
@ -337,12 +235,12 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public ValueContext value() {
ValueContext _localctx = new ValueContext(Context, State);
EnterRule(_localctx, 6, RULE_value);
EnterRule(_localctx, 4, RULE_value);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 48;
State = 30;
_la = TokenStream.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << DEC) | (1L << BOOL) | (1L << STR))) != 0)) ) {
ErrorHandler.RecoverInline(this);
@ -396,12 +294,12 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public OperatorContext @operator() {
OperatorContext _localctx = new OperatorContext(Context, State);
EnterRule(_localctx, 8, RULE_operator);
EnterRule(_localctx, 6, RULE_operator);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 50;
State = 32;
_la = TokenStream.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MULT) | (1L << MOD) | (1L << DIV) | (1L << ADD) | (1L << SUB))) != 0)) ) {
ErrorHandler.RecoverInline(this);
@ -454,12 +352,12 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public LiteralContext literal() {
LiteralContext _localctx = new LiteralContext(Context, State);
EnterRule(_localctx, 10, RULE_literal);
EnterRule(_localctx, 8, RULE_literal);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 52;
State = 34;
_la = TokenStream.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << DEC) | (1L << BOOL) | (1L << STR))) != 0)) ) {
ErrorHandler.RecoverInline(this);
@ -485,10 +383,14 @@ public partial class Waifu2Parser : Parser {
[System.Diagnostics.DebuggerNonUserCode] public FunctionDeclarationContext functionDeclaration() {
return GetRuleContext<FunctionDeclarationContext>(0);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(Waifu2Parser.NL, 0); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(Waifu2Parser.NL); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
return GetToken(Waifu2Parser.NL, i);
}
[System.Diagnostics.DebuggerNonUserCode] public FunctionBodyContext functionBody() {
return GetRuleContext<FunctionBodyContext>(0);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(Waifu2Parser.Eof, 0); }
public FuncContext(ParserRuleContext parent, int invokingState)
: base(parent, invokingState)
{
@ -515,16 +417,45 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public FuncContext func() {
FuncContext _localctx = new FuncContext(Context, State);
EnterRule(_localctx, 12, RULE_func);
EnterRule(_localctx, 10, RULE_func);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 54;
State = 36;
functionDeclaration();
State = 55;
State = 37;
Match(NL);
State = 56;
State = 38;
functionBody();
State = 46;
ErrorHandler.Sync(this);
switch ( Interpreter.AdaptivePredict(TokenStream,1,Context) ) {
case 1:
{
State = 42;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==NL) {
{
{
State = 39;
Match(NL);
}
}
State = 44;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
}
break;
case 2:
{
State = 45;
Match(Eof);
}
break;
}
}
}
catch (RecognitionException re) {
@ -579,45 +510,59 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public FunctionDeclarationContext functionDeclaration() {
FunctionDeclarationContext _localctx = new FunctionDeclarationContext(Context, State);
EnterRule(_localctx, 14, RULE_functionDeclaration);
EnterRule(_localctx, 12, RULE_functionDeclaration);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 58;
State = 48;
Match(LPAREN);
State = 62;
State = 52;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==ID) {
{
{
State = 59;
State = 49;
functionParam();
}
}
State = 64;
State = 54;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
State = 65;
State = 55;
Match(RPAREN);
State = 68;
State = 58;
ErrorHandler.Sync(this);
switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) {
switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) {
case 1:
{
State = 66;
State = 56;
Match(WS);
State = 67;
State = 57;
Match(TYPE);
}
break;
}
State = 70;
State = 60;
Match(WS);
State = 71;
State = 61;
Match(ID);
State = 65;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==WS) {
{
{
State = 62;
Match(WS);
}
}
State = 67;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
}
}
catch (RecognitionException re) {
@ -661,15 +606,15 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public FunctionParamContext functionParam() {
FunctionParamContext _localctx = new FunctionParamContext(Context, State);
EnterRule(_localctx, 16, RULE_functionParam);
EnterRule(_localctx, 14, RULE_functionParam);
try {
EnterOuterAlt(_localctx, 1);
{
State = 73;
State = 68;
Match(ID);
State = 74;
State = 69;
Match(WS);
State = 75;
State = 70;
Match(TYPE);
}
}
@ -685,10 +630,6 @@ public partial class Waifu2Parser : Parser {
}
public partial class FunctionBodyContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(Waifu2Parser.NL); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
return GetToken(Waifu2Parser.NL, i);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] INDENT() { return GetTokens(Waifu2Parser.INDENT); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INDENT(int i) {
return GetToken(Waifu2Parser.INDENT, i);
@ -699,13 +640,13 @@ public partial class Waifu2Parser : Parser {
[System.Diagnostics.DebuggerNonUserCode] public ExprContext expr(int i) {
return GetRuleContext<ExprContext>(i);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] SingleLineComment() { return GetTokens(Waifu2Parser.SingleLineComment); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SingleLineComment(int i) {
return GetToken(Waifu2Parser.SingleLineComment, i);
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(Waifu2Parser.NL); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
return GetToken(Waifu2Parser.NL, i);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] MultiLineComment() { return GetTokens(Waifu2Parser.MultiLineComment); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MultiLineComment(int i) {
return GetToken(Waifu2Parser.MultiLineComment, i);
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] WS() { return GetTokens(Waifu2Parser.WS); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS(int i) {
return GetToken(Waifu2Parser.WS, i);
}
public FunctionBodyContext(ParserRuleContext parent, int invokingState)
: base(parent, invokingState)
@ -733,51 +674,52 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public FunctionBodyContext functionBody() {
FunctionBodyContext _localctx = new FunctionBodyContext(Context, State);
EnterRule(_localctx, 18, RULE_functionBody);
EnterRule(_localctx, 16, RULE_functionBody);
int _la;
try {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 84;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
do {
{
{
State = 81;
ErrorHandler.Sync(this);
switch (TokenStream.LA(1)) {
case INDENT:
{
State = 77;
State = 72;
Match(INDENT);
State = 78;
State = 73;
expr(0);
}
break;
case SingleLineComment:
{
State = 79;
Match(SingleLineComment);
}
break;
case MultiLineComment:
{
State = 80;
Match(MultiLineComment);
}
break;
default:
throw new NoViableAltException(this);
}
State = 83;
Match(NL);
}
}
State = 86;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,6,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 78;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INDENT) | (1L << MultiLineComment) | (1L << SingleLineComment))) != 0) );
while (_la==WS) {
{
{
State = 75;
Match(WS);
}
}
State = 80;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
State = 81;
Match(NL);
State = 82;
Match(INDENT);
State = 83;
expr(0);
}
}
}
State = 88;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,6,Context);
}
}
}
catch (RecognitionException re) {
@ -829,32 +771,32 @@ public partial class Waifu2Parser : Parser {
[RuleVersion(0)]
public FunctionCallContext functionCall() {
FunctionCallContext _localctx = new FunctionCallContext(Context, State);
EnterRule(_localctx, 20, RULE_functionCall);
EnterRule(_localctx, 18, RULE_functionCall);
try {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 88;
Match(ID);
State = 89;
Match(WS);
Match(ID);
State = 90;
Match(WS);
State = 91;
expr(0);
State = 95;
State = 96;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,7,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 91;
Match(WS);
State = 92;
Match(WS);
State = 93;
expr(0);
}
}
}
State = 97;
State = 98;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,7,Context);
}
@ -871,6 +813,71 @@ public partial class Waifu2Parser : Parser {
return _localctx;
}
public partial class EmptyExprContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] WS() { return GetTokens(Waifu2Parser.WS); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS(int i) {
return GetToken(Waifu2Parser.WS, i);
}
public EmptyExprContext(ParserRuleContext parent, int invokingState)
: base(parent, invokingState)
{
}
public override int RuleIndex { get { return RULE_emptyExpr; } }
[System.Diagnostics.DebuggerNonUserCode]
public override void EnterRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.EnterEmptyExpr(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override void ExitRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.ExitEmptyExpr(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
IWaifu2Visitor<TResult> typedVisitor = visitor as IWaifu2Visitor<TResult>;
if (typedVisitor != null) return typedVisitor.VisitEmptyExpr(this);
else return visitor.VisitChildren(this);
}
}
[RuleVersion(0)]
public EmptyExprContext emptyExpr() {
EmptyExprContext _localctx = new EmptyExprContext(Context, State);
EnterRule(_localctx, 20, RULE_emptyExpr);
try {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 102;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,8,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 99;
Match(WS);
}
}
}
State = 104;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,8,Context);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
ErrorHandler.ReportError(this, re);
ErrorHandler.Recover(this, re);
}
finally {
ExitRule();
}
return _localctx;
}
public partial class ExprContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public LiteralContext literal() {
return GetRuleContext<LiteralContext>(0);
@ -897,6 +904,9 @@ public partial class Waifu2Parser : Parser {
[System.Diagnostics.DebuggerNonUserCode] public FunctionCallContext functionCall() {
return GetRuleContext<FunctionCallContext>(0);
}
[System.Diagnostics.DebuggerNonUserCode] public EmptyExprContext emptyExpr() {
return GetRuleContext<EmptyExprContext>(0);
}
[System.Diagnostics.DebuggerNonUserCode] public OperatorContext @operator() {
return GetRuleContext<OperatorContext>(0);
}
@ -939,37 +949,37 @@ public partial class Waifu2Parser : Parser {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 115;
State = 123;
ErrorHandler.Sync(this);
switch ( Interpreter.AdaptivePredict(TokenStream,9,Context) ) {
switch ( Interpreter.AdaptivePredict(TokenStream,10,Context) ) {
case 1:
{
State = 99;
State = 106;
literal();
}
break;
case 2:
{
State = 100;
State = 107;
Match(ID);
}
break;
case 3:
{
State = 101;
State = 108;
Match(DEC);
}
break;
case 4:
{
State = 102;
State = 109;
Match(SUB);
State = 105;
State = 112;
ErrorHandler.Sync(this);
switch (TokenStream.LA(1)) {
case ID:
{
State = 103;
State = 110;
Match(ID);
}
break;
@ -977,7 +987,7 @@ public partial class Waifu2Parser : Parser {
case DEC:
case BOOL:
{
State = 104;
State = 111;
num();
}
break;
@ -988,41 +998,47 @@ public partial class Waifu2Parser : Parser {
break;
case 5:
{
State = 107;
State = 114;
Match(ID);
State = 108;
State = 115;
Match(WS);
State = 109;
State = 116;
Match(ASSIGN);
State = 110;
State = 117;
Match(WS);
State = 111;
expr(4);
State = 118;
expr(5);
}
break;
case 6:
{
State = 112;
State = 119;
Match(MultiLineComment);
}
break;
case 7:
{
State = 113;
State = 120;
Match(SingleLineComment);
}
break;
case 8:
{
State = 114;
State = 121;
functionCall();
}
break;
case 9:
{
State = 122;
emptyExpr();
}
break;
}
Context.Stop = TokenStream.LT(-1);
State = 125;
State = 133;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,10,Context);
_alt = Interpreter.AdaptivePredict(TokenStream,11,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( ParseListeners!=null )
@ -1032,22 +1048,22 @@ public partial class Waifu2Parser : Parser {
{
_localctx = new ExprContext(_parentctx, _parentState);
PushNewRecursionContext(_localctx, _startState, RULE_expr);
State = 117;
if (!(Precpred(Context, 6))) throw new FailedPredicateException(this, "Precpred(Context, 6)");
State = 118;
State = 125;
if (!(Precpred(Context, 7))) throw new FailedPredicateException(this, "Precpred(Context, 7)");
State = 126;
Match(WS);
State = 119;
@operator();
State = 120;
Match(WS);
State = 121;
expr(7);
}
}
}
State = 127;
@operator();
State = 128;
Match(WS);
State = 129;
expr(8);
}
}
}
State = 135;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,10,Context);
_alt = Interpreter.AdaptivePredict(TokenStream,11,Context);
}
}
}
@ -1062,6 +1078,148 @@ public partial class Waifu2Parser : Parser {
return _localctx;
}
public partial class WaifuFileContext : ParserRuleContext {
[System.Diagnostics.DebuggerNonUserCode] public ExprContext[] expr() {
return GetRuleContexts<ExprContext>();
}
[System.Diagnostics.DebuggerNonUserCode] public ExprContext expr(int i) {
return GetRuleContext<ExprContext>(i);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(Waifu2Parser.NL); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
return GetToken(Waifu2Parser.NL, i);
}
[System.Diagnostics.DebuggerNonUserCode] public FuncContext[] func() {
return GetRuleContexts<FuncContext>();
}
[System.Diagnostics.DebuggerNonUserCode] public FuncContext func(int i) {
return GetRuleContext<FuncContext>(i);
}
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] WS() { return GetTokens(Waifu2Parser.WS); }
[System.Diagnostics.DebuggerNonUserCode] public ITerminalNode WS(int i) {
return GetToken(Waifu2Parser.WS, i);
}
public WaifuFileContext(ParserRuleContext parent, int invokingState)
: base(parent, invokingState)
{
}
public override int RuleIndex { get { return RULE_waifuFile; } }
[System.Diagnostics.DebuggerNonUserCode]
public override void EnterRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.EnterWaifuFile(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override void ExitRule(IParseTreeListener listener) {
IWaifu2Listener typedListener = listener as IWaifu2Listener;
if (typedListener != null) typedListener.ExitWaifuFile(this);
}
[System.Diagnostics.DebuggerNonUserCode]
public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
IWaifu2Visitor<TResult> typedVisitor = visitor as IWaifu2Visitor<TResult>;
if (typedVisitor != null) return typedVisitor.VisitWaifuFile(this);
else return visitor.VisitChildren(this);
}
}
[RuleVersion(0)]
public WaifuFileContext waifuFile() {
WaifuFileContext _localctx = new WaifuFileContext(Context, State);
EnterRule(_localctx, 24, RULE_waifuFile);
int _la;
try {
int _alt;
EnterOuterAlt(_localctx, 1);
{
State = 139;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,12,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 136;
_la = TokenStream.LA(1);
if ( !(_la==WS || _la==NL) ) {
ErrorHandler.RecoverInline(this);
}
else {
ErrorHandler.ReportMatch(this);
Consume();
}
}
}
}
State = 141;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,12,Context);
}
State = 147;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,13,Context);
while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
State = 142;
expr(0);
State = 143;
Match(NL);
}
}
}
State = 149;
ErrorHandler.Sync(this);
_alt = Interpreter.AdaptivePredict(TokenStream,13,Context);
}
State = 153;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==WS || _la==NL) {
{
{
State = 150;
_la = TokenStream.LA(1);
if ( !(_la==WS || _la==NL) ) {
ErrorHandler.RecoverInline(this);
}
else {
ErrorHandler.ReportMatch(this);
Consume();
}
}
}
State = 155;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
State = 159;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
while (_la==LPAREN) {
{
{
State = 156;
func();
}
}
State = 161;
ErrorHandler.Sync(this);
_la = TokenStream.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
ErrorHandler.ReportError(this, re);
ErrorHandler.Recover(this, re);
}
finally {
ExitRule();
}
return _localctx;
}
public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 11: return expr_sempred((ExprContext)_localctx, predIndex);
@ -1070,51 +1228,63 @@ public partial class Waifu2Parser : Parser {
}
private bool expr_sempred(ExprContext _localctx, int predIndex) {
switch (predIndex) {
case 0: return Precpred(Context, 6);
case 0: return Precpred(Context, 7);
}
return true;
}
private static int[] _serializedATN = {
4,1,21,129,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,1,0,1,0,1,1,5,1,28,8,1,10,1,12,
1,31,9,1,1,1,5,1,34,8,1,10,1,12,1,37,9,1,1,1,5,1,40,8,1,10,1,12,1,43,9,
1,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,6,1,6,1,7,1,7,5,7,
61,8,7,10,7,12,7,64,9,7,1,7,1,7,1,7,3,7,69,8,7,1,7,1,7,1,7,1,8,1,8,1,8,
1,8,1,9,1,9,1,9,1,9,3,9,82,8,9,1,9,4,9,85,8,9,11,9,12,9,86,1,10,1,10,1,
10,1,10,1,10,5,10,94,8,10,10,10,12,10,97,9,10,1,11,1,11,1,11,1,11,1,11,
1,11,1,11,3,11,106,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,116,
8,11,1,11,1,11,1,11,1,11,1,11,1,11,5,11,124,8,11,10,11,12,11,127,9,11,
1,11,0,1,22,12,0,2,4,6,8,10,12,14,16,18,20,22,0,4,1,0,17,19,1,0,10,11,
1,0,17,20,1,0,7,11,134,0,24,1,0,0,0,2,29,1,0,0,0,4,46,1,0,0,0,6,48,1,0,
0,0,8,50,1,0,0,0,10,52,1,0,0,0,12,54,1,0,0,0,14,58,1,0,0,0,16,73,1,0,0,
0,18,84,1,0,0,0,20,88,1,0,0,0,22,115,1,0,0,0,24,25,7,0,0,0,25,1,1,0,0,
0,26,28,5,2,0,0,27,26,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,
0,30,35,1,0,0,0,31,29,1,0,0,0,32,34,3,12,6,0,33,32,1,0,0,0,34,37,1,0,0,
0,35,33,1,0,0,0,35,36,1,0,0,0,36,41,1,0,0,0,37,35,1,0,0,0,38,40,5,2,0,
0,39,38,1,0,0,0,40,43,1,0,0,0,41,39,1,0,0,0,41,42,1,0,0,0,42,44,1,0,0,
0,43,41,1,0,0,0,44,45,5,0,0,1,45,3,1,0,0,0,46,47,7,1,0,0,47,5,1,0,0,0,
48,49,7,2,0,0,49,7,1,0,0,0,50,51,7,3,0,0,51,9,1,0,0,0,52,53,7,2,0,0,53,
11,1,0,0,0,54,55,3,14,7,0,55,56,5,2,0,0,56,57,3,18,9,0,57,13,1,0,0,0,58,
62,5,13,0,0,59,61,3,16,8,0,60,59,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,
63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,68,5,14,0,0,66,67,5,1,0,0,67,
69,5,21,0,0,68,66,1,0,0,0,68,69,1,0,0,0,69,70,1,0,0,0,70,71,5,1,0,0,71,
72,5,3,0,0,72,15,1,0,0,0,73,74,5,3,0,0,74,75,5,1,0,0,75,76,5,21,0,0,76,
17,1,0,0,0,77,78,5,4,0,0,78,82,3,22,11,0,79,82,5,6,0,0,80,82,5,5,0,0,81,
77,1,0,0,0,81,79,1,0,0,0,81,80,1,0,0,0,82,83,1,0,0,0,83,85,5,2,0,0,84,
81,1,0,0,0,85,86,1,0,0,0,86,84,1,0,0,0,86,87,1,0,0,0,87,19,1,0,0,0,88,
89,5,3,0,0,89,90,5,1,0,0,90,95,3,22,11,0,91,92,5,1,0,0,92,94,3,22,11,0,
93,91,1,0,0,0,94,97,1,0,0,0,95,93,1,0,0,0,95,96,1,0,0,0,96,21,1,0,0,0,
97,95,1,0,0,0,98,99,6,11,-1,0,99,116,3,10,5,0,100,116,5,3,0,0,101,116,
5,18,0,0,102,105,5,11,0,0,103,106,5,3,0,0,104,106,3,0,0,0,105,103,1,0,
0,0,105,104,1,0,0,0,106,116,1,0,0,0,107,108,5,3,0,0,108,109,5,1,0,0,109,
110,5,12,0,0,110,111,5,1,0,0,111,116,3,22,11,4,112,116,5,5,0,0,113,116,
5,6,0,0,114,116,3,20,10,0,115,98,1,0,0,0,115,100,1,0,0,0,115,101,1,0,0,
0,115,102,1,0,0,0,115,107,1,0,0,0,115,112,1,0,0,0,115,113,1,0,0,0,115,
114,1,0,0,0,116,125,1,0,0,0,117,118,10,6,0,0,118,119,5,1,0,0,119,120,3,
8,4,0,120,121,5,1,0,0,121,122,3,22,11,7,122,124,1,0,0,0,123,117,1,0,0,
0,124,127,1,0,0,0,125,123,1,0,0,0,125,126,1,0,0,0,126,23,1,0,0,0,127,125,
1,0,0,0,11,29,35,41,62,68,81,86,95,105,115,125
4,1,21,163,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,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,5,1,5,5,5,41,8,5,10,5,12,5,44,9,5,1,5,3,
5,47,8,5,1,6,1,6,5,6,51,8,6,10,6,12,6,54,9,6,1,6,1,6,1,6,3,6,59,8,6,1,
6,1,6,1,6,5,6,64,8,6,10,6,12,6,67,9,6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,
5,8,77,8,8,10,8,12,8,80,9,8,1,8,1,8,1,8,5,8,85,8,8,10,8,12,8,88,9,8,1,
9,1,9,1,9,1,9,1,9,5,9,95,8,9,10,9,12,9,98,9,9,1,10,5,10,101,8,10,10,10,
12,10,104,9,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,113,8,11,1,11,1,
11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,124,8,11,1,11,1,11,1,11,1,11,
1,11,1,11,5,11,132,8,11,10,11,12,11,135,9,11,1,12,5,12,138,8,12,10,12,
12,12,141,9,12,1,12,1,12,1,12,5,12,146,8,12,10,12,12,12,149,9,12,1,12,
5,12,152,8,12,10,12,12,12,155,9,12,1,12,5,12,158,8,12,10,12,12,12,161,
9,12,1,12,0,1,22,13,0,2,4,6,8,10,12,14,16,18,20,22,24,0,5,1,0,17,19,1,
0,10,11,1,0,17,20,1,0,7,11,1,0,1,2,172,0,26,1,0,0,0,2,28,1,0,0,0,4,30,
1,0,0,0,6,32,1,0,0,0,8,34,1,0,0,0,10,36,1,0,0,0,12,48,1,0,0,0,14,68,1,
0,0,0,16,72,1,0,0,0,18,89,1,0,0,0,20,102,1,0,0,0,22,123,1,0,0,0,24,139,
1,0,0,0,26,27,7,0,0,0,27,1,1,0,0,0,28,29,7,1,0,0,29,3,1,0,0,0,30,31,7,
2,0,0,31,5,1,0,0,0,32,33,7,3,0,0,33,7,1,0,0,0,34,35,7,2,0,0,35,9,1,0,0,
0,36,37,3,12,6,0,37,38,5,2,0,0,38,46,3,16,8,0,39,41,5,2,0,0,40,39,1,0,
0,0,41,44,1,0,0,0,42,40,1,0,0,0,42,43,1,0,0,0,43,47,1,0,0,0,44,42,1,0,
0,0,45,47,5,0,0,1,46,42,1,0,0,0,46,45,1,0,0,0,47,11,1,0,0,0,48,52,5,13,
0,0,49,51,3,14,7,0,50,49,1,0,0,0,51,54,1,0,0,0,52,50,1,0,0,0,52,53,1,0,
0,0,53,55,1,0,0,0,54,52,1,0,0,0,55,58,5,14,0,0,56,57,5,1,0,0,57,59,5,21,
0,0,58,56,1,0,0,0,58,59,1,0,0,0,59,60,1,0,0,0,60,61,5,1,0,0,61,65,5,3,
0,0,62,64,5,1,0,0,63,62,1,0,0,0,64,67,1,0,0,0,65,63,1,0,0,0,65,66,1,0,
0,0,66,13,1,0,0,0,67,65,1,0,0,0,68,69,5,3,0,0,69,70,5,1,0,0,70,71,5,21,
0,0,71,15,1,0,0,0,72,73,5,4,0,0,73,74,3,22,11,0,74,86,1,0,0,0,75,77,5,
1,0,0,76,75,1,0,0,0,77,80,1,0,0,0,78,76,1,0,0,0,78,79,1,0,0,0,79,81,1,
0,0,0,80,78,1,0,0,0,81,82,5,2,0,0,82,83,5,4,0,0,83,85,3,22,11,0,84,78,
1,0,0,0,85,88,1,0,0,0,86,84,1,0,0,0,86,87,1,0,0,0,87,17,1,0,0,0,88,86,
1,0,0,0,89,90,5,3,0,0,90,91,5,1,0,0,91,96,3,22,11,0,92,93,5,1,0,0,93,95,
3,22,11,0,94,92,1,0,0,0,95,98,1,0,0,0,96,94,1,0,0,0,96,97,1,0,0,0,97,19,
1,0,0,0,98,96,1,0,0,0,99,101,5,1,0,0,100,99,1,0,0,0,101,104,1,0,0,0,102,
100,1,0,0,0,102,103,1,0,0,0,103,21,1,0,0,0,104,102,1,0,0,0,105,106,6,11,
-1,0,106,124,3,8,4,0,107,124,5,3,0,0,108,124,5,18,0,0,109,112,5,11,0,0,
110,113,5,3,0,0,111,113,3,0,0,0,112,110,1,0,0,0,112,111,1,0,0,0,113,124,
1,0,0,0,114,115,5,3,0,0,115,116,5,1,0,0,116,117,5,12,0,0,117,118,5,1,0,
0,118,124,3,22,11,5,119,124,5,5,0,0,120,124,5,6,0,0,121,124,3,18,9,0,122,
124,3,20,10,0,123,105,1,0,0,0,123,107,1,0,0,0,123,108,1,0,0,0,123,109,
1,0,0,0,123,114,1,0,0,0,123,119,1,0,0,0,123,120,1,0,0,0,123,121,1,0,0,
0,123,122,1,0,0,0,124,133,1,0,0,0,125,126,10,7,0,0,126,127,5,1,0,0,127,
128,3,6,3,0,128,129,5,1,0,0,129,130,3,22,11,8,130,132,1,0,0,0,131,125,
1,0,0,0,132,135,1,0,0,0,133,131,1,0,0,0,133,134,1,0,0,0,134,23,1,0,0,0,
135,133,1,0,0,0,136,138,7,4,0,0,137,136,1,0,0,0,138,141,1,0,0,0,139,137,
1,0,0,0,139,140,1,0,0,0,140,147,1,0,0,0,141,139,1,0,0,0,142,143,3,22,11,
0,143,144,5,2,0,0,144,146,1,0,0,0,145,142,1,0,0,0,146,149,1,0,0,0,147,
145,1,0,0,0,147,148,1,0,0,0,148,153,1,0,0,0,149,147,1,0,0,0,150,152,7,
4,0,0,151,150,1,0,0,0,152,155,1,0,0,0,153,151,1,0,0,0,153,154,1,0,0,0,
154,159,1,0,0,0,155,153,1,0,0,0,156,158,3,10,5,0,157,156,1,0,0,0,158,161,
1,0,0,0,159,157,1,0,0,0,159,160,1,0,0,0,160,25,1,0,0,0,161,159,1,0,0,0,
16,42,46,52,58,65,78,86,96,102,112,123,133,139,147,153,159
};
public static readonly ATN _ATN =

View File

@ -39,12 +39,6 @@ public interface IWaifu2Visitor<Result> : IParseTreeVisitor<Result> {
/// <return>The visitor result.</return>
Result VisitNum([NotNull] Waifu2Parser.NumContext context);
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
Result VisitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.sign"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
@ -99,10 +93,22 @@ public interface IWaifu2Visitor<Result> : IParseTreeVisitor<Result> {
/// <return>The visitor result.</return>
Result VisitFunctionCall([NotNull] Waifu2Parser.FunctionCallContext context);
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.emptyExpr"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
Result VisitEmptyExpr([NotNull] Waifu2Parser.EmptyExprContext context);
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.expr"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
Result VisitExpr([NotNull] Waifu2Parser.ExprContext context);
/// <summary>
/// Visit a parse tree produced by <see cref="Waifu2Parser.waifuFile"/>.
/// </summary>
/// <param name="context">The parse tree.</param>
/// <return>The visitor result.</return>
Result VisitWaifuFile([NotNull] Waifu2Parser.WaifuFileContext context);
}
} // namespace waifu