Skip to content

Commit

Permalink
GROOVY-8177: Remedial work still needed for groovy-parser-antlr4 subp…
Browse files Browse the repository at this point in the history
…roject
  • Loading branch information
paulk-asert committed May 8, 2017
1 parent 67ccb14 commit 27bedfe
Show file tree
Hide file tree
Showing 225 changed files with 3,879 additions and 72 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ The following class within this product:
org.codehaus.groovy.tools.shell.completion.FileNameCompleter

was derived from JLine 2.12, and the following patch:
https://github.com/jline/jline2/pull/204
https://github.com/jline/jline2/issues/90
JLine2 is made available under a BSD License.
For details, see licenses/jline2-license.

Expand Down
7 changes: 7 additions & 0 deletions licenses/LICENSE-ALLJARJAR
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ See licenses/antlr2-license.txt for details.

------------------------------------------------------------------------

ANTLR 4 License

Antlr4 is released under a BSD 3-clause license.
See licenses/antlr4-license.txt for details.

------------------------------------------------------------------------

ASM 4 License

ASM 4 uses a 3-clause BSD license. For details, see licenses/asm-license.txt.
Expand Down
7 changes: 7 additions & 0 deletions licenses/LICENSE-BINZIP
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ See licenses/antlr2-license.txt for details.

------------------------------------------------------------------------

ANTLR 4 License

Antlr4 is released under a BSD 3-clause license.
See licenses/antlr4-license.txt for details.

------------------------------------------------------------------------

ASM 4 License

ASM 4 uses a 3-clause BSD license. For details, see licenses/asm-license.txt.
Expand Down
7 changes: 7 additions & 0 deletions licenses/LICENSE-JARJAR
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ See licenses/antlr2-license.txt for details.

------------------------------------------------------------------------

ANTLR 4 License

Antlr4 is released under a BSD 3-clause license.
See licenses/antlr4-license.txt for details.

------------------------------------------------------------------------

ASM 4 License

ASM 4 uses a 3-clause BSD license. For details, see licenses/asm-license.txt.
7 changes: 7 additions & 0 deletions licenses/LICENSE-SDK
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ See licenses/antlr2-license.txt for details.

------------------------------------------------------------------------

ANTLR 4 License

Antlr4 is released under a BSD 3-clause license.
See licenses/antlr4-license.txt for details.

------------------------------------------------------------------------

ASM 4 License

ASM 4 uses a 3-clause BSD license. For details, see licenses/asm-license.txt.
Expand Down
4 changes: 4 additions & 0 deletions licenses/antlr4-JARJAR.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ANTLR 4 License

Antlr4 is released under a BSD 3-clause license.
See licenses/antlr4-license.txt for details.
28 changes: 28 additions & 0 deletions licenses/antlr4-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ANTLR 4 License

