From 63924cfc01a8c512791471d67fd07b317e9a1710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Costa?= Date: Thu, 20 Sep 2018 12:09:53 +0100 Subject: [PATCH] Move lever predicates to the right hand side See: https://github.com/antlr/antlr4/blob/master/doc/predicates.md#predicates-in-lexer-rules --- src/main/antlr4/liquid/parser/v4/LiquidLexer.g4 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/antlr4/liquid/parser/v4/LiquidLexer.g4 b/src/main/antlr4/liquid/parser/v4/LiquidLexer.g4 index 88d2ae10..2ad827f1 100644 --- a/src/main/antlr4/liquid/parser/v4/LiquidLexer.g4 +++ b/src/main/antlr4/liquid/parser/v4/LiquidLexer.g4 @@ -16,16 +16,16 @@ lexer grammar LiquidLexer; } OutStart - : ( {stripSpacesAroundTags && stripSingleLine}? SpaceOrTab* '{{' - | {stripSpacesAroundTags && !stripSingleLine}? WhitespaceChar* '{{' + : ( SpaceOrTab* '{{' {stripSpacesAroundTags && stripSingleLine}? + | WhitespaceChar* '{{' {stripSpacesAroundTags && !stripSingleLine}? | WhitespaceChar* '{{-' | '{{' ) -> pushMode(IN_TAG) ; TagStart - : ( {stripSpacesAroundTags && stripSingleLine}? SpaceOrTab* '{%' - | {stripSpacesAroundTags && !stripSingleLine}? WhitespaceChar* '{%' + : ( SpaceOrTab* '{%' {stripSpacesAroundTags && stripSingleLine}? + | WhitespaceChar* '{%' {stripSpacesAroundTags && !stripSingleLine}? | WhitespaceChar* '{%-' | '{%' ) -> pushMode(IN_TAG) @@ -49,16 +49,16 @@ mode IN_TAG; TagStart2 : '{%' -> pushMode(IN_TAG); OutEnd - : ( {stripSpacesAroundTags && stripSingleLine}? '}}' SpaceOrTab* LineBreak? - | {stripSpacesAroundTags && !stripSingleLine}? '}}' WhitespaceChar* + : ( '}}' SpaceOrTab* LineBreak? {stripSpacesAroundTags && stripSingleLine}? + | '}}' WhitespaceChar* {stripSpacesAroundTags && !stripSingleLine}? | '-}}' WhitespaceChar* | '}}' ) -> popMode ; TagEnd - : ( {stripSpacesAroundTags && stripSingleLine}? '%}' SpaceOrTab* LineBreak? - | {stripSpacesAroundTags && !stripSingleLine}? '%}' WhitespaceChar* + : ( '%}' SpaceOrTab* LineBreak? {stripSpacesAroundTags && stripSingleLine}? + | '%}' WhitespaceChar* {stripSpacesAroundTags && !stripSingleLine}? | '-%}' WhitespaceChar* | '%}' ) -> popMode