Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X dd27ab055 -> cbe975940
Add threadsafe as a reserved keyword (cherry picked from commit 36a51e1) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cbe97594 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cbe97594 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cbe97594 Branch: refs/heads/GROOVY_2_6_X Commit: cbe9759409d44a09e95702b512855ee42480bea8 Parents: dd27ab0 Author: sunlan <[email protected]> Authored: Sat Aug 5 23:16:34 2017 +0800 Committer: sunlan <[email protected]> Committed: Sat Aug 5 23:17:33 2017 +0800 ---------------------------------------------------------------------- src/main/antlr/GroovyLexer.g4 | 3 +-- src/main/antlr/GroovyParser.g4 | 1 + .../parser/antlr4/GroovyParserTest.groovy | 1 + .../src/test/resources/core/Map_02x.groovy | 28 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/cbe97594/src/main/antlr/GroovyLexer.g4 ---------------------------------------------------------------------- diff --git a/src/main/antlr/GroovyLexer.g4 b/src/main/antlr/GroovyLexer.g4 index e493e9f..c90302f 100644 --- a/src/main/antlr/GroovyLexer.g4 +++ b/src/main/antlr/GroovyLexer.g4 @@ -345,6 +345,7 @@ AS : 'as'; DEF : 'def'; IN : 'in'; TRAIT : 'trait'; +THREADSAFE : 'threadsafe'; // reserved keyword // §3.9 Keywords @@ -410,8 +411,6 @@ INTERFACE : 'interface'; fragment LONG : 'long'; -THREADSAFE : 'threadsafe'; // reserved keyword - NATIVE : 'native'; NEW : 'new'; PACKAGE : 'package'; http://git-wip-us.apache.org/repos/asf/groovy/blob/cbe97594/src/main/antlr/GroovyParser.g4 ---------------------------------------------------------------------- diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4 index bc5dfbc..461a973 100644 --- a/src/main/antlr/GroovyParser.g4 +++ b/src/main/antlr/GroovyParser.g4 @@ -1269,6 +1269,7 @@ keywords | THROWS | TRANSIENT | TRAIT + | THREADSAFE | TRY | VOLATILE | WHILE http://git-wip-us.apache.org/repos/asf/groovy/blob/cbe97594/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy index a680d5c..696dab9 100644 --- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy +++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy @@ -173,6 +173,7 @@ class GroovyParserTest extends GroovyTestCase { void "test groovy core - Map"() { doTest('core/Map_01.groovy'); + doRunAndTest('core/Map_02x.groovy'); } void "test groovy core - Expression"() { http://git-wip-us.apache.org/repos/asf/groovy/blob/cbe97594/subprojects/parser-antlr4/src/test/resources/core/Map_02x.groovy ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/test/resources/core/Map_02x.groovy b/subprojects/parser-antlr4/src/test/resources/core/Map_02x.groovy new file mode 100644 index 0000000..507aa82 --- /dev/null +++ b/subprojects/parser-antlr4/src/test/resources/core/Map_02x.groovy @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def map = [ + private: 1, public: 2, protected: 3, static: 4, + transient: 5, final: 6, abstract: 7, native: 8, + threadsafe: 9, synchronized: 10, volatile: 11, strictfp: 12 +] +assert 1..12 == [ + map.private, map.public, map.protected, map.static, + map.transient, map.final, map.abstract, map.native, + map.threadsafe, map.synchronized, map.volatile, map.strictfp +] \ No newline at end of file