[The "BSD 3-clause license"]
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 4 additions & 1 deletion notices/NOTICE-ALLJARJAR
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Copyright 2003-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes/uses ANTLR (http://www.antlr2.org/)
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006

This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

This product bundles icons from the famfamfam.com silk icons set
http://www.famfamfam.com/lab/icons/silk/
Licensed under the Creative Commons Attribution Licence v2.5
Expand Down
5 changes: 4 additions & 1 deletion notices/NOTICE-BINZIP
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Copyright 2003-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes/uses ANTLR (http://www.antlr2.org/)
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006

This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

This product bundles the JUnit jar (junit.org)
which is available under the terms of the Eclipse Public License v1.0

Expand Down
5 changes: 4 additions & 1 deletion notices/NOTICE-GROOIDJARJAR
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Copyright 2003-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes/uses ANTLR (http://www.antlr2.org/)
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006

This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

This product embeds the OpenBeans jar within its grooid jar artifacts
OpenBeans includes/uses files from Apache Harmony and the following notice applies
Copyright 2006, 2010 The Apache Software Foundation.
Expand Down
7 changes: 5 additions & 2 deletions notices/NOTICE-JARJAR
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ Copyright 2003-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes/uses ANTLR (http://www.antlr2.org/)
developed by Terence Parr 1989-2006
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006

This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
5 changes: 4 additions & 1 deletion notices/NOTICE-SDK
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Copyright 2003-2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This product includes/uses ANTLR (http://www.antlr2.org/)
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006

This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

This product bundles the JUnit jar (junit.org)
which is available under the terms of the Eclipse Public License v1.0

Expand Down
2 changes: 0 additions & 2 deletions notices/antl2-JARJAR.txt

This file was deleted.

2 changes: 2 additions & 0 deletions notices/antlr2-JARJAR.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This product includes/uses ANTLR2 (http://www.antlr2.org/)
developed by Terence Parr 1989-2006
2 changes: 2 additions & 0 deletions notices/antlr4-JARJAR.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def subprojects = ['groovy-ant',
'groovy-test',
'groovy-testng',
'groovy-xml',
'groovy-parser-antlr4',
'groovy-macro'
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
## This is the home of the new parser Parrot, which is based on antlr4.
//////////////////////////////////////////

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.

//////////////////////////////////////////
== This is the home of the new parser Parrot, which is based on Antlr4.
The new parser(Parrot) can parse Groovy source code and construct the related AST, which is almost identical to the one generated by the old parser(except the corrected node position, e.g. line, column of node). Currently all features of Groovy are available. In addition, **the following new features have been added:**
Expand All @@ -13,7 +34,8 @@ The new parser(Parrot) can parse Groovy source code and construct the related AS
* safe index(e.g. `nullableVar?[1, 2]`)
* runtime groovydoc(i.e. groovydoc with `@Groovydoc`), groovydoc attached to AST node as metadata
**How to enable the new parser**
=== How to enable the new parser
* In the gradle build the property useAntlr4 has to be set to enable the build of the parser and the execution of all tests with it. Command line example:
```
./gradlew -PuseAntlr4=true bootstrapJar
Expand All @@ -28,7 +50,8 @@ groovy foo.groovy
groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
```
**JVM system properties to control parsing:**
=== JVM system properties to control parsing
* `groovy.antlr4.cache.threshold`: how frequently to clear DFA cache(default: 50). **Notice:** The more frequently the DFA cache is cleared, the poorer parsing performance will be(you can not set the value that is less than the default value). But the DFA cache has to be cleared to avoid OutOfMemoryError's occurring.
* `groovy.extract.doc.comment`: whether to collect groovydoc while parsing groovy source code(default: false)
Expand Down
18 changes: 18 additions & 0 deletions subprojects/groovy-parser-antlr4/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* 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.
*/
if (!rootProject.hasProperty('useAntlr4')) return

apply plugin: 'me.champeau.gradle.antlr4'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
Copyright (c) 2016 Daniel Sun
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**
* The Groovy grammar is based on the official grammar for Java(https://github.com/antlr/grammars-v4/blob/master/java/Java.g4)
* This file is adapted from the Antlr4 Java grammar which has the following license
*
* Copyright (c) 2013 Terence Parr, Sam Harwell
* All rights reserved.
* [The "BSD licence"]
*
* http://www.opensource.org/licenses/bsd-license.php
*
* Subsequent modifications by the Groovy community have been done under the Apache License v2:
*
* @author <a href="mailto:[email protected]">Daniel.Sun</a>
* Created on 2016/08/14
* 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.
*/

/**
* The Groovy grammar is based on the official grammar for Java:
* https://github.com/antlr/grammars-v4/blob/master/java/Java.g4
*/
lexer grammar GroovyLexer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
Copyright (c) 2016 Daniel Sun
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**
* The Groovy grammar is based on the official grammar for Java(https://github.com/antlr/grammars-v4/blob/master/java/Java.g4)
* This file is adapted from the Antlr4 Java grammar which has the following license
*
* Copyright (c) 2013 Terence Parr, Sam Harwell
* All rights reserved.
* [The "BSD licence"]
*
* http://www.opensource.org/licenses/bsd-license.php
*
* Subsequent modifications by the Groovy community have been done under the Apache License v2:
*
* @author <a href="mailto:[email protected]">Daniel.Sun</a>
* Created on 2016/08/14
* 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.
*/

/**
* The Groovy grammar is based on the official grammar for Java:
* https://github.com/antlr/grammars-v4/blob/master/java/Java.g4
*/
parser grammar GroovyParser;

Expand Down
Loading

0 comments on commit 27bedfe

Please sign in to comment.