You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/08/05 14:32:04 UTC
groovy git commit: Add threadsafe as a reserved keyword
Repository: groovy
Updated Branches:
refs/heads/master 42f1e6d8f -> 7ebeba08d
Add threadsafe as a reserved keyword
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7ebeba08
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7ebeba08
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7ebeba08
Branch: refs/heads/master
Commit: 7ebeba08d07104a3c64f14f5c2f796083b552b1a
Parents: 42f1e6d
Author: sunlan <su...@apache.org>
Authored: Sat Aug 5 22:31:54 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sat Aug 5 22:31:54 2017 +0800
----------------------------------------------------------------------
src/main/antlr/GroovyLexer.g4 | 2 ++
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 5 +++++
.../test/resources/fail/ThreadSafe_01x.groovy | 20 ++++++++++++++++++++
3 files changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/7ebeba08/src/main/antlr/GroovyLexer.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyLexer.g4 b/src/main/antlr/GroovyLexer.g4
index f9e9063..e493e9f 100644
--- a/src/main/antlr/GroovyLexer.g4
+++ b/src/main/antlr/GroovyLexer.g4
@@ -410,6 +410,8 @@ 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/7ebeba08/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
index 86bec8d..0905717 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
@@ -189,6 +189,11 @@ class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/DuplicatedNamedParameter_02x.groovy');
}
+ void "test groovy core - threadsafe"() {
+ TestUtils.doRunAndShouldFail('fail/ThreadSafe_01x.groovy');
+ }
+
+
/**************************************/
static unzipScriptAndShouldFail(String entryName, List ignoreClazzList, Map<String, String> replacementsMap=[:], boolean toCheckNewParserOnly = false) {
ignoreClazzList.addAll(TestUtils.COMMON_IGNORE_CLASS_LIST)
http://git-wip-us.apache.org/repos/asf/groovy/blob/7ebeba08/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy b/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
new file mode 100644
index 0000000..1285964
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+threadsafe foo() {}