From d4db723b3b1140787f733e83fd2dc7689ee82cbd Mon Sep 17 00:00:00 2001 From: Jean-Christophe Jaskula Date: Tue, 21 May 2024 21:51:36 -0400 Subject: [PATCH] Rewrite SubContext* rules and update tests Signed-off-by: Jean-Christophe Jaskula --- .../LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt | 4 ++-- .../LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt | 4 ++-- .../LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt | 4 ++-- .../LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt | 4 ++-- .../LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt | 4 ++-- .../org/antlr/v4/test/runtime/templates/CSharp.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/Cpp.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/Dart.test.stg | 4 ++-- .../resources/org/antlr/v4/test/runtime/templates/Go.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/Java.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/JavaScript.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/PHP.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/Python3.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/Swift.test.stg | 4 ++-- .../org/antlr/v4/test/runtime/templates/TypeScript.test.stg | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt index 629311487f..f30122ff0b 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt @@ -10,8 +10,8 @@ Parser grammar T; s : e {}; e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + : e '*' e {$v = }, {}, {0})> * }, {}, {1})>;} # binary + | e '+' e {$v = }, {}, {0})> + }, {}, {1})>;} # binary | INT{$v = $INT.int;} # anInt | '(' e ')' {$v = $e.v;} # parens | left=e INC {$v = $left.v + 1;} # unary diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt index 31ee95f747..236a43463c 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt @@ -10,8 +10,8 @@ Parser grammar T; s : e {}; e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + : e '*' e {$v = }, {}, {0})> * }, {}, {1})>;} # binary + | e '+' e {$v = }, {}, {0})> + }, {}, {1})>;} # binary | INT{$v = $INT.int;} # anInt | '(' e ')' {$v = $e.v;} # parens | left=e INC {$v = $left.v + 1;} # unary diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt index 3e2de3e588..6de2e848cf 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt @@ -10,8 +10,8 @@ Parser grammar T; s : e {}; e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + : e '*' e {$v = }, {}, {0})> * }, {}, {1})>;} # binary + | e '+' e {$v = }, {}, {0})> + }, {}, {1})>;} # binary | INT{$v = $INT.int;} # anInt | '(' e ')' {$v = $e.v;} # parens | left=e INC {$v = $left.v + 1;} # unary diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt index d3a5726520..f65cfd2b42 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt @@ -10,8 +10,8 @@ Parser grammar T; s : e {}; e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + : e '*' e {$v = }, {}, {0})> * }, {}, {1})>;} # binary + | e '+' e {$v = }, {}, {0})> + }, {}, {1})>;} # binary | INT{$v = $INT.int;} # anInt | '(' e ')' {$v = $e.v;} # parens | left=e INC {$v = $left.v + 1;} # unary diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt index 4a313df433..f43efc270d 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt @@ -10,8 +10,8 @@ Parser grammar T; s : e {}; e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + : e '*' e {$v = }, {}, {0})> * }, {}, {1})>;} # binary + | e '+' e {$v = }, {}, {0})> + }, {}, {1})>;} # binary | INT{$v = $INT.int;} # anInt | '(' e ')' {$v = $e.v;} # parens | left=e INC {$v = $left.v + 1;} # unary diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg index 8cf10d710a..6526af7826 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg @@ -328,5 +328,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= ".()" StringType() ::= "String" ContextMember(ctx, member) ::= "." -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".." +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Cpp.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Cpp.test.stg index b72bc74d65..f45a70408f 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Cpp.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Cpp.test.stg @@ -279,5 +279,5 @@ ContextRuleFunction(ctx, rule) ::= "->" ContextListFunction(ctx, rule) ::= "->()" StringType() ::= "std::string" ContextMember(ctx, member) ::= "->" -SubContextLocal(ctx, subctx, local) ::= "->->" -SubContextMember(ctx, subctx, member) ::= "->->" +SubContextLocal(ctx, subctx, local, arg) ::= "->()->" +SubContextMember(ctx, subctx, member, arg) ::= "->()->" diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Dart.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Dart.test.stg index b9a08af29d..31e34a598a 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Dart.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Dart.test.stg @@ -319,5 +319,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= ".()" StringType() ::= "String" ContextMember(ctx, member) ::= ".!" -SubContextLocal(ctx, subctx, local) ::= ".!.!" -SubContextMember(ctx, subctx, member) ::= ".!.!" +SubContextLocal(ctx, subctx, local, arg) ::= ".()!.!" +SubContextMember(ctx, subctx, member, arg) ::= ".()!.!" diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Go.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Go.test.stg index f629702ca8..49cebf9d56 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Go.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Go.test.stg @@ -341,5 +341,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= ".()" StringType() ::= "string" ContextMember(ctx, member) ::= "." -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".." +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Java.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Java.test.stg index e81f75a197..2e985231d3 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Java.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Java.test.stg @@ -297,5 +297,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= ".()" StringType() ::= "String" ContextMember(ctx, member) ::= "." -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".." +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/JavaScript.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/JavaScript.test.stg index 56b48a2b12..5815618c33 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/JavaScript.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/JavaScript.test.stg @@ -303,5 +303,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= "._list()" StringType() ::= "String" ContextMember(ctx, member) ::= "." -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".." +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/PHP.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/PHP.test.stg index 1889e09951..016a3c4210 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/PHP.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/PHP.test.stg @@ -273,5 +273,5 @@ ContextRuleFunction(ctx, rule) ::= "->" ContextListFunction(ctx, rule) ::= "->()" StringType() ::= "" ContextMember(ctx, member) ::= "->" -SubContextLocal(ctx, subctx, local) ::= "->->" -SubContextMember(ctx, subctx, member) ::= "->->" +SubContextLocal(ctx, subctx, local, arg) ::= "->()->" +SubContextMember(ctx, subctx, member, arg) ::= "->()->" diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg index 943085aeb7..fa3300ee4d 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Python3.test.stg @@ -267,5 +267,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= "._list()" StringType() ::= "String" ContextMember(ctx, member) ::= "." -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".." +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Swift.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Swift.test.stg index af0606d841..47f0e55768 100755 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Swift.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/Swift.test.stg @@ -305,5 +305,5 @@ Invoke_pred(v) ::= <)>> ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= ".()" ContextMember(ctx, member) ::= "!." -SubContextLocal(ctx, subctx, local) ::= ".!." -SubContextMember(ctx, subctx, member) ::= ".!." +SubContextLocal(ctx, subctx, local, arg) ::= ".()!." +SubContextMember(ctx, subctx, member, arg) ::= ".()!." diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/TypeScript.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/TypeScript.test.stg index ba8a332809..1fa08b5ab1 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/TypeScript.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/TypeScript.test.stg @@ -308,5 +308,5 @@ ContextRuleFunction(ctx, rule) ::= "." ContextListFunction(ctx, rule) ::= "._list()" StringType() ::= "string | undefined" ContextMember(ctx, member) ::= "._" -SubContextLocal(ctx, subctx, local) ::= ".." -SubContextMember(ctx, subctx, member) ::= ".._" +SubContextLocal(ctx, subctx, local, arg) ::= ".()." +SubContextMember(ctx, subctx, member, arg) ::= ".()._"