Merge branch 'master' into master

This commit is contained in:
Gerasimos Dimitriadis 2019-11-14 23:52:19 +02:00 committed by GitHub
commit 437c5a7b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 6048 additions and 313 deletions

1
.gitignore vendored
View File

@ -97,3 +97,4 @@ xcuserdata
# VSCode Java plugin temporary files
javac-services.0.log
javac-services.0.log.lck
test/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "runtime/PHP"]
path = runtime/PHP
url = https://github.com/antlr/antlr-php-runtime.git

View File

@ -19,8 +19,9 @@ stages:
matrix:
include:
- os: linux
dist: trusty
compiler: clang
jdk: openjdk7
jdk: openjdk8
env:
- TARGET=cpp
- CXX=g++-5
@ -36,8 +37,9 @@ matrix:
- uuid-dev
- clang-3.7
- os: linux
dist: trusty
compiler: clang
jdk: openjdk7
jdk: openjdk8
env:
- TARGET=cpp
- CXX=g++-5
@ -53,8 +55,9 @@ matrix:
- uuid-dev
- clang-3.7
- os: linux
dist: trusty
compiler: clang
jdk: openjdk7
jdk: openjdk8
env:
- TARGET=cpp
- CXX=g++-5
@ -137,23 +140,27 @@ matrix:
- GROUP=RECURSION
stage: extended-test
- os: linux
dist: trusty
jdk: openjdk7
env: TARGET=java
stage: extended-test
- os: linux
jdk: openjdk8
env: TARGET=java
stage: extended-test
- os: linux
jdk: oraclejdk8
env: TARGET=java
stage: smoke-test
- os: linux
jdk: openjdk7
jdk: openjdk8
env: TARGET=csharp
stage: main-test
- os: linux
jdk: oraclejdk8
language: php
php:
- 7.2
jdk: openjdk8
env: TARGET=php
stage: main-test
- os: linux
jdk: openjdk8
dist: trusty
env:
- TARGET=dotnet
@ -167,18 +174,18 @@ matrix:
- GROUP=PARSER
stage: extended-test
- os: linux
jdk: oraclejdk8
jdk: openjdk8
dist: trusty
env:
- TARGET=dotnet
- GROUP=RECURSION
stage: extended-test
- os: linux
jdk: openjdk7
jdk: openjdk8
env: TARGET=python2
stage: main-test
- os: linux
jdk: openjdk7
jdk: openjdk8
env: TARGET=python3
addons:
apt:

View File

@ -3,6 +3,6 @@
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian xenial main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update -qq
echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/3.12.1 main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get install -qq mono-complete

View File

@ -6,5 +6,5 @@ set -euo pipefail
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.4
sudo apt-get --allow-unauthenticated install dotnet-dev-1.0.4

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt-get update -qq
php -v
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

9
.travis/run-tests-php.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
php_path=$(which php)
composer install -d ../runtime/PHP
mvn -q -DPHP_PATH="${php_path}" -Dparallel=methods -DthreadCount=4 -Dtest=php.* test

View File

@ -3,3 +3,7 @@
set -euo pipefail
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=python2.* test
cd ../runtime/Python2/tests
python run.py

View File

@ -3,3 +3,7 @@
set -euo pipefail
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=python3.* test
cd ../runtime/Python3/test
python3.6 run.py

View File

