Skip to content

Commit

Permalink
Merge pull request #267 from zbynek/resolve-conflict
Browse files Browse the repository at this point in the history
Resolve merge conflicts from #245
  • Loading branch information
zosrothko committed Aug 25, 2023
2 parents 807c491 + dfba32b commit 38cfc5d
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 47 deletions.
6 changes: 3 additions & 3 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ title: JavaCC
description: The most popular parser generator for use with Java applications.

# Latest release
version: 7.0.10
version: 7.0.12

# Site URLs
github:
contributors_url: https://github.com/javacc/javacc/graphs/contributors
zip_url: https://github.com/javacc/javacc/archive/javacc-7.0.10.zip
tar_url: https://github.com/javacc/javacc/archive/javacc-7.0.10.tar.gz
zip_url: https://github.com/javacc/javacc/archive/javacc-7.0.12.zip
tar_url: https://github.com/javacc/javacc/archive/javacc-7.0.12.tar.gz
2 changes: 1 addition & 1 deletion docs/documentation/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ javacc_input ::= javacc_options
"PARSER_BEGIN" "(" <IDENTIFIER> ")"
java_compilation_unit
"PARSER_END" "(" <IDENTIFIER> ")"
( production )*
( production )+
<EOF>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JavaCC 7.0.12 is our latest stable release.
All JavaCC releases are available via [GitHub](https://github.com/javacc/javacc/releases) and [Maven](https://mvnrepository.com/artifact/net.java.dev.javacc/javacc) including checksums and cryptographic signatures.

#### 7.0.x
* JavaCC 7.0.12 - 2020-11-22 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.12.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.12.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.12))
* JavaCC 7.0.12 - 2022-07-06 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.12.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.12.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.12))
* JavaCC 7.0.11 - 2020-11-22 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.11.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.11.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.11/javacc-7.0.11.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.11/javacc-7.0.11-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.11))
* JavaCC 7.0.10 - 2020-11-22 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.10.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.10.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.10/javacc-7.0.10.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.10/javacc-7.0.10-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.10))
* JavaCC 7.0.9 - 2020-06-22 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.9.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.9.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.9/javacc-7.0.9.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.9/javacc-7.0.9-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.9))
Expand Down
17 changes: 8 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ This example recognizes matching braces followed by zero or more line terminator

Examples of legal strings in this grammar are:

`{}`, `{{{{{}}}}}` // ... etc
`{}`, `{‎{‎{‎{‎{}}}}}` // ... etc

Examples of illegal strings are:

Expand Down Expand Up @@ -152,10 +152,9 @@ This guide will walk you through locally building the project, running an existi

### <a name="download"></a>Download & Installation

JavaCC 7.0.10 is our latest stable release.

* JavaCC 7.0.10 - ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.10.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.10.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.10/javacc-7.0.10.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.10/javacc-7.0.10-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.10))
JavaCC 7.0.12 is our latest stable release.

* JavaCC 7.0.12 - ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.12.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.12.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.12/javacc-7.0.12-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.12))

