Repository: groovy
Updated Branches:
  refs/heads/master c3315afca -> 3e3b0f49b


Minor improvement for lexer


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3e3b0f49
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3e3b0f49
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3e3b0f49

Branch: refs/heads/master
Commit: 3e3b0f49b06ac3a78f47f3b950e0893255cf6f94
Parents: c3315af
Author: sunlan <sun...@apache.org>
Authored: Thu Oct 5 21:48:33 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Thu Oct 5 21:48:33 2017 +0800

----------------------------------------------------------------------
 src/antlr/GroovyLexer.g4 | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3e3b0f49/src/antlr/GroovyLexer.g4
----------------------------------------------------------------------
diff --git a/src/antlr/GroovyLexer.g4 b/src/antlr/GroovyLexer.g4
index bcf6f24..402d364 100644
--- a/src/antlr/GroovyLexer.g4
+++ b/src/antlr/GroovyLexer.g4
@@ -202,29 +202,29 @@ options {
 
 // §3.10.5 String Literals
 StringLiteral
-    :   GStringQuotationMark    DqStringCharacter*? GStringQuotationMark
-    |   SqStringQuotationMark   SqStringCharacter*? SqStringQuotationMark
+    :   GStringQuotationMark    DqStringCharacter* GStringQuotationMark
+    |   SqStringQuotationMark   SqStringCharacter* SqStringQuotationMark
 
     |   Slash      { this.isRegexAllowed() && _input.LA(1) != '*' }?
-                 SlashyStringCharacter+?       Slash
+                 SlashyStringCharacter+       Slash
 
-    |   TdqStringQuotationMark  TdqStringCharacter*?    TdqStringQuotationMark
-    |   TsqStringQuotationMark  TsqStringCharacter*?    TsqStringQuotationMark
-    |   DollarSlashyGStringQuotationMarkBegin   DollarSlashyStringCharacter+?  
 DollarSlashyGStringQuotationMarkEnd
+    |   TdqStringQuotationMark  TdqStringCharacter*    TdqStringQuotationMark
+    |   TsqStringQuotationMark  TsqStringCharacter*    TsqStringQuotationMark
+    |   DollarSlashyGStringQuotationMarkBegin   DollarSlashyStringCharacter+   
DollarSlashyGStringQuotationMarkEnd
     ;
 
 // Groovy gstring
 GStringBegin
-    :   GStringQuotationMark DqStringCharacter*? Dollar -> 
pushMode(DQ_GSTRING_MODE), pushMode(GSTRING_TYPE_SELECTOR_MODE)
+    :   GStringQuotationMark DqStringCharacter* Dollar -> 
pushMode(DQ_GSTRING_MODE), pushMode(GSTRING_TYPE_SELECTOR_MODE)
     ;
 TdqGStringBegin
-    :   TdqStringQuotationMark   TdqStringCharacter*? Dollar -> 
type(GStringBegin), pushMode(TDQ_GSTRING_MODE), 
pushMode(GSTRING_TYPE_SELECTOR_MODE)
+    :   TdqStringQuotationMark   TdqStringCharacter* Dollar -> 
type(GStringBegin), pushMode(TDQ_GSTRING_MODE), 
pushMode(GSTRING_TYPE_SELECTOR_MODE)
     ;
 SlashyGStringBegin
-    :   Slash { this.isRegexAllowed() && _input.LA(1) != '*' }? 
SlashyStringCharacter*? Dollar { isFollowedByJavaLetterInGString(_input) }? -> 
type(GStringBegin), pushMode(SLASHY_GSTRING_MODE), 
pushMode(GSTRING_TYPE_SELECTOR_MODE)
+    :   Slash { this.isRegexAllowed() && _input.LA(1) != '*' }? 
SlashyStringCharacter* Dollar { isFollowedByJavaLetterInGString(_input) }? -> 
type(GStringBegin), pushMode(SLASHY_GSTRING_MODE), 
pushMode(GSTRING_TYPE_SELECTOR_MODE)
     ;
 DollarSlashyGStringBegin
-    :   DollarSlashyGStringQuotationMarkBegin DollarSlashyStringCharacter*? 
Dollar { isFollowedByJavaLetterInGString(_input) }? -> type(GStringBegin), 
pushMode(DOLLAR_SLASHY_GSTRING_MODE), pushMode(GSTRING_TYPE_SELECTOR_MODE)
+    :   DollarSlashyGStringQuotationMarkBegin DollarSlashyStringCharacter* 
Dollar { isFollowedByJavaLetterInGString(_input) }? -> type(GStringBegin), 
pushMode(DOLLAR_SLASHY_GSTRING_MODE), pushMode(GSTRING_TYPE_SELECTOR_MODE)
     ;
 
 mode DQ_GSTRING_MODE;

Reply via email to