Skip to content

Commit

Permalink
Painless: Fix Semicolon Regression (#33212)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jdconrad committed Aug 28, 2018
1 parent 7dc2de9 commit 7549964
Show file tree
Hide file tree
Showing 6 changed files with 564 additions and 573 deletions.
4 changes: 2 additions & 2 deletions modules/lang-painless/src/main/antlr/PainlessParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ parser grammar PainlessParser;
options { tokenVocab=PainlessLexer; }

source
: function* statement* dstatement? EOF
: function* statement* EOF
;

function
Expand All @@ -35,7 +35,7 @@ parameters

statement
: rstatement
| dstatement SEMICOLON
| dstatement ( SEMICOLON | EOF )
;

// Note we use a predicate on the if/else case here to prevent the
Expand Down
Loading

0 comments on commit 7549964

Please sign in to comment.