All JavaCC releases are available via [GitHub](https://github.com/javacc/javacc/releases) and [Maven](https://mvnrepository.com/artifact/net.java.dev.javacc/javacc) including checksums and cryptographic signatures.

Expand All @@ -168,16 +167,16 @@ The GitHub 8.0 branch contains the next generation of JavaCC that splits the fr
To install JavaCC, navigate to the download directory and type:

```
$ unzip javacc-7.0.10.zip
$ unzip javacc-7.0.12.zip
or
$ tar xvf javacc-7.0.10.tar.gz
$ tar xvf javacc-7.0.12.tar.gz
```

Then place the binary `javacc-7.0.10.jar` in a new `target/` folder, and rename to `javacc.jar`.
Then place the binary `javacc-7.0.12.jar` in a new `target/` folder, and rename to `javacc.jar`.

Once you have completed installation add the `scripts/` directory in the JavaCC installation to your `PATH`. The JavaCC, JJTree, and JJDoc invocation scripts/executables reside in this directory.

On UNIX based systems, the scripts may not be executable immediately. This can be solved by using the command from the `javacc-7.0.10/` directory:
On UNIX based systems, the scripts may not be executable immediately. This can be solved by using the command from the `javacc-7.0.12/` directory:

```
chmod +x scripts/javacc
Expand Down Expand Up @@ -288,7 +287,7 @@ User | Use Case
[Apache Calcite](https://calcite.apache.org/) | Parsing SQL statements | [Parser.jj](https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj)
[Apache Camel](https://camel.apache.org/) | Parsing stored SQL templates | [sspt.jj](https://github.com/apache/camel/blob/master/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj)
[Apache Jena](https://jena.apache.org/) | Parsing queries written in SPARQL, ARQ, SSE, Turtle and JSON | [sparql_10](https://github.com/apache/jena/blob/master/jena-arq/Grammar/Final/sparql_10-final.jj), [sparql_11](https://github.com/apache/jena/blob/master/jena-arq/Grammar/Final/sparql_11-final.jj), [arq.jj](https://github.com/apache/jena/blob/master/jena-arq/Grammar/arq.jj), [sse.jj](https://github.com/apache/jena/blob/master/jena-arq/Grammar/sse/sse.jj), [turtle.jj](https://github.com/apache/jena/blob/master/jena-arq/Grammar/turtle.jj), [json.jj](https://github.com/apache/jena/blob/master/jena-arq/Grammar/JSON/json.jj)
[Apache Lucene](https://lucene.apache.org/) | Parsing search queries | [QueryParser.jj](https://github.com/apache/lucene-solr/blob/master/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj)
[Apache Lucene](https://lucene.apache.org/) | Parsing search queries | [QueryParser.jj](https://github.com/apache/lucene/tree/main/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.jj)
[Apache Tomcat](https://tomcat.apache.org/) | Parsing Expression Language (EL) and JSON | [ELParser.jjt](https://github.com/apache/tomcat/blob/master/java/org/apache/el/parser/ELParser.jjt), [JSONParser.jj](https://github.com/apache/tomcat/blob/master/java/org/apache/tomcat/util/json/JSONParser.jj)
[Apache Zookeeper](https://zookeeper.apache.org/) | Optimising serialisation/deserialisation of Hadoop I/O records | [rcc.jj](https://github.com/apache/zookeeper/blob/master/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/rcc.jj)
[Java Parser](https://javaparser.org/) | Parsing Java language files | [java.jj](https://github.com/javaparser/javaparser/blob/master/javaparser-core/src/main/javacc/java.jj)
Expand Down
21 changes: 21 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@ It also includes the change history for JJTree, JJDoc and the C++ versions of Ja
### MODIFICATIONS IN VERSION <a name="javacc-7.0.12"></a>7.0.12
---
<br>
* \#230 : Remove unused char from TokenMgrError.template in LexicalEr
* \#228 : Remove redundant cast in TokenMgrError template
* \#224 : Production part in javacc_input cannot be omitted
* \#223 : Fix annotations for JavaCharStream
* \#222 : Generate max. one deprecated annotation per method
* \#219 : Fix mismatched javadoc
* \#213 : Fix legacy links to Apache Lucene's grammar file
* \#212 : Test for allocation expression #189
* \#211 : Bad defaultVisit() method generated
* \#210 : Another change for marked for removal
* \#209 : Improve lexical error message
* \#208 : Relocated misplaced annotations
* \#207 : Changed methods marked for removal
* \#206 : Build xml improvements
* \#205 : Small fixes on warnings
* \#203 : Missing change for doc for token_manager_decls (issue #190)
* \#202 : Fix doc for token_manager_decls (issue #190)
* \#200 : Update index.md and _config.yml

* \#199 : Fix QueryParser.jj url in README

<br>

### MODIFICATIONS IN VERSION <a name="javacc-7.0.11"></a>7.0.11
Expand Down
27 changes: 22 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@
<arg line="examples/GUIParsing/ParserVersion/CalcInput.jj" />
</java>
<javac fork="true" srcdir="test.tmp/GUIParsing/ParserVersion" />
<!--
<!--
<echo />
<copy todir="test.tmp/GUIParsing/TokenMgrVersion">
<fileset dir="examples/GUIParsing/TokenMgrVersion">
<include name="*.java" />
</fileset>
</copy>
<java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
<arg line="-OUTPUT_DIRECTORY=test.tmp/GUIParsing/TokenMgrVersion" />
<arg line="-OUTPUT_DIRECTORY=test.tmp/GUIParsing/TokenMgrVersion" />
<arg line="examples/GUIParsing/TokenMgrVersion/CalcInput.jj" />
</java>
<javac fork="true" srcdir="test.tmp/GUIParsing/TokenMgrVersion" />
Expand Down Expand Up @@ -554,6 +554,21 @@
<arg line="examples/Obfuscator/MapFile.jj" />
</java>
<javac fork="true" srcdir="test.tmp/Obfuscator" />

<echo />
<java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
<arg line="-OUTPUT_DIRECTORY=test.tmp/gwtTemplate" />
<arg line="test/gwtTemplate/Parser.jj" />
</java>
<javac fork="true" srcdir="test.tmp/gwtTemplate" />

<echo />
<java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
<arg line="-OUTPUT_DIRECTORY=test.tmp/gwtUnicodeTemplate" />
<arg line="test/gwtUnicodeTemplate/Parser.jj" />
</java>
<javac fork="true" srcdir="test.tmp/gwtUnicodeTemplate" />

<!-- TODO, test cases for SimpleExamples -->
<echo />
<copy todir="test.tmp/Transformer">
Expand Down Expand Up @@ -608,6 +623,7 @@
<executions>
<execution>
<id>generate sources jar</id>
<phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
Expand All @@ -620,6 +636,7 @@
<executions>
<execution>
<id>generate javadoc jar</id>
<phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
Expand All @@ -640,20 +657,20 @@
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
<!--
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<phase>verify</phase>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
Expand Down
12 changes: 5 additions & 7 deletions src/main/resources/templates/gwt/JavaCharStream.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* An implementation of interface CharStream, where the stream is assumed to
* contain only ASCII characters (with java-like unicode escape processing).
*/


#if SUPPORT_CLASS_VISIBILITY_PUBLIC
public
Expand Down Expand Up @@ -380,14 +380,13 @@ class JavaCharStream
}
}

#if GENERATE_ANNOTATIONS
@Deprecated
#fi
/**
* @deprecated
* @see #getEndColumn
*/
#if GENERATE_ANNOTATIONS
@Deprecated
#fi
${PREFIX}public int getColumn() {
#if KEEP_LINE_COLUMN
return bufcolumn[bufpos];
Expand All @@ -396,14 +395,13 @@ class JavaCharStream
#fi
}

#if GENERATE_ANNOTATIONS
@Deprecated
#fi
/**
* @deprecated
* @see #getEndLine
*/
#if GENERATE_ANNOTATIONS
@Deprecated
#fi
${PREFIX}public int getLine() {
#if KEEP_LINE_COLUMN
return bufline[bufpos];
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/gwt/Provider.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public interface Provider {
/**
* Reads characters into an array
* @param buffer Destination buffer
* @param offset Offset at which to start storing characters
* @param length The maximum possible number of characters to read
* @param offset Offset at which to start storing characters
* @param len The maximum possible number of characters to read
* @return The number of characters read, or -1 if all read
* @exception IOException
*/
Expand All @@ -19,4 +19,4 @@ public interface Provider {
*/
public void close() throws IOException;

}
}
10 changes: 4 additions & 6 deletions src/main/resources/templates/gwt/SimpleCharStream.template
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,13 @@ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class SimpleCharStream
return c;
}

#if GENERATE_ANNOTATIONS
@Deprecated
#fi
/**
* @deprecated
* @see #getEndColumn
*/
#if GENERATE_ANNOTATIONS
@Deprecated
#fi
${PREFIX}public int getColumn() {
#if KEEP_LINE_COLUMN
return bufcolumn[bufpos];
Expand All @@ -231,14 +230,13 @@ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class SimpleCharStream
#fi
}

#if GENERATE_ANNOTATIONS
@Deprecated
#fi
/**
* @deprecated
* @see #getEndLine
*/
#if GENERATE_ANNOTATIONS
@Deprecated
#fi
${PREFIX}public int getLine() {
#if KEEP_LINE_COLUMN
return bufline[bufpos];
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version.major=7
version.minor=0
version.patch=11
version.patch=12
76 changes: 76 additions & 0 deletions test/gwtTemplate/Parser.jj
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* Copyright (c) 2006, Sun Microsystems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of the Sun Microsystems, Inc. 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
*/


options {
LOOKAHEAD = 1;
CHOICE_AMBIGUITY_CHECK = 2;
OTHER_AMBIGUITY_CHECK = 1;
STATIC = true;
DEBUG_PARSER = false;
DEBUG_LOOKAHEAD = false;
DEBUG_TOKEN_MANAGER = false;
ERROR_REPORTING = true;
JAVA_UNICODE_ESCAPE = false;
UNICODE_INPUT = false;
IGNORE_CASE = false;
USER_TOKEN_MANAGER = false;
USER_CHAR_STREAM = false;
BUILD_PARSER = true;
BUILD_TOKEN_MANAGER = true;
SANITY_CHECK = true;
FORCE_LA_CHECK = false;
JAVA_TEMPLATE_TYPE = "modern";
}

PARSER_BEGIN(Parser)

import java.io.IOException;

/** Simple brace matcher. */
public class Parser {

/** Main entry point. */
public static void main(String args[]) throws ParseException, IOException {
Parser parser = new Parser(new StreamProvider(System.in));
parser.Input();
}

}

PARSER_END(Parser)

/** Root production. */
void Input() :
{}
{

"A" {
System.out.println("hello");
} <EOF>
}

0 comments on commit 38cfc5d

Please sign in to comment.