Merge branch 'master' into easonlin404-patch-1

This commit is contained in:
Eason Lin 2019-12-31 01:35:20 +08:00 committed by GitHub
commit 334e8801c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
150 changed files with 5912 additions and 624 deletions

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

@ -74,42 +74,42 @@ matrix:
- clang-3.7
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=cpp
- GROUP=LEXER
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=cpp
- GROUP=PARSER
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=cpp
- GROUP=RECURSION
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=swift
- GROUP=LEXER
stage: main-test
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=swift
- GROUP=PARSER
stage: main-test
- os: osx
compiler: clang
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=swift
- GROUP=RECURSION
@ -122,19 +122,19 @@ matrix:
- GROUP=ALL
stage: extended-test
- os: osx
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=dotnet
- GROUP=LEXER
stage: extended-test
- os: osx
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=dotnet
- GROUP=PARSER
stage: extended-test
- os: osx
osx_image: xcode10.1
osx_image: xcode10.2
env:
- TARGET=dotnet
- GROUP=RECURSION
@ -152,6 +152,13 @@ matrix:
jdk: openjdk8
env: TARGET=csharp
stage: main-test
- os: linux
language: php
php:
- 7.2
jdk: openjdk8
env: TARGET=php
stage: main-test
- os: linux
jdk: openjdk8
dist: trusty

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

@ -2,7 +2,5 @@
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt-get update -qq
eval "$(sudo gimme 1.7.3)"
( go version ; go env ) || true

View File

@ -1,6 +0,0 @@
#!/bin/bash
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt-get update -qq

View File

@ -2,7 +2,6 @@
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt-get update -qq
curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
sudo apt-get install -qq nodejs

View File

@ -4,3 +4,7 @@ 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

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -euo pipefail
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt-get update -qq
python --version

View File

@ -1,5 +0,0 @@
#!/bin/bash
set -euo pipefail
python3 --version

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

@ -2,6 +2,8 @@
set -euo pipefail
python --version
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=python2.* test
cd ../runtime/Python2/tests

View File

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

View File

@ -6,7 +6,7 @@ set -euo pipefail
# here since environment variables doesn't pass
# across scripts
if [ $TRAVIS_OS_NAME == "linux" ]; then
export SWIFT_VERSION=swift-4.2.1
export SWIFT_VERSION=swift-5.0.1
export SWIFT_HOME=$(pwd)/swift/$SWIFT_VERSION-RELEASE-ubuntu16.04/usr/bin/
export PATH=$SWIFT_HOME:$PATH

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,10 @@ cache:
- '%USERPROFILE%\.nuget\packages -> **\project.json'
image: Visual Studio 2017
build: off
install:
- git submodule update --init --recursive
- cinst -y php --params "/InstallDir:C:\tools\php"
- cinst -y 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 +15,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\php\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

@ -214,7 +214,9 @@ YYYY/MM/DD, github id, Full name, email
2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com
2018/12/20, WalterCouto, Walter Couto, WalterCouto@users.noreply.github.com
2018/12/23, youkaichao, Kaichao You, youkaichao@gmail.com
2019/01/16, kuegi, Markus Zancolo, markus.zancolo@roomle.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
@ -222,3 +224,17 @@ YYYY/MM/DD, github id, Full name, email
2019/07/16, abhijithneilabraham, Abhijith Neil Abraham, abhijithneilabrahampk@gmail.com
2019/07/26, Braavos96, Eric Hettiaratchi, erichettiaratchi@gmail.com
2019/08/12, easonlin404, Eason Lin, easonlin404@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/29, tehbone, Tabari Alexander, tehbone@gmail.com
2019/10/31, a-square, Alexei Averchenko, lex.aver@gmail.com
2019/11/11, foxeverl, Liu Xinfeng, liuxf1986[at]gmail[dot]com
2019/11/17, felixn, Felix Nieuwenhuizhen, felix@tdlrali.com
2019/11/18, mlilback, Mark Lilback, mark@lilback.com

View File

@ -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:

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

