[Git][java-team/javacc][upstream] New upstream version 7.0.13
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Wed Apr 16 14:28:55 BST 2025
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / javacc
Commits:
33623b54 by Emmanuel Bourg at 2025-04-16T15:23:43+02:00
New upstream version 7.0.13
- - - - -
15 changed files:
- .gitignore
- README.md
- docs/_config.yml
- docs/downloads.md
- docs/faq.md
- docs/index.md
- docs/release-notes.md
- pom.xml
- src/main/resources/templates/TokenMgrError.template
- src/main/resources/version.properties
- test/java7features/Parser.jj
- test/javaFileGeneration/expected/no-keep-line/TokenMgrError.java
- test/javaFileGeneration/expected/non-static/TokenMgrError.java
- test/javaFileGeneration/expected/not-public/TokenMgrError.java
- test/javaFileGeneration/expected/static/TokenMgrError.java
Changes:
=====================================
.gitignore
=====================================
@@ -49,3 +49,5 @@ dist/
ant.log
mvn.log
cobertura.ser
+/release-perform.log
+/release-prepare.log
=====================================
README.md
=====================================
@@ -3,9 +3,10 @@ Created from:
* the original README file at https://github.com/javacc/javacc
* the documentation https://github.com/javacc/javacc/www
* an example README.md file from https://github.com/apache/flink
+* modified
-->
-# <a name="top"></a>JavaCC
+# JavaCC
[](https://maven-badges.herokuapp.com/maven-central/net.java.dev.javacc/javacc)
[](https://www.javadoc.io/doc/net.java.dev.javacc/javacc)
@@ -20,27 +21,27 @@ All you need to run a JavaCC parser, once generated, is a Java Runtime Environme
This README is meant as a brief overview of the core features and how to set things up to get yourself started with JavaCC. For a fully detailed documentation, please see [https://javacc.github.io/javacc/](https://javacc.github.io/javacc/).
-## <a name="toc"></a>Contents
+## Contents
- [Introduction](#introduction)
- * [Features](#features)
- * [Example](#example)
- * [Tutorials](docs/tutorials/index.md)
- * [FAQ](docs/faq.md)
+ * [Features](#features)
+ * [An example](#an-example)
+ * [Tutorials](docs/tutorials/index.md)
+ * [FAQ](docs/faq.md)
- [Getting Started](#getting-started)
- * [Download & Installation](#download)
- * [Building JavaCC from Source](#building-from-source)
- * [Developing JavaCC](#developing)
+ * [From the command line](#use-javacc-from-the-command-line)
+ * [Within an IDE](#use-javacc-within-an-ide)
+ * [Rebuilding JavaCC](#rebuilding-javacc)
- [Community](#community)
- * [Support](#support)
- * [Documentation](#documentation)
- * [Resources](#resources)
- * [Powered by JavaCC](#powered-by)
+ * [Support](#support)
+ * [Documentation](#documentation)
+ * [Resources](#resources)
+ * [Powered by JavaCC](#powered-by-javacc)
- [License](#license)
-## <a name="introduction"></a>Introduction
+## Introduction
-### <a name="features"></a>Features
+### Features
* JavaCC generates top-down ([recursive descent](https://en.wikipedia.org/wiki/Recursive_descent_parser)) parsers as opposed to bottom-up parsers generated by [YACC](https://en.wikipedia.org/wiki/Yacc)-like tools. This allows the use of more general grammars, although [left-recursion](https://en.wikipedia.org/wiki/Left_recursion) is disallowed. Top-down parsers have a number of other advantages (besides more general grammars) such as being easier to debug, having the ability to parse to any [non-terminal](https://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols) in the grammar, and also having the ability to pass values (attributes) both up and down the parse tree during parsing.
@@ -73,9 +74,9 @@ This README is meant as a brief overview of the core features and how to set thi
* The JavaCC release includes a wide range of examples including Java and HTML grammars. The examples, along with their documentation, are a great way to get acquainted with JavaCC.
-### <a name="example"></a>Example
+### An example
-This example recognizes matching braces followed by zero or more line terminators and then an end of file.
+The following JavaCC grammar example recognizes matching braces followed by zero or more line terminators and then an end of file.
Examples of legal strings in this grammar are:
@@ -85,7 +86,8 @@ Examples of illegal strings are:
`{}{}`, `}{}}`, `{ }`, `{x}` // ... etc
-#### Grammar
+##### Its grammar
+
```java
PARSER_BEGIN(Example)
@@ -117,12 +119,17 @@ void MatchedBraces() :
}
```
-#### Output
+##### Some executions and outputs
+
+###### {{}} gives no error
+
```java
$ java Example
{{}}<return>
```
+###### {x gives a Lexical error
+
```java
$ java Example
{x<return>
@@ -135,6 +142,8 @@ TokenMgrError: Lexical error at line 1, column 2. Encountered: "x" (120), after
at Example.main(Example.java:6)
```
+###### {{}} gives a ParseException
+
```java
$ java Example
{}}<return>
@@ -149,74 +158,52 @@ Was expecting one of:
at Example.main(Example.java:6)
```
-## <a name="getting-started"></a>Getting Started
+## Getting Started
-Follow the steps here to get started with JavaCC.
+You can use JavaCC either from the command line or through an IDE.
-This guide will walk you through locally building the project, running an existing example, and setup to start developing and testing your own JavaCC application.
+### Use JavaCC from the command line
-### <a name="download"></a>Download & Installation
+#### Download
-JavaCC 7.0.12 is our latest stable release.
+Download the latest stable release (at least the source and the binaries) in a so called download directory:
-* 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](docs/release-notes.md#javacc-7.0.12))
+* JavaCC 7.0.13 - ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.13.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.13.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13-javadoc.jar), [Release Notes](docs/release-notes.md#javacc-7.0.13))
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.
For all previous releases, please see [stable releases](docs/downloads.md).
-The GitHub 8.0 branch contains the next generation of JavaCC that splits the frontend -- the JavaCC parser -- from the backends -- the code generator targeted for Java, C++ &and C# --. Status of JavaCC is experimental and not production ready.
-
-#### <a name="installation"></a>Installation
-
-To install JavaCC, navigate to the download directory and type:
+#### Install
+Once you have downloaded the files, navigate to the download directory and unzip the source file, this creating a so called JavaCC installation directory:
```
-$ unzip javacc-7.0.12.zip
+$ unzip javacc-7.0.13.zip
or
-$ tar xvf javacc-7.0.12.tar.gz
+$ tar xvf javacc-7.0.13.tar.gz
```
-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.
+Then move the binary file `javacc-7.0.13.jar` under the download directory in a new `target/` directory under the installation directory, and rename it to `javacc.jar`.
-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:
+Then add the `scripts/` directory in the JavaCC installation directory 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.13/` directory:
```
chmod +x scripts/javacc
```
-### <a name="building-from-source"></a>Building JavaCC from Source
-
-The source contain the JavaCC, JJTree and JJDoc sources, launcher scripts, example grammars and documentation. It also contains a bootstrap version of JavaCC needed to build JavaCC.
-
-Prerequisites for building JavaCC:
-
-* Git
-* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
-* Maven
-* Java 8 (Java 9 and 10 are not yet supported)
-
-```
-$ git clone https://github.com/javacc/javacc.git
-$ cd javacc
-$ ant
-```
+#### Write your grammar and generate your parser
-This will build the `javacc.jar` file in the `target/` directory
+You can then create and edit a grammar file with your favorite text editor.
+Then use the appropriate script for generating your parser from your grammar.
-### <a name="developing"></a>Developing JavaCC
+### Use JavaCC within an IDE
-<!---
-The JavaCC committers use IntelliJ IDEA to develop the JavaCC codebase.
--->
Minimal requirements for an IDE are:
* Support for Java
* Support for Maven with Java
-
#### IntelliJ IDEA
The IntelliJ IDE supports Maven out of the box and offers a plugin for JavaCC development.
@@ -233,7 +220,6 @@ Check out our [Setting up IntelliJ](https://ci.apache.org/projects/flink/flink-d
* Eclipse download: [https://www.eclipse.org/ide/](https://www.eclipse.org/ide/)
* Eclipse JavaCC Plugin: [https://marketplace.eclipse.org/content/javacc-eclipse-plug](https://marketplace.eclipse.org/content/javacc-eclipse-plug)
-<!---
#### Maven
Add the following dependency to your `pom.xml` file.
@@ -242,7 +228,7 @@ Add the following dependency to your `pom.xml` file.
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
- <version>7.0.12</version>
+ <version>7.0.13</version>
</dependency>
```
@@ -259,18 +245,59 @@ repositories {
}
dependencies {
- compile group: 'net.java.dev.javacc', name: 'javacc', version: '7.0.12'
+ compile group: 'net.java.dev.javacc', name: 'javacc', version: '7.0.13'
}
```
--->
-## <a name="community"></a>Community
+### Rebuilding JavaCC
+
+#### From the source installation directory
+
+The source installation directory contains the JavaCC, JJTree and JJDoc sources, launcher scripts, example grammars and documentation, and also a bootstrap version of JavaCC needed to build JavaCC.
+
+Prerequisites for building JavaCC with this method:
+
+* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
+* Maven
+* Java 8 (Java 9 and 10 are not yet supported)
+
+Use the ant build script:
+
+```
+$ cd javacc
+$ ant
+```
+
+This will build the `javacc.jar` file in the `target/` directory
+
+#### After cloning the JavaCC GitHub repository
+
+This is the preferred method for contributing to JavaCC.
+
+Prerequisites for building JavaCC with this method:
+
+* Git
+* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
+* Maven
+* Java 8 (Java 9 and 10 are not yet supported)
+
+Just clone the repository and then use the ant build script:
+
+```
+$ git clone https://github.com/javacc/javacc.git
+$ cd javacc
+$ ant
+```
+
+This will build the `javacc.jar` file in the `target/` directory
+
+## Community
JavaCC is by far the most popular parser generator used with Java applications with an estimated user base of over 1,000 users and more than 100,000 downloads to date.
It is maintained by the [developer community](https://github.com/javacc/javacc/graphs/contributors) which includes the original authors and [Chris Ainsley](https://github.com/ainslec), [Tim Pizney](https://github.com/timp) and [Francis Andre](https://github.com/zosrothko).
-### <a name="support"></a>Support
+### Support
Don’t hesitate to ask!
@@ -280,38 +307,38 @@ Contact the developers and community on the [Google user group](https://groups.g
For questions relating to development please join our [Slack channel](https://javacc.slack.com/).
-### <a name="documentation"></a>Documentation
+### Documentation
The documentation of JavaCC is located on the website [https://javacc.github.io/javacc/](https://javacc.github.io/javacc/) and in the `docs/` directory of the source code on [GitHub](https://github.com/javacc/javacc).
It includes [detailed documentation](docs/documentation/index.md) for JavaCC, JJTree, and JJDoc.
-### <a name="resources"></a>Resources
+### Resources
-#### Books
+##### Books
* Dos Reis, Anthony J., Compiler Construction Using Java, JavaCC, and Yacc., Wiley-Blackwell 2012. ISBN 0-4709495-9-7 ([book](https://www.amazon.co.uk/Compiler-Construction-Using-Java-JavaCC/dp/0470949597), [pdf](https://doc.lagout.org/programmation/Java/Compiler%20Construction%20using%20Java%2C%20JavaCC%2C%20and%20YACC%20%5BReis%202011-12-20%5D.pdf)).
* Copeland, Tom, Generating Parsers with JavaCC., Centennial Books, 2007. ISBN 0-9762214-3-8 ([book](https://www.amazon.com/Generating-Parsers-JavaCC-Easy-Use/dp/0976221438)).
-#### Tutorials
+##### Tutorials
* JavaCC [tutorials](docs/tutorials/index.md).
* [Introduction to JavaCC](https://www.engr.mun.ca/~theo/JavaCC-Tutorial/javacc-tutorial.pdf) by Theodore S. Norvell.
* [Incorporating language processing into Java applications: a JavaCC tutorial](https://ieeexplore.ieee.org/document/1309649) by Viswanathan Kodaganallur.
-#### Articles
+##### Articles
* [Looking for lex and yacc for Java? You don't know Jack](https://www.javaworld.com/article/2077315/looking-for-lex-and-yacc-for-java--you-don-t-know-jack.html) by Chuck Mcmanis.
* [Build your own languages with JavaCC](https://www.javaworld.com/article/2076269/build-your-own-languages-with-javacc.html) by Oliver Enseling.
* [Writing an Interpreter Using JavaCC](https://anandsekar.github.io/writing-an-interpretter-using-javacc/) by Anand Rajasekar.
* [Building a lexical analyzer with JavaCC](http://kiwwito.com/build-a-lexical-analyzer-with-javacc/) by Keyvan Akbary.
-#### Parsing theory
+##### Parsing theory
* Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools, 2nd Edition, Addison-Wesley, 2006, ISBN 0-3211314-3-6 ([book](https://www.amazon.co.uk/Compilers-Principles-Techniques-Tools-2nd/dp/0321131436), [pdf](https://github.com/germanoa/compiladores/blob/master/doc/ebook/Compilers%20Principles%2C%20Techniques%2C%20and%20Tools%20-%202nd%20Edition%20-%20Alfred%20V.%20Aho.pdf)).
* Charles N. Fischer and Richard J. Leblanc, Jr., Crafting a Compiler with C., Pearson, 1991. ISBN 0-8053216-6-7 ([book](https://www.amazon.co.uk/Crafting-Compiler-Charles-N-Fischer/dp/0805321667)).
-### <a name="powered-by"></a>Powered by JavaCC
+### Powered by JavaCC
JavaCC is used in many commercial applications and open source projects.
@@ -330,7 +357,7 @@ User | Use Case
[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)
<!---
-## <a name="contributing"></a>Contributing
+## Contributing
This is an active open-source project. We are always open to people who want to use the system or contribute to it.
Contact us if you are looking for implementation tasks that fit your skills.
@@ -340,7 +367,7 @@ https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/
-->
-## <a name="license"></a>License
+## License
JavaCC is an open source project released under the [BSD License 2.0](LICENSE). The JavaCC project was originally developed at Sun Microsystems Inc. by [Sreeni Viswanadha](https://github.com/kaikalur) and [Sriram Sankar](https://twitter.com/sankarsearch).
@@ -348,6 +375,6 @@ JavaCC is an open source project released under the [BSD License 2.0](LICENSE).
---
-[Top](#top)
+[Top](#javacc)
<br>
=====================================
docs/_config.yml
=====================================
@@ -9,10 +9,10 @@ title: JavaCC
description: The most popular parser generator for use with Java applications.
# Latest release
-version: 7.0.11
+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.11.zip
- tar_url: https://github.com/javacc/javacc/archive/javacc-7.0.11.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
=====================================
docs/downloads.md
=====================================
@@ -4,13 +4,14 @@
### <a name="stable"></a>All stable releases
-N.B. LOOKAHEAD functionality is broken from version 7.0.5. It will be fixed in version 7.0.10 and upper. In the interim, if you require LOOKAHEAD functionality, please use version 7.0.4.
-
-JavaCC 7.0.12 is our latest stable release.
+JavaCC 7.0.13 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.
+(N.B. LOOKAHEAD functionality was broken from version 7.0.5 and fixed in version 7.0.10.)
+
#### 7.0.x
+* JavaCC 7.0.13 - 2023-11-09 ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.13.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.13.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13-javadoc.jar), [Release Notes](release-notes.md#javacc-7.0.13))
* 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))
=====================================
docs/faq.md
=====================================
@@ -2,92 +2,92 @@
---
-### <a name="toc"></a>Contents
+### </a>Contents
- [**General Information**](#general-information)
- * [What is JavaCC?](#question-1.1)
- * [What is JavaCC used for?](#question-1.2)
- * [Where can I get JavaCC?](#question-1.3)
- * [Is the source code and documentation for JavaCC publicly available?](#question-1.4)
- * [Where can I find books, articles, or tutorials on JavaCC?](#question-1.5)
- * [Are there publicly available grammars?](#question-1.6)
- * [Is there a user group or mailing list?](#question-1.7)
- * [Should I send my questions to the user group?](#question-1.8)
- * [Who wrote JavaCC and who maintains it?](#question-1.9)
+ * [What is JavaCC?](#what-is-javacc)
+ * [What is JavaCC used for?](#what-is-javacc-used-for)
+ * [Where can I get JavaCC?](#where-can-i-get-javacc)
+ * [Is the source code and documentation for JavaCC publicly available?](#is-the-source-code-and-documentation-for-javacc-publicly-available)
+ * [Where can I find books, articles, or tutorials on JavaCC?](#where-can-i-find-books-articles-or-tutorials-on-javacc)
+ * [Are there publicly available grammars?](#are-there-publicly-available-grammars)
+ * [Is there a user group or mailing list?](#is-there-a-user-group-or-mailing-list)
+ * [Should I send my questions to the user group?](#should-i-send-my-questions-to-the-user-group)
+ * [Who wrote JavaCC and who maintains it?](#who-wrote-javacc-and-who-maintains-it)
- [**Common Issues**](#common-issues)
- * [What files does JavaCC generate?](#question-2.1)
- * [Can I modify the generated files?](#question-2.2)
- * [I changed option X, why am I having trouble?](#question-2.3)
- * [How do I put the generated classes in a package?](#question-2.4)
- * [How do I use JavaCC with Ant?](#question-2.5)
- * [Can I use JavaCC with my IDE?](#question-2.6)
-- [**The Token Manager**](#token-manager)
- * [What is a token manager?](#question-3.1)
- * [Can I read from a String instead of a file?](#question-3.2)
- * [What if more than one regular expression matches a prefix of the remaining input?](#question-3.3)
- * [What if the chosen regular expression matches more than one prefix?](#question-3.4)
- * [What if no regular expression matches a prefix of the remaining input?](#question-3.5)
- * [How do I make a character sequence match more than one type of token?](#question-3.6)
- * [How do I match any character?](#question-3.7)
- * [Should I use (~[])+ to match an arbitrarily long sequence of characters?](#question-3.8)
- * [How do I match exactly n repetitions of a regular expression?](#question-3.9)
- * [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#question-3.10)
- * [What are lexical states?](#question-3.11)
- * [Can the parser force a switch to a new lexical state?](#question-3.12)
- * [Is there a way to make SwitchTo safer?](#question-3.13)
- * [What is MORE?](#question-3.14)
- * [Why do the example Java and C++ token managers report an error when the last line of a file is a single line comment?](#question-3.15)
- * [What is a lexical action?](#question-3.16)
- * [How do I tokenize nested comments?](#question-3.17)
- * [What is a common token action?](#question-3.18)
- * [How do I throw a ParseException instead of a TokenMgrError?](#question-3.19)
- * [Why are line and column numbers not recorded?](#question-3.20)
- * [Can I process Unicode?](#question-3.21)
-- [**The Parser and Lookahead**](#parser-and-lookahead)
- * [Where should I draw the line between lexical analysis and parsing?](#question-4.1)
- * [What is recursive descent parsing?](#question-4.2)
- * [What is left-recursion and why can't I use it?](#question-4.3)
- * [How do I match an empty sequence of tokens?](#question-4.4)
- * [What is "lookahead"?](#question-4.5)
- * [I get a message saying "Warning: Choice Conflict ... " what should I do?](#question-4.6)
- * [I added a LOOKAHEAD specification and the warning went away, does that mean I fixed the problem?](#question-4.7)
- * [Are nested syntactic lookahead specifications evaluated during syntactic lookahead?](#question-4.8)
- * [Are parameters passed during syntactic lookahead?](#question-4.9)
- * [Are semantic actions executed during syntactic lookahead?](#question-4.10)
- * [Is semantic lookahead evaluated during syntactic lookahead?](#question-4.11)
- * [Can local variables (including parameters) be used in semantic lookahead?](#question-4.12)
- * [How does JavaCC differ from standard LL(1) parsing?](#question-4.13)
- * [How do I communicate from the parser to the token manager?](#question-4.14)
- * [How do I communicate from the token manager to the parser?](#question-4.15)
- * [What does it mean to put a regular expression within a BNF production?](#question-4.16)
- * [When should regular expressions be put directly into a BNF production?](#question-4.17)
- * [How do I parse a sequence without allowing duplications?](#question-4.18)
- * [How do I deal with keywords that aren't reserved?](#question-4.19)
- * [There's an error in the input, so why doesn't my parser throw a ParseException?](#question-4.20)
+ * [What files does JavaCC generate?](#what-files-does-javacc-generate)
+ * [Can I modify the generated files?](#can-i-modify-the-generated-files)
+ * [I changed option X, why am I having trouble?](#i-changed-option-x-why-am-i-having-trouble)
+ * [How do I put the generated classes in a package?](#how-do-i-put-the-generated-classes-in-a-package)
+ * [How do I use JavaCC with Ant?](#how-do-i-use-javacc-with-ant)
+ * [Can I use JavaCC with my IDE?](#can-i-use-javacc-with-my-ide)
+- [**The Token Manager**](#the-token-manager)
+ * [What is a token manager?](#what-is-a-token-manager)
+ * [Can I read from a String instead of a file?](#can-i-read-from-a-string-instead-of-a-file)
+ * [What if more than one regular expression matches a prefix of the remaining input?](#what-if-more-than-one-regular-expression-matches-a-prefix-of-the-remaining-input)
+ * [What if the chosen regular expression matches more than one prefix?](#what-if-the-chosen-regular-expression-matches-more-than-one-prefix)
+ * [What if no regular expression matches a prefix of the remaining input?](#what-if-no-regular-expression-matches-a-prefix-of-the-remaining-input)
+ * [How do I make a character sequence match more than one type of token?](#how-do-i-make-a-character-sequence-match-more-than-one-type-of-token)
+ * [How do I match any character?](#how-do-i-match-any-character)
+ * [Should I use (~[])+ to match an arbitrarily long sequence of characters?](#should-i-use-to-match-an-arbitrarily-long-sequence-of-characters)
+ * [How do I match exactly n repetitions of a regular expression?](#how-do-i-match-exactly-n-repetitions-of-a-regular-expression)
+ * [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#what-are-token-skip-and-special_token)
+ * [What are lexical states?](#what-are-lexical-states)
+ * [Can the parser force a switch to a new lexical state?](#can-the-parser-force-a-switch-to-a-new-lexical-state)
+ * [Is there a way to make SwitchTo safer?](#is-there-a-way-to-make-switchto-safer)
+ * [What is MORE?](#what-is-more)
+ * [Why do the example Java and C++ token managers report an error when the last line of a file is a single line comment?](#why-do-the-example-java-and-c-token-managers-report-an-error-when-the-last-line-of-a-file-is-a-single-line-comment)
+ * [What is a lexical action?](#what-is-a-lexical-action)
+ * [How do I tokenize nested comments?](#how-do-i-tokenize-nested-comments)
+ * [What is a common token action?](#what-is-a-common-token-action)
+ * [How do I throw a ParseException instead of a TokenMgrError?](#how-do-i-throw-a-parseexception-instead-of-a-tokenmgrerror)
+ * [Why are line and column numbers not recorded?](#why-are-line-and-column-numbers-not-recorded)
+ * [Can I process Unicode?](#can-i-process-unicode)
+- [**The Parser and Lookahead**](#the-parser-and-lookahead)
+ * [Where should I draw the line between lexical analysis and parsing?](#where-should-i-draw-the-line-between-lexical-analysis-and-parsing)
+ * [What is recursive descent parsing?](#what-is-recursive-descent-parsing)
+ * [What is left-recursion and why can't I use it?](#what-is-left-recursion-and-why-can-t-i-use-it)
+ * [How do I match an empty sequence of tokens?](#how-do-i-match-an-empty-sequence-of-tokens)
+ * [What is "lookahead"?](#what-is-lookahead)
+ * [I get a message saying "Warning: Choice Conflict ... " what should I do?](#i-get-a-message-saying-warning-choice-conflict-what-should-i-do)
+ * [I added a LOOKAHEAD specification and the warning went away, does that mean I fixed the problem?](#i-added-a-lookahead-specification-and-the-warning-went-away-does-that-mean-i-fixed-the-problem)
+ * [Are nested syntactic lookahead specifications evaluated during syntactic lookahead?](#are-nested-syntactic-lookahead-specifications-evaluated-during-syntactic-lookahead)
+ * [Are parameters passed during syntactic lookahead?](#are-parameters-passed-during-syntactic-lookahead)
+ * [Are semantic actions executed during syntactic lookahead?](#are-semantic-actions-executed-during-syntactic-lookahead)
+ * [Is semantic lookahead evaluated during syntactic lookahead?](#is-semantic-lookahead-evaluated-during-syntactic-lookahead)
+ * [Can local variables (including parameters) be used in semantic lookahead?](#can-local-variables-including-parameters-be-used-in-semantic-lookahead)
+ * [How does JavaCC differ from standard LL(1) parsing?](#how-does-javacc-differ-from-standard-ll-1-parsing)
+ * [How do I communicate from the parser to the token manager?](#how-do-i-communicate-from-the-parser-to-the-token-manager)
+ * [How do I communicate from the token manager to the parser?](#how-do-i-communicate-from-the-parser-to-the-token-manager)
+ * [What does it mean to put a regular expression within a BNF production?](#what-does-it-mean-to-put-a-regular-expression-within-a-bnf-production)
+ * [When should regular expressions be put directly into a BNF production?](#when-should-regular-expressions-be-put-directly-into-a-bnf-production)
+ * [How do I parse a sequence without allowing duplications?](#how-do-i-parse-a-sequence-without-allowing-duplications)
+ * [How do I deal with keywords that aren't reserved?](#how-do-i-deal-with-keywords-that-aren-t-reserved)
+ * [There's an error in the input, so why doesn't my parser throw a ParseException?](#there-s-an-error-in-the-input-so-why-doesn-t-my-parser-throw-a-parseexception)
- [**Semantic Actions**](#semantic-actions)
- * [I've written a parser, why doesn't it do anything?](#question-5.1)
- * [How do I capture and traverse a sequence of tokens?](#question-5.2)
- * [Why does my parser use so much space?](#question-5.3)
+ * [I've written a parser, why doesn't it do anything?](#i-ve-written-a-parser-why-doesn-t-it-do-anything)
+ * [How do I capture and traverse a sequence of tokens?](#how-do-i-capture-and-traverse-a-sequence-of-tokens)
+ * [Why does my parser use so much space?](#why-does-my-parser-use-so-much-space)
- [**JJTree and JTB**](#jjtree-and-jtb)
- * [What are JJTree and JTB?](#question-6.1)
- * [Where can I get JJTree?](#question-6.2)
- * [Where can I get JTB?](#question-6.3)
+ * [What are JJTree and JTB?](#what-are-jjtree-and-jtb)
+ * [Where can I get JJTree?](#where-can-i-get-jjtree)
+ * [Where can I get JTB?](#where-can-i-get-jtb)
- [**Applications of JavaCC**](#applications-of-javacc)
- * [Where can I find a parser for X?](#question-7.1)
- * [How do I parse arithmetic expressions?](#question-7.2)
- * [I'm writing a programming language interpreter, how do I deal with loops?](#question-7.3)
-- [**Comparing JavaCC**](#comparing-javacc)
- * [Since LL(1) ⊂ LALR(1), wouldn't a tool based on LALR parsing be better?](#question-8.1)
- * [How does JavaCC compare with Lex and Flex?](#question-8.2)
- * [How does JavaCC compare with other Yacc and Bison?](#question-8.3)
-- [**Footnotes**](#footnotes)
+ * [Where can I find a parser for X?](#where-can-i-find-a-parser-for-x)
+ * [How do I parse arithmetic expressions?](#how-do-i-parse-arithmetic-expressions)
+ * [I'm writing a programming language interpreter, how do I deal with loops?](#i-m-writing-a-programming-language-interpreter-how-do-i-deal-with-loops)
+- [**Comparing JavaCC**](#comparing-javacc-with-other-tools)
+ * [Since LL(1) ⊂ LALR(1), wouldn't a tool based on LALR parsing be better?](#since-ll-1-lalr-1-wouldn-t-a-tool-based-on-lalr-parsing-be-better)
+ * [How does JavaCC compare with Lex and Flex?](#how-does-javacc-compare-with-lex-and-flex)
+ * [How does JavaCC compare with other Yacc and Bison?](#how-does-javacc-compare-with-other-yacc-and-bison)
+- [**Footnotes**](footnotes)
- [**Acknowledgments**](#acknowledgments)
<br>
-## <a name="general-information"></a>General Information
+## General Information
-### <a name="question-1.1"></a>What is JavaCC?
+### What is JavaCC?
---
@@ -117,7 +117,7 @@ The user defines a collection of *Extended BNF production rules* that JavaCC use
<br>
-### <a name="question-1.2"></a>What is JavaCC used for?
+### What is JavaCC used for?
---
@@ -142,7 +142,7 @@ JavaCC has been used to create many types of parsers based on formal and proprie
<br>
-### <a name="question-1.3"></a>Where can I get JavaCC?
+### Where can I get JavaCC?
---
@@ -150,7 +150,7 @@ JavaCC is available from [https://javacc.github.io/javacc/](https://javacc.githu
<br>
-### <a name="question-1.4"></a>Is the source code and documentation for JavaCC publicly available?
+### Is the source code and documentation for JavaCC publicly available?
---
@@ -162,7 +162,7 @@ JavaCC is redistributable and there are essentially no restrictions on the use o
<br>
-### <a name="question-1.5"></a>Where can I find books, articles, or tutorials on JavaCC?
+### Where can I find books, articles, or tutorials on JavaCC?
---
@@ -191,7 +191,7 @@ JavaCC is redistributable and there are essentially no restrictions on the use o
<br>
-### <a name="question-1.6"></a>Are there publicly available grammars?
+### Are there publicly available grammars?
---
@@ -199,7 +199,7 @@ Yes. Please see the [example grammars](tutorials/examples.md#examples) and the J
<br>
-### <a name="question-1.7"></a>Is there a user group or mailing list?
+### Is there a user group or mailing list?
---
@@ -209,7 +209,7 @@ If you found a bug in JavaCC, please [open an issue](https://github.com/javacc/j
<br>
-### <a name="question-1.8"></a>Should I send my questions to the user group?
+### Should I send my questions to the user group?
---
@@ -223,7 +223,7 @@ General questions on parser generation or parsing theory should be addressed to
<br>
-### <a name="question-1.9"></a>Who wrote JavaCC and who maintains it?
+### Who wrote JavaCC and who maintains it?
---
@@ -233,9 +233,9 @@ It is maintained by the [developer community](https://github.com/javacc/javacc/g
<br>
-## <a name="common-issues"></a>Common Issues
+## Common Issues
-### <a name="question-2.1"></a>What files does JavaCC generate?
+### What files does JavaCC generate?
---
@@ -270,12 +270,12 @@ Similarly, the option `USER_TOKEN_MANAGER` will cause the generation of an inter
The boilerplate files will only be produced if they don't already exist. There are two important consequences:
-1. If you make any changes that might require changes to these files, you should delete them prior to running JavaCC (see [I changed option X, why am I having trouble?](#question-2.3)).
-2. If you really want to, you can modify these files and be sure that JavaCC won't overwrite them (see [Can I modify the generated files?](#question-2.2)).
+1. If you make any changes that might require changes to these files, you should delete them prior to running JavaCC (see [I changed option X, why am I having trouble?](#i-changed-option-x-why-am-i-having-trouble)).
+2. If you really want to, you can modify these files and be sure that JavaCC won't overwrite them (see [Can I modify the generated files?](#can-i-modify-the-generated-files)).
<br>
-### <a name="question-2.2"></a>Can I modify the generated files?
+### Can I modify the generated files?
---
@@ -287,15 +287,15 @@ The custom files (`XXX.java`, `XXXTokenManager.java`, and `XXXConstants.java`) a
<br>
-### <a name="question-2.3"></a>I changed option X, why am I having trouble?
+### I changed option X, why am I having trouble?
---
-This issue usually comes up when the `STATIC` option is changed - JavaCC needs to generate new files, but it will not generate boilerplate files unless they aren't there already. Try deleting all files generated by JavaCC (see [What files does JavaCC generate?](#question-2.1)) and then re-running JavaCC.
+This issue usually comes up when the `STATIC` option is changed - JavaCC needs to generate new files, but it will not generate boilerplate files unless they aren't there already. Try deleting all files generated by JavaCC (see [What files does JavaCC generate?](#what-files-does-javacc-generate)) and then re-running JavaCC.
<br>
-### <a name="question-2.4"></a>How do I put the generated classes in a package?
+### How do I put the generated classes in a package?
---
@@ -303,7 +303,7 @@ Put a package declaration right after the `PARSER_BEGIN(XXX)` declaration in the
<br>
-### <a name="question-2.5"></a>How do I use JavaCC with Ant?
+### How do I use JavaCC with Ant?
---
@@ -363,7 +363,7 @@ A complete `build.xml` file is as follows:
<br>
-### <a name="question-2.6"></a>Can I use JavaCC with my IDE?
+### Can I use JavaCC with my IDE?
---
@@ -381,9 +381,9 @@ The IntelliJ IDE supports Ant and Maven out of the box and offers a plugin for J
<br>
-## <a name="token-manager"></a>The Token Manager
+## The Token Manager
-### <a name="question-3.1"></a>What is a token manager?
+### What is a token manager?
---
@@ -429,7 +429,7 @@ This sequence of `Token` objects is produced based on regular expressions define
<br>
-### <a name="question-3.2"></a>Can I read from a String instead of a file?
+### Can I read from a String instead of a file?
---
@@ -457,7 +457,7 @@ public class MyApp {
<br>
-### <a name="question-3.3"></a>What if more than one regular expression matches a prefix of the remaining input?
+### What if more than one regular expression matches a prefix of the remaining input?
---
@@ -532,7 +532,7 @@ In this case the KWINT production is preferred (by Rule 3) because it comes firs
<br>
-### <a name="question-3.4"></a>What if the chosen regular expression matches more than one prefix?
+### What if the chosen regular expression matches more than one prefix?
---
@@ -540,7 +540,7 @@ Then the longest prefix is used. That is, the token's image will be the longest
<br>
-### <a name="question-3.5"></a>What if no regular expression matches a prefix of the remaining input?
+### What if no regular expression matches a prefix of the remaining input?
---
@@ -548,7 +548,7 @@ If the remaining input is empty, an `EOF` token is generated. Otherwise, a `Toke
<br>
-### <a name="question-3.6"></a>How do I make a character sequence match more than one type of token?
+### How do I make a character sequence match more than one type of token?
---
@@ -565,7 +565,7 @@ TOKEN : {
you might expect the token manager to interpret `y` as an `A` if the parser *expects* an `A` and as a `B` if the parser *expects* a `B`.
-This is not how JavaCC works<sup>[3](#footnote-3)</sup>. As discussed previously, the first match wins (see [What if more than one regular expression matches a prefix of the remaining input?](#question-3.3)).
+This is not how JavaCC works<sup>[3](#footnote-3)</sup>. As discussed previously, the first match wins (see [What if more than one regular expression matches a prefix of the remaining input?](#what-if-more-than-one-regular-expression-matches-a-prefix-of-the-remaining-input)).
So what do you do? Let's consider the more general situation where `a` and `b` are regular expressions, and we have the following token definitions:
@@ -659,11 +659,11 @@ This idea can be generalized to any number of overlapping sets.
There are two other approaches that might also be tried - one involves lexical states and the other involves semantic actions.
-All three approaches are discussed in [How do I deal with keywords that aren't reserved?](#question-4.19) which considers a special case of the problem discussed here.
+All three approaches are discussed in [How do I deal with keywords that aren't reserved?](#how-do-i-deal-with-keywords-that-aren-t-reserved) which considers a special case of the problem discussed here.
<br>
-### <a name="question-3.7"></a>How do I match any character?
+### How do I match any character?
---
@@ -671,11 +671,11 @@ Use `~[]`.
<br>
-### <a name="question-3.8"></a>Should I use (~[])+ to match an arbitrarily long sequence of characters?
+### Should I use (~[])+ to match an arbitrarily long sequence of characters?
---
-You might be tempted to use `(~[])+`. This will match all characters up to the end of the file provided there are more than zero, which is likely not what you want (see [What if the chosen regular expression matches more than one prefix?](#question-3.4)). Usually, what you really want is to match all characters up to either the end of the file or some stopping point.
+You might be tempted to use `(~[])+`. This will match all characters up to the end of the file provided there are more than zero, which is likely not what you want (see [What if the chosen regular expression matches more than one prefix?](#what-if-the-chosen-regular-expression-matches-more-than-one-prefix)). Usually, what you really want is to match all characters up to either the end of the file or some stopping point.
Consider a scripting language in which scripts are embedded in an otherwise uninterpreted text file set off by `" < < "` and `" > > "` tokens. Between the start of the file or a `" > > "` and the next `" < < "` or the end of file we need to match an arbitrarily long sequence that does not contain two `" < "` characters in a row.
@@ -685,7 +685,7 @@ We could use a regular expression:
(~[" < "]| " < "~[" < "])+
```
-We don't want to match this regular expression within a script and so we would use lexical states to separate tokenizing within scripts from tokenizing outside of scripts (see [What are lexical states?](#question-3.11)).
+We don't want to match this regular expression within a script and so we would use lexical states to separate tokenizing within scripts from tokenizing outside of scripts (see [What are lexical states?](#what-are-lexical-states)).
A simpler method uses `~[]` and moves the repetition up to the grammar level. Note that the `TEXT` tokens are all exactly one character long.
@@ -723,7 +723,7 @@ void text() : {}
<br>
-### <a name="question-3.9"></a>How do I match exactly n repetitions of a regular expression?
+### How do I match exactly n repetitions of a regular expression?
---
@@ -745,7 +745,7 @@ Note that this syntax is implemented essentially as a macro, so `(X){3}` is impl
<br>
-### <a name="question-3.10"></a>What are TOKEN, SKIP, and SPECIAL_TOKEN?
+### What are TOKEN, SKIP, and SPECIAL_TOKEN?
---
@@ -754,11 +754,11 @@ Regular expression productions are classified as one of four types:
1. `TOKEN` means that when the production is applied, a `Token` object should be created and passed to the parser.
2. `SKIP` means that when the production is applied, no `Token` object should be constructed.
3. `SPECIAL_TOKEN` means that when the production is applied a `Token` object should be created but it should not be passed to the parser. Each of these *special tokens* can be accessed from the next `Token` produced (whether special or not), via its `specialToken` field.
-4. `MORE` is discussed in [What is MORE?](#question-3.14).
+4. `MORE` is discussed in [What is MORE?](#what-is-more).
<br>
-### <a name="question-3.11"></a>What are lexical states?
+### What are lexical states?
---
@@ -832,11 +832,11 @@ Assuming that there are no occurrences of `*/` later in the file, this is an err
If we use the lexical states approach then the behaviour is different (although again incorrect) as the comment will be skipped - an `EOF` token will be produced after the token for `j` and no error will be reported by the token manager<sup>[5](#footnote-5)</sup>.
-We can correct the lexical states approach with the use of `MORE` (see [What is MORE?](#question-3.14)).
+We can correct the lexical states approach with the use of `MORE` (see [What is MORE?](#what-is-more)).
<br>
-### <a name="question-3.12"></a>Can the parser force a switch to a new lexical state?
+### Can the parser force a switch to a new lexical state?
---
@@ -858,7 +858,7 @@ If you ever feel tempted to call `SwitchTo` from the parser, stop and try to thi
<br>
-### <a name="question-3.13"></a>Is there a way to make SwitchTo safer?
+### Is there a way to make SwitchTo safer?
---
@@ -1247,17 +1247,17 @@ public final class BackupCharStream implements CharStream {
<br>
-### <a name="question-3.14"></a>What is MORE?
+### What is MORE?
---
-Regular expression productions are classified as one of four types (`TOKEN`, `SKIP`, and `SPECIAL_TOKEN` are discussed in [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#question-3.10)).
+Regular expression productions are classified as one of four types (`TOKEN`, `SKIP`, and `SPECIAL_TOKEN` are discussed in [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#what-are-token-skip-and-special_token)).
`MORE` means that no token should be produced yet - instead, the characters matched will form part of the next token to be recognized. `MORE` means that there will be more to the token. After a sequence of one or more `MORE` productions have been applied, we must reach a production that is marked `TOKEN`, `SKIP`, `SPECIAL_TOKEN`. The token produced (or not produced in the case of `SKIP`) will contain the saved up characters from the preceding `MORE` productions.
Note that if the end of the input is encountered when the token manager is looking for more of a token, then a `TokenMgrError` is thrown. The assumption made by JavaCC is that the `EOF` token should correspond exactly to the end of the input, not to some characters leading up to the end of the input.
-Let's revisit and fix the comment example from [What are lexical states?](#question-3.11). The problem was that unterminated comments were simply skipped rather than producing an error. We can correct this problem using `MORE` productions to combine the entire comment into a single token.
+Let's revisit and fix the comment example from [What are lexical states?](#what-are-lexical-states). The problem was that unterminated comments were simply skipped rather than producing an error. We can correct this problem using `MORE` productions to combine the entire comment into a single token.
```java
// when /* is seen in the DEFAULT state, skip it and switch to the IN_COMMENT state
@@ -1280,7 +1280,7 @@ Suppose that a file ends with `/*a`. Then no token can be recognized because the
<br>
-### <a name="question-3.15"></a>Why do the example Java and C++ token managers report an error when the last line of a file is a single line comment?
+### Why do the example Java and C++ token managers report an error when the last line of a file is a single line comment?
---
@@ -1316,7 +1316,7 @@ SPECIAL_TOKEN : {
<br>
-### <a name="question-3.16"></a>What is a lexical action?
+### What is a lexical action?
---
@@ -1332,15 +1332,15 @@ TOKEN : {
The Java statement `{ tabcount += 1; }` will be executed after the production is applied.
-Keep in mind that the token manager may be significantly ahead of the parser (owing to syntactic lookahead), so using lexical actions to communicate from the token manager to the parser requires care (see [How do I communicate from the token manager to the parser?](#question-4.15)).
+Keep in mind that the token manager may be significantly ahead of the parser (owing to syntactic lookahead), so using lexical actions to communicate from the token manager to the parser requires care (see [How do I communicate from the token manager to the parser?](#how-do-i-communicate-from-the-parser-to-the-token-manager)).
<br>
-### <a name="question-3.17"></a>How do I tokenize nested comments?
+### How do I tokenize nested comments?
---
-The answer lies in the fact that you can use `SwitchTo` in a lexical action (see [Can the parser force a switch to a new lexical state?](#question-3.12) and [What is a lexical action?](#question-3.16)). This technique might be useful for a number of things, but the example that keeps coming up is nested comments.
+The answer lies in the fact that you can use `SwitchTo` in a lexical action (see [Can the parser force a switch to a new lexical state?](#can-the-parser-force-a-switch-to-a-new-lexical-state) and [What is a lexical action?](#what-is-a-lexical-action)). This technique might be useful for a number of things, but the example that keeps coming up is nested comments.
Consider a language where comment start with `(*` and end with `*)` but can be nested so that:
@@ -1399,11 +1399,11 @@ For this problem only a counter was required. For more complex problems one migh
<br>
-### <a name="question-3.18"></a>What is a common token action?
+### What is a common token action?
---
-A common token action is simply a subroutine that is called after each token is matched. Note that this does not apply to *skipped tokens* nor to *special tokens* (see [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#question-3.10)).
+A common token action is simply a subroutine that is called after each token is matched. Note that this does not apply to *skipped tokens* nor to *special tokens* (see [What are TOKEN, SKIP, and SPECIAL_TOKEN?](#what-are-token-skip-and-special_token)).
Use
@@ -1426,7 +1426,7 @@ TOKEN_MGR_DECLS : {
<br>
-### <a name="question-3.19"></a>How do I throw a ParseException instead of a TokenMgrError?
+### How do I throw a ParseException instead of a TokenMgrError?
---
@@ -1443,7 +1443,7 @@ However, this may not do the trick - if you use `MORE`, it may be hard to avoid
<br>
-### <a name="question-3.20"></a>Why are line and column numbers not recorded?
+### Why are line and column numbers not recorded?
---
@@ -1451,7 +1451,7 @@ Since version 2.1 you have the option that the line and column numbers will not
<br>
-### <a name="question-3.21"></a>Can I process Unicode?
+### Can I process Unicode?
---
@@ -1497,9 +1497,9 @@ Since JavaCC 4.0 there are constructors that take an encoding as an argument.
<br>
-## <a name="parser-and-lookahead"></a>The Parser and Lookahead
+## The Parser and Lookahead
-### <a name="question-4.1"></a>Where should I draw the line between lexical analysis and parsing?
+### Where should I draw the line between lexical analysis and parsing?
---
@@ -1507,7 +1507,7 @@ This question is dependent on the application. A lot of simple applications only
<br>
-### <a name="question-4.2"></a>What is recursive descent parsing?
+### What is recursive descent parsing?
---
@@ -1521,7 +1521,7 @@ The actual prefix matched is not arbitrary but is determined by the rules of Jav
<br>
-### <a name="question-4.3"></a>What is left-recursion and why can't I use it?
+### What is left-recursion and why can't I use it?
---
@@ -1582,7 +1582,7 @@ where `A1` is a new production. General methods for left-recursion removal can b
<br>
-### <a name="question-4.4"></a>How do I match an empty sequence of tokens?
+### How do I match an empty sequence of tokens?
---
@@ -1610,7 +1610,7 @@ The former production is useful if there is a semantic action associated with th
<br>
-### <a name="question-4.5"></a>What is "lookahead"?
+### What is "lookahead"?
---
@@ -1620,7 +1620,7 @@ The following questions of the FAQ address some common problems and misconceptio
<br>
-### <a name="question-4.6"></a>I get a message saying "Warning: Choice Conflict ... " what should I do?
+### I get a message saying "Warning: Choice Conflict ... " what should I do?
---
@@ -1772,7 +1772,7 @@ If you get a warning, first try rewriting the grammar so that a lookahead of `1`
<br>
-### <a name="question-4.7"></a>I added a LOOKAHEAD specification and the warning went away, does that mean I fixed the problem?
+### I added a LOOKAHEAD specification and the warning went away, does that mean I fixed the problem?
---
@@ -1793,7 +1793,7 @@ Clearly the lookahead is insufficient (`LOOKAHEAD (3)` would do the trick), but
<br>
-### <a name="question-4.8"></a>Are nested syntactic lookahead specifications evaluated during syntactic lookahead?
+### Are nested syntactic lookahead specifications evaluated during syntactic lookahead?
---
@@ -1886,7 +1886,7 @@ In some cases to accomplish this you can put the *longer* choice first (that is,
<br>
-### <a name="question-4.9"></a>Are parameters passed during syntactic lookahead?
+### Are parameters passed during syntactic lookahead?
---
@@ -1894,7 +1894,7 @@ No.
<br>
-### <a name="question-4.10"></a>Are semantic actions executed during syntactic lookahead?
+### Are semantic actions executed during syntactic lookahead?
---
@@ -1902,7 +1902,7 @@ No.
<br>
-### <a name="question-4.11"></a>Is semantic lookahead evaluated during syntactic lookahead?
+### Is semantic lookahead evaluated during syntactic lookahead?
---
@@ -1910,7 +1910,7 @@ Yes. It is also evaluated during evaluation of `LOOKAHEAD( n )` for `n > 1`.
<br>
-### <a name="question-4.12"></a>Can local variables (including parameters) be used in semantic lookahead?
+### Can local variables (including parameters) be used in semantic lookahead?
---
@@ -1924,7 +1924,7 @@ This is a case of three rights not making a right! It is right that semantic loo
<br>
-### <a name="question-4.13"></a>How does JavaCC differ from standard LL(1) parsing?
+### How does JavaCC differ from standard LL(1) parsing?
---
@@ -1932,7 +1932,7 @@ First of all, JavaCC is more flexible. It lets you use multi-token lookahead, sy
<br>
-### <a name="question-4.14"></a>How do I communicate from the parser to the token manager?
+### How do I communicate from the parser to the token manager?
---
@@ -1969,7 +1969,7 @@ The lookahead will fail since the semantic action putting `T` in the symbol tabl
<br>
-### <a name="question-4.15"></a>How do I communicate from the token manager to the parser?
+### How do I communicate from the token manager to the parser?
---
@@ -1981,7 +1981,7 @@ Another solution is to use a table. For example, in dealing with `#line` directi
<br>
-### <a name="question-4.16"></a>What does it mean to put a regular expression within a BNF production?
+### What does it mean to put a regular expression within a BNF production?
---
@@ -2040,15 +2040,15 @@ In general terms, when a regular expression is a Java string and identical to a
When a regular expression is a Java string but there is no corresponding regular expression production, then JavaCC essentially makes up a corresponding regular expression production. This is shown by the `def` which becomes an anonymous regular expression production. Note that all occurrences of the same string end up represented by a single regular expression production.
-Finally, consider the two occurrences of the complex regular expression `< (["0"-"9"])+ >`. Each one is turned into a different regular expression production. This spells trouble, as the `ANON2` regular expression production will never succeed (see [What if more than one regular expression matches a prefix of the remaining input?](#question-3.3) and [When should regular expressions be put directly into a BNF production?](#question-4.17)).
+Finally, consider the two occurrences of the complex regular expression `< (["0"-"9"])+ >`. Each one is turned into a different regular expression production. This spells trouble, as the `ANON2` regular expression production will never succeed (see [What if more than one regular expression matches a prefix of the remaining input?](#what-if-more-than-one-regular-expression-matches-a-prefix-of-the-remaining-input) and [When should regular expressions be put directly into a BNF production?](#when-should-regular-expressions-be-put-directly-into-a-bnf-production)).
<br>
-### <a name="question-4.17"></a>When should regular expressions be put directly into a BNF production?
+### When should regular expressions be put directly into a BNF production?
---
-If you haven't already, it is worth reading [What does it mean to put a regular expression within a BNF production?](#question-4.16).
+If you haven't already, it is worth reading [What does it mean to put a regular expression within a BNF production?](#what-does-it-mean-to-put-a-regular-expression-within-a-bnf-production).
For regular expressions that are simply strings, you might as well put them directly into the BNF productions, and not bother with defining them in a regular expression production<sup>[8](#footnote-8)</sup>.
@@ -2098,11 +2098,11 @@ void letter_number_letters() : {
}
```
-and it might be easier to see the error. On a string like `z7d` the token manager will find a `LETTER`, a `NUMBER` and then another `LETTER` - the BNF production can not succeed (see [What if more than one regular expression matches a prefix of the remaining input?](#question-3.3)).
+and it might be easier to see the error. On a string like `z7d` the token manager will find a `LETTER`, a `NUMBER` and then another `LETTER` - the BNF production can not succeed (see [What if more than one regular expression matches a prefix of the remaining input?](#what-if-more-than-one-regular-expression-matches-a-prefix-of-the-remaining-input)).
<br>
-### <a name="question-4.18"></a>How do I parse a sequence without allowing duplications?
+### How do I parse a sequence without allowing duplications?
---
@@ -2171,7 +2171,7 @@ If you use the second version of `abc` then the first choice is taken, since syn
<br>
-### <a name="question-4.19"></a>How do I deal with keywords that aren't reserved?
+### How do I deal with keywords that aren't reserved?
---
@@ -2185,7 +2185,7 @@ if if = then then then = else ; else else = if ;
Sometimes you want `if`, `then`, and `else` to act like keywords and sometimes like identifiers.
-This is a special case of a more general problem discussed in [How do I make a character sequence match more than one type of token?](#question-3.6).
+This is a special case of a more general problem discussed in [How do I make a character sequence match more than one type of token?](#how-do-i-make-a-character-sequence-match-more-than-one-type-of-token).
For a more modern example - parsing URLs - we might want to treat the word `http` as a keyword, but we don't want to prevent it being used as a host name or a path segment.
@@ -2207,7 +2207,7 @@ void host() : {} {
}
```
-Both the regular expressions labelled `HTTP` and `LABEL`, match the string `http`. As covered in [What if more than one regular expression matches a prefix of the remaining input?](#question-3.3) the first rule will be chosen, therefore the URL `http://www.http.org/` will not be accepted by the grammar.
+Both the regular expressions labelled `HTTP` and `LABEL`, match the string `http`. As covered in [What if more than one regular expression matches a prefix of the remaining input?](#what-if-more-than-one-regular-expression-matches-a-prefix-of-the-remaining-input) the first rule will be chosen, therefore the URL `http://www.http.org/` will not be accepted by the grammar.
So what can you do? There are basically three strategies:
@@ -2246,7 +2246,7 @@ The added semantic lookahead ensures that the URL really begins with a `LABEL` w
3. Use lexical states.
-The idea here is to use a different lexical state when the word is reserved and when it isn't (see [What are lexical states?](#question-3.11)).
+The idea here is to use a different lexical state when the word is reserved and when it isn't (see [What are lexical states?](#what-are-lexical-states)).
We can make `http` reserved in the default lexical state, but not reserved when a label is expected. In the example this is easy because it is clear when a label is expected - after a `//` and after a `.`<sup>[10](#footnote-10)</sup>. Therefore we can refactor the regular expression productions as:
@@ -2278,7 +2278,7 @@ void host() : {} {
<br>
-### <a name="question-4.20"></a>There's an error in the input, so why doesn't my parser throw a ParseException?
+### There's an error in the input, so why doesn't my parser throw a ParseException?
---
@@ -2286,9 +2286,9 @@ You may have omitted the `< EOF >` in the production for your start non-terminal
<br>
-## <a name="semantic-actions"></a>Semantic Actions
+## Semantic Actions
-### <a name="question-5.1"></a>I've written a parser, why doesn't it do anything?
+### I've written a parser, why doesn't it do anything?
---
@@ -2296,7 +2296,7 @@ You need to add semantic actions. Semantic actions are bits of Java code that ge
<br>
-### <a name="question-5.2"></a>How do I capture and traverse a sequence of tokens?
+### How do I capture and traverse a sequence of tokens?
---
@@ -2388,7 +2388,7 @@ If you want to capture and print a whole file, don't forget about the special to
<br>
-### <a name="question-5.3"></a>Why does my parser use so much space?
+### Why does my parser use so much space?
---
@@ -2417,9 +2417,9 @@ That token has a `next` field that points to the next token and that one has a `
<br>
-## <a name="jjtree-and-jtb"></a>JJTree and JTB
+## JJTree and JTB
-### <a name="question-6.1"></a>What are JJTree and JTB?
+### What are JJTree and JTB?
---
@@ -2427,25 +2427,25 @@ These are preprocessors that produce `.jj` files. The `.jj` files produced will
<br>
-### <a name="question-6.2"></a>Where can I get JJTree?
+### Where can I get JJTree?
---
-JJTree comes with JavaCC (see [Where can I get JavaCC?](#question-1.3)).
+JJTree comes with JavaCC (see [Where can I get JavaCC?](#where-can-i-get-javacc)).
<br>
-### <a name="question-6.3"></a>Where can I get JTB?
+### Where can I get JTB?
---
-Please see the [Java Tree Builder](http://compilers.cs.ucla.edu/jtb/) website.
+Please see the [Java Tree Builder](https://github.com/jtb-javacc/JTB) website.
<br>
-## <a name="applications-of-javacc"></a>Applications of JavaCC
+## Applications of JavaCC
-### <a name="question-7.1"></a>Where can I find a parser for X?
+### Where can I find a parser for X?
---
@@ -2454,7 +2454,7 @@ Please see the [example grammars](tutorials/examples.md#examples) and the JavaCC
<br>
-### <a name="question-7.2"></a>How do I parse arithmetic expressions?
+### How do I parse arithmetic expressions?
---
@@ -2464,7 +2464,7 @@ See Parsing Expressions by Recursive Descent and a tutorial by Theodore Norvell.
<br>
-### <a name="question-7.3"></a>I'm writing a programming language interpreter, how do I deal with loops?
+### I'm writing a programming language interpreter, how do I deal with loops?
---
@@ -2472,13 +2472,13 @@ Lots of users who want to write an interpreter for a programming language like t
It's a sensible idea, but JavaCC will not make this approach easy. It may be easier to translate to an intermediate code during parsing and then execute the intermediate code. A tree makes a convenient intermediate code. Consider using JJTree or JTB (see [JJTree and JTB](#jjtree-and-jtb)).
-If you still want to back up the token manager, you can tokenize the entire file to capture the tokens in a list (see [How do I capture and traverse a sequence of tokens?](#question-5.2)) or, better still, a vector. Then write a custom token manager that delivers this captured sequence of tokens, and allows backing up.
+If you still want to back up the token manager, you can tokenize the entire file to capture the tokens in a list (see [How do I capture and traverse a sequence of tokens?](#how-do-i-capture-and-traverse-a-sequence-of-tokens)) or, better still, a vector. Then write a custom token manager that delivers this captured sequence of tokens, and allows backing up.
<br>
-## <a name="comparing-javacc"></a>Comparing JavaCC with other tools
+## Comparing JavaCC with other tools
-### <a name="question-8.1"></a>Since LL(1) ⊂ LALR(1), wouldn't a tool based on LALR parsing be better?
+### Since LL(1) ⊂ LALR(1), wouldn't a tool based on LALR parsing be better?
---
@@ -2498,7 +2498,7 @@ Experienced users ignore this result. Both users of `LALR(1)` based parser gener
<br>
-### <a name="question-8.2"></a>How does JavaCC compare with Lex and Flex?
+### How does JavaCC compare with Lex and Flex?
---
@@ -2530,7 +2530,7 @@ However, JavaCC does have some nice features that Lex and Flex lack:
<br>
-### <a name="question-8.3"></a>How does JavaCC compare with other Yacc and Bison?
+### How does JavaCC compare with other Yacc and Bison?
---
@@ -2572,31 +2572,31 @@ If your language is totally unsuitable for top-down parsing, you'll be happier w
<br>
-## <a name="footnotes"></a>Footnotes
+## Footnotes
-1. <a name="footnote-1"></a>Another way of looking at it is that JavaCC is of little help in this regard. However, if you want to produce trees there are two tools (based on JavaCC) that are less flexible and more helpful - these are JJTree and JTB (see [JJTree and JTB](#jjtree-and-jtb)).
+1. <a id="footnote-1">Another way of looking at it is that JavaCC is of little help in this regard. However, if you want to produce trees there are two tools (based on JavaCC) that are less flexible and more helpful - these are JJTree and JTB (see [JJTree and JTB](#jjtree-and-jtb)).</a>
-2. <a name="footnote-2"></a>JavaCC's terminology here is a bit unusual. The conventional name for what JavaCC calls a *token type* is *terminal* and the set of all token types is the *alphabet* of the EBNF grammar.
+2. <a id="footnote-2">JavaCC's terminology here is a bit unusual. The conventional name for what JavaCC calls a *token type* is *terminal* and the set of all token types is the *alphabet* of the EBNF grammar.</a>
-3. <a name="footnote-3"></a>This idea leaves some open questions. What should the token manager do if the parser would accept either an `A` or a `B`? How do we write a parser for a language with reserved words?
+3. <a id="footnote-3">This idea leaves some open questions. What should the token manager do if the parser would accept either an `A` or a `B`? How do we write a parser for a language with reserved words?</a>
-4. <a name="footnote-4"></a>This example is taken from `examples/JJTreeExamples/eg4.jjt`, however it is not correct. A better example is `"/*" (~["*"])* "*" (~["*","/"] (~["*"])* "*" | "*")* "/"`.
+4. <a id="footnote-4">This example is taken from `examples/JJTreeExamples/eg4.jjt`, however it is not correct. A better example is `"/*" (~["*"])* "*" (~["*","/"] (~["*"])* "*" | "*")* "/"`.</a>
-5. <a name="footnote-5"></a>The rule that an `EOF` token is produced at the end of the file applies regardless of the lexical state.
+5. <a id="footnote-5">The rule that an `EOF` token is produced at the end of the file applies regardless of the lexical state.</a>
-6. <a name="footnote-6"></a>This particular example is well known to be resistant to refactoring the grammar so that a lookahead of `1` will suffice. It is possible to remove the ambiguity. You can write a `LR(1)` grammar that solves the problem, but it is an ugly grammar, and in any case unsuitable for JavaCC. You cannot write an `LL(1)` grammar to solve the problem.
+6. <a id="footnote-6">This particular example is well known to be resistant to refactoring the grammar so that a lookahead of `1` will suffice. It is possible to remove the ambiguity. You can write a `LR(1)` grammar that solves the problem, but it is an ugly grammar, and in any case unsuitable for JavaCC. You cannot write an `LL(1)` grammar to solve the problem.</a>
-7. <a name="footnote-7"></a>And provided that regular expression applies in the `DEFAULT` lexical state.
+7. <a id="footnote-7">And provided that regular expression applies in the `DEFAULT` lexical state.</a>
-8. <a name="footnote-8"></a>There are still a few reasons to use a regular expression production. One is if you are using lexical states other than `DEFAULT`. Another is if you want to ignore the case of a word. Also, some people just like to have an alphabetical list of their keywords somewhere.
+8. <a id="footnote-8">There are still a few reasons to use a regular expression production. One is if you are using lexical states other than `DEFAULT`. Another is if you want to ignore the case of a word. Also, some people just like to have an alphabetical list of their keywords somewhere.</a>
-9. <a name="footnote-9"></a>This example is based on a simplified version of the syntax for HTTP URLs in [RFC:2616](https://www.ietf.org/rfc/rfc2616.txt) of the IETF by R. Fielding, et. al.
+9. <a id="footnote-9">This example is based on a simplified version of the syntax for HTTP URLs in [RFC:2616](https://www.ietf.org/rfc/rfc2616.txt) of the IETF by R. Fielding, et. al.</a>
-10. <a name="footnote-10"></a>We are assuming that double slashes and dots are always followed by labels in a syntactically correct input stream.
+10. <a id="footnote-10">We are assuming that double slashes and dots are always followed by labels in a syntactically correct input stream.</a>
<br>
-## <a name="acknowledgments"></a>Acknowledgments
+## Acknowledgments
This FAQ is copyright (c) [Theodore S. Norvell](mailto:theo at mun.ca). Thanks to Ken Beesley, Leonardo Bueno, Paul Cager, Tom Copeland, Tom Davies, Brian Goetz, Roedy Green, John Kristian, Tony LaPaso, Eric Nickell, Andreas Papasalouros, Phil Robare, Alan Rooks, David Rosenstrauch, Sriram Sankar, Sreeni Viswanadha, and Michael Welle for suggestions and clarifications.
=====================================
docs/index.md
=====================================
@@ -3,9 +3,10 @@ Created from:
* the original README file at https://github.com/javacc/javacc
* the documentation https://github.com/javacc/javacc/www
* an example README.md file from https://github.com/apache/flink
+* modified
-->
-# <a name="top"></a>JavaCC
+# JavaCC
Java Compiler Compiler (JavaCC) is the most popular parser generator for use with Java applications.
@@ -15,27 +16,29 @@ In addition to the parser generator itself, JavaCC provides other standard capab
All you need to run a JavaCC parser, once generated, is a Java Runtime Environment (JRE).
-## <a name="toc"></a>Contents
+This README is meant as a brief overview of the core features and how to set things up to get yourself started with JavaCC. For a fully detailed documentation, please see [https://javacc.github.io/javacc/](https://javacc.github.io/javacc/).
+
+## Contents
- [Introduction](#introduction)
- * [Features](#features)
- * [Example](#example)
- * [Tutorials](tutorials/index.md)
- * [FAQ](faq.md)
+ * [Features](#features)
+ * [An example](#an-example)
+ * [Tutorials](tutorials/index.md)
+ * [FAQ](faq.md)
- [Getting Started](#getting-started)
- * [Download & Installation](#download)
- * [Building JavaCC from Source](#building-from-source)
- * [Developing JavaCC](#developing)
+ * [From the command line](#use-javacc-from-the-command-line)
+ * [Within an IDE](#use-javacc-within-an-ide)
+ * [Rebuilding JavaCC](#rebuilding-javacc)
- [Community](#community)
- * [Support](#support)
- * [Documentation](#documentation)
- * [Resources](#resources)
- * [Powered by JavaCC](#powered-by)
+ * [Support](#support)
+ * [Documentation](#documentation)
+ * [Resources](#resources)
+ * [Powered by JavaCC](#powered-by-javacc)
- [License](#license)
-## <a name="introduction"></a>Introduction
+## Introduction
-### <a name="features"></a>Features
+### Features
* JavaCC generates top-down ([recursive descent](https://en.wikipedia.org/wiki/Recursive_descent_parser)) parsers as opposed to bottom-up parsers generated by [YACC](https://en.wikipedia.org/wiki/Yacc)-like tools. This allows the use of more general grammars, although [left-recursion](https://en.wikipedia.org/wiki/Left_recursion) is disallowed. Top-down parsers have a number of other advantages (besides more general grammars) such as being easier to debug, having the ability to parse to any [non-terminal](https://en.wikipedia.org/wiki/Terminal_and_nonterminal_symbols) in the grammar, and also having the ability to pass values (attributes) both up and down the parse tree during parsing.
@@ -68,19 +71,20 @@ All you need to run a JavaCC parser, once generated, is a Java Runtime Environme
* The JavaCC release includes a wide range of examples including Java and HTML grammars. The examples, along with their documentation, are a great way to get acquainted with JavaCC.
-### <a name="example"></a>Example
+### An example
-This example recognizes matching braces followed by zero or more line terminators and then an end of file.
+The following JavaCC grammar example recognizes matching braces followed by zero or more line terminators and then an end of file.
Examples of legal strings in this grammar are:
-`{}`, `{{{{{}}}}}` // ... etc
+`{}`, `{{{{{}}}}}` // ... etc
Examples of illegal strings are:
`{}{}`, `}{}}`, `{ }`, `{x}` // ... etc
-#### Grammar
+##### Its grammar
+
```java
PARSER_BEGIN(Example)
@@ -112,12 +116,17 @@ void MatchedBraces() :
}
```
-#### Output
+##### Some executions and outputs
+
+###### {{}} gives no error
+
```java
$ java Example
{{}}<return>
```
+###### {x gives a Lexical error
+
```java
$ java Example
{x<return>
@@ -130,6 +139,8 @@ TokenMgrError: Lexical error at line 1, column 2. Encountered: "x" (120), after
at Example.main(Example.java:6)
```
+###### {{}} gives a ParseException
+
```java
$ java Example
{}}<return>
@@ -144,74 +155,52 @@ Was expecting one of:
at Example.main(Example.java:6)
```
-## <a name="getting-started"></a>Getting Started
-
-Follow the steps here to get started with JavaCC.
+## Getting Started
-This guide will walk you through locally building the project, running an existing example, and setup to start developing and testing your own JavaCC application.
+You can use JavaCC either from the command line or through an IDE.
-### <a name="download"></a>Download & Installation
+### Use JavaCC from the command line
-JavaCC 7.0.12 is our latest stable release.
+#### Download
-* 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))
+Download the latest stable release (at least the source and the binaries) in a so called download directory:
+* JavaCC 7.0.13 - ([Source (zip)](https://github.com/javacc/javacc/archive/javacc-7.0.13.zip), [Source (tar.gz)](https://github.com/javacc/javacc/archive/javacc-7.0.13.tar.gz), [Binaries](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13.jar), [Javadocs](https://repo1.maven.org/maven2/net/java/dev/javacc/javacc/7.0.13/javacc-7.0.13-javadoc.jar), [Release Notes](docs/release-notes.md#javacc-7.0.13))
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.
-For all previous releases, please see [stable releases](downloads.md).
-
-The GitHub 8.0 branch contains the next generation of JavaCC that splits the frontend -- the JavaCC parser -- from the backends -- the code generator targeted for Java, C++ &and C# --. Status of JavaCC is experimental and not production ready.
-
-#### <a name="installation"></a>Installation
+For all previous releases, please see [stable releases](docs/downloads.md).
-To install JavaCC, navigate to the download directory and type:
+#### Install
+Once you have downloaded the files, navigate to the download directory and unzip the source file, this creating a so called JavaCC installation directory:
```
-$ unzip javacc-7.0.12.zip
+$ unzip javacc-7.0.13.zip
or
-$ tar xvf javacc-7.0.12.tar.gz
+$ tar xvf javacc-7.0.13.tar.gz
```
-Then place the binary `javacc-7.0.12.jar` in a new `target/` folder, and rename to `javacc.jar`.
+Then move the binary file `javacc-7.0.13.jar` under the download directory in a new `target/` directory under the installation directory, and rename it 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.12/` directory:
+Then add the `scripts/` directory in the JavaCC installation directory 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.13/` directory:
```
chmod +x scripts/javacc
```
-### <a name="building-from-source"></a>Building JavaCC from Source
-
-The source contain the JavaCC, JJTree and JJDoc sources, launcher scripts, example grammars and documentation. It also contains a bootstrap version of JavaCC needed to build JavaCC.
-
-Prerequisites for building JavaCC:
+#### Write your grammar and generate your parser
-* Git
-* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
-* Maven
-* Java 8 (Java 9 and 10 are not yet supported)
-
-```
-$ git clone https://github.com/javacc/javacc.git
-$ cd javacc
-$ ant
-```
+You can then create and edit a grammar file with your favorite text editor.
-This will build the `javacc.jar` file in the `target/` directory
+Then use the appropriate script for generating your parser from your grammar.
-### <a name="developing"></a>Developing JavaCC
+### Use JavaCC within an IDE
-<!---
-The JavaCC committers use IntelliJ IDEA to develop the JavaCC codebase.
--->
Minimal requirements for an IDE are:
* Support for Java
* Support for Maven with Java
-
#### IntelliJ IDEA
The IntelliJ IDE supports Maven out of the box and offers a plugin for JavaCC development.
@@ -228,13 +217,84 @@ Check out our [Setting up IntelliJ](https://ci.apache.org/projects/flink/flink-d
* Eclipse download: [https://www.eclipse.org/ide/](https://www.eclipse.org/ide/)
* Eclipse JavaCC Plugin: [https://marketplace.eclipse.org/content/javacc-eclipse-plug](https://marketplace.eclipse.org/content/javacc-eclipse-plug)
-## <a name="community"></a>Community
+#### Maven
+
+Add the following dependency to your `pom.xml` file.
+
+```
+<dependency>
+ <groupId>net.java.dev.javacc</groupId>
+ <artifactId>javacc</artifactId>
+ <version>7.0.13</version>
+</dependency>
+```
+
+#### Gradle
+
+Add the following to your `build.gradle` file.
+
+```
+repositories {
+ mavenLocal()
+ maven {
+ url = 'https://mvnrepository.com/artifact/net.java.dev.javacc/javacc'
+ }
+}
+
+dependencies {
+ compile group: 'net.java.dev.javacc', name: 'javacc', version: '7.0.13'
+}
+```
+
+### Rebuilding JavaCC
+
+#### From the source installation directory
+
+The source installation directory contains the JavaCC, JJTree and JJDoc sources, launcher scripts, example grammars and documentation, and also a bootstrap version of JavaCC needed to build JavaCC.
+
+Prerequisites for building JavaCC with this method:
+
+* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
+* Maven
+* Java 8 (Java 9 and 10 are not yet supported)
+
+Use the ant build script:
+
+```
+$ cd javacc
+$ ant
+```
+
+This will build the `javacc.jar` file in the `target/` directory
+
+#### After cloning the JavaCC GitHub repository
+
+This is the preferred method for contributing to JavaCC.
+
+Prerequisites for building JavaCC with this method:
+
+* Git
+* Ant (we require version 1.5.3 or above - you can get ant from [http://ant.apache.org](http://ant.apache.org))
+* Maven
+* Java 8 (Java 9 and 10 are not yet supported)
+
+Just clone the repository and then use the ant build script:
+
+```
+$ git clone https://github.com/javacc/javacc.git
+$ cd javacc
+$ ant
+```
+
+This will build the `javacc.jar` file in the `target/` directory
+
+## Community
JavaCC is by far the most popular parser generator used with Java applications with an estimated user base of over 1,000 users and more than 100,000 downloads to date.
It is maintained by the [developer community](https://github.com/javacc/javacc/graphs/contributors) which includes the original authors and [Chris Ainsley](https://github.com/ainslec), [Tim Pizney](https://github.com/timp) and [Francis Andre](https://github.com/zosrothko).
-### <a name="support"></a>Support
+### Support
Don’t hesitate to ask!
@@ -244,38 +304,38 @@ Contact the developers and community on the [Google user group](https://groups.g
For questions relating to development please join our [Slack channel](https://javacc.slack.com/).
-### <a name="documentation"></a>Documentation
+### Documentation
-The documentation is located on the website [https://javacc.github.io/javacc/](https://javacc.github.io/javacc/) and in the `docs/` directory of the source code on [GitHub](https://github.com/javacc/javacc).
+The documentation of JavaCC is located on the website [https://javacc.github.io/javacc/](https://javacc.github.io/javacc/) and in the `docs/` directory of the source code on [GitHub](https://github.com/javacc/javacc).
-It includes [detailed documentation](documentation/index.md) for JavaCC, JJTree, and JJDoc.
+It includes [detailed documentation](docs/documentation/index.md) for JavaCC, JJTree, and JJDoc.
-### <a name="resources"></a>Resources
+### Resources
-#### Books
+##### Books
* Dos Reis, Anthony J., Compiler Construction Using Java, JavaCC, and Yacc., Wiley-Blackwell 2012. ISBN 0-4709495-9-7 ([book](https://www.amazon.co.uk/Compiler-Construction-Using-Java-JavaCC/dp/0470949597), [pdf](https://doc.lagout.org/programmation/Java/Compiler%20Construction%20using%20Java%2C%20JavaCC%2C%20and%20YACC%20%5BReis%202011-12-20%5D.pdf)).
* Copeland, Tom, Generating Parsers with JavaCC., Centennial Books, 2007. ISBN 0-9762214-3-8 ([book](https://www.amazon.com/Generating-Parsers-JavaCC-Easy-Use/dp/0976221438)).
-#### Tutorials
+##### Tutorials
-* JavaCC [tutorials](tutorials/index.md).
+* JavaCC [tutorials](docs/tutorials/index.md).
* [Introduction to JavaCC](https://www.engr.mun.ca/~theo/JavaCC-Tutorial/javacc-tutorial.pdf) by Theodore S. Norvell.
* [Incorporating language processing into Java applications: a JavaCC tutorial](https://ieeexplore.ieee.org/document/1309649) by Viswanathan Kodaganallur.
-#### Articles
+##### Articles
* [Looking for lex and yacc for Java? You don't know Jack](https://www.javaworld.com/article/2077315/looking-for-lex-and-yacc-for-java--you-don-t-know-jack.html) by Chuck Mcmanis.
* [Build your own languages with JavaCC](https://www.javaworld.com/article/2076269/build-your-own-languages-with-javacc.html) by Oliver Enseling.
* [Writing an Interpreter Using JavaCC](https://anandsekar.github.io/writing-an-interpretter-using-javacc/) by Anand Rajasekar.
* [Building a lexical analyzer with JavaCC](http://kiwwito.com/build-a-lexical-analyzer-with-javacc/) by Keyvan Akbary.
-#### Parsing theory
+##### Parsing theory
* Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools, 2nd Edition, Addison-Wesley, 2006, ISBN 0-3211314-3-6 ([book](https://www.amazon.co.uk/Compilers-Principles-Techniques-Tools-2nd/dp/0321131436), [pdf](https://github.com/germanoa/compiladores/blob/master/doc/ebook/Compilers%20Principles%2C%20Techniques%2C%20and%20Tools%20-%202nd%20Edition%20-%20Alfred%20V.%20Aho.pdf)).
* Charles N. Fischer and Richard J. Leblanc, Jr., Crafting a Compiler with C., Pearson, 1991. ISBN 0-8053216-6-7 ([book](https://www.amazon.co.uk/Crafting-Compiler-Charles-N-Fischer/dp/0805321667)).
-### <a name="powered-by"></a>Powered by JavaCC
+### Powered by JavaCC
JavaCC is used in many commercial applications and open source projects.
@@ -288,14 +348,13 @@ 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/tree/main/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/blob/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)
-[JOSM](https://josm.openstreetmap.de/) | Parsing MapCSS files | [MapCSSParser.jj](https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj)
<!---
-## <a name="contributing"></a>Contributing
+## Contributing
This is an active open-source project. We are always open to people who want to use the system or contribute to it.
Contact us if you are looking for implementation tasks that fit your skills.
@@ -305,7 +364,7 @@ https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/
-->
-## <a name="license"></a>License
+## License
JavaCC is an open source project released under the [BSD License 2.0](LICENSE). The JavaCC project was originally developed at Sun Microsystems Inc. by [Sreeni Viswanadha](https://github.com/kaikalur) and [Sriram Sankar](https://twitter.com/sankarsearch).
@@ -313,6 +372,6 @@ JavaCC is an open source project released under the [BSD License 2.0](LICENSE).
---
-[Top](#top)
+[Top](#javacc)
<br>
=====================================
docs/release-notes.md
=====================================
@@ -8,162 +8,142 @@ Instructions to update documentation for a new release:
[Home](index.md) > Release Notes
----
-
This page is a complete log of changes that have taken place since the release of JavaCC v0.5 in October 1996.
It also includes the change history for JJTree, JJDoc and the C++ versions of JavaCC and JJTree.
-### <a name="toc"></a>Contents
+## <a name="toc"></a>Contents
-- [**Release Notes**](#notes)
* [JavaCC](#javacc)
* [JJTree](#jjtree)
* [JJDoc](#jjdoc)
- * [JavaCC (C++ version)](#javacc-cpp)
- * [JJTree (C++ version)](#jjtree-cpp)
-
-### <a name="javacc"></a>JavaCC
-
-### VERSION HISTORY
+ * [JavaCC (C++ version)](#javacc-c-version)
+ * [JJTree (C++ version)](#jjtree-c-version)
---
+## JavaCC
+
+### Version history
#### 7.0.x
-* [7.0.12](#javacc-7.0.12)
-* [7.0.11](#javacc-7.0.11)
-* [7.0.10](#javacc-7.0.10)
-* [7.0.9](#javacc-7.0.9)
-* [7.0.8](#javacc-7.0.8)
-* [7.0.7](#javacc-7.0.7)
-* [7.0.6](#javacc-7.0.6)
-* [7.0.5](#javacc-7.0.5)
-* [7.0.4](#javacc-7.0.4)
-* [7.0.3](#javacc-7.0.3)
-* [7.0.2](#javacc-7.0.2)
-* [7.0.1](#javacc-7.0.1)
-* [7.0.0](#javacc-7.0.0)
+* [7.0.13](#modifications-in-javacc-7-0-13)
+* [7.0.12](#modifications-in-javacc-7-0-12)
+* [7.0.11](#modifications-in-javacc-7-0-11)
+* [7.0.10](#modifications-in-javacc-7-0-10)
+* [7.0.9](#modifications-in-javacc-7-0-9)
+* [7.0.8](#modifications-in-javacc-7-0-8)
+* [7.0.7](#modifications-in-javacc-7-0-7)
+* [7.0.6](#modifications-in-javacc-7-0-6)
+* [7.0.5](#modifications-in-javacc-7-0-5)
+* [7.0.4](#modifications-in-javacc-7-0-4)
+* [7.0.3](#modifications-in-javacc-7-0-3)
+* [7.0.2](#modifications-in-javacc-7-0-2)
+* [7.0.1](#modifications-in-javacc-7-0-1)
+* [7.0.0](#modifications-in-javacc-7-0-0)
#### 6.0.x
-* [6.1.2](#javacc-6.1.2)
-* [6.0.0](#javacc-6.0.0)
+* [6.1.2](#modifications-in-javacc-6-1-2)
+* [6.0.0](#modifications-in-javacc-6-0-0)
#### 4.x
-* [4.2](#javacc-4.2)
-* [4.1](#javacc-4.1)
-* [4.0](#javacc-4.0)
+* [4.2](#modifications-in-javacc-4-2)
+* [4.1](#modifications-in-javacc-4-1)
+* [4.0](#modifications-in-javacc-4-0)
#### 3.x
-* [3.2](#javacc-3.2)
-* [3.1](#javacc-3.1)
-* [3.0](#javacc-3.0)
+* [3.2](#modifications-in-javacc-3-2)
+* [3.1](#modifications-in-javacc-3-1)
+* [3.0](#modifications-in-javacc-3-0)
#### 2.x
-* [2.1](#javacc-2.1)
-* [2.0](#javacc-2.0)
+* [2.1](#modifications-in-javacc-2-1)
+* [2.0](#modifications-in-javacc-2-0)
#### 1.x
-* [1.2](#javacc-1.2)
-* [1.0](#javacc-1.0)
+* [1.2](#modifications-in-javacc-1-2)
+* [1.0](#modifications-in-javacc-1-0)
#### 0.x
-* [0.8-pre2](#javacc-0.8-pre2)
-* [0.8-pre1](#javacc-0.8-pre1)
-* [0.7.1](#javacc-0.7.1)
-* [0.7](#javacc-0.7)
-* [0.7-pre7](#javacc-0.7-pre7)
-* [0.7-pre6](#javacc-0.7-pre6)
-* [0.7-pre5](#javacc-0.7-pre5)
-* [0.7-pre4](#javacc-0.7-pre4)
-* [0.7-pre3](#javacc-0.7-pre3)
-* [0.7-pre2](#javacc-0.7-pre2)
-* [0.7-pre1](#javacc-0.7-pre1)
-* [0.6.1](#javacc-0.6.1)
-* [0.6](#javacc-0.6)
-* [0.6 (Beta2)](#javacc-0.6-Beta2)
-* [0.6 (Beta1)](#javacc-0.6-Beta1)
-* [0.6.-8](#javacc-0.6.-8)
-* [0.6.-9](#javacc-0.6.-9)
-* [0.6.-10](#javacc-0.6.-10)
-
-<br>
-
-### 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 READMD
-
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.11"></a>7.0.11
----
- <br>
+* [0.8-pre2](#modifications-in-javacc-0-8-pre2)
+* [0.8-pre1](#modifications-in-javacc-0-8-pre1)
+* [0.7.1](#modifications-in-javacc-0-7-1)
+* [0.7](#modifications-in-javacc-0-7)
+* [0.7-pre7](#modifications-in-javacc-0-7-pre7)
+* [0.7-pre6](#modifications-in-javacc-0-7-pre6)
+* [0.7-pre5](#modifications-in-javacc-0-7-pre5)
+* [0.7-pre4](#modifications-in-javacc-0-7-pre4)
+* [0.7-pre3](#modifications-in-javacc-0-7-pre3)
+* [0.7-pre2](#modifications-in-javacc-0-7-pre2)
+
+---
+### Modifications in JavaCC 7.0.13
+
+* \#267 : Resolve merge conflicts from #245
+* \#245 : Fix issue #243 (Character code is returned instead of the symbol in the message)
+* \#232 : Revert "Try to fix {{{{{}}}}} issue in GitHub Pages"
+* \#231 : Try to fix {{{{{}}}}} issue in GitHub Pages
+
+---
+### Modifications in JavaCC 7.0.12
+
+* \#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
+
+---
+### Modifications in JavaCC 7.0.11
+
* \#193 : Code error in class RCharacterList.SortDescriptors(): fixed
-<br>
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.10"></a>7.0.10
---
-
-<br>
-* \#183 : Lookahead is broken since 7.0.5 (introduced in commit fbac68f)
-<br>
+### Modifications in JavaCC 7.0.10
+
+ * \#183 : Lookahead is broken since 7.0.5 (introduced in commit fbac68f)
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.9"></a>7.0.9
---
-
+### Modifications in JavaCC 7.0.9
+
* pom.xml : change deployment on OSS to automatic release
* documentation : fix broken links
-<br>
-
-<br>
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.8"></a>7.0.8
---
-
+### Modifications in JavaCC 7.0.8
+
* \#175 : Doesn't work in Turkish Locale
* \#73 : javacc/c++: invalid lookahead processing: missing one lookahead to get rid of the conflict
-<br>
-
-<br>
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.7"></a>7.0.7
---
-
+### Modifications in JavaCC 7.0.7
+
* JavaCC.jj : remove unused c++ declaration blocs tokens
* \#172 : add a specific '-version' command line argument
-<br>
-
-
-<br>
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.6"></a>7.0.6
---
+### Modifications in JavaCC 7.0.6
+
The following changes are not upward compatible with the previous 7.0.5 version but have
a very little impact on existing grammars. Main advantage is to prepare a more smooth upgrade
with the upcoming javacc-8.0.0 major release.
@@ -172,12 +152,9 @@ with the upcoming javacc-8.0.0 major release.
* C++ generation: renaming the option TOKEN_INCLUDES by TOKEN_INCLUDE
* C++ generation: renaming the option PARSER_INCLUDES by PARSER_INCLUDE
* C++ generation: renaming the option TOKEN_MANAGER_INCLUDES by TOKEN_MANAGER_INCLUDE
-<br>
-
-<br>
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.5"></a>7.0.5
---
+### Modifications in JavaCC 7.0.5
* \#42: new README.md file.
* \#71: Add support for Java7 language features.
@@ -191,51 +168,36 @@ Declare trace_indent only if debug parser is enabled.
CPPParser.jj grammar added to grammars.
Build with Maven is working again.
----WARNING---WARNING---WARNING---
+---WARNING---WARNING---WARNING---
Required Java Platform: Standard Edition 7.0: known under Eclipse as JavaSE-1.7
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.4"></a>7.0.4
-
---
+### Modifications in JavaCC 7.0.4
Internal refactoring
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.3"></a>7.0.3
-
---
+### Modifications in JavaCC 7.0.3
Internal refactoring
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.2"></a>7.0.2
-
---
+### Modifications in JavaCC 7.0.2
C++ generation: Fixes of private/public scope for Node constructors.
Fix JJTParserState::closeNodeScope signature to avoid ambiguity in
resolving the overloaded function name.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.1"></a>7.0.1
-
---
+### Modifications in JavaCC 7.0.1
C++ generation: Fix generation of variadic template return type of BNF
production that were missing in the code file.
Refactoring of the build process.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-7.0.0"></a>7.0.0
-
---
+### Modifications in JavaCC 7.0.0
This version initiates the table driven parsing process as a optional feature.
@@ -244,11 +206,8 @@ Ant can now publish the distribution to Maven Central using the target
The c++ generation has been refactored.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-6.1.2"></a>6.1.2
-
---
+### Modifications in JavaCC 6.1.2
This version brings fixes of the JavaCC for c++ generation with also a
refactoring of the generated code. Main features/fixes added are
@@ -264,11 +223,8 @@ refactoring of the generated code. Main features/fixes added are
SimpleNode is also generated in his own file.
See examples/JJTreeExamples/cpp.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-6.0.0"></a>6.0.0
-
---
+### Modifications in JavaCC 6.0.0
Added support for C++ code generation - for almost all features - except ERROR_REPORTING.
The generated code mostly uses the same design as the Java version.
@@ -304,27 +260,18 @@ Added new options relevant to C++:
-TOKEN_MANAGER_SUPER_CLASS - super class of the token manager
-IGNORE_ACTIONS - an option to ignore all the action so a clean parser can be generated even when jjtree is used. Useful for debugging/profiling/testing
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-4.2"></a>4.2
-
---
+### Modifications in JavaCC 4.2
Release 4.2 is a maintenance release, incorporating a number of bug fixes and enhancements. For a complete list, please see the [issue tracker](https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.2).
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-4.1"></a>4.1
-
---
+### Modifications in JavaCC 4.1
Release 4.1 is a maintenance release, incorporating a number of bug fixes and enhancements. For a complete list, please see the [issue tracker](https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.1).
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-4.0"></a>4.0
-
---
+### Modifications in JavaCC 4.0
See the bug list in issue tracker for all the bugs fixed in this release.
JJTree and JavaCC both now support 1.5 syntax.
@@ -334,11 +281,8 @@ Tabsetting is now customizable.
SimpleNode can now extend a class using the NODE_EXTENDS option.
JAVACODE and BNF productions take optional access modifiers.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-3.2"></a>3.2
-
---
+### Modifications in JavaCC 3.2
New regular expression kind with range operator where the upperbound is
optional, meaning just minimum, no max - (<RE>){n,}
@@ -348,20 +292,14 @@ Added the LICENSE file to the installation root directory.
Fixed issues #: 10, 11, 13, 2, 4, 5, 7
In particular, the generated code should now compile with JDK 1.5 (Tiger)
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-3.1"></a>3.1
-
---
+### Modifications in JavaCC 3.1
Open source with BSD license.
Fixed the copyright text in the source files.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-3.0"></a>3.0
-
---
+### Modifications in JavaCC 3.0
No GUI version anymore.
@@ -371,11 +309,8 @@ regular expression.
Split up initializations of jj_la1_* vars into smaller methods so
that there is no code size issue. This is a recently reported bug.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-2.1"></a>2.1
-
---
+### Modifications in JavaCC 2.1
Added a new option - KEEP_LINE_COLUMN default true.
@@ -424,11 +359,8 @@ The APIs remain the same.
Also, the CharStream interface remains the same. So, if you have been using
USER_CHAR_STREAM option, then you don't need to change anything.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-2.0"></a>2.0
-
---
+### Modifications in JavaCC 2.0
Added CPP grammar to examples directory (contributed by Malome Khomo).
@@ -445,11 +377,8 @@ Uninstaller included.
Fixed some minor bugs.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-1.2"></a>1.2
-
---
+### Modifications in JavaCC 1.2
Moved JavaCC to the Metamata installer and made it available for
download from Metamata's web site.
@@ -493,29 +422,20 @@ if any to execute on seeing EOF.
This should help in writing grammars for processing C/C++ #include
files, without going through hoops as in the old versions.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-1.0"></a>1.0
-
---
+### Modifications in JavaCC 1.0
Fixed bugs related to usage of JavaCC with Java 2.
Many other bug fixes.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.8-pre2"></a>0.8-pre2
-
---
+### Modifications in JavaCC 0.8-pre2
Mainly bug fixes.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.8-pre1"></a>0.8-pre1
-
---
+### Modifications in JavaCC 0.8-pre1
Changed all references to Stream classes in the JavaCC code itself and
changed them to Reader/Writer.
@@ -529,11 +449,8 @@ should continue to use the InputStream constructors.
Generate inner classes instead of top level classes where appropriate.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7.1"></a>0.7.1
-
---
+### Modifications in JavaCC 0.7.1
Fixed a bug in the handling of empty PARSER_BEGIN...PARSER_END
regions.
@@ -543,11 +460,8 @@ Fixed a bug in Java1.1noLA.jj - the improved performance Java grammar.
Fixed a spurious definition that was being generated into the parser
when USER_TOKEN_MANAGER was set to true.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7"></a>0.7
-
---
+### Modifications in JavaCC 0.7
Fixed the error reporting routines to delete duplicate entries from
the "expected" list.
@@ -573,11 +487,8 @@ the declaration of the field.
Updated the performance page to demonstrate how JavaCC performance
has improved since Version 0.5.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre7"></a>0.7-pre7
-
---
+### Modifications in JavaCC 0.7-pre7
Added an option CACHE_TOKENS with a default value of false. You
can generate slightly faster and (it so happens) more compact
@@ -612,11 +523,8 @@ calls to which are generated, but not the method.
Generating the 'static' keyword for the backup method of the
UCode\*.java files when STATIC flag is set.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre6"></a>0.7-pre6
-
---
+### Modifications in JavaCC 0.7-pre6
Extended the generated CharStream classes with a method to adjust the
line and column numbers for the beginning of a token. Look at the C++
@@ -666,11 +574,8 @@ Fixed a bug in the optimizations of the lexical analyzer.
Many changes have been made to JJTree. See the JJTree release
notes for more information.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre5"></a>0.7-pre5
-
---
+### Modifications in JavaCC 0.7-pre5
Fixed a bug with TOKEN_MGR_DECLS introduced in 0.7pre4.
@@ -714,22 +619,16 @@ Fixed all UNICODE lexing bugs that we know about.
Fixed an array index out of bounds bug in the token manager.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre4"></a>0.7-pre4
-
---
+### Modifications in JavaCC 0.7-pre4
The only significant change for this version is that we incorporated
the Java grammar into the JavaCC grammar. The JavaCC front end is
therefore able to parse the entire grammar file intelligently rather
than simple ignore the actions.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre3"></a>0.7-pre3
-
---
+### Modifications in JavaCC 0.7-pre3
WE HAVE NOT ADDED ANY MAJOR FEATURES TO JAVACC FOR THIS PRERELEASE.
WE'VE FOCUSED MAINLY ON BUG FIXES. BUT HERE IS WHAT HAS CHANGED:
@@ -770,11 +669,8 @@ being set before a lexical action for a TOKEN type reg. exp.
Added a toString method to the Token class to return the image.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-0.7-pre2"></a>0.7-pre2
-
---
+### Modifications in JavaCC 0.7-pre2
AS USUAL, KEEP IN MIND THAT THIS IS A PRERELEASE THAT WE HAVE NOT
TESTED EXTENSIVELY. THERE ARE A FEW KNOWN BUGS THAT ARE STILL PRESENT
@@ -821,43 +717,39 @@ classes. Now all these are thrown as Error objects.
Fixed a very old problem with giving input from System.in.
-### <a name="jjtree"></a>JJTree
-
-### VERSION HISTORY
-
---
+## JJTree
+
+### Version history
THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE THE RELEASE OF VERSION 0.2.2.
#### 6.x
-* [6.0](#jjtree-6.0)
+* [6.0](#modifications-in-jjtree-6-0)
#### 4.x
-* [4.2](#jjtree-4.2)
-* [4.3](#jjtree-4.2)
-* [4.0](#jjtree-4.0)
+* [4.2](#modifications-in-jjtree-4-2)
+* [4.3](#modifications-in-jjtree-4-2)
+* [4.0](#modifications-in-jjtree-4-0)
#### 0.x
-* [0.3-pre6](#jjtree-0.3-pre6)
-* [0.3-pre5](#jjtree-0.3-pre5)
-* [0.3-pre4](#jjtree-0.3-pre4)
-* [0.3-pre3](#jjtree-0.3-pre3)
-* [0.3-pre2](#jjtree-0.3-pre2)
-* [0.3-pre1](#jjtree-0.3-pre1)
-* [0.2.6](#jjtree-0.2.6)
-* [0.2.5](#jjtree-0.2.5)
-* [0.2.4](#jjtree-0.2.4)
-* [0.2.3](#jjtree-0.2.3)
-* [0.2.2](#jjtree-0.2.2)
-
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-6.0"></a>6.0
+* [0.3-pre6](#modifications-in-jjtree-0-3-pre6)
+* [0.3-pre5](#modifications-in-jjtree-0-3-pre5)
+* [0.3-pre4](#modifications-in-jjtree-0-3-pre4)
+* [0.3-pre3](#modifications-in-jjtree-0-3-pre3)
+* [0.3-pre2](#modifications-in-jjtree-0-3-pre2)
+* [0.3-pre1](#modifications-in-jjtree-0-3-pre1)
+* [0.2.6](#modifications-in-jjtree-0-2-6)
+* [0.2.5](#modifications-in-jjtree-0-2-5)
+* [0.2.4](#modifications-in-jjtree-0-2-4)
+* [0.2.3](#modifications-in-jjtree-0-2-3)
+* [0.2.2](#modifications-in-jjtree-0-2-2)
---
+### Modifications in JJTree 6.0
JJTree is extended to support C++ code generation starting with version 6.0.
The generated code mostly uses the same design as the Java version.
@@ -874,46 +766,31 @@ Added the new option:
-OUTPUT_LANGUAGE - string valued options with "java" and "c++" currently allowed.
-VISITOR_METHOD_NAME_INCLUDES_TYPE_NAME - include the name of the class being visited in the Visitor
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-4.2"></a>4.2
-
---
+### Modifications in JJTree 4.2
Release 4.2 is a maintenance release, incorporating a number of bug fixes and enhancements. For a complete list, please see the [issue tracker](https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.2).
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-4.1"></a>4.1
-
---
+### Modifications in JJTree 4.1
Release 4.1 is a maintenance release, incorporating a number of bug fixes and enhancements. For a complete list, please see the [issue tracker](https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.1).
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-4.0"></a>4.0
-
---
+### Modifications in JJTree 4.0
New option NODE_EXTENDS to specify a classname that
SimpleNode extends so that boiler plate code can be put
in that class. See the examples/Interpreter for an example
usage.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre6"></a>0.3-pre6
-
---
+### Modifications in JJTree 0.3-pre6
Fixed bug where Writers were not being closed correctly.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre5"></a>0.3-pre5
-
---
+### Modifications in JJTree 0.3-pre5
Fixed a bug where a node annotation #P() caused a null pointer error.
@@ -923,11 +800,8 @@ set.
Fixed a bug where the name of the JJTree state file was being used in
the declaration of the field.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre4"></a>0.3-pre4
-
---
+### Modifications in JJTree 0.3-pre4
Made the constructors of nodes public. Also made the node identifier
constants and the associated strings public.
@@ -961,11 +835,8 @@ here because I needed it for one of my own projects and thought it
might be useful to someone else too. Don't use it unless you're
prepared to change your code again later.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre3"></a>0.3-pre3
-
---
+### Modifications in JJTree 0.3-pre3
JJTree now uses the same grammar as JavaCC. This means that Java code
in parser actions is parsed.
@@ -1013,11 +884,8 @@ Removed not very useful debugging stuff from the JJTree state object.
It was causing problems with parsers running in security environments
where access to arbitrary properties is disallowed.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre2"></a>0.3-pre2
-
---
+### Modifications in JJTree 0.3-pre2
The state that JJTree inserts into the parser class is now guarded by
the formal comments.
@@ -1046,11 +914,8 @@ set to true, JJTree will call the node constructor with a reference to
the parser object as an extra parameter. This reference is null for
static parsers.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.3-pre1"></a>0.3-pre1
-
---
+### Modifications in JJTree 0.3-pre1
JJTree 0.3pre1 has been bootstrapped with JJTree 0.2.6.
@@ -1118,28 +983,19 @@ The JJTree state method currentNode() has been removed. Any calls to
the method in an action within a node scope are automatically replaced
by references to the special identifier jjtThis.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.2.6"></a>0.2.6
-
---
+### Modifications in JJTree 0.2.6
Made appropriate internal modifications for the JavaCC 0.7 parse error exceptions.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.2.5"></a>0.2.5
-
---
+### Modifications in JJTree 0.2.5
Fixed a bug where the current node was not being updated in the right
place for final user actions.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.2.4"></a>0.2.4
-
---
+### Modifications in JJTree 0.2.4
Fixed a bug where bad code was generated for void nodes in MULTI mode.
@@ -1150,11 +1006,8 @@ bad code. For example,
{} #MyNode
```
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.2.3"></a>0.2.3
-
---
+### Modifications in JJTree 0.2.3
Added toString() and toString(String) methods to SimpleNode and
modified the dumping code to use them. Now you can easily customize
@@ -1187,11 +1040,8 @@ Fixed names of internally used JJTree classes so that they use the JJT
prefix and the name of the parser. This is to avoid naming conflicts
where there is more than one JJTree parser in the same package.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-0.2.2"></a>0.2.2
-
---
+### Modifications in JJTree 0.2.2
The main change between Beanstalk 0.2 and JJTree 0.2.2 is the removal
of the factory classes. Their function is now performed by a static
@@ -1207,74 +1057,54 @@ iterate over the children.
Two new options have been added: OUTPUT_FILE and NODE_DEFAULT_VOID.
-
-### <a name="jjdoc"></a>JJDoc
-
-### VERSION HISTORY
-
---
+## JJDoc
+
+### Version history
THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE THE RELEASE OF VERSION 0.1.
#### 0.1.x
-* [0.1.6](#jjdoc-0.1.6)
-* [0.1.5](#jjdoc-0.1.5)
-* [0.1.4](#jjdoc-0.1.4)
-* [0.1.3](#jjdoc-0.1.3)
-* [0.1.2](#jjdoc-0.1.2)
-* [0.1.1](#jjdoc-0.1.1)
-* [0.1.0](#jjdoc-0.1.0)
-
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.6"></a>0.1.6
+* [0.1.6](#modifications-in-jjdoc-0-1-6)
+* [0.1.5](#modifications-in-jjdoc-0-1-5)
+* [0.1.4](#modifications-in-jjdoc-0-1-4)
+* [0.1.3](#modifications-in-jjdoc-0-1-3)
+* [0.1.2](#modifications-in-jjdoc-0-1-2)
+* [0.1.1](#modifications-in-jjdoc-0-1-1)
+* [0.1.0](#modifications-in-jjdoc-0-1-0)
---
+### Modifications in JJDoc 0.1.6
Refactored to make Generator a settable interface,
enabling Maven or other generators.
Existing Generator becomes TextGenerator.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.5"></a>0.1.5
-
---
+### Modifications in JJDoc 0.1.5
Fixed bug where Writers were not being closed correctly.
Fixed bug where help message would not appear on command line.
Added the "CSS" option.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.4"></a>0.1.4
-
---
+### Modifications in JJDoc 0.1.4
Now accepts JavaCC try/catch/finally blocks.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.3"></a>0.1.3
-
---
+### Modifications in JJDoc 0.1.3
Made appropriate internal modifications for the JavaCC 0.7 parse error exceptions.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.2"></a>0.1.2
-
---
+### Modifications in JJDoc 0.1.2
Fixed bug where ()+ expansions were being reported as ()\*.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.1"></a>0.1.1
-
---
+### Modifications in JJDoc 0.1.1
Fixed several stupid bugs in the Macintosh main class.
@@ -1284,11 +1114,8 @@ times in text modes and one table HTML mode.
Moved production comments to the correct place: they were coming out
with the preceding production in one table HTML mode.
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjdoc-0.1.0"></a>0.1.0
-
---
+### Modifications in JJDoc 0.1.0
JJDoc takes a JavaCC parser specification and produces documentation
for the BNF grammar. It can operate in three modes, determined by
@@ -1321,28 +1148,22 @@ The default behavior is to put the JJDoc output into a file with
either .html or .txt added as a suffix to the input file's base name.
You can supply a different file name with this option.
-<br>
-
-### <a name="javacc-cpp"></a>JavaCC (C++ version)
+---
+## JavaCC (C++ version)
Javacc was extended to support C++ code generation starting with version 6.0. The generated code mostly uses the same design as the Java version.
-### VERSION HISTORY
-
----
+### Version history
THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE THE RELEASE OF VERSION 6.0.
#### 6.x
-* [6.0](#javacc-cpp-6.0)
-* [C++ specific issues](#javacc-cpp-issues)
-
-<br>
-
-### MODIFICATIONS IN VERSION <a name="javacc-cpp-6.0"></a>6.0
+* [6.0](#modifications-in-javacc-cpp-6-0)
+* [C++ specific issues](#c-specific-issues)
---
+### Modifications in JavaCC CPP 6.0
Implemented all JavaCC options for the C++ version as well.
@@ -1355,11 +1176,8 @@ Added new options relevant to C++:
- `TOKEN_MANAGER_SUPER_CLASS` - super class of the token manager.
- `IGNORE_ACTIONS` - an option to ignore all the action so a clean parser can be generated even when `jjtree` is used. Useful for debugging/profiling/testing.
-<br>
-
-### <a name="javacc-cpp-issues"></a>C++ SPECIFIC ISSUES
-
---
+## C++ SPECIFIC ISSUES
Since C++ is somewhat different from Java in code organization in terms of header files etc. we made the following changes:
- Parser class in `PARSER_BEGIN/PARSER_END` - this cannot be supported as the parser is generated into the header file. So in the C++ version you can only define the contents of the class, not the class itself.
@@ -1369,39 +1187,30 @@ Since C++ is somewhat different from Java in code organization in terms of heade
- Exceptions - due to the way the code evolved, we could not use exceptions in C++. So we have an `ErrorHandler` interface instead which by default just prints syntax error and continues trying to parse. Please see the [JavaCC API](/documentation/api.md) for more details.
- Wide character support - C++ version is fully wide character compatible and it has been tested on Windows, Linux and Mac environments.
-<br>
-
-### <a name="jjtree-cpp"></a>JJTree (C++ version)
+---
+## JJTree (C++ version)
JJTree is extended to support C++ code generation starting with version 6.0. The generated code mostly uses the same design as the Java version.
Note that there are still some kinks being worked on - like the NODE_FACTORY option etc.
-### VERSION HISTORY
-
----
+### Version history
THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE THE RELEASE OF VERSION 6.0.
#### 6.x
-* [6.0](#jjtree-cpp-6.0)
-
-<br>
-
-### MODIFICATIONS IN VERSION <a name="jjtree-cpp-6.0"></a>6.0
+* [6.0](#modifications-in-jjtree-cpp-6-0)
---
+### Modifications in JJTree cpp-6.0
Implemented all JavaCC options for the C++ version.
Implemented the following C++ specific options:
- `NODE_INCLUDES` - a common include file for all the node classes.
-<br>
-
---
-
[Home](index.md)
-<br>
+---
\ No newline at end of file
=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
<name>JavaCC</name>
- <version>7.0.12</version>
+ <version>7.0.13</version>
<description>JavaCC is a parser/scanner generator for java. </description>
<url>https://github.com/javacc/javacc</url>
@@ -21,7 +21,7 @@
<url>https://github.com/javacc/javacc</url>
<connection>scm:git:https://github.com/javacc/javacc.git</connection>
<developerConnection>scm:git:ssh://git@github.com/javacc/javacc.git</developerConnection>
- <tag>javacc-7.0.12</tag>
+ <tag>javacc-7.0.13</tag>
</scm>
<mailingLists>
<mailingList>
@@ -623,6 +623,7 @@
<executions>
<execution>
<id>generate sources jar</id>
+ <phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
@@ -635,6 +636,7 @@
<executions>
<execution>
<id>generate javadoc jar</id>
+ <phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
@@ -655,7 +657,7 @@
<executions>
<execution>
<id>sign-artifacts</id>
- <phase>verify</phase>
+ <phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
@@ -668,7 +670,7 @@
<executions>
<execution>
<id>sign</id>
- <phase>verify</phase>
+ <phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
=====================================
src/main/resources/templates/TokenMgrError.template
=====================================
@@ -1,4 +1,5 @@
/** Token Manager Error. */
+${GENERATE_ANNOTATIONS?@SuppressWarnings("all") :}
${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class ${LEGACY_EXCEPTION_HANDLING?TokenMgrError:TokenMgrException} extends ${LEGACY_EXCEPTION_HANDLING?Error:RuntimeException}
{
@@ -102,7 +103,7 @@ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class ${LEGACY_EXCEPTION_HANDLING?Tok
return("Lexical error at line " + //
errorLine + ", column " + //
errorColumn + ". Encountered: " + //
- (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + curChar + "),")) + //
+ (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf((char) curChar)) + "' (" + curChar + "),")) + //
(errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + //
(lexState == 0 ? "" : " (in lexical state " + lexState + ")");
}
=====================================
src/main/resources/version.properties
=====================================
@@ -1,3 +1,3 @@
version.major=7
version.minor=0
-version.patch=12
+version.patch=13
=====================================
test/java7features/Parser.jj
=====================================
@@ -1,9 +1,9 @@
/* 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
@@ -12,7 +12,7 @@
* * 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
@@ -70,24 +70,24 @@ PARSER_END(Parser)
void Input() :
{}
{
-
+
"A" {
//Here we test for Java 7 language features
-
+
//Try-with resources
try (Foo a = new Foo()) {
System.out.println("hello");
} catch(Exception d) {
System.out.println("world");
}
-
+
//Multiple exception catching
try (Foo a = new Foo(); Bar b = new Bar()) {
System.out.println("hello");
} catch(FirstException | SecondException ex) {
- System.out.println("world");
+ System.out.println("world");
}
-
+
//Underscores in numeric literals
int one_million = 1_000__000;
int cafe_babe = 0xCAFE_BABE;
@@ -99,13 +99,13 @@ void Input() :
double pi = 3.141_592_65;
double half = .5_0;
double h = 0x4__3p4_4;
-
+
//Binary literals
int binary = 0b1001_1001;
-
+
//Type Inference for Generic Instance Creation
Map<String, String> m = new HashMap<>();
-
+
//String in switch
String s = "foo";
switch(s) {
=====================================
test/javaFileGeneration/expected/no-keep-line/TokenMgrError.java
=====================================
@@ -104,7 +104,7 @@ public class TokenMgrError extends Error
return("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + curChar + "), ") +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf((char) curChar)) + "\"") + " (" + curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
}
=====================================
test/javaFileGeneration/expected/non-static/TokenMgrError.java
=====================================
@@ -104,7 +104,7 @@ public class TokenMgrError extends Error
return("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + curChar + "), ") +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf((char) curChar)) + "\"") + " (" + curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
}
=====================================
test/javaFileGeneration/expected/not-public/TokenMgrError.java
=====================================
@@ -104,7 +104,7 @@ class TokenMgrError extends Error
return("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + curChar + "), ") +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf((char) curChar)) + "\"") + " (" + curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
}
=====================================
test/javaFileGeneration/expected/static/TokenMgrError.java
=====================================
@@ -104,7 +104,7 @@ public class TokenMgrError extends Error
return("Lexical error at line " +
errorLine + ", column " +
errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + curChar + "), ") +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf((char) curChar)) + "\"") + " (" + curChar + "), ") +
"after : \"" + addEscapes(errorAfter) + "\"");
}
View it on GitLab: https://salsa.debian.org/java-team/javacc/-/commit/33623b5437070fa4818006261b95bfe33ec9de8d
--
View it on GitLab: https://salsa.debian.org/java-team/javacc/-/commit/33623b5437070fa4818006261b95bfe33ec9de8d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250416/997cf03e/attachment.htm>
More information about the pkg-java-commits
mailing list