(Switch parsing cleanup)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3b034066 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3b034066 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3b034066 Branch: refs/heads/2.3 Commit: 3b0340661d218a77e2422aed1a73bec1e09b8292 Parents: 507ba1f Author: ddekany <ddek...@apache.org> Authored: Mon Jul 24 19:50:34 2017 +0200 Committer: ddekany <ddek...@apache.org> Committed: Mon Jul 24 19:50:34 2017 +0200 ---------------------------------------------------------------------- src/main/javacc/FTL.jj | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3b034066/src/main/javacc/FTL.jj ---------------------------------------------------------------------- diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj index 385bbea..6bd358e 100644 --- a/src/main/javacc/FTL.jj +++ b/src/main/javacc/FTL.jj @@ -3601,21 +3601,22 @@ SwitchBlock Switch() : breakableDirectiveNesting++; switchBlock = new SwitchBlock(switchExp, ignoredSectionBeforeFirstCase); } - ( - LOOKAHEAD(2) - caseIns = Case() - { - if (caseIns.condition == null) { - if (defaultFound) { - throw new ParseException( - "You can only have one default case in a switch statement", template, start); - } - defaultFound = true; - } - switchBlock.addCase(caseIns); - } - )* - [<STATIC_TEXT_WS>] + [ + ( + caseIns = Case() + { + if (caseIns.condition == null) { + if (defaultFound) { + throw new ParseException( + "You can only have one default case in a switch statement", template, start); + } + defaultFound = true; + } + switchBlock.addCase(caseIns); + } + )+ + [<STATIC_TEXT_WS>] + ] end = <END_SWITCH> { breakableDirectiveNesting--;