@ -22,6 +22,7 @@ ANTLR project lead and supreme dictator for life
* [Janyou](https://github.com/janyou) (Swift target)
* [Ewan Mellor](https://github.com/ewanmellor), [Hanzhou Shi](https://github.com/hanjoes) (Swift target merging)
* [Ben Hamilton](https://github.com/bhamiltoncx) (Full Unicode support in serialized ATN and all languages' runtimes for code points > U+FFFF)
* [Marcos Passos](https://github.com/marcospassos) (PHP target)
## Useful information

View File

@ -4,6 +4,9 @@ cache:
- '%USERPROFILE%\.nuget\packages -> **\project.json'
image: Visual Studio 2017
build: off
install:
- git submodule update --init --recursive
- cinst -y php composer
build_script:
- mvn -DskipTests install --batch-mode
- msbuild /target:restore /target:rebuild /property:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:detailed runtime/CSharp/runtime/CSharp/Antlr4.dotnet.sln
@ -11,7 +14,7 @@ build_script:
after_build:
- msbuild /target:pack /property:Configuration=Release /verbosity:detailed runtime/CSharp/runtime/CSharp/Antlr4.dotnet.sln
test_script:
- mvn install -Dantlr-python2-python="C:\Python27\python.exe" -Dantlr-python3-python="C:\Python35\python.exe" -Dantlr-javascript-nodejs="C:\Program Files (x86)\nodejs\node.exe" --batch-mode
- mvn install -Dantlr-php-php="C:\tools\php73\php.exe" -Dantlr-python2-python="C:\Python27\python.exe" -Dantlr-python3-python="C:\Python35\python.exe" -Dantlr-javascript-nodejs="C:\Program Files (x86)\nodejs\node.exe" --batch-mode
artifacts:
- path: 'runtime\**\*.nupkg'
name: NuGet

View File

@ -203,6 +203,8 @@ YYYY/MM/DD, github id, Full name, email
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
2018/07/03, jgoppert, James Goppert, james.goppert@gmail.com
2018/07/27, Maksim Novikov, mnovikov.work@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/18, edirgarcia, Edir García Lazo, edirgl@hotmail.com
2018/07/31, Lucas Henrqiue, lucashenrique580@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/29, chrisaycock, Christopher Aycock, chris[at]chrisaycock[dot]com
@ -214,3 +216,20 @@ YYYY/MM/DD, github id, Full name, email
2018/12/23, youkaichao, Kaichao You, youkaichao@gmail.com
2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com
2019/02/23, gedimitr, Gerasimos Dimitriadis, gedimitr@gmail.com
2019/03/13, base698, Justin Thomas, justin.thomas1@gmail.com
2019/03/18, carlodri, Carlo Dri, carlo.dri@gmail.com
2019/05/02, askingalot, Andy Collins, askingalot@gmail.com
2019/07/11, olowo726, Olof Wolgast, olof@baah.se
2019/07/16, abhijithneilabraham, Abhijith Neil Abraham, abhijithneilabrahampk@gmail.com
2019/07/26, Braavos96, Eric Hettiaratchi, erichettiaratchi@gmail.com
2019/08/23, akaJes, Oleksandr Mamchyts, akaJes@gmail.com
2019/09/10, ImanHosseini, Iman Hosseini, hosseini.iman@yahoo.com
2019/09/03, João Henrique, johnnyonflame@hotmail.com
2019/09/10, neko1235, Ihar Mokharau, igor.mohorev@gmail.com
2019/09/10, yar3333, Yaroslav Sivakov, yar3333@gmail.com
2019/09/10, marcospassos, Marcos Passos, marcospassos.com@gmail.com
2019/09/10, amorimjuliana, Juliana Amorim, juu.amorim@gmail.com
2019/09/17, kaz, Kazuki Sawada, kazuki@6715.jp
2019/09/28, lmy269, Mingyang Liu, lmy040758@gmail.com
2019/10/31, a-square, Alexei Averchenko, lex.aver@gmail.com
2019/11/11, foxeverl, Liu Xinfeng, liuxf1986[at]gmail[dot]com

View File

@ -14,7 +14,7 @@ For the 4.7.1 release, we discussed both approaches in [detail](https://github.c
## Case-insensitive grammars
As a prime example of a grammar that specifically describes case insensitive keywords, see the
As a prime example of a grammar that specifically describes case insensitive keywords, see the
[SQLite grammar](https://github.com/antlr/grammars-v4/blob/master/sqlite/SQLite.g4). To match a case insensitive keyword, there are rules such as
```
@ -72,7 +72,8 @@ Lexer lexer = new SomeSQLLexer(upper);
Here are implementations of `CaseChangingCharStream` in various target languages:
* [Java](https://github.com/parrt/antlr4/blob/case-insensitivity-doc/doc/resources/CaseChangingCharStream.java)
* [JavaScript](https://github.com/parrt/antlr4/blob/case-insensitivity-doc/doc/resources/CaseInsensitiveInputStream.js)
* [Go](https://github.com/parrt/antlr4/blob/case-insensitivity-doc/doc/resources/case_changing_stream.go)
* [C#](https://github.com/parrt/antlr4/blob/case-insensitivity-doc/doc/resources/CaseChangingCharStream.cs)
* [C#](https://github.com/antlr/antlr4/blob/master/doc/resources/CaseChangingCharStream.cs)
* [Go](https://github.com/antlr/antlr4/blob/master/doc/resources/case_changing_stream.go)
* [Java](https://github.com/antlr/antlr4/blob/master/doc/resources/CaseChangingCharStream.java)
* [JavaScript](https://github.com/antlr/antlr4/blob/master/doc/resources/CaseChangingStream.js)
* [Python2/3](https://github.com/antlr/antlr4/blob/master/doc/resources/CaseChangingStream.py)

View File

@ -45,7 +45,7 @@ The generation step above created a listener and base listener class for you. Th
#include "MyGrammarParser.h"
#include "MyGrammarBaseListener.h"
using namespace org::antlr::v4::runtime;
using namespace antlr4;
class TreeShapeListener : public MyGrammarBaseListener {
public:

View File

@ -30,7 +30,7 @@ Let's suppose that your grammar is named `MyGrammar`. The tool will generate for
Now a fully functioning code might look like the following for start rule `StartRule`:
```
```csharp
using Antlr4.Runtime;
using Antlr4.Runtime.Tree;
@ -59,7 +59,7 @@ Let's suppose your MyGrammar grammar comprises 2 rules: "key" and "value".
The antlr4 tool will have generated the following listener (only partial code shown here):
```
```csharp
interface IMyGrammarParserListener : IParseTreeListener {
void EnterKey (MyGrammarParser.KeyContext context);
void ExitKey (MyGrammarParser.KeyContext context);
@ -70,7 +70,7 @@ interface IMyGrammarParserListener : IParseTreeListener {
In order to provide custom behavior, you might want to create the following class:
```
```csharp
class KeyPrinter : MyGrammarBaseListener {
// override default listener behavior
void ExitKey (MyGrammarParser.KeyContext context) {
@ -82,7 +82,7 @@ class KeyPrinter : MyGrammarBaseListener {
In order to execute this listener, you would simply add the following lines to the above code:
```
```csharp
...
IParseTree tree = parser.StartRule() - only repeated here for reference
KeyPrinter printer = new KeyPrinter();

View File

@ -112,8 +112,11 @@ Now test it:
```
$ grun Hello r -tree
(Now enter something like the string below)
hello parrt
(now,do:)
^D
(The output:)
(r hello parrt)
(That ^D means EOF on unix; it's ^Z in Windows.) The -tree option prints the parse tree in LISP notation.
It's nicer to look at parse trees visually.

View File

@ -117,6 +117,44 @@ This program will work. But it won't be useful unless you do one of the followin
(please note that production code is target specific, so you can't have multi target grammars that include production code)
## How do I create and run a visitor?
```javascript
// test.js
var antlr4 = require('antlr4');
var MyGrammarLexer = require('./QueryLexer').QueryLexer;
var MyGrammarParser = require('./QueryParser').QueryParser;
var MyGrammarListener = require('./QueryListener').QueryListener;
var input = "field = 123 AND items in (1,2,3)"
var chars = new antlr4.InputStream(input);
var lexer = new MyGrammarLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new MyGrammarParser(tokens);
parser.buildParseTrees = true;
var tree = parser.query();
class Visitor {
visitChildren(ctx) {
if (!ctx) {
return;
}
if (ctx.children) {
return ctx.children.map(child => {
if (child.children && child.children.length != 0) {
return child.accept(this);
} else {
return child.getText();
}
});
}
}
}
tree.accept(new Visitor());
````
## How do I create and run a custom listener?
Let's suppose your MyGrammar grammar comprises 2 rules: "key" and "value". The antlr4 tool will have generated the following listener:

111
doc/php-target.md Normal file
View File

@ -0,0 +1,111 @@
# ANTLR4 Runtime for PHP
### First steps
#### 1. Install ANTLR4
[The getting started guide](https://github.com/antlr/antlr4/blob/master/doc/getting-started.md)
should get you started.
#### 2. Install the PHP ANTLR runtime
Each target language for ANTLR has a runtime package for running parser
generated by ANTLR4. The runtime provides a common set of tools for using your parser.
Install the runtime with Composer:
```bash
composer install antlr/antlr4
```
#### 3. Generate your parser
You use the ANTLR4 "tool" to generate a parser. These will reference the ANTLR
runtime, installed above.
Suppose you're using a UNIX system and have set up an alias for the ANTLR4 tool
as described in [the getting started guide](https://github.com/antlr/antlr4/blob/master/doc/getting-started.md).
To generate your PHP parser, run the following command:
```bash
antlr4 -Dlanguage=PHP MyGrammar.g4
```
For a full list of antlr4 tool options, please visit the
[tool documentation page](https://github.com/antlr/antlr4/blob/master/doc/tool-options.md).
### Complete example
Suppose you're using the JSON grammar from https://github.com/antlr/grammars-v4/tree/master/json.
Then, invoke `antlr4 -Dlanguage=PHP JSON.g4`. The result of this is a
collection of `.php` files in the `parser` directory including:
```
JsonParser.php
JsonBaseListener.php
JsonLexer.php
JsonListener.php
```
Another common option to the ANTLR tool is `-visitor`, which generates a parse
tree visitor, but we won't be doing that here. For a full list of antlr4 tool
options, please visit the [tool documentation page](tool-options.md).
We'll write a small main func to call the generated parser/lexer
(assuming they are separate). This one writes out the encountered
`ParseTreeContext`'s:
```php
<?php
namespace JsonParser;
use Antlr\Antlr4\Runtime\CommonTokenStream;
use Antlr\Antlr4\Runtime\Error\Listeners\DiagnosticErrorListener;
use Antlr\Antlr4\Runtime\InputStream;
use Antlr\Antlr4\Runtime\ParserRuleContext;
use Antlr\Antlr4\Runtime\Tree\ErrorNode;
use Antlr\Antlr4\Runtime\Tree\ParseTreeListener;
use Antlr\Antlr4\Runtime\Tree\ParseTreeWalker;
use Antlr\Antlr4\Runtime\Tree\TerminalNode;
final class TreeShapeListener implements ParseTreeListener {
public function visitTerminal(TerminalNode $node) : void {}
public function visitErrorNode(ErrorNode $node) : void {}
public function exitEveryRule(ParserRuleContext $ctx) : void {}
public function enterEveryRule(ParserRuleContext $ctx) : void {
echo $ctx->getText();
}
}
$input = InputStream::fromPath($argv[1]);
$lexer = new JSONLexer($input);
$tokens = new CommonTokenStream($lexer);
$parser = new JSONParser($tokens);
$parser->addErrorListener(new DiagnosticErrorListener());
$parser->setBuildParseTree(true);
$tree = $parser->json();
ParseTreeWalker::default()->walk(new TreeShapeListener(), $tree);
```
Create a `example.json` file:
```json
{"a":1}
```
Parse the input file:
```
php json.php example.json
```
The expected output is:
```
{"a":1}
{"a":1}
"a":1
1
```

View File

@ -50,8 +50,8 @@ from MyGrammarLexer import MyGrammarLexer
from MyGrammarParser import MyGrammarParser
def main(argv):
input = FileStream(argv[1])
lexer = MyGrammarLexer(input)
input_stream = FileStream(argv[1])
lexer = MyGrammarLexer(input_stream)
stream = CommonTokenStream(lexer)
parser = MyGrammarParser(stream)
tree = parser.startRule()

View File

@ -0,0 +1,65 @@
//
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
//
function CaseChangingStream(stream, upper) {
this._stream = stream;
this._upper = upper;
}
CaseChangingStream.prototype.LA = function(offset) {
var c = this._stream.LA(offset);
if (c <= 0) {
return c;
}
return String.fromCodePoint(c)[this._upper ? "toUpperCase" : "toLowerCase"]().codePointAt(0);
};
CaseChangingStream.prototype.reset = function() {
return this._stream.reset();
};
CaseChangingStream.prototype.consume = function() {
return this._stream.consume();
};
CaseChangingStream.prototype.LT = function(offset) {
return this._stream.LT(offset);
};
CaseChangingStream.prototype.mark = function() {
return this._stream.mark();
};
CaseChangingStream.prototype.release = function(marker) {
return this._stream.release(marker);
};
CaseChangingStream.prototype.seek = function(_index) {
return this._stream.seek(_index);
};
CaseChangingStream.prototype.getText = function(start, stop) {
return this._stream.getText(start, stop);
};
CaseChangingStream.prototype.toString = function() {
return this._stream.toString();
};
Object.defineProperty(CaseChangingStream.prototype, "index", {
get: function() {
return this._stream.index;
}
});
Object.defineProperty(CaseChangingStream.prototype, "size", {
get: function() {
return this._stream.size;
}
});
exports.CaseChangingStream = CaseChangingStream;

View File

@ -0,0 +1,13 @@
class CaseChangingStream():
def __init__(self, stream, upper):
self._stream = stream
self._upper = upper
def __getattr__(self, name):
return self._stream.__getattribute__(name)
def LA(self, offset):
c = self._stream.LA(offset)
if c <= 0:
return c
return ord(chr(c).upper() if self._upper else chr(c).lower())

View File

@ -1,54 +0,0 @@
//
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
//
function CaseInsensitiveInputStream(stream, upper) {
this._stream = stream;
this._case = upper ? String.toUpperCase : String.toLowerCase;
return this;
}
CaseInsensitiveInputStream.prototype.LA = function (offset) {
c = this._stream.LA(i);
if (c <= 0) {
return c;
}
return this._case.call(String.fromCodePoint(c))
};
CaseInsensitiveInputStream.prototype.reset = function() {
return this._stream.reset();
};
CaseInsensitiveInputStream.prototype.consume = function() {
return this._stream.consume();
};
CaseInsensitiveInputStream.prototype.LT = function(offset) {
return this._stream.LT(offset);
};
CaseInsensitiveInputStream.prototype.mark = function() {
return this._stream.mark();
};
CaseInsensitiveInputStream.prototype.release = function(marker) {
return this._stream.release(marker);
};
CaseInsensitiveInputStream.prototype.seek = function(_index) {
return this._stream.getText(start, stop);
};
CaseInsensitiveInputStream.prototype.getText = function(start, stop) {
return this._stream.getText(start, stop);
};
CaseInsensitiveInputStream.prototype.toString = function() {
return this._stream.toString();
};
exports.CaseInsensitiveInputStream = CaseInsensitiveInputStream;

View File

@ -1,13 +1,15 @@
package antlr
package antlr_resource
import (
"unicode"
"github.com/antlr/antlr4/runtime/Go/antlr"
)
// CaseChangingStream wraps an existing CharStream, but upper cases, or
// lower cases the input before it is tokenized.
type CaseChangingStream struct {
CharStream
antlr.CharStream
upper bool
}
@ -15,10 +17,8 @@ type CaseChangingStream struct {
// NewCaseChangingStream returns a new CaseChangingStream that forces
// all tokens read from the underlying stream to be either upper case
// or lower case based on the upper argument.
func NewCaseChangingStream(in CharStream, upper bool) *CaseChangingStream {
return &CaseChangingStream{
in, upper,
}
func NewCaseChangingStream(in antlr.CharStream, upper bool) *CaseChangingStream {
return &CaseChangingStream{in, upper}
}
// LA gets the value of the symbol at offset from the current position

View File

@ -9,12 +9,13 @@ This page lists the available and upcoming ANTLR runtimes. Please note that you
* [Go](go-target.md)
* [C++](cpp-target.md)
* [Swift](swift-target.md)
* [PHP](php-target.md)
## Target feature parity
New features generally appear in the Java target and then migrate to the other targets, but these other targets don't always get updated in the same overall tool release. This section tries to identify features added to Java that have not been added to the other targets.
|Feature|Java|C&sharp;|Python2|Python3|JavaScript|Go|C++|Swift|
|---|---|---|---|---|---|---|---|---|
|Ambiguous tree construction|4.5.1|-|-|-|-|-|-|-|
|Feature|Java|C&sharp;|Python2|Python3|JavaScript|Go|C++|Swift|PHP
|---|---|---|---|---|---|---|---|---|---|
|Ambiguous tree construction|4.5.1|-|-|-|-|-|-|-|-|

View File

@ -68,7 +68,8 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>[9.3.24.v20180605,)</version>
<!-- stick to version 9 for jdk compatibility -->
<version>9.4.19.v20190610</version>
<scope>test</scope>
</dependency>
<dependency>
@ -108,14 +109,15 @@
<!-- SUREFIRE-951: file.encoding cannot be set via systemPropertyVariables -->
<argLine>-Dfile.encoding=UTF-8</argLine>
<includes>
<include>**/csharp/Test*.java</include>
<include>**/java/Test*.java</include>
<include>**/go/Test*.java</include>
<include>**/javascript/node/Test*.java</include>
<include>**/python2/Test*.java</include>
<include>**/python3/Test*.java</include>
<include>${antlr.tests.swift}</include>
</includes>
<include>**/csharp/Test*.java</include>
<include>**/java/Test*.java</include>
<include>**/go/Test*.java</include>
<include>**/javascript/node/Test*.java</include>
<include>**/python2/Test*.java</include>
<include>**/python3/Test*.java</include>
<include>**/php/Test*.java</include>
<include>${antlr.tests.swift}</include>
</includes>
</configuration>
</plugin>
<plugin>

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "((<t>)<v>)"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "Object <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%int <n> = <v>;%>
InitBooleanMember(n,v) ::= <%bool <n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -94,6 +102,8 @@ bool Property() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
public override IToken NextToken() {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%this.<n> = <v>;%>
InitBooleanMember(n,v) ::= <%this.<n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -92,6 +100,8 @@ this.Property = function() {
}
>>
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -9,6 +9,7 @@ Assert(s) ::= ""
Cast(t,v) ::= "dynamic_cast\<<t> *>(<v>)" // Should actually use a more specific name. We may have to use other casts as well.
Append(a,b) ::= "<a> + <b>->toString()"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= "<a> + <b>"
DeclareLocal(s,v) ::= "<s> = <v>"
@ -17,6 +18,9 @@ AssignLocal(s,v) ::= "<s> = <v>;"
InitIntMember(n,v) ::= "int <n> = <v>;"
InitBooleanMember(n,v) ::= "bool <n> = <v>;"
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= "<n>"
SetMember(n,v) ::= "<n> = <v>;"
@ -68,6 +72,8 @@ bool Property() {
ParserPropertyCall(p, call) ::= "<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
protected:
class PositionAdjustingLexerATNSimulator : public antlr4::atn::LexerATNSimulator {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%this.<n> = <v>;%>
InitBooleanMember(n,v) ::= <%this.<n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -98,6 +106,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%this.<n> = <v>;%>
InitBooleanMember(n,v) ::= <%this.<n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -100,6 +108,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "(<v>)"
Append(a,b) ::= "<a> + fmt.Sprint(<b>)"
AppendStr(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
DeclareLocal(s, v) ::= "var <s> = <v>"
@ -26,6 +28,12 @@ InitIntMember(n, v) ::= <%var <n> int = <v>; var _ int = <n>; %>
InitBooleanMember(n, v) ::= <%var <n> bool = <v>; var _ bool = <n>; %>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%<n>%>
SetMember(n, v) ::= <%<n> = <v>;%>
@ -94,6 +102,8 @@ func (p *TParser) Property() bool {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
func (p *PositionAdjustingLexer) NextToken() antlr.Token {
if _, ok := p.Interpreter.(*PositionAdjustingLexerATNSimulator); !ok {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "((<t>)<v>)"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "Object <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%int <n> = <v>;%>
InitBooleanMember(n,v) ::= <%boolean <n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -94,6 +102,8 @@ boolean Property() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
@Override

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%this.<n> = <v>;%>
InitBooleanMember(n,v) ::= <%this.<n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -98,6 +106,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -0,0 +1,272 @@
writeln(s) ::= <<echo <s> . \PHP_EOL;>>
write(s) ::= <<echo <s>;>>
writeList(s) ::= <<echo <s; separator=".">;>>
False() ::= "false"
True() ::= "true"
Not(v) ::= "!<v>"
Assert(s) ::= <<assert(<s>);>>
Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> . <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "<s> = <v>;"
AssertIsList(v) ::= "assert(\is_array(<v>));" // just use static type system
AssignLocal(s,v) ::= "<s> = <v>;"
InitIntMember(n,v) ::= <%public \$<n> = <v>;%>
InitBooleanMember(n,v) ::= <%public \$<n> = <v>;%>
InitIntVar(n,v) ::= <%\$<n> = <v>;%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "$<n>"
GetMember(n) ::= <%\$this-><n>%>
SetMember(n,v) ::= <%\$this-><n> = <v>;%>
AddMember(n,v) ::= <%\$this-><n> += <v>;%>
PlusMember(v,n) ::= <%<v> + \$this-><n>%>
MemberEquals(n,v) ::= <%\$this-><n> == <v>%>
ModMemberEquals(n,m,v) ::= <%\$this-><n> % <m> == <v>%>
ModMemberNotEquals(n,m,v) ::= <%\$this-><n> % <m> !== <v>%>
DumpDFA() ::= "\$this->dumpDFA();"
Pass() ::= ""
StringList() ::= ""
BuildParseTrees() ::= "\$this->setBuildParseTree(true);"
BailErrorStrategy() ::= <%\$this->setErrorHandler(new Antlr\\Antlr4\\Runtime\\Error\\BailErrorStrategy());%>
ToStringTree(s) ::= <%<s>->toStringTree(\$this->getRuleNames())%>
Column() ::= "\$this->getCharPositionInLine()"
Text() ::= "\$this->getText()"
ValEquals(a,b) ::= <%<a>===<b>%>
TextEquals(a) ::= <%\$this->getText() === "<a>"%>
PlusText(a) ::= <%"<a>" . \$this->getText()%>
InputText() ::= "\$this->input->getText()"
LTEquals(i, v) ::= <%\$this->input->LT(<i>)->getText() === <v>%>
LANotEquals(i, v) ::= <%\$this->input->LA(<i>) !== <v>%>
TokenStartColumnEquals(i) ::= <%\$this->tokenStartCharPositionInLine === <i>%>
ImportListener(X) ::= ""
GetExpectedTokenNames() ::= "\$this->getExpectedTokens()->toStringVocabulary(\$this->getVocabulary())"
RuleInvocationStack() ::= "'[' . \implode(', ', \$this->getRuleInvocationStack()) . ']'"
LL_EXACT_AMBIG_DETECTION() ::= <<\$this->interp->setPredictionMode(Antlr\\Antlr4\\Runtime\\Atn\\PredictionMode::LL_EXACT_AMBIG_DETECTION);>>
ParserToken(parser, token) ::= <%<parser>::<token>%>
Production(p) ::= <%<p>%>
Result(r) ::= <%<r>%>
ParserPropertyMember() ::= <<
@members {
public function Property() : bool
{
return true;
}
}
>>
ParserPropertyCall(p, call) ::= "<p>-><call>"
PositionAdjustingLexerDef() ::= <<
class PositionAdjustingLexerATNSimulator extends LexerATNSimulator {
public function resetAcceptPosition(CharStream \$input, int \$index, int \$line, int \$charPositionInLine) : void {
\$input->seek(\$index);
\$this->line = \$line;
\$this->charPositionInLine = \$charPositionInLine;
\$this->consume(\$input);
}
}
>>
PositionAdjustingLexer() ::= <<
public function nextToken() : Antlr\\Antlr4\\Runtime\\Token
{
if (!\$this->interp instanceof PositionAdjustingLexerATNSimulator) {
\$this->interp = new PositionAdjustingLexerATNSimulator(\$this, self::\$atn, self::\$decisionToDFA, self::\$sharedContextCache);
}
return parent::nextToken();
}
public function emit() : Antlr\\Antlr4\\Runtime\\Token
{
switch (\$this->type) {
case self::TOKENS:
\$this->handleAcceptPositionForKeyword('tokens');
break;
case self::LABEL:
\$this->handleAcceptPositionForIdentifier();
break;
}
return parent::emit();
}
private function handleAcceptPositionForIdentifier() : bool
{
\$tokenText = \$this->getText();
\$identifierLength = 0;
while (\$identifierLength \< \strlen(\$tokenText) && self::isIdentifierChar(\$tokenText[\$identifierLength])) {
\$identifierLength++;
}
if (\$this->getInputStream()->getIndex() > \$this->tokenStartCharIndex + \$identifierLength) {
\$offset = \$identifierLength - 1;
\$this->getInterpreter()->resetAcceptPosition(\$this->getInputStream(), \$this->tokenStartCharIndex + \$offset, \$this->tokenStartLine, \$this->tokenStartCharPositionInLine + \$offset);
return true;
}
return false;
}
private function handleAcceptPositionForKeyword(string \$keyword) : bool
{
if (\$this->getInputStream()->getIndex() > \$this->tokenStartCharIndex + \strlen(\$keyword)) {
\$offset = \strlen(\$keyword) - 1;
\$this->getInterpreter()->resetAcceptPosition(\$this->getInputStream(), \$this->tokenStartCharIndex + \$offset, \$this->tokenStartLine, \$this->tokenStartCharPositionInLine + \$offset);
return true;
}
return false;
}
private static function isIdentifierChar(string \$c) : bool
{
return \ctype_alnum(\$c) || \$c === '_';
}
>>
BasicListener(X) ::= <<
@parser::definitions {
class LeafListener extends TBaseListener
{
public function visitTerminal(Antlr\\Antlr4\\Runtime\\Tree\\TerminalNode \$node) : void
{
echo \$node->getSymbol()->getText() . \PHP_EOL;
}
}
}
>>
WalkListener(s) ::= <<
\$walker = new Antlr\\Antlr4\\Runtime\\Tree\\ParseTreeWalker();
\$walker->walk(new LeafListener(), <s>);
>>
TreeNodeWithAltNumField(X) ::= <<
@parser::contexts {
class MyRuleNode extends ParserRuleContext
{
public \$altNum;
public function getAltNumber() : int
{
return \$this->altNum;
}
public function setAltNumber(int \$altNum) : void
{
\$this->altNum = \$altNum;
}
}
}
>>
TokenGetterListener(X) ::= <<
@parser::definitions {
class LeafListener extends TBaseListener {
public function exitA(Context\\AContext \$ctx) : void {
if (\$ctx->getChildCount() === 2) {
echo \sprintf('%s %s [%s]',\$ctx->INT(0)->getSymbol()->getText(), \$ctx->INT(1)->getSymbol()->getText(), \implode(', ', \$ctx->INT())) . \PHP_EOL;
} else {
echo \$ctx->ID()->getSymbol() . \PHP_EOL;
}
}
}
}
>>
RuleGetterListener(X) ::= <<
@parser::definitions {
class LeafListener extends TBaseListener {
public function exitA(Context\\AContext \$ctx) : void
{
if (\$ctx->getChildCount() === 2) {
echo \sprintf('%s %s %s', \$ctx->b(0)->start->getText(), \$ctx->b(1)->start->getText(),\$ctx->b()[0]->start->getText()) . \PHP_EOL;
} else {
echo \$ctx->b(0)->start->getText() . \PHP_EOL;
}
}
}
}
>>
LRListener(X) ::= <<
@parser::definitions {
class LeafListener extends TBaseListener {
public function exitE(Context\\EContext \$ctx) : void
{
if (\$ctx->getChildCount() === 3) {
echo \sprintf('%s %s %s', \$ctx->e(0)->start->getText(), \$ctx->e(1)->start->getText(), \$ctx->e()[0]->start->getText()) . \PHP_EOL;
} else {
echo \$ctx->INT()->getSymbol()->getText() . \PHP_EOL;
}
}
}
}
>>
LRWithLabelsListener(X) ::= <<
@parser::definitions {
class LeafListener extends TBaseListener
{
public function exitCall(Context\\CallContext \$ctx) : void {
echo \sprintf('%s %s',\$ctx->e()->start->getText(),\$ctx->eList()) . \PHP_EOL;
}
public function exitInt(Context\\IntContext \$ctx) : void {
echo \$ctx->INT()->getSymbol()->getText() . \PHP_EOL;
}
}
}
>>
DeclareContextListGettersFunction() ::= <<
public function foo() : void {
\$s = null;
\$a = \$s->a();
\$b = \$s->b();
}
>>
Declare_foo() ::= <<
public function foo() : void {
echo 'foo' . \PHP_EOL;
}
>>
Invoke_foo() ::= "\$this->foo();"
Declare_pred() ::= <<public function pred(bool \$v) : bool {
echo "eval=".(\$v ? 'true' : 'false') . \PHP_EOL;
return \$v;
}
>>
Invoke_pred(v) ::= "\$this->pred(<v>)"
ParserTokenType(t) ::= "Parser::<t>"
ContextRuleFunction(ctx, rule) ::= "<ctx>-><rule>"
StringType() ::= ""
ContextMember(ctx, subctx, member) ::= "<ctx>-><subctx>-><member>"

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + str(<b>)"
AppendStr(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "<s> = <v>"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%<n> = <v>%>
InitBooleanMember(n,v) ::= <%<n> = <v>%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%self.<n>%>
SetMember(n,v) ::= <%self.<n> = <v>%>
@ -94,6 +102,8 @@ def Property(self):
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
def resetAcceptPosition(self, index, line, column):

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + str(<b>)"
AppendStr(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "<s> = <v>"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%<n> = <v>%>
InitBooleanMember(n,v) ::= <%<n> = <v>%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%self.<n>%>
SetMember(n,v) ::= <%self.<n> = <v>%>
@ -99,6 +107,8 @@ def Property(self):
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
def resetAcceptPosition(self, index, line, column):

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>;"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%this.<n> = <v>;%>
InitBooleanMember(n,v) ::= <%this.<n> = <v>;%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "<n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%this.<n>%>
SetMember(n,v) ::= <%this.<n> = <v>;%>
@ -98,6 +106,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,6 +14,8 @@ Cast(t,v) ::= "((<v> as! <t>))"
Append(a,b) ::= "<a> + <b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
Concat(a,b) ::= "<a><b>"
DeclareLocal(s,v) ::= "var <s> = <v>"
@ -26,6 +28,12 @@ InitIntMember(n,v) ::= <%var <n> = <v>%>
InitBooleanMember(n,v) ::= <%var <n> = <v>%>
InitIntVar(n,v) ::= <%<InitIntMember(n,v)>%>
IntArg(n) ::= "int <n>"
VarRef(n) ::= "<n>"
GetMember(n) ::= <%self.<n>%>
SetMember(n,v) ::= <%self.<n> = <v>%>
@ -96,6 +104,8 @@ ParserPropertyCall(parser, property) ::= <<
<parser>.<property>
>>
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
override

View File

@ -50,6 +50,7 @@ public abstract class BaseRuntimeTest {
"Go",
"CSharp",
"Python2", "Python3",
"PHP",
"Node", "Safari", "Firefox", "Explorer", "Chrome"
};
public final static String[] JavaScriptTargets = {
@ -116,6 +117,7 @@ public abstract class BaseRuntimeTest {
System.out.printf("Ignore "+descriptor);
return;
}
if ( descriptor.getTestType().contains("Parser") ) {
testParser(descriptor);
}

View File

@ -418,7 +418,7 @@ public class CompositeParsersDescriptors {
parser grammar S;
type_ : 'int' ;
decl : type_ ID ';'
| type_ ID init_ ';' {<write("\"JavaDecl: \" + $text")>};
| type_ ID init_ ';' {<AppendStr("\"JavaDecl: \"","$text"):writeln()>};
init_ : '=' INT;
*/
@CommentHasStringValue
@ -532,7 +532,7 @@ public class CompositeParsersDescriptors {
/**
parser grammar S;
a @after {<InitIntMember("x","0")>} : B;
a @after {<InitIntVar("x","0")>} : B;
*/
@CommentHasStringValue
public String slaveGrammarS;

View File

@ -372,7 +372,7 @@ public class FullContextParsingDescriptors {
: expr_or_assign*;
expr_or_assign
: expr '++' {<writeln("\"fail.\"")>}
| expr {<writeln("\"pass: \"+$expr.text")>}
| expr {<AppendStr("\"pass: \"","$expr.text"):writeln()>}
;
expr: expr_primary ('\<-' ID)?;
expr_primary

View File

@ -529,8 +529,8 @@ public class LeftRecursionDescriptors {
| e '+' e {$v = <Cast("BinaryContext","$ctx"):ContextMember({<Production("e")>(0)}, {<Result("v")>})> + <Cast("BinaryContext","$ctx"):ContextMember({<Production("e")>(1)}, {<Result("v")>})>;} # binary
| INT {$v = $INT.int;} # anInt
| '(' e ')' {$v = $e.v;} # parens
| left=e INC {<Cast("UnaryContext","$ctx"):Concat(".INC() != null"):Assert()>$v = $left.v + 1;} # unary
| left=e DEC {<Cast("UnaryContext","$ctx"):Concat(".DEC() != null"):Assert()>$v = $left.v - 1;} # unary
| left=e INC {<ContextRuleFunction(Cast("UnaryContext","$ctx"), "INC()"):Concat(" != null"):Assert()>$v = $left.v + 1;} # unary
| left=e DEC {<ContextRuleFunction(Cast("UnaryContext","$ctx"), "DEC()"):Concat(" != null"):Assert()>$v = $left.v - 1;} # unary
| ID {<AssignLocal("$v","3")>} # anID
;
ID : 'a'..'z'+ ;
@ -636,9 +636,9 @@ public class LeftRecursionDescriptors {
grammar T;
s : e {<writeln("$e.result")>} ;
e returns [<StringType()> result]
: ID '=' e1=e {$result = "(" + $ID.text + "=" + $e1.result + ")";}
: ID '=' e1=e {$result = <AppendStr("\"(\"", AppendStr("$ID.text", AppendStr("\"=\"", AppendStr("$e1.result", "\")\""))))>;}
| ID {$result = $ID.text;}
| e1=e '+' e2=e {$result = "(" + $e1.result + "+" + $e2.result + ")";}
| e1=e '+' e2=e {$result = <AppendStr("\"(\"", AppendStr("$e1.result", AppendStr("\"+\"", AppendStr("$e2.result", "\")\""))))>;}
;
ID : 'a'..'z'+ ;
INT : '0'..'9'+ ;

View File

@ -766,6 +766,10 @@ public class LexerExecDescriptors {
/**
lexer grammar PositionAdjustingLexer;
@definitions {
<PositionAdjustingLexerDef()>
}
@members {
<PositionAdjustingLexer()>
}

View File

@ -144,8 +144,8 @@ public class SemPredEvalParserDescriptors {
/**
grammar T;
s : b[2] ';' | b[2] '.' ; // decision in s drills down to ctx-dependent pred in a;
b[int i] : a[i] ;
a[int i]
b[<IntArg("i")>] : a[<VarRef("i")>] ;
a[<IntArg("i")>]
: {<ValEquals("$i","1")>}? ID {<writeln("\"alt 1\"")>}
| {<ValEquals("$i","2")>}? ID {<writeln("\"alt 2\"")>}
;
@ -310,7 +310,7 @@ public class SemPredEvalParserDescriptors {
grammar T;
@parser::members {<InitBooleanMember("enumKeyword",True())>}
primary
: ID {<writeln("\"ID \"+$ID.text")>}
: ID {<AppendStr("\"ID \"", "$ID.text"):writeln()>}
| {<GetMember("enumKeyword"):Not()>}? 'enum' {<writeln("\"enum\"")>}
;
ID : [a-z]+ ;

View File

@ -0,0 +1,599 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.antlr.v4.Tool;
import org.antlr.v4.automata.LexerATNFactory;
import org.antlr.v4.automata.ParserATNFactory;
import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.atn.ATNDeserializer;
import org.antlr.v4.runtime.atn.ATNSerializer;
import org.antlr.v4.semantics.SemanticPipeline;
import org.antlr.v4.test.runtime.ErrorQueue;
import org.antlr.v4.test.runtime.RuntimeTestSupport;
import org.antlr.v4.test.runtime.StreamVacuum;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.LexerGrammar;
import org.stringtemplate.v4.ST;
import static org.antlr.v4.test.runtime.BaseRuntimeTest.antlrOnString;
import static org.antlr.v4.test.runtime.BaseRuntimeTest.writeFile;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class BasePHPTest implements RuntimeTestSupport {
public static final String newline = System.getProperty("line.separator");
public String tmpdir = null;
/**
* If error during parser execution, store stderr here; can't return
* stdout and stderr. This doesn't trap errors from running antlr.
*/
protected String stderrDuringParse;
/**
* Errors found while running antlr
*/
protected StringBuilder antlrToolErrors;
private String getPropertyPrefix() {
return "antlr-php";
}
@Override
public void testSetUp() throws Exception {
// new output dir for each test
String propName = getPropertyPrefix() + "-test-dir";
String prop = System.getProperty(propName);
if (prop != null && prop.length() > 0) {
tmpdir = prop;
} else {
String classSimpleName = getClass().getSimpleName();
String threadName = Thread.currentThread().getName();
String childPath = String.format("%s-%s-%s", classSimpleName, threadName, System.currentTimeMillis());
tmpdir = new File(System.getProperty("java.io.tmpdir"), childPath).getAbsolutePath();
}
antlrToolErrors = new StringBuilder();
}
@Override
public void testTearDown() throws Exception {
}
@Override
public String getTmpDir() {
return tmpdir;
}
@Override
public String getStdout() {
return null;
}
@Override
public String getParseErrors() {
return stderrDuringParse;
}
@Override
public String getANTLRToolErrors() {
if (antlrToolErrors.length() == 0) {
return null;
}
return antlrToolErrors.toString();
}
protected ATN createATN(Grammar g, boolean useSerializer) {
if (g.atn == null) {
semanticProcess(g);
assertEquals(0, g.tool.getNumErrors());
ParserATNFactory f;
if (g.isLexer()) {
f = new LexerATNFactory((LexerGrammar) g);
} else {
f = new ParserATNFactory(g);
}
g.atn = f.createATN();
assertEquals(0, g.tool.getNumErrors());
}
ATN atn = g.atn;
if (useSerializer) {
char[] serialized = ATNSerializer.getSerializedAsChars(atn);
return new ATNDeserializer().deserialize(serialized);
}
return atn;
}
protected void semanticProcess(Grammar g) {
if (g.ast != null && !g.ast.hasErrors) {
Tool antlr = new Tool();
SemanticPipeline sem = new SemanticPipeline(g);
sem.process();
if (g.getImportedGrammars() != null) {
for (Grammar imp: g.getImportedGrammars()) {
antlr.processNonCombinedGrammar(imp, false);
}
}
}
}
protected String execLexer(
String grammarFileName,
String grammarStr,
String lexerName,
String input
) {
return execLexer(grammarFileName, grammarStr, lexerName, input, false);
}
@Override
public String execLexer(
String grammarFileName,
String grammarStr,
String lexerName,
String input,
boolean showDFA
) {
boolean success = rawGenerateAndBuildRecognizer(
grammarFileName,
grammarStr,
null,
lexerName,
"-no-listener"
);
assertTrue(success);
writeFile(tmpdir, "input", input);
writeLexerTestFile(lexerName, showDFA);
String output = execModule("Test.php");
return output;
}
public String execParser(
String grammarFileName,
String grammarStr,
String parserName,
String lexerName,
String listenerName,
String visitorName,
String startRuleName,
String input,
boolean showDiagnosticErrors
) {
return execParser_(
grammarFileName,
grammarStr,
parserName,
lexerName,
listenerName,
visitorName,
startRuleName,
input,
showDiagnosticErrors,
false
);
}
public String execParser_(
String grammarFileName,
String grammarStr,
String parserName,
String lexerName,
String listenerName,
String visitorName,
String startRuleName,
String input,
boolean debug,
boolean trace
) {
boolean success = rawGenerateAndBuildRecognizer(
grammarFileName,
grammarStr,
parserName,
lexerName,
"-visitor"
);
assertTrue(success);
writeFile(tmpdir, "input", input);
rawBuildRecognizerTestFile(
parserName,
lexerName,
listenerName,
visitorName,
startRuleName,
debug,
trace
);
return execRecognizer();
}
/**
* Return true if all is well
*/
protected boolean rawGenerateAndBuildRecognizer(
String grammarFileName,
String grammarStr,
String parserName,
String lexerName,
String... extraOptions
) {
return rawGenerateAndBuildRecognizer(
grammarFileName,
grammarStr,
parserName,
lexerName,
false,
extraOptions
);
}
/**
* Return true if all is well
*/
protected boolean rawGenerateAndBuildRecognizer(
String grammarFileName,
String grammarStr,
String parserName,
String lexerName,
boolean defaultListener,
String... extraOptions
) {
ErrorQueue equeue = antlrOnString(getTmpDir(), "PHP", grammarFileName, grammarStr, defaultListener, extraOptions);
if (!equeue.errors.isEmpty()) {
return false;
}
List<String> files = new ArrayList<String>();
if (lexerName != null) {
files.add(lexerName + ".php");
}
if (parserName != null) {
files.add(parserName + ".php");
Set<String> optionsSet = new HashSet<String>(Arrays.asList(extraOptions));
if (!optionsSet.contains("-no-listener")) {
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.')) + "Listener.php");
}
if (optionsSet.contains("-visitor")) {
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.')) + "Visitor.php");
}
}
return true;
}
protected void rawBuildRecognizerTestFile(
String parserName,
String lexerName,
String listenerName,
String visitorName,
String parserStartRuleName,
boolean debug,
boolean trace
) {
this.stderrDuringParse = null;
if (parserName == null) {
writeLexerTestFile(lexerName, false);
} else {
writeParserTestFile(
parserName,
lexerName,
listenerName,
visitorName,
parserStartRuleName,
debug,
trace
);
}
}
public String execRecognizer() {
return execModule("Test.php");
}
public String execModule(String fileName) {
String phpPath = locatePhp();
String runtimePath = locateRuntime();
File tmpdirFile = new File(tmpdir);
String modulePath = new File(tmpdirFile, fileName).getAbsolutePath();
String inputPath = new File(tmpdirFile, "input").getAbsolutePath();
Path outputPath = tmpdirFile.toPath().resolve("output").toAbsolutePath();
try {
ProcessBuilder builder = new ProcessBuilder(phpPath, modulePath, inputPath, outputPath.toString());
builder.environment().put("RUNTIME", runtimePath);
builder.directory(tmpdirFile);
Process process = builder.start();
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
stdoutVacuum.start();
stderrVacuum.start();
process.waitFor();
stdoutVacuum.join();
stderrVacuum.join();
String output = stdoutVacuum.toString();
if (output.length() == 0) {
output = null;
}
if (stderrVacuum.toString().length() > 0) {
this.stderrDuringParse = stderrVacuum.toString();
}
return output;
} catch (Exception e) {
System.err.println("can't exec recognizer");
e.printStackTrace(System.err);
}
return null;
}
private String locateTool(String tool) {
final String phpPath = System.getProperty("PHP_PATH");
if (phpPath != null && new File(phpPath).exists()) {
return phpPath;
}
String[] roots = {"/usr/local/bin/", "/opt/local/bin", "/usr/bin/"};
for (String root: roots) {
if (new File(root + tool).exists()) {
return root + tool;
}
}
throw new RuntimeException("Could not locate " + tool);
}
protected String locatePhp() {
String propName = getPropertyPrefix() + "-php";
String prop = System.getProperty(propName);
if (prop == null || prop.length() == 0) {
prop = locateTool("php");
}
File file = new File(prop);
if (!file.exists()) {
throw new RuntimeException("Missing system property:" + propName);
}
return file.getAbsolutePath();
}
protected String locateRuntime() {
String propName = "antlr-php-runtime";
String prop = System.getProperty(propName);
if (prop == null || prop.length() == 0) {
prop = "../runtime/PHP";
}
File file = new File(prop);
if (!file.exists()) {
throw new RuntimeException("Missing system property:" + propName);
}
try {
return file.getCanonicalPath();
} catch (IOException e) {
return file.getAbsolutePath();
}
}
protected void mkdir(String dir) {
File f = new File(dir);
f.mkdirs();
}
protected void writeLexerTestFile(String lexerName, boolean showDFA) {
ST outputFileST = new ST(
"\\<?php\n"
+ "\n"
+ "declare(strict_types=1);\n"
+ "\n"
+ "use Antlr\\Antlr4\\Runtime\\CommonTokenStream;\n"
+ "use Antlr\\Antlr4\\Runtime\\Error\\Listeners\\ConsoleErrorListener;\n"
+ "use Antlr\\Antlr4\\Runtime\\InputStream;\n"
+ "use Antlr\\Antlr4\\Runtime\\Lexer;\n"
+ "\n"
+ "$runtime = \\getenv('RUNTIME');\n"
+ "\n"
+ "\\spl_autoload_register(function (string $class) use ($runtime) : void {\n"
+ " $file = \\str_replace('\\\\\\', \\DIRECTORY_SEPARATOR, \\str_replace('Antlr\\Antlr4\\Runtime\\\\\\', $runtime . '\\\\\\src\\\\\\', $class)) . '.php';\n"
+ "\n"
+ " if (\\file_exists($file)) {\n"
+ " require_once $file; \n"
+ " }\n"
+ "});"
+ "\n"
+ "$input = InputStream::fromPath($argv[1]);\n"
+ "$lexer = new <lexerName>($input);\n"
+ "$lexer->addErrorListener(new ConsoleErrorListener());"
+ "$tokens = new CommonTokenStream($lexer);\n"
+ "$tokens->fill();\n"
+ "\n"
+ "foreach ($tokens->getAllTokens() as $token) {\n"
+ " echo $token . \\PHP_EOL;\n"
+ "}"
+ (showDFA
? "echo $lexer->getInterpreter()->getDFA(Lexer::DEFAULT_MODE)->toLexerString();\n"
: "")
);
outputFileST.add("lexerName", lexerName);
writeFile(tmpdir, "Test.php", outputFileST.render());
}
protected void writeParserTestFile(
String parserName, String lexerName,
String listenerName, String visitorName,
String parserStartRuleName, boolean debug, boolean trace
) {
if (!parserStartRuleName.endsWith(")")) {
parserStartRuleName += "()";
}
ST outputFileST = new ST(
"\\<?php\n"
+ "\n"
+ "declare(strict_types=1);\n"
+ "\n"
+ "use Antlr\\Antlr4\\Runtime\\CommonTokenStream;\n"
+ "use Antlr\\Antlr4\\Runtime\\Error\\Listeners\\DiagnosticErrorListener;\n"
+ "use Antlr\\Antlr4\\Runtime\\Error\\Listeners\\ConsoleErrorListener;\n"
+ "use Antlr\\Antlr4\\Runtime\\InputStream;\n"
+ "use Antlr\\Antlr4\\Runtime\\ParserRuleContext;\n"
+ "use Antlr\\Antlr4\\Runtime\\Tree\\ErrorNode;\n"
+ "use Antlr\\Antlr4\\Runtime\\Tree\\ParseTreeListener;\n"
+ "use Antlr\\Antlr4\\Runtime\\Tree\\ParseTreeWalker;\n"
+ "use Antlr\\Antlr4\\Runtime\\Tree\\RuleNode;\n"
+ "use Antlr\\Antlr4\\Runtime\\Tree\\TerminalNode;\n"
+ "\n"
+ "$runtime = \\getenv('RUNTIME');\n"
+ "\n"
+ "\\spl_autoload_register(function (string $class) use ($runtime) : void {\n"
+ " $file = \\str_replace('\\\\\\', \\DIRECTORY_SEPARATOR, \\str_replace('Antlr\\Antlr4\\Runtime\\\\\\', $runtime . '\\\\\\src\\\\\\', $class)) . '.php';\n"
+ "\n"
+ " if (\\file_exists($file)) {\n"
+ " require_once $file; \n"
+ " }\n"
+ "});\n"
+ "\n"
+ "final class TreeShapeListener implements ParseTreeListener {\n"
+ " public function visitTerminal(TerminalNode $node) : void {}\n"
+ " public function visitErrorNode(ErrorNode $node) : void {}\n"
+ " public function exitEveryRule(ParserRuleContext $ctx) : void {}\n"
+ "\n"
+ " public function enterEveryRule(ParserRuleContext $ctx) : void {\n"
+ " for ($i = 0, $count = $ctx->getChildCount(); $i \\< $count; $i++) {\n"
+ " $parent = $ctx->getChild($i)->getParent();\n"
+ "\n"
+ " if (!($parent instanceof RuleNode) || $parent->getRuleContext() !== $ctx) {\n"
+ " throw new RuntimeException('Invalid parse tree shape detected.');\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}"
+ "\n"
+ "$input = InputStream::fromPath($argv[1]);\n"
+ "$lexer = new <lexerName>($input);\n"
+ "$lexer->addErrorListener(new ConsoleErrorListener());"
+ "$tokens = new CommonTokenStream($lexer);\n"
+ "<createParser>"
+ "$parser->addErrorListener(new ConsoleErrorListener());"
+ "$parser->setBuildParseTree(true);\n"
+ "$tree = $parser-><parserStartRuleName>;\n\n"
+ "ParseTreeWalker::default()->walk(new TreeShapeListener(), $tree);\n"
);
String stSource = "$parser = new <parserName>($tokens);\n";
if (debug) {
stSource += "$parser->addErrorListener(new DiagnosticErrorListener());\n";
}
if (trace) {
stSource += "$parser->setTrace(true);\n";
}
ST createParserST = new ST(stSource);
outputFileST.add("createParser", createParserST);
outputFileST.add("parserName", parserName);
outputFileST.add("lexerName", lexerName);
outputFileST.add("listenerName", listenerName);
outputFileST.add("visitorName", visitorName);
outputFileST.add("parserStartRuleName", parserStartRuleName);
writeFile(tmpdir, "Test.php", outputFileST.render());
}
protected void eraseFiles(File dir) {
String[] files = dir.list();
for (int i = 0; files != null && i < files.length; i++) {
new File(dir, files[i]).delete();
}
}
@Override
public void eraseTempDir() {
boolean doErase = true;
String propName = getPropertyPrefix() + "-erase-test-dir";
String prop = System.getProperty(propName);
if (prop != null && prop.length() > 0) {
doErase = Boolean.getBoolean(prop);
}
if (doErase) {
File tmpdirF = new File(tmpdir);
if (tmpdirF.exists()) {
eraseFiles(tmpdirF);
tmpdirF.delete();
}
}
}
/**
* Sort a list
*/
public <T extends Comparable<? super T>> List<T> sort(List<T> data) {
List<T> dup = new ArrayList<T>();
dup.addAll(data);
Collections.sort(dup);
return dup;
}
/**
* Return map sorted by key
*/
public <K extends Comparable<? super K>, V> LinkedHashMap<K, V> sort(Map<K, V> data) {
LinkedHashMap<K, V> dup = new LinkedHashMap<K, V>();
List<K> keys = new ArrayList<K>();
keys.addAll(data.keySet());
Collections.sort(keys);
for (K k: keys) {
dup.put(k, data.get(k));
}
return dup;
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestCompositeLexers extends BaseRuntimeTest {
public TestCompositeLexers(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestCompositeParsers extends BaseRuntimeTest {
public TestCompositeParsers(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestFullContextParsing extends BaseRuntimeTest {
public TestFullContextParsing(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestLeftRecursion extends BaseRuntimeTest {
public TestLeftRecursion(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestLexerErrors extends BaseRuntimeTest {
public TestLexerErrors(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestLexerExec extends BaseRuntimeTest {
public TestLexerExec(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestListeners extends BaseRuntimeTest {
public TestListeners(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestParseTrees extends BaseRuntimeTest {
public TestParseTrees(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestParserErrors extends BaseRuntimeTest {
public TestParserErrors(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestParserExec extends BaseRuntimeTest {
public TestParserExec(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestPerformance extends BaseRuntimeTest {
public TestPerformance(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestSemPredEvalLexer extends BaseRuntimeTest {
public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestSemPredEvalParser extends BaseRuntimeTest {
public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "PHP");
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.test.runtime.php;
import org.antlr.v4.test.runtime.BaseRuntimeTest;
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
import org.antlr.v4.test.runtime.descriptors.SetsDescriptors;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TestSets extends BaseRuntimeTest {
public TestSets(RuntimeTestDescriptor descriptor) {
super(descriptor,new BasePHPTest());
}
@Parameterized.Parameters(name="{0}")
public static RuntimeTestDescriptor[] getAllTestDescriptors() {
return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "PHP");
}
}

View File

@ -31,6 +31,8 @@ namespace Antlr4.Runtime
private readonly string _grammarFileName;
private readonly ATN _atn;
private readonly Dfa.DFA[] _decisionToDFA;
protected internal readonly BitSet pushRecursionContextStates;
@ -61,8 +63,17 @@ namespace Antlr4.Runtime
this.pushRecursionContextStates.Set(state.stateNumber);
}
}
// get atn simulator that knows how to do predictions
Interpreter = new ParserATNSimulator(this, atn, null, null);
//init decision DFA
int numberofDecisions = atn.NumberOfDecisions;
this._decisionToDFA = new Dfa.DFA[numberofDecisions];
for (int i = 0; i < numberofDecisions; i++)
{
DecisionState decisionState = atn.GetDecisionState(i);
_decisionToDFA[i] = new Dfa.DFA(decisionState, i);
}
// get atn simulator that knows how to do predictions
Interpreter = new ParserATNSimulator(this, atn, _decisionToDFA, null);
}
public override ATN Atn

View File

@ -612,7 +612,6 @@ namespace Antlr4.Runtime
}
// throw exception unless disjoint or identical
bool disjoint = prevRop.lastIndex < rop.index || prevRop.index > rop.lastIndex;
bool same = prevRop.index == rop.index && prevRop.lastIndex == rop.lastIndex;
// Delete special case of replace (text==null):
// D.i-j.u D.x-y.v | boundaries overlap combine to max(min)..max(right)
if (prevRop.text == null && rop.text == null && !disjoint)
@ -628,7 +627,7 @@ namespace Antlr4.Runtime
}
else
{
if (!disjoint && !same)
if (!disjoint)
{
throw new ArgumentException("replace op boundaries of " + rop + " overlap with previous " + prevRop);
}

View File

@ -14,7 +14,7 @@ given input file during build.
The following table lists the parameters that can be used with the function:
Argument# | Required | Default | Use
----------|-----------|---------|--
----------|-----------|---------|---
0 | Yes | n/a | Unique target name. It is used to generate CMake Variables to reference the various outputs of the generation
1 | Yes | n/a | Input file containing the lexer/parser definition
2 | Yes | n/a | Type of Rules contained in the input: LEXER, PARSER or BOTH
@ -24,10 +24,10 @@ Argument# | Required | Default | Use
7 | No | none | Additional files on which the input depends
8 | No | none | Library path to use during generation
The `ANTLR4_JAR_LOCATION` CMake variable must be set to the location where the `antlr-4*-complete.jar` generator is located.
You can download the file from [here](http://www.antlr.org/download.html).
The `ANTLR4_JAR_LOCATION` CMake variable must be set to the location where the `antlr-4*-complete.jar` generator is located. You can download the file from [here](http://www.antlr.org/download.html).
Additional option to the ANTLR4 generator can be passed in the `ANTLR4_GENERATED_OPTIONS` variable
Additional options to the ANTLR4 generator can be passed in the `ANTLR4_GENERATED_OPTIONS` variable. Add the installation prefix of `antlr4-runtime` to `CMAKE_PREFIX_PATH` or set
`antlr4-runtime_DIR` to a directory containing the files.
The following CMake variables are available following a call to `antlr4_generate`

View File

@ -332,7 +332,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "pushd ..\nif [ TParser.g4 -nt generated/TParser.cpp -o TLexer.g4 -nt generated/TLexer.cpp ]; then\n./generate.sh;\nfi\npopd";
shellScript = "pushd ..\nif [ TParser.g4 -nt generated/TParser.cpp -o TLexer.g4 -nt generated/TLexer.cpp ]; then\n./generate.sh;\nfi\npopd\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

View File

@ -0,0 +1,651 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Static|Win32">
<Configuration>Debug Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|x64">
<Configuration>Debug Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug DLL|Win32">
<Configuration>Debug DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug DLL|x64">
<Configuration>Debug DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|Win32">
<Configuration>Release Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|x64">
<Configuration>Release Static</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|Win32">
<Configuration>Release DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release DLL|x64">
<Configuration>Release DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{83BE66CD-9C4F-4F84-B72A-DD1855C8FC8A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>antlr4cpp</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\vs-2019\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\</IntDir>
<TargetName>antlr4-runtime</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>ANTLR4CPP_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>ANTLR4CPP_DLL;ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>ANTLR4CPP_DLL;ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>ANTLR4CPP_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ForcedIncludeFiles>
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\ANTLRErrorListener.cpp" />
<ClCompile Include="src\ANTLRErrorStrategy.cpp" />
<ClCompile Include="src\ANTLRFileStream.cpp" />
<ClCompile Include="src\ANTLRInputStream.cpp" />
<ClCompile Include="src\atn\AbstractPredicateTransition.cpp" />
<ClCompile Include="src\atn\ActionTransition.cpp" />
<ClCompile Include="src\atn\AmbiguityInfo.cpp" />
<ClCompile Include="src\atn\ArrayPredictionContext.cpp" />
<ClCompile Include="src\atn\ATN.cpp" />
<ClCompile Include="src\atn\ATNConfig.cpp" />
<ClCompile Include="src\atn\ATNConfigSet.cpp" />
<ClCompile Include="src\atn\ATNDeserializationOptions.cpp" />
<ClCompile Include="src\atn\ATNDeserializer.cpp" />
<ClCompile Include="src\atn\ATNSerializer.cpp" />
<ClCompile Include="src\atn\ATNSimulator.cpp" />
<ClCompile Include="src\atn\ATNState.cpp" />
<ClCompile Include="src\atn\AtomTransition.cpp" />
<ClCompile Include="src\atn\BasicBlockStartState.cpp" />
<ClCompile Include="src\atn\BasicState.cpp" />
<ClCompile Include="src\atn\BlockEndState.cpp" />
<ClCompile Include="src\atn\BlockStartState.cpp" />
<ClCompile Include="src\atn\ContextSensitivityInfo.cpp" />
<ClCompile Include="src\atn\DecisionEventInfo.cpp" />
<ClCompile Include="src\atn\DecisionInfo.cpp" />
<ClCompile Include="src\atn\DecisionState.cpp" />
<ClCompile Include="src\atn\EmptyPredictionContext.cpp" />
<ClCompile Include="src\atn\EpsilonTransition.cpp" />
<ClCompile Include="src\atn\ErrorInfo.cpp" />
<ClCompile Include="src\atn\LexerAction.cpp" />
<ClCompile Include="src\atn\LexerActionExecutor.cpp" />
<ClCompile Include="src\atn\LexerATNConfig.cpp" />
<ClCompile Include="src\atn\LexerATNSimulator.cpp" />
<ClCompile Include="src\atn\LexerChannelAction.cpp" />
<ClCompile Include="src\atn\LexerCustomAction.cpp" />
<ClCompile Include="src\atn\LexerIndexedCustomAction.cpp" />
<ClCompile Include="src\atn\LexerModeAction.cpp" />
<ClCompile Include="src\atn\LexerMoreAction.cpp" />
<ClCompile Include="src\atn\LexerPopModeAction.cpp" />
<ClCompile Include="src\atn\LexerPushModeAction.cpp" />
<ClCompile Include="src\atn\LexerSkipAction.cpp" />
<ClCompile Include="src\atn\LexerTypeAction.cpp" />
<ClCompile Include="src\atn\LL1Analyzer.cpp" />
<ClCompile Include="src\atn\LookaheadEventInfo.cpp" />
<ClCompile Include="src\atn\LoopEndState.cpp" />
<ClCompile Include="src\atn\NotSetTransition.cpp" />
<ClCompile Include="src\atn\OrderedATNConfigSet.cpp" />
<ClCompile Include="src\atn\ParseInfo.cpp" />
<ClCompile Include="src\atn\ParserATNSimulator.cpp" />
<ClCompile Include="src\atn\PlusBlockStartState.cpp" />
<ClCompile Include="src\atn\PlusLoopbackState.cpp" />
<ClCompile Include="src\atn\PrecedencePredicateTransition.cpp" />
<ClCompile Include="src\atn\PredicateEvalInfo.cpp" />
<ClCompile Include="src\atn\PredicateTransition.cpp" />
<ClCompile Include="src\atn\PredictionContext.cpp" />
<ClCompile Include="src\atn\PredictionMode.cpp" />
<ClCompile Include="src\atn\ProfilingATNSimulator.cpp" />
<ClCompile Include="src\atn\RangeTransition.cpp" />
<ClCompile Include="src\atn\RuleStartState.cpp" />
<ClCompile Include="src\atn\RuleStopState.cpp" />
<ClCompile Include="src\atn\RuleTransition.cpp" />
<ClCompile Include="src\atn\SemanticContext.cpp" />
<ClCompile Include="src\atn\SetTransition.cpp" />
<ClCompile Include="src\atn\SingletonPredictionContext.cpp" />
<ClCompile Include="src\atn\StarBlockStartState.cpp" />
<ClCompile Include="src\atn\StarLoopbackState.cpp" />
<ClCompile Include="src\atn\StarLoopEntryState.cpp" />
<ClCompile Include="src\atn\TokensStartState.cpp" />
<ClCompile Include="src\atn\Transition.cpp" />
<ClCompile Include="src\atn\WildcardTransition.cpp" />
<ClCompile Include="src\BailErrorStrategy.cpp" />
<ClCompile Include="src\BaseErrorListener.cpp" />
<ClCompile Include="src\BufferedTokenStream.cpp" />
<ClCompile Include="src\CharStream.cpp" />
<ClCompile Include="src\CommonToken.cpp" />
<ClCompile Include="src\CommonTokenFactory.cpp" />
<ClCompile Include="src\CommonTokenStream.cpp" />
<ClCompile Include="src\ConsoleErrorListener.cpp" />
<ClCompile Include="src\DefaultErrorStrategy.cpp" />
<ClCompile Include="src\dfa\DFA.cpp" />
<ClCompile Include="src\dfa\DFASerializer.cpp" />
<ClCompile Include="src\dfa\DFAState.cpp" />
<ClCompile Include="src\dfa\LexerDFASerializer.cpp" />
<ClCompile Include="src\DiagnosticErrorListener.cpp" />
<ClCompile Include="src\Exceptions.cpp" />
<ClCompile Include="src\FailedPredicateException.cpp" />
<ClCompile Include="src\InputMismatchException.cpp" />
<ClCompile Include="src\InterpreterRuleContext.cpp" />
<ClCompile Include="src\IntStream.cpp" />
<ClCompile Include="src\Lexer.cpp" />
<ClCompile Include="src\LexerInterpreter.cpp" />
<ClCompile Include="src\LexerNoViableAltException.cpp" />
<ClCompile Include="src\ListTokenSource.cpp" />
<ClCompile Include="src\misc\InterpreterDataReader.cpp" />
<ClCompile Include="src\misc\Interval.cpp" />
<ClCompile Include="src\misc\IntervalSet.cpp" />
<ClCompile Include="src\misc\MurmurHash.cpp" />
<ClCompile Include="src\misc\Predicate.cpp" />
<ClCompile Include="src\NoViableAltException.cpp" />
<ClCompile Include="src\Parser.cpp" />
<ClCompile Include="src\ParserInterpreter.cpp" />
<ClCompile Include="src\ParserRuleContext.cpp" />
<ClCompile Include="src\ProxyErrorListener.cpp" />
<ClCompile Include="src\RecognitionException.cpp" />
<ClCompile Include="src\Recognizer.cpp" />
<ClCompile Include="src\RuleContext.cpp" />
<ClCompile Include="src\RuleContextWithAltNum.cpp" />
<ClCompile Include="src\RuntimeMetaData.cpp" />
<ClCompile Include="src\support\Any.cpp" />
<ClCompile Include="src\support\Arrays.cpp" />
<ClCompile Include="src\support\CPPUtils.cpp" />
<ClCompile Include="src\support\guid.cpp" />
<ClCompile Include="src\support\StringUtils.cpp" />
<ClCompile Include="src\Token.cpp" />
<ClCompile Include="src\TokenSource.cpp" />
<ClCompile Include="src\TokenStream.cpp" />
<ClCompile Include="src\TokenStreamRewriter.cpp" />
<ClCompile Include="src\tree\ErrorNode.cpp" />
<ClCompile Include="src\tree\ErrorNodeImpl.cpp" />
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp" />
<ClCompile Include="src\tree\ParseTree.cpp" />
<ClCompile Include="src\tree\ParseTreeListener.cpp" />
<ClCompile Include="src\tree\ParseTreeVisitor.cpp" />
<ClCompile Include="src\tree\ParseTreeWalker.cpp" />
<ClCompile Include="src\tree\pattern\Chunk.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreeMatch.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePattern.cpp" />
<ClCompile Include="src\tree\pattern\ParseTreePatternMatcher.cpp" />
<ClCompile Include="src\tree\pattern\RuleTagToken.cpp" />
<ClCompile Include="src\tree\pattern\TagChunk.cpp" />
<ClCompile Include="src\tree\pattern\TextChunk.cpp" />
<ClCompile Include="src\tree\pattern\TokenTagToken.cpp" />
<ClCompile Include="src\tree\TerminalNode.cpp" />
<ClCompile Include="src\tree\TerminalNodeImpl.cpp" />
<ClCompile Include="src\tree\Trees.cpp" />
<ClCompile Include="src\tree\xpath\XPath.cpp" />
<ClCompile Include="src\tree\xpath\XPathElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathLexer.cpp" />
<ClCompile Include="src\tree\xpath\XPathLexerErrorListener.cpp" />
<ClCompile Include="src\tree\xpath\XPathRuleAnywhereElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathRuleElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathTokenAnywhereElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathTokenElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathWildcardAnywhereElement.cpp" />
<ClCompile Include="src\tree\xpath\XPathWildcardElement.cpp" />
<ClCompile Include="src\UnbufferedCharStream.cpp" />
<ClCompile Include="src\UnbufferedTokenStream.cpp" />
<ClCompile Include="src\Vocabulary.cpp" />
<ClCompile Include="src\WritableToken.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\antlr4-common.h" />
<ClInclude Include="src\antlr4-runtime.h" />
<ClInclude Include="src\ANTLRErrorListener.h" />
<ClInclude Include="src\ANTLRErrorStrategy.h" />
<ClInclude Include="src\ANTLRFileStream.h" />
<ClInclude Include="src\ANTLRInputStream.h" />
<ClInclude Include="src\atn\AbstractPredicateTransition.h" />
<ClInclude Include="src\atn\ActionTransition.h" />
<ClInclude Include="src\atn\AmbiguityInfo.h" />
<ClInclude Include="src\atn\ArrayPredictionContext.h" />
<ClInclude Include="src\atn\ATN.h" />
<ClInclude Include="src\atn\ATNConfig.h" />
<ClInclude Include="src\atn\ATNConfigSet.h" />
<ClInclude Include="src\atn\ATNDeserializationOptions.h" />
<ClInclude Include="src\atn\ATNDeserializer.h" />
<ClInclude Include="src\atn\ATNSerializer.h" />
<ClInclude Include="src\atn\ATNSimulator.h" />
<ClInclude Include="src\atn\ATNState.h" />
<ClInclude Include="src\atn\ATNType.h" />
<ClInclude Include="src\atn\AtomTransition.h" />
<ClInclude Include="src\atn\BasicBlockStartState.h" />
<ClInclude Include="src\atn\BasicState.h" />
<ClInclude Include="src\atn\BlockEndState.h" />
<ClInclude Include="src\atn\BlockStartState.h" />
<ClInclude Include="src\atn\ConfigLookup.h" />
<ClInclude Include="src\atn\ContextSensitivityInfo.h" />
<ClInclude Include="src\atn\DecisionEventInfo.h" />
<ClInclude Include="src\atn\DecisionInfo.h" />
<ClInclude Include="src\atn\DecisionState.h" />
<ClInclude Include="src\atn\EmptyPredictionContext.h" />
<ClInclude Include="src\atn\EpsilonTransition.h" />
<ClInclude Include="src\atn\ErrorInfo.h" />
<ClInclude Include="src\atn\LexerAction.h" />
<ClInclude Include="src\atn\LexerActionExecutor.h" />
<ClInclude Include="src\atn\LexerActionType.h" />
<ClInclude Include="src\atn\LexerATNConfig.h" />
<ClInclude Include="src\atn\LexerATNSimulator.h" />
<ClInclude Include="src\atn\LexerChannelAction.h" />
<ClInclude Include="src\atn\LexerCustomAction.h" />
<ClInclude Include="src\atn\LexerIndexedCustomAction.h" />
<ClInclude Include="src\atn\LexerModeAction.h" />
<ClInclude Include="src\atn\LexerMoreAction.h" />
<ClInclude Include="src\atn\LexerPopModeAction.h" />
<ClInclude Include="src\atn\LexerPushModeAction.h" />
<ClInclude Include="src\atn\LexerSkipAction.h" />
<ClInclude Include="src\atn\LexerTypeAction.h" />
<ClInclude Include="src\atn\LL1Analyzer.h" />
<ClInclude Include="src\atn\LookaheadEventInfo.h" />
<ClInclude Include="src\atn\LoopEndState.h" />
<ClInclude Include="src\atn\NotSetTransition.h" />
<ClInclude Include="src\atn\OrderedATNConfigSet.h" />
<ClInclude Include="src\atn\ParseInfo.h" />
<ClInclude Include="src\atn\ParserATNSimulator.h" />
<ClInclude Include="src\atn\PlusBlockStartState.h" />
<ClInclude Include="src\atn\PlusLoopbackState.h" />
<ClInclude Include="src\atn\PrecedencePredicateTransition.h" />
<ClInclude Include="src\atn\PredicateEvalInfo.h" />
<ClInclude Include="src\atn\PredicateTransition.h" />
<ClInclude Include="src\atn\PredictionContext.h" />
<ClInclude Include="src\atn\PredictionMode.h" />
<ClInclude Include="src\atn\ProfilingATNSimulator.h" />
<ClInclude Include="src\atn\RangeTransition.h" />
<ClInclude Include="src\atn\RuleStartState.h" />
<ClInclude Include="src\atn\RuleStopState.h" />
<ClInclude Include="src\atn\RuleTransition.h" />
<ClInclude Include="src\atn\SemanticContext.h" />
<ClInclude Include="src\atn\SetTransition.h" />
<ClInclude Include="src\atn\SingletonPredictionContext.h" />
<ClInclude Include="src\atn\StarBlockStartState.h" />
<ClInclude Include="src\atn\StarLoopbackState.h" />
<ClInclude Include="src\atn\StarLoopEntryState.h" />
<ClInclude Include="src\atn\TokensStartState.h" />
<ClInclude Include="src\atn\Transition.h" />
<ClInclude Include="src\atn\WildcardTransition.h" />
<ClInclude Include="src\BailErrorStrategy.h" />
<ClInclude Include="src\BaseErrorListener.h" />
<ClInclude Include="src\BufferedTokenStream.h" />
<ClInclude Include="src\CharStream.h" />
<ClInclude Include="src\CommonToken.h" />
<ClInclude Include="src\CommonTokenFactory.h" />
<ClInclude Include="src\CommonTokenStream.h" />
<ClInclude Include="src\ConsoleErrorListener.h" />
<ClInclude Include="src\DefaultErrorStrategy.h" />
<ClInclude Include="src\dfa\DFA.h" />
<ClInclude Include="src\dfa\DFASerializer.h" />
<ClInclude Include="src\dfa\DFAState.h" />
<ClInclude Include="src\dfa\LexerDFASerializer.h" />
<ClInclude Include="src\DiagnosticErrorListener.h" />
<ClInclude Include="src\Exceptions.h" />
<ClInclude Include="src\FailedPredicateException.h" />
<ClInclude Include="src\InputMismatchException.h" />
<ClInclude Include="src\InterpreterRuleContext.h" />
<ClInclude Include="src\IntStream.h" />
<ClInclude Include="src\Lexer.h" />
<ClInclude Include="src\LexerInterpreter.h" />
<ClInclude Include="src\LexerNoViableAltException.h" />
<ClInclude Include="src\ListTokenSource.h" />
<ClInclude Include="src\misc\InterpreterDataReader.h" />
<ClInclude Include="src\misc\Interval.h" />
<ClInclude Include="src\misc\IntervalSet.h" />
<ClInclude Include="src\misc\MurmurHash.h" />
<ClInclude Include="src\misc\Predicate.h" />
<ClInclude Include="src\NoViableAltException.h" />
<ClInclude Include="src\Parser.h" />
<ClInclude Include="src\ParserInterpreter.h" />
<ClInclude Include="src\ParserRuleContext.h" />
<ClInclude Include="src\ProxyErrorListener.h" />
<ClInclude Include="src\RecognitionException.h" />
<ClInclude Include="src\Recognizer.h" />
<ClInclude Include="src\RuleContext.h" />
<ClInclude Include="src\RuleContextWithAltNum.h" />
<ClInclude Include="src\RuntimeMetaData.h" />
<ClInclude Include="src\support\Any.h" />
<ClInclude Include="src\support\Arrays.h" />
<ClInclude Include="src\support\BitSet.h" />
<ClInclude Include="src\support\CPPUtils.h" />
<ClInclude Include="src\support\Declarations.h" />
<ClInclude Include="src\support\guid.h" />
<ClInclude Include="src\support\StringUtils.h" />
<ClInclude Include="src\Token.h" />
<ClInclude Include="src\TokenFactory.h" />
<ClInclude Include="src\TokenSource.h" />
<ClInclude Include="src\TokenStream.h" />
<ClInclude Include="src\TokenStreamRewriter.h" />
<ClInclude Include="src\tree\AbstractParseTreeVisitor.h" />
<ClInclude Include="src\tree\ErrorNode.h" />
<ClInclude Include="src\tree\ErrorNodeImpl.h" />
<ClInclude Include="src\tree\IterativeParseTreeWalker.h" />
<ClInclude Include="src\tree\ParseTree.h" />
<ClInclude Include="src\tree\ParseTreeListener.h" />
<ClInclude Include="src\tree\ParseTreeProperty.h" />
<ClInclude Include="src\tree\ParseTreeVisitor.h" />
<ClInclude Include="src\tree\ParseTreeWalker.h" />
<ClInclude Include="src\tree\pattern\Chunk.h" />
<ClInclude Include="src\tree\pattern\ParseTreeMatch.h" />
<ClInclude Include="src\tree\pattern\ParseTreePattern.h" />
<ClInclude Include="src\tree\pattern\ParseTreePatternMatcher.h" />
<ClInclude Include="src\tree\pattern\RuleTagToken.h" />
<ClInclude Include="src\tree\pattern\TagChunk.h" />
<ClInclude Include="src\tree\pattern\TextChunk.h" />
<ClInclude Include="src\tree\pattern\TokenTagToken.h" />
<ClInclude Include="src\tree\RuleNode.h" />
<ClInclude Include="src\tree\SyntaxTree.h" />
<ClInclude Include="src\tree\TerminalNode.h" />
<ClInclude Include="src\tree\TerminalNodeImpl.h" />
<ClInclude Include="src\tree\Trees.h" />
<ClInclude Include="src\tree\xpath\XPath.h" />
<ClInclude Include="src\tree\xpath\XPathElement.h" />
<ClInclude Include="src\tree\xpath\XPathLexer.h" />
<ClInclude Include="src\tree\xpath\XPathLexerErrorListener.h" />
<ClInclude Include="src\tree\xpath\XPathRuleAnywhereElement.h" />
<ClInclude Include="src\tree\xpath\XPathRuleElement.h" />
<ClInclude Include="src\tree\xpath\XPathTokenAnywhereElement.h" />
<ClInclude Include="src\tree\xpath\XPathTokenElement.h" />
<ClInclude Include="src\tree\xpath\XPathWildcardAnywhereElement.h" />
<ClInclude Include="src\tree\xpath\XPathWildcardElement.h" />
<ClInclude Include="src\UnbufferedCharStream.h" />
<ClInclude Include="src\UnbufferedTokenStream.h" />
<ClInclude Include="src\Vocabulary.h" />
<ClInclude Include="src\WritableToken.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,987 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Header Files\atn">
<UniqueIdentifier>{587a2726-4856-4d21-937a-fbaebaa90232}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\atn">
<UniqueIdentifier>{2662156f-1508-4dad-b991-a8298a6db9bf}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\dfa">
<UniqueIdentifier>{5b1e59b1-7fa5-46a5-8d92-965bd709cca0}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\dfa">
<UniqueIdentifier>{9de9fe74-5d67-441d-a972-3cebe6dfbfcc}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\misc">
<UniqueIdentifier>{89fd3896-0ab1-476d-8d64-a57f10a5e73b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\misc">
<UniqueIdentifier>{23939d7b-8e11-421e-80eb-b2cfdfdd64e9}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\support">
<UniqueIdentifier>{05f2bacb-b5b2-4ca3-abe1-ca9a7239ecaa}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\support">
<UniqueIdentifier>{d3b2ae2d-836b-4c73-8180-aca4ebb7d658}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\tree">
<UniqueIdentifier>{6674a0f0-c65d-4a00-a9e5-1f243b89d0a2}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\tree">
<UniqueIdentifier>{1893fffe-7a2b-4708-8ce5-003aa9b749f7}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\tree\pattern">
<UniqueIdentifier>{053a0632-27bc-4043-b5e8-760951b3b5b9}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\tree\pattern">
<UniqueIdentifier>{048c180d-44cf-49ca-a7aa-d0053fea07f5}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\tree\xpath">
<UniqueIdentifier>{3181cae5-cc15-4050-8c45-22af44a823de}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\tree\xpath">
<UniqueIdentifier>{290632d2-c56e-4005-a417-eb83b9531e1a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ANTLRErrorListener.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ANTLRErrorStrategy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ANTLRFileStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ANTLRInputStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\BailErrorStrategy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\BaseErrorListener.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\BufferedTokenStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\CharStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\CommonToken.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\CommonTokenFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\CommonTokenStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ConsoleErrorListener.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DefaultErrorStrategy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\DiagnosticErrorListener.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Exceptions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\FailedPredicateException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\InputMismatchException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\InterpreterRuleContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\IntStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Lexer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\LexerInterpreter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\LexerNoViableAltException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ListTokenSource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\NoViableAltException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ParserInterpreter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ParserRuleContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ProxyErrorListener.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RecognitionException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Recognizer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RuleContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Token.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TokenFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TokenSource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TokenStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TokenStreamRewriter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\UnbufferedCharStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\UnbufferedTokenStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\WritableToken.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\atn\DecisionState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\EmptyPredictionContext.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\EpsilonTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerATNConfig.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerATNSimulator.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LL1Analyzer.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LoopEndState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\NotSetTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\OrderedATNConfigSet.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ParserATNSimulator.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PlusBlockStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PlusLoopbackState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PrecedencePredicateTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PredicateTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PredictionContext.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PredictionMode.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\RangeTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\RuleStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\RuleStopState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\RuleTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\SemanticContext.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\SetTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\SingletonPredictionContext.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\StarBlockStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\StarLoopbackState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\StarLoopEntryState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\TokensStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\Transition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\WildcardTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\AbstractPredicateTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ActionTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ArrayPredictionContext.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATN.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNConfig.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNConfigSet.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNDeserializationOptions.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNDeserializer.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNSerializer.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNSimulator.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ATNType.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\AtomTransition.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\BasicBlockStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\BasicState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\BlockEndState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\BlockStartState.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ConfigLookup.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\dfa\LexerDFASerializer.h">
<Filter>Header Files\dfa</Filter>
</ClInclude>
<ClInclude Include="src\dfa\DFA.h">
<Filter>Header Files\dfa</Filter>
</ClInclude>
<ClInclude Include="src\dfa\DFASerializer.h">
<Filter>Header Files\dfa</Filter>
</ClInclude>
<ClInclude Include="src\dfa\DFAState.h">
<Filter>Header Files\dfa</Filter>
</ClInclude>
<ClInclude Include="src\misc\Interval.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="src\misc\IntervalSet.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="src\misc\MurmurHash.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="src\support\Arrays.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\support\BitSet.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\support\CPPUtils.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\support\Declarations.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\support\guid.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\tree\AbstractParseTreeVisitor.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ErrorNode.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ErrorNodeImpl.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ParseTree.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ParseTreeListener.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ParseTreeProperty.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ParseTreeVisitor.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\ParseTreeWalker.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\RuleNode.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\SyntaxTree.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\TerminalNode.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\TerminalNodeImpl.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\Trees.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\Chunk.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\ParseTreeMatch.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\ParseTreePattern.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\ParseTreePatternMatcher.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\RuleTagToken.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\TagChunk.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\TextChunk.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\pattern\TokenTagToken.h">
<Filter>Header Files\tree\pattern</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathLexer.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\Vocabulary.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\atn\AmbiguityInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ContextSensitivityInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\DecisionEventInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\DecisionInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ErrorInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerActionExecutor.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerActionType.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerChannelAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerCustomAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerIndexedCustomAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerModeAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerMoreAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerPopModeAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerPushModeAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerSkipAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LexerTypeAction.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\LookaheadEventInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ParseInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\PredicateEvalInfo.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\atn\ProfilingATNSimulator.h">
<Filter>Header Files\atn</Filter>
</ClInclude>
<ClInclude Include="src\misc\Predicate.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="src\RuleContextWithAltNum.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RuntimeMetaData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\support\StringUtils.h">
<Filter>Header Files\support</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPath.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathLexerErrorListener.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathRuleAnywhereElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathRuleElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathTokenAnywhereElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathTokenElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathWildcardAnywhereElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\tree\xpath\XPathWildcardElement.h">
<Filter>Header Files\tree\xpath</Filter>
</ClInclude>
<ClInclude Include="src\antlr4-common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\antlr4-runtime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\tree\IterativeParseTreeWalker.h">
<Filter>Header Files\tree</Filter>
</ClInclude>
<ClInclude Include="src\misc\InterpreterDataReader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\support\Any.h">
<Filter>Header Files\support</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ANTLRFileStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRInputStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\BailErrorStrategy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\BaseErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\BufferedTokenStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\CharStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\CommonToken.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\CommonTokenFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\CommonTokenStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ConsoleErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DefaultErrorStrategy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DiagnosticErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Exceptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\FailedPredicateException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\InputMismatchException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\InterpreterRuleContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IntStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Lexer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\LexerInterpreter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\LexerNoViableAltException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ListTokenSource.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\NoViableAltException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ParserInterpreter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ParserRuleContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ProxyErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\RecognitionException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Recognizer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\RuleContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TokenStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TokenStreamRewriter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\UnbufferedCharStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\UnbufferedTokenStream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\atn\AbstractPredicateTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ActionTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ArrayPredictionContext.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATN.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNConfig.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNConfigSet.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNDeserializationOptions.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNDeserializer.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNSerializer.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNSimulator.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ATNState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\AtomTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\BasicBlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\BasicState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\BlockEndState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\DecisionState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\EmptyPredictionContext.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\EpsilonTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerATNConfig.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerATNSimulator.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LL1Analyzer.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LoopEndState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\NotSetTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\OrderedATNConfigSet.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ParserATNSimulator.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PlusBlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PlusLoopbackState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PrecedencePredicateTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PredicateTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PredictionContext.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PredictionMode.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\RangeTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\RuleStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\RuleStopState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\RuleTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\SemanticContext.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\SetTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\SingletonPredictionContext.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\StarBlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\StarLoopbackState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\StarLoopEntryState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\TokensStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\Transition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\WildcardTransition.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\dfa\DFA.cpp">
<Filter>Source Files\dfa</Filter>
</ClCompile>
<ClCompile Include="src\dfa\DFASerializer.cpp">
<Filter>Source Files\dfa</Filter>
</ClCompile>
<ClCompile Include="src\dfa\DFAState.cpp">
<Filter>Source Files\dfa</Filter>
</ClCompile>
<ClCompile Include="src\dfa\LexerDFASerializer.cpp">
<Filter>Source Files\dfa</Filter>
</ClCompile>
<ClCompile Include="src\misc\Interval.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="src\misc\IntervalSet.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="src\misc\MurmurHash.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="src\support\Arrays.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\support\CPPUtils.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\support\guid.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\tree\ErrorNodeImpl.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeWalker.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\TerminalNodeImpl.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\Trees.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\ParseTreeMatch.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\ParseTreePattern.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\ParseTreePatternMatcher.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\RuleTagToken.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\TagChunk.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\TextChunk.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\TokenTagToken.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
<ClCompile Include="src\atn\AmbiguityInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ContextSensitivityInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\DecisionEventInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\DecisionInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ErrorInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerActionExecutor.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerChannelAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerCustomAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerIndexedCustomAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerModeAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerMoreAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerPopModeAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerPushModeAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerSkipAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerTypeAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LookaheadEventInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ParseInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\PredicateEvalInfo.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\ProfilingATNSimulator.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\RuleContextWithAltNum.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\RuntimeMetaData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\support\StringUtils.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPath.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathLexer.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathLexerErrorListener.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathRuleAnywhereElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathRuleElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathTokenAnywhereElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathTokenElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathWildcardAnywhereElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\tree\xpath\XPathWildcardElement.cpp">
<Filter>Source Files\tree\xpath</Filter>
</ClCompile>
<ClCompile Include="src\Vocabulary.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTree.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\misc\InterpreterDataReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorListener.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ANTLRErrorStrategy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\atn\BlockStartState.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\atn\LexerAction.cpp">
<Filter>Source Files\atn</Filter>
</ClCompile>
<ClCompile Include="src\misc\Predicate.cpp">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="src\Token.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TokenSource.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\WritableToken.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\support\Any.cpp">
<Filter>Source Files\support</Filter>
</ClCompile>
<ClCompile Include="src\tree\ErrorNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeListener.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\ParseTreeVisitor.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\TerminalNode.cpp">
<Filter>Source Files\tree</Filter>
</ClCompile>
<ClCompile Include="src\tree\pattern\Chunk.cpp">
<Filter>Source Files\tree\pattern</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -2226,7 +2226,7 @@
37D727A21867AF1E007B6D10 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = ANTLR;
TargetAttributes = {
270C67EF1CDB4F1E00116E17 = {
@ -2239,10 +2239,11 @@
};
buildConfigurationList = 37D727A51867AF1E007B6D10 /* Build configuration list for PBXProject "antlrcpp" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 37D727A11867AF1E007B6D10;
productRefGroup = 37D727AB1867AF1E007B6D10 /* Products */;
@ -2839,6 +2840,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
@ -2898,6 +2900,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -51,8 +49,6 @@
ReferencedContainer = "container:antlrcpp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -24,7 +24,7 @@ namespace antlr4 {
/// Implementations of this interface report syntax errors by calling
/// <seealso cref="Parser#notifyErrorListeners"/>.
/// <p/>
/// TO_DO: what to do about lexers
/// TODO: what to do about lexers
/// </summary>
class ANTLR4CPP_PUBLIC ANTLRErrorStrategy {
public:

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -273,7 +273,7 @@ std::string Lexer::getErrorDisplay(const std::string &s) {
}
void Lexer::recover(RecognitionException * /*re*/) {
// TO_DO: Do we lose character or line position information?
// TODO: Do we lose character or line position information?
_input->consume();
}

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -464,7 +464,7 @@ bool Parser::precpred(RuleContext * /*localctx*/, int precedence) {
}
bool Parser::inContext(const std::string &/*context*/) {
// TO_DO: useful in parser?
// TODO: useful in parser?
return false;
}

View File

@ -75,16 +75,16 @@ antlrcpp::Any RuleContext::accept(tree::ParseTreeVisitor *visitor) {
return visitor->visitChildren(this);
}
std::string RuleContext::toStringTree(Parser *recog) {
return tree::Trees::toStringTree(this, recog);
std::string RuleContext::toStringTree(Parser *recog, bool pretty) {
return tree::Trees::toStringTree(this, recog, pretty);
}
std::string RuleContext::toStringTree(std::vector<std::string> &ruleNames) {
return tree::Trees::toStringTree(this, ruleNames);
std::string RuleContext::toStringTree(std::vector<std::string> &ruleNames, bool pretty) {
return tree::Trees::toStringTree(this, ruleNames, pretty);
}
std::string RuleContext::toStringTree() {
return toStringTree(nullptr);
std::string RuleContext::toStringTree(bool pretty) {
return toStringTree(nullptr, pretty);
}

View File

@ -110,15 +110,15 @@ namespace antlr4 {
/// (root child1 .. childN). Print just a node if this is a leaf.
/// We have to know the recognizer so we can get rule names.
/// </summary>
virtual std::string toStringTree(Parser *recog) override;
virtual std::string toStringTree(Parser *recog, bool pretty = false) override;
/// <summary>
/// Print out a whole tree, not just a node, in LISP format
/// (root child1 .. childN). Print just a node if this is a leaf.
/// </summary>
virtual std::string toStringTree(std::vector<std::string> &ruleNames);
virtual std::string toStringTree(std::vector<std::string> &ruleNames, bool pretty = false);
virtual std::string toStringTree() override;
virtual std::string toStringTree(bool pretty = false) override;
virtual std::string toString() override;
std::string toString(Recognizer *recog);
std::string toString(const std::vector<std::string> &ruleNames);

View File

@ -348,7 +348,6 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
}
// throw exception unless disjoint or identical
bool disjoint = prevRop->lastIndex < rop->index || prevRop->index > rop->lastIndex;
bool same = prevRop->index == rop->index && prevRop->lastIndex == rop->lastIndex;
// Delete special case of replace (text==null):
// D.i-j.u D.x-y.v | boundaries overlap combine to max(min)..max(right)
if (prevRop->text.empty() && rop->text.empty() && !disjoint) {
@ -358,7 +357,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
rop->lastIndex = std::max(prevRop->lastIndex, rop->lastIndex);
std::cout << "new rop " << rop << std::endl;
}
else if (!disjoint && !same) {
else if (!disjoint) {
throw IllegalArgumentException("replace op boundaries of " + rop->toString() +
" overlap with previous " + prevRop->toString());
}

View File

@ -16,7 +16,6 @@ namespace dfa {
public:
Vocabulary(Vocabulary const&) = default;
virtual ~Vocabulary();
Vocabulary& operator=(Vocabulary const&) = default;
/// Gets an empty <seealso cref="Vocabulary"/> instance.
///

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -57,7 +57,7 @@ namespace atn {
* <p>
* closure() tracks the depth of how far we dip into the outer context:
* depth > 0. Note that it may not be totally accurate depth since I
* don't ever decrement. TO_DO: make it a boolean then</p>
* don't ever decrement. TODO: make it a boolean then</p>
*
* <p>
* For memory efficiency, the {@link #isPrecedenceFilterSuppressed} method
@ -87,7 +87,6 @@ namespace atn {
ATNConfig(ATNConfig const&) = default;
virtual ~ATNConfig();
ATNConfig& operator=(ATNConfig const&) = default;
virtual size_t hashCode() const;

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -18,8 +18,8 @@ namespace atn {
/// Track the elements as they are added to the set; supports get(i)
std::vector<Ref<ATNConfig>> configs;
// TO_DO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation
// TO_DO: can we track conflicts as they are added to save scanning configs later?
// TODO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation
// TODO: can we track conflicts as they are added to save scanning configs later?
size_t uniqueAlt;
/** Currently this is only used when we detect SLL conflict; this does

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -10,7 +10,7 @@
namespace antlr4 {
namespace atn {
/// TO_DO: make all transitions sets? no, should remove set edges.
/// TODO: make all transitions sets? no, should remove set edges.
class ANTLR4CPP_PUBLIC AtomTransition final : public Transition {
public:
/// The token type or character value; or, signifies special label.

View File

@ -422,7 +422,7 @@ Ref<LexerATNConfig> LexerATNSimulator::getEpsilonTarget(CharStream *input, const
if (config->context == nullptr|| config->context->hasEmptyPath()) {
// execute actions anywhere in the start rule for a token.
//
// TO_DO: if the entry rule is invoked recursively, some
// TODO: if the entry rule is invoked recursively, some
// actions may be executed during the recursive call. The
// problem can appear when hasEmptyPath() is true but
// isEmpty() is false. In this case, the config needs to be

View File

@ -922,7 +922,7 @@ void ParserATNSimulator::closure_(Ref<ATNConfig> const& config, ATNConfigSet *co
}
}
configs->dipsIntoOuterContext = true; // TO_DO: can remove? only care when we add to set per middle of this method
configs->dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
assert(newDepth > INT_MIN);
newDepth--;

View File

@ -760,7 +760,7 @@ namespace atn {
virtual bool evalSemanticContext(Ref<SemanticContext> const& pred, ParserRuleContext *parserCallStack,
size_t alt, bool fullCtx);
/* TO_DO: If we are doing predicates, there is no point in pursuing
/* TODO: If we are doing predicates, there is no point in pursuing
closure operations if we reach a DFA state that uniquely predicts
alternative. We will not be caching that DFA state and it is a
waste to pursue the closure. Might have to advance when we do

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -11,7 +11,7 @@
namespace antlr4 {
namespace atn {
/// TO_DO: this is old comment:
/// TODO: this is old comment:
/// A tree of semantic predicates from the grammar AST if label==SEMPRED.
/// In the ATN, labels will always be exactly one predicate, but the DFA
/// may have to combine a bunch of them as it collects predicates from

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -335,7 +335,7 @@ Ref<PredictionContext> PredictionContext::mergeArrays(const Ref<ArrayPredictionC
Ref<ArrayPredictionContext> M = std::make_shared<ArrayPredictionContext>(mergedParents, mergedReturnStates);
// if we created same array as a or b, return that instead
// TO_DO: track whether this is possible above during merge sort for speed
// TODO: track whether this is possible above during merge sort for speed
if (*M == *a) {
if (mergeCache != nullptr) {
mergeCache->put(a, b, a);

View File

@ -99,7 +99,7 @@ std::unique_ptr<ATNConfigSet> ProfilingATNSimulator::computeReachSet(ATNConfigSe
_decisions[_currentDecision].LL_ATNTransitions++; // count computation even if error
if (reachConfigs != nullptr) {
} else { // no reach on current lookahead symbol. ERROR.
// TO_DO: does not handle delayed errors per getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule()
// TODO: does not handle delayed errors per getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule()
_decisions[_currentDecision].errors.push_back(ErrorInfo(_currentDecision, closure, _input, _startIndex, _llStopIndex, true));
}
} else {

View File

@ -22,7 +22,7 @@ namespace antlrcpp {
inline std::string utf32_to_utf8(T const& data)
{
// Don't make the converter static or we have to serialize access to it.
UTF32Converter converter;
thread_local UTF32Converter converter;
#if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
auto p = reinterpret_cast<const int32_t *>(data.data());
@ -34,7 +34,7 @@ namespace antlrcpp {
inline UTF32String utf8_to_utf32(const char* first, const char* last)
{
UTF32Converter converter;
thread_local UTF32Converter converter;
#if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
auto r = converter.from_bytes(first, last);

View File

@ -39,12 +39,12 @@ namespace tree {
/// Print out a whole tree, not just a node, in LISP format
/// {@code (root child1 .. childN)}. Print just a node if this is a leaf.
virtual std::string toStringTree() = 0;
virtual std::string toStringTree(bool pretty = false) = 0;
virtual std::string toString() = 0;
/// Specialize toStringTree so that it can print out more information
/// based upon the parser.
virtual std::string toStringTree(Parser *parser) = 0;
virtual std::string toStringTree(Parser *parser, bool pretty = false) = 0;
virtual bool operator == (const ParseTree &other) const;

View File

@ -41,7 +41,7 @@ std::string TerminalNodeImpl::getText() {
return symbol->getText();
}
std::string TerminalNodeImpl::toStringTree(Parser * /*parser*/) {
std::string TerminalNodeImpl::toStringTree(Parser * /*parser*/, bool /*pretty*/) {
return toString();
}
@ -52,6 +52,6 @@ std::string TerminalNodeImpl::toString() {
return symbol->getText();
}
std::string TerminalNodeImpl::toStringTree() {
std::string TerminalNodeImpl::toStringTree(bool /*pretty*/) {
return toString();
}

View File

@ -23,9 +23,9 @@ namespace tree {
virtual antlrcpp::Any accept(ParseTreeVisitor *visitor) override;
virtual std::string getText() override;
virtual std::string toStringTree(Parser *parser) override;
virtual std::string toStringTree(Parser *parser, bool pretty = false) override;
virtual std::string toString() override;
virtual std::string toStringTree() override;
virtual std::string toStringTree(bool pretty = false) override;
};

View File

@ -25,17 +25,17 @@ using namespace antlrcpp;
Trees::Trees() {
}
std::string Trees::toStringTree(ParseTree *t) {
return toStringTree(t, nullptr);
std::string Trees::toStringTree(ParseTree *t, bool pretty) {
return toStringTree(t, nullptr, pretty);
}
std::string Trees::toStringTree(ParseTree *t, Parser *recog) {
std::string Trees::toStringTree(ParseTree *t, Parser *recog, bool pretty) {
if (recog == nullptr)
return toStringTree(t, std::vector<std::string>());
return toStringTree(t, recog->getRuleNames());
return toStringTree(t, std::vector<std::string>(), pretty);
return toStringTree(t, recog->getRuleNames(), pretty);
}
std::string Trees::toStringTree(ParseTree *t, const std::vector<std::string> &ruleNames) {
std::string Trees::toStringTree(ParseTree *t, const std::vector<std::string> &ruleNames, bool pretty) {
std::string temp = antlrcpp::escapeWhitespace(Trees::getNodeText(t, ruleNames), false);
if (t->children.empty()) {
return temp;
@ -48,6 +48,7 @@ std::string Trees::toStringTree(ParseTree *t, const std::vector<std::string> &ru
std::stack<size_t> stack;
size_t childIndex = 0;
ParseTree *run = t;
size_t indentationLevel = 1;
while (childIndex < run->children.size()) {
if (childIndex > 0) {
ss << ' ';
@ -59,6 +60,13 @@ std::string Trees::toStringTree(ParseTree *t, const std::vector<std::string> &ru
stack.push(childIndex);
run = child;
childIndex = 0;
if (pretty) {
++indentationLevel;
ss << std::endl;
for (size_t i = 0; i < indentationLevel; ++i) {
ss << " ";
}
}
ss << "(" << temp << " ";
} else {
ss << temp;
@ -68,6 +76,9 @@ std::string Trees::toStringTree(ParseTree *t, const std::vector<std::string> &ru
childIndex = stack.top();
stack.pop();
run = run->parent;
if (pretty) {
--indentationLevel;
}
ss << ")";
} else {
break;

View File

@ -18,17 +18,17 @@ namespace tree {
/// Print out a whole tree in LISP form. getNodeText is used on the
/// node payloads to get the text for the nodes. Detect
/// parse trees and extract data appropriately.
static std::string toStringTree(ParseTree *t);
static std::string toStringTree(ParseTree *t, bool pretty = false);
/// Print out a whole tree in LISP form. getNodeText is used on the
/// node payloads to get the text for the nodes. Detect
/// parse trees and extract data appropriately.
static std::string toStringTree(ParseTree *t, Parser *recog);
static std::string toStringTree(ParseTree *t, Parser *recog, bool pretty = false);
/// Print out a whole tree in LISP form. getNodeText is used on the
/// node payloads to get the text for the nodes. Detect
/// parse trees and extract data appropriately.
static std::string toStringTree(ParseTree *t, const std::vector<std::string> &ruleNames);
static std::string toStringTree(ParseTree *t, const std::vector<std::string> &ruleNames, bool pretty = false);
static std::string getNodeText(ParseTree *t, Parser *recog);
static std::string getNodeText(ParseTree *t, const std::vector<std::string> &ruleNames);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -45,7 +45,6 @@ namespace pattern {
const std::map<std::string, std::vector<ParseTree *>> &labels, ParseTree *mismatchedNode);
ParseTreeMatch(ParseTreeMatch const&) = default;
virtual ~ParseTreeMatch();
ParseTreeMatch& operator=(ParseTreeMatch const&) = default;
/// <summary>
/// Get the last node associated with a specific {@code label}.

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@ -30,7 +30,6 @@ namespace pattern {
ParseTree *patternTree);
ParseTreePattern(ParseTreePattern const&) = default;
virtual ~ParseTreePattern();
ParseTreePattern& operator=(ParseTreePattern const&) = default;
/// <summary>
/// Match a specific parse tree against this tree pattern.

View File

@ -25,11 +25,10 @@ const std::string XPath::NOT = "!";
XPath::XPath(Parser *parser, const std::string &path) {
_parser = parser;
_path = path;
_elements = split(path);
}
std::vector<XPathElement> XPath::split(const std::string &path) {
ANTLRFileStream in(path);
std::vector<std::unique_ptr<XPathElement>> XPath::split(const std::string &path) {
ANTLRInputStream in(path);
XPathLexer lexer(&in);
lexer.removeErrorListeners();
XPathLexerErrorListener listener;
@ -44,7 +43,7 @@ std::vector<XPathElement> XPath::split(const std::string &path) {
}
std::vector<Token *> tokens = tokenStream.getTokens();
std::vector<XPathElement> elements;
std::vector<std::unique_ptr<XPathElement>> elements;
size_t n = tokens.size();
size_t i = 0;
bool done = false;
@ -62,9 +61,9 @@ std::vector<XPathElement> XPath::split(const std::string &path) {
i++;
next = tokens[i];
}
XPathElement pathElement = getXPathElement(next, anywhere);
pathElement.setInvert(invert);
elements.push_back(pathElement);
std::unique_ptr<XPathElement> pathElement = getXPathElement(next, anywhere);
pathElement->setInvert(invert);
elements.push_back(std::move(pathElement));
i++;
break;
@ -81,25 +80,26 @@ std::vector<XPathElement> XPath::split(const std::string &path) {
break;
default :
throw IllegalArgumentException("Unknow path element " + el->toString());
throw IllegalArgumentException("Unknown path element " + el->toString());
}
}
return elements;
}
XPathElement XPath::getXPathElement(Token *wordToken, bool anywhere) {
std::unique_ptr<XPathElement> XPath::getXPathElement(Token *wordToken, bool anywhere) {
if (wordToken->getType() == Token::EOF) {
throw IllegalArgumentException("Missing path element at end of path");
}
std::string word = wordToken->getText();
size_t ttype = _parser->getTokenType(word);
ssize_t ruleIndex = _parser->getRuleIndex(word);
switch (wordToken->getType()) {
case XPathLexer::WILDCARD :
if (anywhere)
return XPathWildcardAnywhereElement();
return XPathWildcardElement();
return std::unique_ptr<XPathWildcardAnywhereElement>(new XPathWildcardAnywhereElement());
return std::unique_ptr<XPathWildcardElement>(new XPathWildcardElement());
case XPathLexer::TOKEN_REF:
case XPathLexer::STRING :
@ -107,35 +107,42 @@ XPathElement XPath::getXPathElement(Token *wordToken, bool anywhere) {
throw IllegalArgumentException(word + " at index " + std::to_string(wordToken->getStartIndex()) + " isn't a valid token name");
}
if (anywhere)
return XPathTokenAnywhereElement(word, (int)ttype);
return XPathTokenElement(word, (int)ttype);
return std::unique_ptr<XPathTokenAnywhereElement>(new XPathTokenAnywhereElement(word, (int)ttype));
return std::unique_ptr<XPathTokenElement>(new XPathTokenElement(word, (int)ttype));
default :
if (ruleIndex == -1) {
throw IllegalArgumentException(word + " at index " + std::to_string(wordToken->getStartIndex()) + " isn't a valid rule name");
}
if (anywhere)
return XPathRuleAnywhereElement(word, (int)ruleIndex);
return XPathRuleElement(word, (int)ruleIndex);
return std::unique_ptr<XPathRuleAnywhereElement>(new XPathRuleAnywhereElement(word, (int)ruleIndex));
return std::unique_ptr<XPathRuleElement>(new XPathRuleElement(word, (int)ruleIndex));
}
}
static ParserRuleContext dummyRoot;
std::vector<ParseTree *> XPath::findAll(ParseTree *tree, std::string const& xpath, Parser *parser) {
XPath p(parser, xpath);
return p.evaluate(tree);
}
std::vector<ParseTree *> XPath::evaluate(ParseTree *t) {
dummyRoot.children = { t }; // don't set t's parent.
std::vector<ParseTree *> work = { &dummyRoot };
size_t i = 0;
while (i < _elements.size()) {
std::vector<std::unique_ptr<XPathElement>> elements = split(_path);
while (i < elements.size()) {
std::vector<ParseTree *> next;
for (auto node : work) {
if (!node->children.empty()) {
// only try to match next element if it has children
// e.g., //func/*/stat might have a token node for which
// we can't go looking for stat nodes.
auto matching = _elements[i].evaluate(node);
auto matching = elements[i]->evaluate(node);
next.insert(next.end(), matching.begin(), matching.end());
}
}

View File

@ -61,8 +61,10 @@ namespace xpath {
XPath(Parser *parser, const std::string &path);
virtual ~XPath() {}
// TO_DO: check for invalid token/rule names, bad syntax
virtual std::vector<XPathElement> split(const std::string &path);
// TODO: check for invalid token/rule names, bad syntax
virtual std::vector<std::unique_ptr<XPathElement>> split(const std::string &path);
static std::vector<ParseTree *> findAll(ParseTree *tree, std::string const& xpath, Parser *parser);
/// Return a list of all nodes starting at {@code t} as root that satisfy the
/// path. The root {@code /} is relative to the node passed to
@ -71,13 +73,12 @@ namespace xpath {
protected:
std::string _path;
std::vector<XPathElement> _elements;
Parser *_parser;
/// Convert word like {@code *} or {@code ID} or {@code expr} to a path
/// element. {@code anywhere} is {@code true} if {@code //} precedes the
/// word.
virtual XPathElement getXPathElement(Token *wordToken, bool anywhere);
virtual std::unique_ptr<XPathElement> getXPathElement(Token *wordToken, bool anywhere);
};
} // namespace xpath

View File

@ -78,8 +78,6 @@ public class LexerATNSimulator extends ATNSimulator {
protected final SimState prevAccept = new SimState();
public static int match_calls = 0;
public LexerATNSimulator(ATN atn, DFA[] decisionToDFA,
PredictionContextCache sharedContextCache)
{
@ -103,7 +101,6 @@ public class LexerATNSimulator extends ATNSimulator {
}
public int match(CharStream input, int mode) {
match_calls++;
this.mode = mode;
int mark = input.mark();
try {

View File

@ -7,6 +7,7 @@
var RuleContext = require('./RuleContext').RuleContext;
var Hash = require('./Utils').Hash;
var Map = require('./Utils').Map;
function PredictionContext(cachedHashCode) {
this.cachedHashCode = cachedHashCode;
@ -79,7 +80,7 @@ function calculateHashString(parent, returnState) {
// can be used for both lexers and parsers.
function PredictionContextCache() {
this.cache = {};
this.cache = new Map();
return this;
}
@ -91,16 +92,16 @@ PredictionContextCache.prototype.add = function(ctx) {
if (ctx === PredictionContext.EMPTY) {
return PredictionContext.EMPTY;
}
var existing = this.cache[ctx] || null;
var existing = this.cache.get(ctx) || null;
if (existing !== null) {
return existing;
}
this.cache[ctx] = ctx;
this.cache.put(ctx, ctx);
return ctx;
};
PredictionContextCache.prototype.get = function(ctx) {
return this.cache[ctx] || null;
return this.cache.get(ctx) || null;
};
Object.defineProperty(PredictionContextCache.prototype, "length", {
@ -111,11 +112,13 @@ Object.defineProperty(PredictionContextCache.prototype, "length", {
function SingletonPredictionContext(parent, returnState) {
var hashCode = 0;
var hash = new Hash();
if(parent !== null) {
var hash = new Hash();
hash.update(parent, returnState);
hashCode = hash.finish();
} else {
hash.update(1);
}
hashCode = hash.finish();
PredictionContext.call(this, hashCode);
this.parentCtx = parent;
this.returnState = returnState;
@ -640,16 +643,16 @@ function mergeArrays(a, b, rootIsWildcard, mergeCache) {
// ones.
// /
function combineCommonParents(parents) {
var uniqueParents = {};
var uniqueParents = new Map();
for (var p = 0; p < parents.length; p++) {
var parent = parents[p];
if (!(parent in uniqueParents)) {
uniqueParents[parent] = parent;
if (!(uniqueParents.containsKey(parent))) {
uniqueParents.put(parent, parent);
}
}
for (var q = 0; q < parents.length; q++) {
parents[q] = uniqueParents[parents[q]];
parents[q] = uniqueParents.get(parents[q]);
}
}
@ -657,13 +660,13 @@ function getCachedPredictionContext(context, contextCache, visited) {
if (context.isEmpty()) {
return context;
}
var existing = visited[context] || null;
var existing = visited.get(context) || null;
if (existing !== null) {
return existing;
}
existing = contextCache.get(context);
if (existing !== null) {
visited[context] = existing;
visited.put(context, existing);
return existing;
}
var changed = false;
@ -683,7 +686,7 @@ function getCachedPredictionContext(context, contextCache, visited) {
}
if (!changed) {
contextCache.add(context);
visited[context] = context;
visited.put(context, context);
return context;
}
var updated = null;
@ -696,8 +699,8 @@ function getCachedPredictionContext(context, contextCache, visited) {
updated = new ArrayPredictionContext(parents, context.returnStates);
}
contextCache.add(updated);
visited[updated] = updated;
visited[context] = updated;
visited.put(updated, updated);
visited.put(context, updated);
return updated;
}
@ -708,13 +711,13 @@ function getAllContextNodes(context, nodes, visited) {
nodes = [];
return getAllContextNodes(context, nodes, visited);
} else if (visited === null) {
visited = {};
visited = new Map();
return getAllContextNodes(context, nodes, visited);
} else {
if (context === null || visited[context] !== null) {
if (context === null || visited.containsKey(context)) {
return nodes;
}
visited[context] = context;
visited.put(context, context);
nodes.push(context);
for (var i = 0; i < context.length; i++) {
getAllContextNodes(context.getParent(i), nodes, visited);

View File

@ -323,7 +323,9 @@ AltDict.prototype.values = function () {
});
};
function DoubleDict() {
function DoubleDict(defaultMapCtor) {
this.defaultMapCtor = defaultMapCtor || Map;
this.cacheMap = new this.defaultMapCtor();
return this;
}
@ -339,7 +341,7 @@ Hash.prototype.update = function () {
if (value == null)
continue;
if(Array.isArray(value))
this.update.apply(value);
this.update.apply(this, value);
else {
var k = 0;
switch (typeof(value)) {
@ -354,7 +356,10 @@ Hash.prototype.update = function () {
k = value.hashCode();
break;
default:
value.updateHashCode(this);
if(value.updateHashCode)
value.updateHashCode(this);
else
console.log("No updateHashCode for " + value.toString())
continue;
}
k = k * 0xCC9E2D51;
@ -367,7 +372,7 @@ Hash.prototype.update = function () {
this.hash = hash;
}
}
}
};
Hash.prototype.finish = function () {
var hash = this.hash ^ (this.count * 4);
@ -377,26 +382,26 @@ Hash.prototype.finish = function () {
hash = hash * 0xC2B2AE35;
hash = hash ^ (hash >>> 16);
return hash;
}
};
function hashStuff() {
var hash = new Hash();
hash.update.apply(arguments);
hash.update.apply(hash, arguments);
return hash.finish();
}
DoubleDict.prototype.get = function (a, b) {
var d = this[a] || null;
return d === null ? null : (d[b] || null);
var d = this.cacheMap.get(a) || null;
return d === null ? null : (d.get(b) || null);
};
DoubleDict.prototype.set = function (a, b, o) {
var d = this[a] || null;
var d = this.cacheMap.get(a) || null;
if (d === null) {
d = {};
this[a] = d;
d = new this.defaultMapCtor();
this.cacheMap.put(a, d);
}
d[b] = o;
d.put(b, o);
};

View File

@ -175,7 +175,7 @@ ATNConfigSet.prototype.equals = function(other) {
ATNConfigSet.prototype.hashCode = function() {
var hash = new Hash();
this.updateHashCode(hash);
hash.update(this.configs);
return hash.finish();
};
@ -183,13 +183,11 @@ ATNConfigSet.prototype.hashCode = function() {
ATNConfigSet.prototype.updateHashCode = function(hash) {
if (this.readOnly) {
if (this.cachedHashCode === -1) {
var hash = new Hash();
hash.update(this.configs);
this.cachedHashCode = hash.finish();
this.cachedHashCode = this.hashCode();
}
hash.update(this.cachedHashCode);
} else {
hash.update(this.configs);
hash.update(this.hashCode());
}
};

View File

@ -138,7 +138,7 @@ ATNDeserializer.prototype.deserialize = function(data) {
ATNDeserializer.prototype.reset = function(data) {
var adjust = function(c) {
var v = c.charCodeAt(0);
return v>1 ? v-2 : v + 65533;
return v>1 ? v-2 : v + 65534;
};
var temp = data.split("").map(adjust);
// don't adjust the first value since that's the version number

Some files were not shown because too many files have changed in this diff Show More