Return-Path: X-Original-To: apmail-groovy-commits-archive@minotaur.apache.org Delivered-To: apmail-groovy-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 61B6A18AF4 for ; Thu, 25 Jun 2015 10:55:23 +0000 (UTC) Received: (qmail 16950 invoked by uid 500); 25 Jun 2015 10:55:23 -0000 Delivered-To: apmail-groovy-commits-archive@groovy.apache.org Received: (qmail 16915 invoked by uid 500); 25 Jun 2015 10:55:23 -0000 Mailing-List: contact commits-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.incubator.apache.org Delivered-To: mailing list commits@groovy.incubator.apache.org Received: (qmail 16904 invoked by uid 99); 25 Jun 2015 10:55:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2015 10:55:23 +0000 X-ASF-Spam-Status: No, hits=-2001.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 25 Jun 2015 10:53:12 +0000 Received: (qmail 11400 invoked by uid 99); 25 Jun 2015 10:54:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2015 10:54:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 764C7DFF09; Thu, 25 Jun 2015 10:54:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.incubator.apache.org Date: Thu, 25 Jun 2015 10:55:00 -0000 Message-Id: <36de27a5bc214c6abc54fbdbf1494777@git.apache.org> In-Reply-To: <3a5f869991d940b68d3d3af7f6dab909@git.apache.org> References: <3a5f869991d940b68d3d3af7f6dab909@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-groovy git commit: GROOVY-7377: Interpolated variable followed by asterisk in slashy-string causes compiler error (tweak) X-Virus-Checked: Checked by ClamAV on apache.org GROOVY-7377: Interpolated variable followed by asterisk in slashy-string causes compiler error (tweak) Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/fe7fb466 Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/fe7fb466 Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/fe7fb466 Branch: refs/heads/master Commit: fe7fb466aa73ed368d0c853486315577df710a9c Parents: 72abd75 Author: paulk Authored: Thu Jun 25 20:39:24 2015 +1000 Committer: paulk Committed: Thu Jun 25 20:39:24 2015 +1000 ---------------------------------------------------------------------- src/main/org/codehaus/groovy/antlr/groovy.g | 51 +++++++++++++----------- 1 file changed, 28 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/fe7fb466/src/main/org/codehaus/groovy/antlr/groovy.g ---------------------------------------------------------------------- diff --git a/src/main/org/codehaus/groovy/antlr/groovy.g b/src/main/org/codehaus/groovy/antlr/groovy.g index 0dc106c..3512399 100644 --- a/src/main/org/codehaus/groovy/antlr/groovy.g +++ b/src/main/org/codehaus/groovy/antlr/groovy.g @@ -3490,6 +3490,10 @@ options { return LA(1) == '$' && LA(2) == '$'; } + protected boolean atMultiCommentStart() throws CharStreamException { + return LA(1) == '/' && LA(2) == '*'; + } + protected boolean atDollarSlashEscape() throws CharStreamException { return LA(1) == '$' && LA(2) == '/'; } @@ -3756,7 +3760,7 @@ ML_COMMENT options { paraphrase="a multi-line comment"; } - : "/*" + : { atMultiCommentStart() }? "/*" ( /* '\r' '\n' can be matched in one alternative or by matching '\r' in one iteration and '\n' in another. I am trying to handle any flavor of newline that comes in, but the language @@ -3853,29 +3857,30 @@ options { paraphrase="a multiline regular expression literal"; } {int tt=0;} - : ( '/' ~('*'|'=') ) => - {allowRegexpLiteral()}? - '/'! - {++suppressNewline;} - //Do this, but require it to be non-trivial: REGEXP_CTOR_END[true] - // There must be at least one symbol or $ escape, lest the regexp collapse to '//'. - // (This should be simpler, but I don't know how to do it w/o ANTLR warnings vs. '//' comments.) - ( - REGEXP_SYMBOL - tt=REGEXP_CTOR_END[true] - | {!atValidDollarEscape()}? '$' - tt=REGEXP_CTOR_END[true] - | '$'! - { - // Yes, it's a regexp constructor, and we've got a value part. - tt = STRING_CTOR_START; - stringCtorState = SCS_VAL + SCS_RE_TYPE; - } - ) - {$setType(tt);} + : { !atMultiCommentStart() }? + ( {allowRegexpLiteral()}? + '/'! + {++suppressNewline;} + //Do this, but require it to be non-trivial: REGEXP_CTOR_END[true] + // There must be at least one symbol or $ escape, lest the regexp collapse to '//'. + // (This should be simpler, but I don't know how to do it w/o ANTLR warnings vs. '//' comments.) + ( + REGEXP_SYMBOL + tt=REGEXP_CTOR_END[true] + | {!atValidDollarEscape()}? '$' + tt=REGEXP_CTOR_END[true] + | '$'! + { + // Yes, it's a regexp constructor, and we've got a value part. + tt = STRING_CTOR_START; + stringCtorState = SCS_VAL + SCS_RE_TYPE; + } + ) + {$setType(tt);} - | ( '/' ~('*'|'=') ) => DIV {$setType(DIV);} - | DIV_ASSIGN {$setType(DIV_ASSIGN);} + | ( '/' ~'=' ) => DIV {$setType(DIV);} + | DIV_ASSIGN {$setType(DIV_ASSIGN);} + ) ; DOLLAR_REGEXP_LITERAL