@ -22,6 +22,14 @@ $ git push origin 4.7-rc1
$ git push upstream 4.7-rc1
```
## Update submodules
Update the runtime submodules by running the following command:
```bash
git submodule update --recursive
```
## Bump version
Edit the repository looking for 4.5 or whatever and update it. Bump version in the following files:

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

@ -109,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,9 +14,9 @@ Cast(t,v) ::= "((<t>)<v>)"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "Object <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= "System.Collections.IList __ttt__ = <v>;" // just use static type system
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -94,6 +98,8 @@ bool Property() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
public override IToken NextToken() {

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= <<if ( !(v instanceof Array) ) {throw "value is not an array";}>>
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -92,6 +96,8 @@ this.Property = function() {
}
>>
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -9,19 +9,20 @@ 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>"
DeclareLocal(s,v) ::= "<s> = <v>"
AppendStr(a,b) ::= "<a> + <b>"
AssertIsList(v) ::= "assert(<v>.size() >= 0);" // Use a method that exists only on a list (vector actually).
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>;"
AddMember(n,v) ::= "<n> += <v>;"
PlusMember(v,n) ::= "<v> + <n>"
MemberEquals(n,v) ::= "<n> == <v>"
ModMemberEquals(n,m,v) ::= "<n> % <m> == <v>"
ModMemberNotEquals(n,m,v) ::= "<n> % <m> != <v>"
@ -68,6 +69,8 @@ bool Property() {
ParserPropertyCall(p, call) ::= "<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
protected:
class PositionAdjustingLexerATNSimulator : public antlr4::atn::LexerATNSimulator {

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= <<if ( !(v instanceof Array) ) {throw "value is not an array";}>>
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -98,6 +102,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= <<if ( !(v instanceof Array) ) {throw "value is not an array"}>>
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -100,6 +104,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "(<v>)"
Append(a,b) ::= "<a> + fmt.Sprint(<b>)"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= "<a> + <b>"
DeclareLocal(s, v) ::= "var <s> = <v>"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= ""
@ -26,14 +26,18 @@ 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>;%>
AddMember(n, v) ::= <%<n> += <v>;%>
PlusMember(v, n) ::= <%<v> + fmt.Sprint(<n>)%>
MemberEquals(n, v) ::= <%<n> == <v>%>
ModMemberEquals(n, m, v) ::= <%<n> % <m> == <v>%>
@ -94,6 +98,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,9 +14,9 @@ Cast(t,v) ::= "((<t>)<v>)"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "Object <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= "List\<?> __ttt__ = <v>;" // just use static type system
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -94,6 +98,8 @@ boolean Property() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
@Override

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= <<if ( !(v instanceof Array) ) {throw "value is not an array";}>>
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -98,6 +102,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,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + str(<b>)"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= "<a> + <b>"
DeclareLocal(s,v) ::= "<s> = <v>"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= "assert isinstance(v, (list, tuple))"
@ -26,14 +26,18 @@ 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>%>
AddMember(n,v) ::= <%self.<n> += <v>%>
PlusMember(v,n) ::= <%<v> + str(self.<n>)%>
MemberEquals(n,v) ::= <%self.<n> == <v>%>
ModMemberEquals(n,m,v) ::= <%self.<n> % <m> == <v>%>
@ -94,6 +98,8 @@ def Property(self):
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
def resetAcceptPosition(self, index, line, column):

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + str(<b>)"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= "<a> + <b>"
DeclareLocal(s,v) ::= "<s> = <v>"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= "assert isinstance(v, (list, tuple))"
@ -26,14 +26,18 @@ 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>%>
AddMember(n,v) ::= <%self.<n> += <v>%>
PlusMember(v,n) ::= <%<v> + str(self.<n>)%>
MemberEquals(n,v) ::= <%self.<n> == <v>%>
ModMemberEquals(n,m,v) ::= <%self.<n> % <m> == <v>%>
@ -99,6 +103,8 @@ def Property(self):
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
def resetAcceptPosition(self, index, line, column):

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "<v>"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>;"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= <<if ( !(v instanceof Array) ) {throw "value is not an array";}>>
@ -26,14 +26,18 @@ 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>;%>
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>%>
@ -98,6 +102,8 @@ this.Property = function() {
ParserPropertyCall(p, call) ::= "<p>.<call>"
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {

View File

@ -14,9 +14,9 @@ Cast(t,v) ::= "((<v> as! <t>))"
Append(a,b) ::= "<a> + <b>"
Concat(a,b) ::= "<a><b>"
AppendStr(a,b) ::= <%<Append(a,b)>%>
DeclareLocal(s,v) ::= "var <s> = <v>"
Concat(a,b) ::= "<a><b>"
AssertIsList(v) ::= "var __ttt__ = <v>;" // just use static type system
@ -26,14 +26,18 @@ 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>%>
AddMember(n,v) ::= <%self.<n> += <v>%>
PlusMember(v,n) ::= <%<v> + self.<n>%>
MemberEquals(n,v) ::= <%self.<n> == <v>%>
ModMemberEquals(n,m,v) ::= <%self.<n> % <m> == <v>%>
@ -96,6 +100,8 @@ ParserPropertyCall(parser, property) ::= <<
<parser>.<property>
>>
PositionAdjustingLexerDef() ::= ""
PositionAdjustingLexer() ::= <<
override
@ -123,7 +129,7 @@ open func emit() -> Token {
private func handleAcceptPositionForIdentifier() -> Bool {
let tokenText = getText()
var identifierLength = 0
while ((identifierLength \< tokenText.characters.count) && isIdentifierChar(tokenText[tokenText.characters.index(tokenText.startIndex, offsetBy: identifierLength)])) {
while ((identifierLength \< tokenText.count) && isIdentifierChar(tokenText[tokenText.index(tokenText.startIndex, offsetBy: identifierLength)])) {
identifierLength += 1
}
@ -137,8 +143,8 @@ private func handleAcceptPositionForIdentifier() -> Bool {
}
private func handleAcceptPositionForKeyword(_ keyword:String) -> Bool {
if getInputStream()!.index() > _tokenStartCharIndex + keyword.characters.count {
let offset = keyword.characters.count - 1
if getInputStream()!.index() > _tokenStartCharIndex + keyword.count {
let offset = keyword.count - 1
(getInterpreter() as! PositionAdjustingLexerATNSimulator).resetAcceptPosition(getInputStream()!, _tokenStartCharIndex + offset, _tokenStartLine, _tokenStartCharPositionInLine + offset)
return true
}

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

@ -57,12 +57,23 @@ public class BaseSwiftTest implements RuntimeTestSupport {
throw new RuntimeException("Swift runtime file not found at:" + swiftRuntime.getPath());
}
ANTLR_RUNTIME_PATH = swiftRuntime.getPath();
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "build");
try {
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "build");
}
catch (IOException | InterruptedException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
// shutdown logic
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "package", "clean");
try {
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "package", "clean");
}
catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
});
}
@ -145,8 +156,14 @@ public class BaseSwiftTest implements RuntimeTestSupport {
String projectName = "testcase-" + System.currentTimeMillis();
String projectDir = getTmpDir() + "/" + projectName;
buildProject(projectDir, projectName);
return execTest(projectDir, projectName);
try {
buildProject(projectDir, projectName);
return execTest(projectDir, projectName);
}
catch (IOException | InterruptedException e) {
e.printStackTrace();
return null;
}
}
@Override
@ -183,7 +200,7 @@ public class BaseSwiftTest implements RuntimeTestSupport {
Collections.addAll(this.sourceFiles, files);
}
private void buildProject(String projectDir, String projectName) {
private void buildProject(String projectDir, String projectName) throws IOException, InterruptedException {
mkdir(projectDir);
fastFailRunProcess(projectDir, SWIFT_CMD, "package", "init", "--type", "executable");
for (String sourceFile: sourceFiles) {
@ -191,20 +208,16 @@ public class BaseSwiftTest implements RuntimeTestSupport {
fastFailRunProcess(getTmpDir(), "mv", "-f", absPath, projectDir + "/Sources/" + projectName);
}
fastFailRunProcess(getTmpDir(), "mv", "-f", "input", projectDir);
try {
String dylibPath = ANTLR_RUNTIME_PATH + "/.build/debug/";
Pair<String, String> buildResult = runProcess(projectDir, SWIFT_CMD, "build",
"-Xswiftc", "-I"+dylibPath,
"-Xlinker", "-L"+dylibPath,
"-Xlinker", "-lAntlr4",
"-Xlinker", "-rpath",
"-Xlinker", dylibPath);
if (buildResult.b.length() > 0) {
throw new RuntimeException("unit test build failed: " + buildResult.a + "\n" + buildResult.b);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
String dylibPath = ANTLR_RUNTIME_PATH + "/.build/debug/";
// System.err.println(dylibPath);
Pair<String, String> buildResult = runProcess(projectDir, SWIFT_CMD, "build",
"-Xswiftc", "-I"+dylibPath,
"-Xlinker", "-L"+dylibPath,
"-Xlinker", "-lAntlr4",
"-Xlinker", "-rpath",
"-Xlinker", dylibPath);
if (buildResult.b.length() > 0) {
throw new IOException("unit test build failed: " + buildResult.a + "\n" + buildResult.b);
}
}
@ -214,20 +227,22 @@ public class BaseSwiftTest implements RuntimeTestSupport {
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
stdoutVacuum.start();
stderrVacuum.start();
process.waitFor();
int status = process.waitFor();
stdoutVacuum.join();
stderrVacuum.join();
if (status != 0) {
throw new IOException("Process exited with status " + status + ":\n" + stdoutVacuum.toString() + "\n" + stderrVacuum.toString());
}
return new Pair<>(stdoutVacuum.toString(), stderrVacuum.toString());
}
private static void fastFailRunProcess(String workingDir, String... command) {
private static void fastFailRunProcess(String workingDir, String... command) throws IOException, InterruptedException {
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new File(workingDir));
try {
Process p = builder.start();
p.waitFor();
} catch (Exception e) {
e.printStackTrace();
Process p = builder.start();
int status = p.waitFor();
if (status != 0) {
throw new IOException("Process exited with status " + status);
}
}
@ -251,8 +266,14 @@ public class BaseSwiftTest implements RuntimeTestSupport {
addSourceFiles("main.swift");
String projectName = "testcase-" + System.currentTimeMillis();
String projectDir = getTmpDir() + "/" + projectName;
buildProject(projectDir, projectName);
return execTest(projectDir, projectName);
try {
buildProject(projectDir, projectName);
return execTest(projectDir, projectName);
}
catch (IOException | InterruptedException e) {
e.printStackTrace();
return null;
}
}
private void writeParserTestFile(String parserName,

View File

@ -122,7 +122,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND ( CMAKE_SYSTEM_NAME MATCH
endif()
elseif(MSVC_VERSION GREATER 1800 OR MSVC_VERSION EQUAL 1800)
# Visual Studio 2012+ supports c++11 features
else ()
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
else()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif()

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

@ -109,6 +109,12 @@ else()
endif()
# Seperate build step as rarely people want both
set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT})
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0")
# CMake 3.14 builds in above's SOURCE_SUBDIR when BUILD_IN_SOURCE is true
set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT}/runtime/Cpp)
endif()
ExternalProject_Add_Step(
antlr4_runtime
build_static
@ -118,7 +124,7 @@ ExternalProject_Add_Step(
DEPENDS antlr4_runtime
BYPRODUCTS ${ANTLR4_STATIC_LIBRARIES}
EXCLUDE_FROM_MAIN 1
WORKING_DIRECTORY ${ANTLR4_ROOT})
WORKING_DIRECTORY ${ANTLR4_BUILD_DIR})
ExternalProject_Add_StepTargets(antlr4_runtime build_static)
add_library(antlr4_static STATIC IMPORTED)
@ -135,7 +141,7 @@ ExternalProject_Add_Step(
DEPENDS antlr4_runtime
BYPRODUCTS ${ANTLR4_SHARED_LIBRARIES} ${ANTLR4_RUNTIME_LIBRARIES}
EXCLUDE_FROM_MAIN 1
WORKING_DIRECTORY ${ANTLR4_ROOT})
WORKING_DIRECTORY ${ANTLR4_BUILD_DIR})
ExternalProject_Add_StepTargets(antlr4_runtime build_shared)
add_library(antlr4_shared SHARED IMPORTED)

View File

@ -40,7 +40,8 @@ antlr_target(SampleGrammarLexer TLexer.g4 LEXER
PACKAGE antlrcpptest)
antlr_target(SampleGrammarParser TParser.g4 PARSER
PACKAGE antlrcpptest
DEPENDS_ANTLR SampleGrammarLexer)
DEPENDS_ANTLR SampleGrammarLexer
COMPILE_FLAGS -lib ${ANTLR_SampleGrammarLexer_OUTPUT_DIR})
# include generated files in project environment
include_directories(${ANTLR_SampleGrammarLexer_OUTPUT_DIR})

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

@ -358,17 +358,18 @@ std::string BufferedTokenStream::getSourceName() const
}
std::string BufferedTokenStream::getText() {
fill();
return getText(misc::Interval(0U, size() - 1));
}
std::string BufferedTokenStream::getText(const misc::Interval &interval) {
lazyInit();
fill();
size_t start = interval.a;
size_t stop = interval.b;
if (start == INVALID_INDEX || stop == INVALID_INDEX) {
return "";
}
sync(stop);
if (stop >= _tokens.size()) {
stop = _tokens.size() - 1;
}

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

@ -9,6 +9,20 @@
using namespace antlr4;
namespace {
// Create a normal shared pointer if the configurations are to be deleted. If not, then
// the shared pointer is created with a deleter that does nothing.
Ref<atn::ATNConfigSet> buildConfigsRef(atn::ATNConfigSet *configs, bool deleteConfigs) {
if (deleteConfigs) {
return Ref<atn::ATNConfigSet>(configs);
} else {
return Ref<atn::ATNConfigSet>(configs, [](atn::ATNConfigSet *){});
}
}
}
NoViableAltException::NoViableAltException(Parser *recognizer)
: NoViableAltException(recognizer, recognizer->getTokenStream(), recognizer->getCurrentToken(),
recognizer->getCurrentToken(), nullptr, recognizer->getContext(), false) {
@ -17,12 +31,10 @@ NoViableAltException::NoViableAltException(Parser *recognizer)
NoViableAltException::NoViableAltException(Parser *recognizer, TokenStream *input,Token *startToken,
Token *offendingToken, atn::ATNConfigSet *deadEndConfigs, ParserRuleContext *ctx, bool deleteConfigs)
: RecognitionException("No viable alternative", recognizer, input, ctx, offendingToken),
_deadEndConfigs(deadEndConfigs), _startToken(startToken), _deleteConfigs(deleteConfigs) {
_deadEndConfigs(buildConfigsRef(deadEndConfigs, deleteConfigs)), _startToken(startToken) {
}
NoViableAltException::~NoViableAltException() {
if (_deleteConfigs)
delete _deadEndConfigs;
}
Token* NoViableAltException::getStartToken() const {
@ -30,5 +42,5 @@ Token* NoViableAltException::getStartToken() const {
}
atn::ATNConfigSet* NoViableAltException::getDeadEndConfigs() const {
return _deadEndConfigs;
return _deadEndConfigs.get();
}

View File

@ -27,10 +27,9 @@ namespace antlr4 {
private:
/// Which configurations did we try at input.index() that couldn't match input.LT(1)?
atn::ATNConfigSet* _deadEndConfigs;
// Flag that indicates if we own the dead end config set and have to delete it on destruction.
bool _deleteConfigs;
/// Shared pointer that conditionally deletes the configurations (based on flag
/// passed during construction)
Ref<atn::ATNConfigSet> _deadEndConfigs;
/// The token object at the start index; the input stream might
/// not be buffering tokens so get a reference to it. (At the

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

@ -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

@ -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 {

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