Skip to content

Commit 7549964

Browse files
committed
Painless: Fix Semicolon Regression (#33212)
Trailers (statements following something like an if statement) that don't use brackets currently require a semicolon even if they're the last statement. This is a regression caused by (#29566) and noted by (#33193). This change fixes the regression and adds a test for the broken case.
1 parent 7dc2de9 commit 7549964

File tree

6 files changed

+564
-573
lines changed

6 files changed

+564
-573
lines changed

modules/lang-painless/src/main/antlr/PainlessParser.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ parser grammar PainlessParser;
2222
options { tokenVocab=PainlessLexer; }
2323

2424
source
25-
: function* statement* dstatement? EOF
25+
: function* statement* EOF
2626
;
2727

2828
function
@@ -35,7 +35,7 @@ parameters
3535

3636
statement
3737
: rstatement
38-
| dstatement SEMICOLON
38+
| dstatement ( SEMICOLON | EOF )
3939
;
4040

4141
// Note we use a predicate on the if/else case here to prevent the

0 commit comments

Comments
 (0)