forked from jasder/antlr
Merge remote-tracking branch 'antlr/master'
This commit is contained in:
commit
cca57c9af2
88
.travis.yml
88
.travis.yml
|
@ -10,6 +10,7 @@ matrix:
|
|||
env:
|
||||
- TARGET=cpp
|
||||
- CXX=g++-5
|
||||
- GROUP=ALL
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
|
@ -22,7 +23,9 @@ matrix:
|
|||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env: TARGET=cpp
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=LEXER
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
|
@ -35,10 +38,71 @@ matrix:
|
|||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env: TARGET=swift
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=PARSER
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
packages:
|
||||
- g++-5
|
||||
- uuid-dev
|
||||
- clang-3.7
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env:
|
||||
- TARGET=cpp
|
||||
- GROUP=RECURSION
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
packages:
|
||||
- g++-5
|
||||
- uuid-dev
|
||||
- clang-3.7
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=LEXER
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=PARSER
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode8.1
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=RECURSION
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- TARGET=swift
|
||||
- GROUP=ALL
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env: TARGET=dotnet
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=LEXER
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=PARSER
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=RECURSION
|
||||
- os: linux
|
||||
jdk: oraclejdk7
|
||||
env: TARGET=java
|
||||
|
@ -49,9 +113,23 @@ matrix:
|
|||
jdk: oraclejdk7
|
||||
env: TARGET=csharp
|
||||
- os: linux
|
||||
jdk: oraclejdk7
|
||||
jdk: oraclejdk8
|
||||
dist: trusty
|
||||
env: TARGET=dotnet
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=LEXER
|
||||
- os: linux
|
||||
jdk: oraclejdk8
|
||||
dist: trusty
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=PARSER
|
||||
- os: linux
|
||||
jdk: oraclejdk8
|
||||
dist: trusty
|
||||
env:
|
||||
- TARGET=dotnet
|
||||
- GROUP=RECURSION
|
||||
- os: linux
|
||||
jdk: oraclejdk7
|
||||
env: TARGET=python2
|
||||
|
|
|
@ -6,16 +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.1
|
||||
|
||||
# install mvn
|
||||
wget http://apache.mirrors.lucidnetworks.net/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \
|
||||
wget https://www.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz.md5 && \
|
||||
echo "$(cat apache-maven-3.3.9-bin.tar.gz.md5) apache-maven-3.3.9-bin.tar.gz" > apache-maven-3.3.9-bin.tar.gz.md5 && \
|
||||
md5sum -c *.md5
|
||||
|
||||
sudo rm -rf /usr/local/maven/ && sudo mkdir -p /usr/local/maven && \
|
||||
sudo tar xzvf apache-maven-3.3.9-bin.tar.gz -C /usr/local/maven --strip-components=1
|
||||
|
||||
mvn -v
|
||||
sudo apt-get install dotnet-dev-1.0.4
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
set -euo pipefail
|
||||
|
||||
# make sure we use trusty repositories (travis by default uses precise)
|
||||
curl https://repogen.simplylinux.ch/txt/trusty/sources_c4aa56bd26c0f54f391d8fae3e687ef5f6e97c26.txt | sudo tee /etc/apt/sources.list
|
||||
|
||||
# install dependencies
|
||||
# some packages below will be update, swift assumes newer versions
|
||||
# of, for example, sqlite3 and libicu, without the update some
|
||||
# tools will not work
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang libicu-dev libxml2 sqlite3
|
||||
|
||||
# This would fix a know linker issue mentioned in:
|
||||
# https://bugs.swift.org/browse/SR-2299
|
||||
sudo ln -sf ld.gold /usr/bin/ld
|
|
@ -12,10 +12,10 @@ ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
|
|||
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
|
||||
|
||||
# download dotnet core
|
||||
curl https://download.microsoft.com/download/8/F/9/8F9659B9-E628-4D1A-B6BF-C3004C8C954B/dotnet-1.1.1-sdk-osx-x64.pkg -o /tmp/dotnet-1.1.1-sdk-osx-x64.pkg
|
||||
curl https://download.microsoft.com/download/B/9/F/B9F1AF57-C14A-4670-9973-CDF47209B5BF/dotnet-dev-osx-x64.1.0.4.pkg -o /tmp/dotnet-dev-osx-x64.1.0.4.pkg
|
||||
|
||||
# install dotnet core
|
||||
sudo installer -pkg /tmp/dotnet-1.1.1-sdk-osx-x64.pkg -target /
|
||||
sudo installer -pkg /tmp/dotnet-dev-osx-x64.1.0.4.pkg -target /
|
||||
|
||||
# make the link
|
||||
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
mvn -q -Dtest=cpp.* test # timeout due to no output for 10 min on travis if in parallel
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=cpp.* test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=cpp.* test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=cpp.* test
|
||||
else
|
||||
mvn -q -Dtest=cpp.* test
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
mvn -q -Dparallel=methods -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
|
||||
# we need to build the runtime before test run, since we used "--no-dependencies"
|
||||
# when we call dotnet cli for restore and build, in order to speed up
|
||||
|
||||
dotnet restore ../runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.csproj
|
||||
dotnet build -c Release ../runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.dotnet.csproj
|
||||
|
||||
# call test
|
||||
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dparallel=classes -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dparallel=classes -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dparallel=classes -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
|
||||
else
|
||||
mvn -q -Dparallel=classes -DthreadCount=4 -Dtest=csharp.* -Dantlr-csharp-netstandard=true test
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# only test swift as we develop on os x so likely well tested and its dog slow on travis
|
||||
mvn -q -Dtest=swift.* test
|
||||
# linux specific setup, those setup have to be
|
||||
# here since environment variables doesn't pass
|
||||
# across scripts
|
||||
if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||
export SWIFT_VERSION=swift-3.1.1
|
||||
export SWIFT_HOME=$(pwd)/swift/$SWIFT_VERSION-RELEASE-ubuntu14.04/usr/bin/
|
||||
export PATH=$SWIFT_HOME:$PATH
|
||||
|
||||
# download swift
|
||||
mkdir swift
|
||||
curl https://swift.org/builds/$SWIFT_VERSION-release/ubuntu1404/$SWIFT_VERSION-RELEASE/$SWIFT_VERSION-RELEASE-ubuntu14.04.tar.gz -s | tar xz -C swift &> /dev/null
|
||||
fi
|
||||
|
||||
# check swift
|
||||
swift --version
|
||||
swift build --version
|
||||
|
||||
if [ $GROUP == "LEXER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=swift.* test
|
||||
elif [ $GROUP == "PARSER" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=swift.* test
|
||||
elif [ $GROUP == "RECURSION" ]; then
|
||||
mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=swift.* test
|
||||
else
|
||||
mvn -q -Dtest=swift.* test
|
||||
fi
|
||||
|
|
|
@ -395,7 +395,7 @@ public class Antlr4Mojo extends AbstractMojo {
|
|||
String tokensFileName = grammarFile.getName().split("\\.")[0] + ".tokens";
|
||||
File outputFile = new File(outputDirectory, tokensFileName);
|
||||
if ( (! outputFile.exists()) ||
|
||||
outputFile.lastModified() < grammarFile.lastModified() ||
|
||||
outputFile.lastModified() <= grammarFile.lastModified() ||
|
||||
dependencies.isDependencyChanged(grammarFile)) {
|
||||
grammarFilesToProcess.add(grammarFile);
|
||||
}
|
||||
|
@ -412,10 +412,7 @@ public class Antlr4Mojo extends AbstractMojo {
|
|||
// Iterate each grammar file we were given and add it into the tool's list of
|
||||
// grammars to process.
|
||||
for (File grammarFile : grammarFiles) {
|
||||
if (!buildContext.hasDelta(grammarFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
buildContext.refresh(grammarFile);
|
||||
buildContext.removeMessages(grammarFile);
|
||||
|
||||
getLog().debug("Grammar file '" + grammarFile.getPath() + "' detected.");
|
||||
|
|
|
@ -216,14 +216,14 @@ class GrammarDependencies {
|
|||
return;
|
||||
|
||||
for (GrammarAST importDecl : grammar.getAllChildrenWithType(ANTLRParser.IMPORT)) {
|
||||
Tree id = importDecl.getFirstChildWithType(ANTLRParser.ID);
|
||||
for (Tree id: importDecl.getAllChildrenWithType(ANTLRParser.ID)) {
|
||||
// missing id is not valid, but we don't want to prevent the root cause from
|
||||
// being reported by the ANTLR tool
|
||||
if (id != null) {
|
||||
String grammarPath = getRelativePath(grammarFile);
|
||||
|
||||
// missing id is not valid, but we don't want to prevent the root cause from
|
||||
// being reported by the ANTLR tool
|
||||
if (id != null) {
|
||||
String grammarPath = getRelativePath(grammarFile);
|
||||
|
||||
graph.addEdge(id.getText() + ".g4", grammarPath);
|
||||
graph.addEdge(id.getText() + ".g4", grammarPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,6 +202,7 @@ public class Antlr4MojoTest {
|
|||
Path genHello = generatedSources.resolve("test/HelloParser.java");
|
||||
|
||||
Path baseGrammar = antlrDir.resolve("imports/TestBaseLexer.g4");
|
||||
Path baseGrammar2 = antlrDir.resolve("imports/TestBaseLexer2.g4");
|
||||
Path lexerGrammar = antlrDir.resolve("test/TestLexer.g4");
|
||||
Path parserGrammar = antlrDir.resolve("test/TestParser.g4");
|
||||
|
||||
|
@ -222,21 +223,20 @@ public class Antlr4MojoTest {
|
|||
assertTrue(Files.exists(genHello));
|
||||
assertTrue(Files.exists(genTestParser));
|
||||
assertTrue(Files.exists(genTestLexer));
|
||||
byte[] origTestLexerSum = checksum(genTestLexer);
|
||||
byte[] origTestParserSum = checksum(genTestParser);
|
||||
byte[] origHelloSum = checksum(genHello);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 2nd - nothing has been modified, no grammars have to be processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
byte[] testLexerSum = checksum(genTestLexer);
|
||||
byte[] testParserSum = checksum(genTestParser);
|
||||
byte[] helloSum = checksum(genHello);
|
||||
|
||||
maven.executeMojo(session, project, exec);
|
||||
|
||||
assertTrue(Arrays.equals(testLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(testParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(helloSum, checksum(genHello)));
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -245,50 +245,71 @@ public class Antlr4MojoTest {
|
|||
|
||||
// modify the grammar to make checksum comparison detect a change
|
||||
try(Change change = Change.of(baseGrammar, "DOT: '.' ;")) {
|
||||
byte[] testLexerSum = checksum(genTestLexer);
|
||||
byte[] testParserSum = checksum(genTestParser);
|
||||
byte[] helloSum = checksum(genHello);
|
||||
|
||||
maven.executeMojo(session, project, exec);
|
||||
|
||||
assertFalse(Arrays.equals(testLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(testParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(helloSum, checksum(genHello)));
|
||||
assertFalse(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
// Restore file and confirm it was restored.
|
||||
maven.executeMojo(session, project, exec);
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 4th - the lexer grammar changed, the parser grammar has to be processed as well
|
||||
// 4th - the second imported grammar changed, every dependency has to be processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// modify the grammar to make checksum comparison detect a change
|
||||
try(Change change = Change.of(lexerGrammar)) {
|
||||
byte[] testLexerSum = checksum(genTestLexer);
|
||||
byte[] testParserSum = checksum(genTestParser);
|
||||
byte[] helloSum = checksum(genHello);
|
||||
|
||||
try(Change change = Change.of(baseGrammar2, "BANG: '!' ;")) {
|
||||
maven.executeMojo(session, project, exec);
|
||||
|
||||
assertFalse(Arrays.equals(testLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(testParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(helloSum, checksum(genHello)));
|
||||
assertFalse(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
// Restore file and confirm it was restored.
|
||||
maven.executeMojo(session, project, exec);
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 5th - the parser grammar changed, no other grammars have to be processed
|
||||
// 5th - the lexer grammar changed, the parser grammar has to be processed as well
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// modify the grammar to make checksum comparison detect a change
|
||||
try(Change change = Change.of(lexerGrammar, "FOO: 'foo' ;")) {
|
||||
maven.executeMojo(session, project, exec);
|
||||
|
||||
assertFalse(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
// Restore file and confirm it was restored.
|
||||
maven.executeMojo(session, project, exec);
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 6th - the parser grammar changed, no other grammars have to be processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// modify the grammar to make checksum comparison detect a change
|
||||
try(Change change = Change.of(parserGrammar, " t : WS* ;")) {
|
||||
byte[] testLexerSum = checksum(genTestLexer);
|
||||
byte[] testParserSum = checksum(genTestParser);
|
||||
byte[] helloSum = checksum(genHello);
|
||||
|
||||
maven.executeMojo(session, project, exec);
|
||||
|
||||
assertTrue(Arrays.equals(testLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(testParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(helloSum, checksum(genHello)));
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertFalse(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
// Restore file and confirm it was restored.
|
||||
maven.executeMojo(session, project, exec);
|
||||
assertTrue(Arrays.equals(origTestLexerSum, checksum(genTestLexer)));
|
||||
assertTrue(Arrays.equals(origTestParserSum, checksum(genTestParser)));
|
||||
assertTrue(Arrays.equals(origHelloSum, checksum(genHello)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -10,7 +10,4 @@ fragment
|
|||
Whitespace : ' ' | '\n' | '\t' | '\r' ;
|
||||
|
||||
fragment
|
||||
Hexdigit : [a-fA-F0-9] ;
|
||||
|
||||
fragment
|
||||
Digit : [0-9] ;
|
||||
Hexdigit : [a-fA-F0-9] ;
|
|
@ -0,0 +1,4 @@
|
|||
lexer grammar TestBaseLexer2;
|
||||
|
||||
fragment
|
||||
Digit : [0-9] ;
|
|
@ -1,6 +1,6 @@
|
|||
lexer grammar TestLexer;
|
||||
|
||||
import TestBaseLexer;
|
||||
import TestBaseLexer, TestBaseLexer2;
|
||||
|
||||
WS : Whitespace+ -> skip;
|
||||
TEXT : ~[<&]+ ; // match any 16 bit char other than < and &
|
||||
TEXT : ~[<&]+ ; // match any 16 bit char other than < and &
|
||||
|
|
|
@ -144,3 +144,15 @@ YYYY/MM/DD, github id, Full name, email
|
|||
2017/03/15, robertvanderhulst, Robert van der Hulst, robert@xsharp.eu
|
||||
2017/03/28, cmd-johnson, Jonas Auer, jonas.auer.94@gmail.com
|
||||
2017/04/12, lys0716, Yishuang Lu, luyscmu@gmail.com
|
||||
2017/04/30, shravanrn, Shravan Narayan, shravanrn@gmail.com
|
||||
2017/05/11, jimallman, Jim Allman, jim@ibang.com
|
||||
2017/05/26, waf, Will Fuqua, wafuqua@gmail.com
|
||||
2017/05/29, kosak, Corey Kosak, kosak@kosak.com
|
||||
2017/06/11, erikbra, Erik A. Brandstadmoen, erik@brandstadmoen.net
|
||||
2017/06/10, jm-mikkelsen, Jan Martin Mikkelsen, janm@transactionware.com
|
||||
2017/06/25, alimg, Alim Gökkaya, alim.gokkaya@gmail.com
|
||||
2017/07/09, neatnerd, Mike Arshinskiy, neatnerd@users.noreply.github.com
|
||||
2017/07/11, dhalperi, Daniel Halperin, daniel@halper.in
|
||||
2017/07/17, vaibhavaingankar09, Vaibhav Vaingankar, vbhvvaingankar9@gmail.com
|
||||
2017/07/23, venkatperi, Venkat Peri, venkatperi@gmail.com
|
||||
2017/07/27, shirou, WAKAYAMA Shirou, shirou.faw@gmail.com
|
|
@ -49,7 +49,7 @@ using namespace org::antlr::v4::runtime;
|
|||
|
||||
class TreeShapeListener : public MyGrammarBaseListener {
|
||||
public:
|
||||
void enterKey(Ref<ParserRuleContext> ctx) {
|
||||
void enterKey(ParserRuleContext *ctx) override {
|
||||
// Do something when entering the key rule.
|
||||
}
|
||||
};
|
||||
|
@ -63,16 +63,16 @@ int main(int argc, const char* argv[]) {
|
|||
CommonTokenStream tokens(&lexer);
|
||||
MyGrammarParser parser(&tokens);
|
||||
|
||||
Ref<tree::ParseTree> tree = parser.key();
|
||||
Ref<TreeShapeListener> listener(new TreeShapeListener());
|
||||
tree::ParseTreeWalker::DEFAULT->walk(listener, tree);
|
||||
tree::ParseTree *tree = parser.key();
|
||||
TreeShapeListener listener;
|
||||
tree::ParseTreeWalker::DEFAULT->walk(&listener, tree);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
This example assumes your grammar contains a parser rule named `key` for which the enterKey function was generated. The `Ref<>` template is an alias for `std::shared_ptr<>` to simplify the runtime source code which often makes use of smart pointers.
|
||||
This example assumes your grammar contains a parser rule named `key` for which the enterKey function was generated.
|
||||
|
||||
## Specialities of this ANTLR target
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ Let's suppose that your grammar is named `MyGrammar`. The tool will generate for
|
|||
* MyGrammarLexer.cs
|
||||
* MyGrammarParser.cs
|
||||
* MyGrammarListener.cs (if you have not activated the -no-listener option)
|
||||
* MyGrammarBaseListener.js (if you have not activated the -no-listener option)
|
||||
* MyGrammarVisitor.js (if you have activated the -visitor option)
|
||||
* MyGrammarBaseVisitor.js (if you have activated the -visitor option)
|
||||
* MyGrammarBaseListener.cs (if you have not activated the -no-listener option)
|
||||
* MyGrammarVisitor.cs (if you have activated the -visitor option)
|
||||
* MyGrammarBaseVisitor.cs (if you have activated the -visitor option)
|
||||
|
||||
Now a fully functioning code might look like the following for start rule `StartRule`:
|
||||
|
||||
|
@ -35,7 +35,7 @@ using Antlr4.Runtime;
|
|||
|
||||
public void MyParseMethod() {
|
||||
String input = "your text to parse here";
|
||||
ICharStream stream = CharStreams.fromString(input);
|
||||
ICharStream stream = CharStreams.fromstring(input);
|
||||
ITokenSource lexer = new MyGrammarLexer(stream);
|
||||
ITokenStream tokens = new CommonTokenStream(lexer);
|
||||
MyGrammarParser parser = new MyGrammarParser(tokens);
|
||||
|
|
|
@ -96,7 +96,7 @@ Now a fully functioning script might look like the following:
|
|||
|
||||
```javascript
|
||||
var input = "your text to parse here"
|
||||
var chars = CharStreams.fromString(input);
|
||||
var chars = new antlr4.InputStream(input);
|
||||
var lexer = new MyGrammarLexer.MyGrammarLexer(chars);
|
||||
var tokens = new antlr4.CommonTokenStream(lexer);
|
||||
var parser = new MyGrammarParser.MyGrammarParser(tokens);
|
||||
|
|
|
@ -247,16 +247,13 @@ popd
|
|||
|
||||
*Publishing to Nuget from Linux/MacOSX*
|
||||
|
||||
**Getting ready to run Nuget**
|
||||
**Install the pre-requisites**
|
||||
|
||||
Of course you need Mono and `nuget` to be installed. On mac:
|
||||
|
||||
```bash
|
||||
brew install mono
|
||||
brew install nuget
|
||||
```
|
||||
|
||||
Or, you can [download nuget.exe](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe).
|
||||
- mono - on mac, `brew install mono`
|
||||
- nuget - on mac, `brew install nuget` or you can [download nuget.exe](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
|
||||
- dotnet - follow [the instructions here](https://www.microsoft.com/net/core)
|
||||
|
||||
From the shell on mac, you can check all is ok by typing
|
||||
|
||||
|
@ -266,36 +263,23 @@ nuget
|
|||
|
||||
This should display the nuget help.
|
||||
|
||||
**Creating the assembly**
|
||||
**Creating and packaging the assembly**
|
||||
|
||||
```bash
|
||||
$ cd runtime/CSharp/runtime/CSharp/Antlr4.Runtime
|
||||
$ xbuild /p:Configuration=Release Antlr4.Runtime.mono.csproj
|
||||
$ cd runtime/CSharp/runtime/CSharp
|
||||
$ ./build-nuget-package.sh
|
||||
...
|
||||
Copying file from '/Users/parrt/antlr/code/antlr4/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/obj/net20/Release/Antlr4.Runtime.Standard.dll' to '/Users/parrt/antlr/code/antlr4/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/lib/Release/Antlr4.Runtime.Standard.dll'
|
||||
Done building project "/Users/parrt/antlr/code/antlr4/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.mono.csproj".
|
||||
```
|
||||
|
||||
Alternately, you may want to build ANTLR using Xamarin Studio Community (free).
|
||||
|
||||
**Packaging for NuGet**
|
||||
|
||||
```bash
|
||||
cd runtime/CSharp/runtime/CSharp
|
||||
```
|
||||
|
||||
which is where the `Package.nuspec` file resides.
|
||||
|
||||
Type the following command:
|
||||
|
||||
```bash
|
||||
$ nuget pack Package.nuspec
|
||||
Build succeeded.
|
||||
0 Warning(s)
|
||||
0 Error(s)
|
||||
Attempting to build package from 'Package.nuspec'.
|
||||
Successfully created package '/Users/parrt/antlr/code/antlr4/runtime/CSharp/runtime/CSharp/Antlr4.Runtime.Standard.4.7.0.nupkg'.
|
||||
Successfully created package '/path/to/antlr/.../Antlr4.Runtime.Standard.4.7.0.nupkg'.
|
||||
```
|
||||
|
||||
This should display: Successfully created package *<package-path>*
|
||||
|
||||
Alternately, you may want to build ANTLR using Xamarin Studio Community (free).
|
||||
|
||||
**Publishing to NuGet**
|
||||
|
||||
You need to be a NuGet owner for "ANTLR 4 Standard Runtime"
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
# ANTLR4 Language Target, Runtime for Swift
|
||||
|
||||
## Performance Note
|
||||
|
||||
To use ANTLR4 Swift target in production environment, make sure to turn on compiler optimizations by following [these instructions](https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md#build-configurations) if you use SwiftPM to build your project. If you are using Xcode to build your project, it's unlikely you will not use `release` build for production build.
|
||||
|
||||
Conclusion is, you need to turn on `release` mode (which will have all the optimization pre configured for you) so the ANTLR4 Swift target can have reasonable parsing speed.
|
||||
|
||||
|
||||
## Install ANTLR4
|
||||
|
||||
Make sure you have the ANTLR
|
||||
installed.[The getting started guide](getting-started.md) should get
|
||||
installed. [The getting started guide](getting-started.md) should get
|
||||
you started.
|
||||
|
||||
## Create a Swift lexer or parser
|
||||
|
@ -72,28 +79,4 @@ Dependencies__" and "__Link Binary With Libraries__" sections, as
|
|||
shown below. After correctly added dependencies, the error message for
|
||||
importing library will be gone.
|
||||
|
||||
<img src=images/xcodedep.png width="800">
|
||||
|
||||
## Example playground
|
||||
|
||||
The Swift runtime includes an Xcode playground to get started with.
|
||||
|
||||
First go to the ANTLR4 repository, and open
|
||||
`runtime/Swift/Antlr4.xcworkspace` in Xcode. Select "Antlr4 OSX > My
|
||||
Mac" as the build target, and build the project as normal. The
|
||||
playground should then be active.
|
||||
|
||||
The playground includes a simple grammar called "Hello", and an
|
||||
example for walking the parse tree. You should see in the playground
|
||||
output that it is printing messages for each node in the parse tree as
|
||||
it walks.
|
||||
|
||||
The grammar is defined in the playground's `Resources/Hello.g4`. The
|
||||
parser was generated from the grammar using ANTLR like this:
|
||||
|
||||
```
|
||||
antlr4 -Dlanguage=Swift -visitor -o ../Sources/Autogen Hello.g4
|
||||
```
|
||||
|
||||
The example tree walker is in Sources/HelloWalker.swift.
|
||||
|
||||
<img src=images/xcodedep.png width="800">
|
|
@ -0,0 +1,7 @@
|
|||
package org.antlr.v4.test.runtime.category;
|
||||
|
||||
/**
|
||||
* Created by ericvergnaud on 27/06/2017.
|
||||
*/
|
||||
public class LeftRecursionTests {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.antlr.v4.test.runtime.category;
|
||||
|
||||
/**
|
||||
* Created by ericvergnaud on 27/06/2017.
|
||||
*/
|
||||
public class LexerTests {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.antlr.v4.test.runtime.category;
|
||||
|
||||
/**
|
||||
* Created by ericvergnaud on 27/06/2017.
|
||||
*/
|
||||
public class ParserTests {
|
||||
}
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeLexers extends BaseRuntimeTest {
|
||||
public TestCompositeLexers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
|
||||
package org.antlr.v4.test.runtime.cpp;
|
||||
|
||||
import org.antlr.v4.codegen.model.Parser;
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeParsers extends BaseRuntimeTest {
|
||||
public TestCompositeParsers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestFullContextParsing extends BaseRuntimeTest {
|
||||
public TestFullContextParsing(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LeftRecursionTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LeftRecursionTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLeftRecursion extends BaseRuntimeTest {
|
||||
public TestLeftRecursion(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerErrors extends BaseRuntimeTest {
|
||||
public TestLexerErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerExec extends BaseRuntimeTest {
|
||||
public TestLexerExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestListeners extends BaseRuntimeTest {
|
||||
public TestListeners(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParseTrees extends BaseRuntimeTest {
|
||||
public TestParseTrees(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserErrors extends BaseRuntimeTest {
|
||||
public TestParserErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserExec extends BaseRuntimeTest {
|
||||
public TestParserExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestPerformance extends BaseRuntimeTest {
|
||||
public TestPerformance(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalLexer extends BaseRuntimeTest {
|
||||
public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalParser extends BaseRuntimeTest {
|
||||
public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.cpp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SetsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSets extends BaseRuntimeTest {
|
||||
public TestSets(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -127,19 +127,6 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
/** Errors found while running antlr */
|
||||
protected StringBuilder antlrToolErrors;
|
||||
|
||||
@org.junit.Rule
|
||||
public final TestRule testWatcher = new TestWatcher() {
|
||||
|
||||
@Override
|
||||
protected void succeeded(Description description) {
|
||||
// remove tmpdir if no error.
|
||||
if (!PRESERVE_TEST_DIR) {
|
||||
eraseTempDir();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void testSetUp() throws Exception {
|
||||
if (CREATE_PER_TEST_DIRECTORIES) {
|
||||
|
@ -150,7 +137,7 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
else {
|
||||
tmpdir = new File(BASE_TEST_DIR).getAbsolutePath();
|
||||
if (!PRESERVE_TEST_DIR && new File(tmpdir).exists()) {
|
||||
eraseFiles();
|
||||
eraseDirectory(new File(tmpdir));
|
||||
}
|
||||
}
|
||||
antlrToolErrors = new StringBuilder();
|
||||
|
@ -523,7 +510,8 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
args = new String[] {
|
||||
dotnetcli,
|
||||
"restore",
|
||||
"Antlr4.Test.dotnet.csproj"
|
||||
"Antlr4.Test.dotnet.csproj",
|
||||
"--no-dependencies"
|
||||
};
|
||||
success = runProcess(args, tmpdir);
|
||||
|
||||
|
@ -533,7 +521,8 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
"build",
|
||||
"Antlr4.Test.dotnet.csproj",
|
||||
"-c",
|
||||
"Release"
|
||||
"Release",
|
||||
"--no-dependencies"
|
||||
};
|
||||
success = runProcess(args, tmpdir);
|
||||
}
|
||||
|
@ -797,25 +786,30 @@ public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTest
|
|||
}
|
||||
}
|
||||
|
||||
protected void eraseFiles() {
|
||||
if (tmpdir == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
File tmpdirF = new File(tmpdir);
|
||||
String[] files = tmpdirF.list();
|
||||
if(files!=null) for(String file : files) {
|
||||
new File(tmpdir+"/"+file).delete();
|
||||
}
|
||||
protected void eraseDirectory(File dir) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
eraseDirectory(file);
|
||||
}
|
||||
else {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
dir.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseTempDir() {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if ( tmpdirF.exists() ) {
|
||||
eraseFiles();
|
||||
tmpdirF.delete();
|
||||
}
|
||||
if (!PRESERVE_TEST_DIR) {
|
||||
File tmpdirF = new File(tmpdir);
|
||||
if ( tmpdirF.exists() ) {
|
||||
eraseDirectory(tmpdirF);
|
||||
tmpdirF.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getFirstLineOfException() {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeLexers extends BaseRuntimeTest {
|
||||
public TestCompositeLexers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeParsers extends BaseRuntimeTest {
|
||||
public TestCompositeParsers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestFullContextParsing extends BaseRuntimeTest {
|
||||
public TestFullContextParsing(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LeftRecursionTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LeftRecursionTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLeftRecursion extends BaseRuntimeTest {
|
||||
public TestLeftRecursion(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerErrors extends BaseRuntimeTest {
|
||||
public TestLexerErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerExec extends BaseRuntimeTest {
|
||||
public TestLexerExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestListeners extends BaseRuntimeTest {
|
||||
public TestListeners(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParseTrees extends BaseRuntimeTest {
|
||||
public TestParseTrees(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserErrors extends BaseRuntimeTest {
|
||||
public TestParserErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserExec extends BaseRuntimeTest {
|
||||
public TestParserExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestPerformance extends BaseRuntimeTest {
|
||||
public TestPerformance(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalLexer extends BaseRuntimeTest {
|
||||
public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalParser extends BaseRuntimeTest {
|
||||
public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.csharp;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SetsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSets extends BaseRuntimeTest {
|
||||
public TestSets(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -73,6 +73,29 @@ public class LexerExecDescriptors {
|
|||
|
||||
}
|
||||
|
||||
/* regression test for antlr/antlr4#1925 */
|
||||
public static class UnicodeCharSet extends BaseLexerTestDescriptor {
|
||||
public String input = "均";
|
||||
/**
|
||||
[@0,0:0='均',<1>,1:0]
|
||||
[@1,1:0='<EOF>',<-1>,1:1]
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String output;
|
||||
|
||||
public String errors = null;
|
||||
public String startRule = "";
|
||||
public String grammarName = "L";
|
||||
|
||||
/**
|
||||
lexer grammar L;
|
||||
ID : ([A-Z_]|'\u0100'..'\uFFFE') ([A-Z_0-9]|'\u0100'..'\uFFFE')*;
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String grammar;
|
||||
|
||||
}
|
||||
|
||||
public static class CharSetInSet extends BaseLexerTestDescriptor {
|
||||
public String input = "a x";
|
||||
/**
|
||||
|
|
|
@ -581,4 +581,65 @@ public class ParserErrorsDescriptors {
|
|||
public String grammar;
|
||||
|
||||
}
|
||||
|
||||
public static class TokenMismatch3 extends BaseParserTestDescriptor {
|
||||
public String input = "";
|
||||
public String output = null;
|
||||
public String errors = "line 1:0 mismatched input '<EOF>' expecting {'(', BOOLEAN_LITERAL, ID, '$'}\n";
|
||||
public String startRule = "expression";
|
||||
public String grammarName = "T";
|
||||
|
||||
/**
|
||||
grammar T;
|
||||
|
||||
expression
|
||||
: value
|
||||
| expression op=AND expression
|
||||
| expression op=OR expression
|
||||
;
|
||||
value
|
||||
: BOOLEAN_LITERAL
|
||||
| ID
|
||||
| ID1
|
||||
| '(' expression ')'
|
||||
;
|
||||
|
||||
AND : '&&';
|
||||
OR : '||';
|
||||
|
||||
BOOLEAN_LITERAL : 'true' | 'false';
|
||||
|
||||
ID : [a-z]+;
|
||||
ID1 : '$';
|
||||
|
||||
WS : [ \t\r\n]+ -> skip ;
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String grammar;
|
||||
|
||||
}
|
||||
|
||||
public static class ExtraneousInput extends BaseParserTestDescriptor {
|
||||
public String input = "baa";
|
||||
public String output = null;
|
||||
public String errors = "line 1:0 mismatched input 'b' expecting {<EOF>, 'a'}\n";
|
||||
public String startRule = "file";
|
||||
public String grammarName = "T";
|
||||
|
||||
/**
|
||||
grammar T;
|
||||
|
||||
member : 'a';
|
||||
body : member*;
|
||||
file : body EOF;
|
||||
B : 'b';
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String grammar;
|
||||
|
||||
@Override
|
||||
public boolean ignore(String targetName) {
|
||||
return !"Java".equals(targetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,11 +283,16 @@ public class SemPredEvalParserDescriptors {
|
|||
public String input = "s\n\n\nx\n";
|
||||
public String output = "(file_ (para (paraContent s) \\n \\n) (para (paraContent \\n x \\n)) <EOF>)\n";
|
||||
/**
|
||||
line 5:0 mismatched input '<EOF>' expecting '
|
||||
'
|
||||
line 5:0 mismatched input '<EOF>' expecting {'s', '
|
||||
', 'x'}
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String errors;
|
||||
|
||||
@Override
|
||||
public boolean ignore(String targetName) {
|
||||
return !"Java".equals(targetName);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PredFromAltTestedInLoopBack_2 extends PredFromAltTestedInLoopBack {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BasePython2Test extends BasePythonTest {
|
|||
+ " lexer = <lexerName>(input, output)\n"
|
||||
+ " stream = CommonTokenStream(lexer)\n"
|
||||
+ " stream.fill()\n"
|
||||
+ " [ print(t, file=output) for t in stream.tokens ]\n"
|
||||
+ " [ print(unicode(t), file=output) for t in stream.tokens ]\n"
|
||||
+ (showDFA ? " print(lexer._interp.decisionToDFA[Lexer.DEFAULT_MODE].toLexerString(), end='', file=output)\n"
|
||||
: "") + "\n" + "if __name__ == '__main__':\n"
|
||||
+ " main(sys.argv)\n" + "\n");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
package org.antlr.v4.test.runtime.swift;
|
||||
|
||||
import org.antlr.v4.Tool;
|
||||
import org.antlr.v4.runtime.misc.Pair;
|
||||
import org.antlr.v4.test.runtime.ErrorQueue;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestSupport;
|
||||
import org.antlr.v4.test.runtime.StreamVacuum;
|
||||
|
@ -20,113 +20,70 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.antlr.v4.test.runtime.BaseRuntimeTest.antlrOnString;
|
||||
import static org.antlr.v4.test.runtime.BaseRuntimeTest.mkdir;
|
||||
import static org.antlr.v4.test.runtime.BaseRuntimeTest.writeFile;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class BaseSwiftTest implements RuntimeTestSupport {
|
||||
|
||||
/**
|
||||
* The base test directory is the directory where generated files get placed
|
||||
* during unit test execution.
|
||||
* Path of the ANTLR runtime.
|
||||
*/
|
||||
private static final String BASE_TEST_DIR;
|
||||
|
||||
private static String ANTLR_FRAMEWORK_DIR;
|
||||
private static String ANTLR_RUNTIME_PATH;
|
||||
|
||||
/**
|
||||
* Common routine to setup the ANTLR4 runtime.
|
||||
* Absolute path to swift command.
|
||||
*/
|
||||
private static String SWIFT_CMD;
|
||||
|
||||
/**
|
||||
* Environment variable name for swift home.
|
||||
*/
|
||||
private static final String SWIFT_HOME_ENV_KEY = "SWIFT_HOME";
|
||||
|
||||
static {
|
||||
String baseTestDir = System.getProperty("antlr-swift-test-dir");
|
||||
if (baseTestDir == null || baseTestDir.isEmpty()) {
|
||||
baseTestDir = System.getProperty("java.io.tmpdir");
|
||||
}
|
||||
Map<String, String> env = System.getenv();
|
||||
String swiftHome = env.containsKey(SWIFT_HOME_ENV_KEY) ? env.get(SWIFT_HOME_ENV_KEY) : "";
|
||||
SWIFT_CMD = swiftHome + "swift";
|
||||
|
||||
if (!new File(baseTestDir).isDirectory()) {
|
||||
throw new UnsupportedOperationException("The specified base test directory does not exist: " + baseTestDir);
|
||||
}
|
||||
|
||||
BASE_TEST_DIR = baseTestDir;
|
||||
|
||||
//add antlr.swift
|
||||
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
final URL swiftRuntime = loader.getResource("Swift/Sources/Antlr4");
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
// build swift runtime
|
||||
URL swiftRuntime = loader.getResource("Swift");
|
||||
if (swiftRuntime == null) {
|
||||
throw new RuntimeException("Swift runtime file not found at:" + swiftRuntime.getPath());
|
||||
}
|
||||
String swiftRuntimePath = swiftRuntime.getPath();
|
||||
ANTLR_RUNTIME_PATH = swiftRuntime.getPath();
|
||||
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "build");
|
||||
|
||||
try {
|
||||
String commandLine = "find " + swiftRuntimePath + "/ -iname *.swift -not -name merge.swift -exec cat {} ;";
|
||||
ProcessBuilder builder = new ProcessBuilder(commandLine.split(" "));
|
||||
builder.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
Process p = builder.start();
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(p.getInputStream());
|
||||
stdoutVacuum.start();
|
||||
p.waitFor();
|
||||
stdoutVacuum.join();
|
||||
|
||||
String antlrSwift = stdoutVacuum.toString();
|
||||
//write to Antlr4
|
||||
ANTLR_FRAMEWORK_DIR = new File(BASE_TEST_DIR, "Antlr4").getAbsolutePath();
|
||||
mkdir(ANTLR_FRAMEWORK_DIR);
|
||||
writeFile(ANTLR_FRAMEWORK_DIR, "Antlr4.swift", antlrSwift);
|
||||
//compile Antlr4 module
|
||||
buildAntlr4Framework();
|
||||
String argsString;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
// shutdown logic
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
// shutdown logic
|
||||
eraseAntlrFrameWorkDir();
|
||||
fastFailRunProcess(ANTLR_RUNTIME_PATH, SWIFT_CMD, "package", "clean");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void eraseFilesIn(String dirName) {
|
||||
if (dirName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
File dir = new File(dirName);
|
||||
String[] files = dir.list();
|
||||
if (files != null) for (String file : files) {
|
||||
new File(dirName + "/" + file).delete();
|
||||
}
|
||||
}
|
||||
|
||||
private static void eraseAntlrFrameWorkDir() {
|
||||
File frameworkdir = new File(ANTLR_FRAMEWORK_DIR);
|
||||
if (frameworkdir.exists()) {
|
||||
eraseFilesIn(ANTLR_FRAMEWORK_DIR);
|
||||
frameworkdir.delete();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean buildAntlr4Framework() throws Exception {
|
||||
String argsString = "xcrun -sdk macosx swiftc -emit-library -emit-module Antlr4.swift -module-name Antlr4 -module-link-name Antlr4 -Xlinker -install_name -Xlinker " + ANTLR_FRAMEWORK_DIR + "/libAntlr4.dylib ";
|
||||
return runProcess(argsString, ANTLR_FRAMEWORK_DIR);
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
private String stderrDuringParse;
|
||||
|
||||
/**
|
||||
* Errors found while running antlr
|
||||
*/
|
||||
private StringBuilder antlrToolErrors;
|
||||
|
||||
/**
|
||||
* If error during parser execution, store stderr here; can't return
|
||||
* stdout and stderr. This doesn't trap errors from running antlr.
|
||||
* Source files used in each small swift project.
|
||||
*/
|
||||
protected String stderrDuringParse;
|
||||
private Set<String> sourceFiles = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void testSetUp() throws Exception {
|
||||
|
@ -137,21 +94,20 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
tmpdir = prop;
|
||||
}
|
||||
else {
|
||||
tmpdir = new File(System.getProperty("java.io.tmpdir"), getClass().getSimpleName() +
|
||||
"-" + Thread.currentThread().getName() + "-" + System.currentTimeMillis()).getAbsolutePath();
|
||||
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 void eraseTempDir() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,78 +135,80 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
|
||||
@Override
|
||||
public String execLexer(String grammarFileName, String grammarStr, String lexerName, String input, boolean showDFA) {
|
||||
boolean success = rawGenerateRecognizer(grammarFileName,
|
||||
generateParser(grammarFileName,
|
||||
grammarStr,
|
||||
null,
|
||||
lexerName);
|
||||
assertTrue(success);
|
||||
writeFile(tmpdir, "input", input);
|
||||
writeLexerTestFile(lexerName, showDFA);
|
||||
addSourceFiles("main.swift");
|
||||
|
||||
compile();
|
||||
String output = execTest();
|
||||
return output;
|
||||
String projectName = "testcase-" + System.currentTimeMillis();
|
||||
String projectDir = getTmpDir() + "/" + projectName;
|
||||
buildProject(projectDir);
|
||||
return execTest(projectDir, projectName);
|
||||
}
|
||||
|
||||
private String execTest() {
|
||||
@Override
|
||||
public String execParser(String grammarFileName, String grammarStr, String parserName, String lexerName, String listenerName, String visitorName, String startRuleName, String input, boolean showDiagnosticErrors) {
|
||||
generateParser(grammarFileName,
|
||||
grammarStr,
|
||||
parserName,
|
||||
lexerName,
|
||||
"-visitor");
|
||||
writeFile(getTmpDir(), "input", input);
|
||||
return execParser(parserName,
|
||||
lexerName,
|
||||
startRuleName,
|
||||
showDiagnosticErrors,false);
|
||||
}
|
||||
|
||||
private String execTest(String projectDir, String projectName) {
|
||||
try {
|
||||
String exec = tmpdir + "/" + EXEC_NAME;
|
||||
String[] args =
|
||||
new String[]{exec, "input"};//new File(tmpdir, "input").getAbsolutePath()
|
||||
ProcessBuilder pb = new ProcessBuilder(args);
|
||||
pb.directory(new File(tmpdir));
|
||||
Process p = pb.start();
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(p.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(p.getErrorStream());
|
||||
stdoutVacuum.start();
|
||||
stderrVacuum.start();
|
||||
p.waitFor();
|
||||
stdoutVacuum.join();
|
||||
stderrVacuum.join();
|
||||
String output = stdoutVacuum.toString();
|
||||
if ( output.length()==0 ) {
|
||||
output = null;
|
||||
Pair<String, String> output = runProcess(projectDir, "./.build/debug/" + projectName, "input");
|
||||
if (output.b.length() > 0) {
|
||||
stderrDuringParse = output.b;
|
||||
}
|
||||
if (stderrVacuum.toString().length() > 0) {
|
||||
this.stderrDuringParse = stderrVacuum.toString();
|
||||
}
|
||||
return output;
|
||||
String stdout = output.a;
|
||||
return stdout.length() > 0 ? stdout : null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println("can't exec recognizer");
|
||||
System.err.println("Execution of testcase failed.");
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Set<String> sourceFiles = new HashSet<String>();
|
||||
|
||||
private void addSourceFiles(String... files) {
|
||||
Collections.addAll(this.sourceFiles, files);
|
||||
}
|
||||
|
||||
public boolean compile() {
|
||||
private void buildProject(String projectDir) {
|
||||
mkdir(projectDir);
|
||||
fastFailRunProcess(projectDir, SWIFT_CMD, "package", "init", "--type", "executable");
|
||||
for (String sourceFile: sourceFiles) {
|
||||
String absPath = getTmpDir() + "/" + sourceFile;
|
||||
fastFailRunProcess(getTmpDir(), "mv", "-f", absPath, projectDir + "/Sources/");
|
||||
}
|
||||
fastFailRunProcess(getTmpDir(), "mv", "-f", "input", projectDir);
|
||||
|
||||
try {
|
||||
return buildProject();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
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.b);
|
||||
}
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final String EXEC_NAME = "Test";
|
||||
|
||||
private boolean buildProject() throws Exception {
|
||||
String fileList = sourceFiles.toString().replace("[", "").replace("]", "")
|
||||
.replace(", ", " ");
|
||||
|
||||
String argsString = "xcrun -sdk macosx swiftc " + fileList + " -o " + EXEC_NAME + " -I " + ANTLR_FRAMEWORK_DIR + " -L " + ANTLR_FRAMEWORK_DIR + " -module-link-name Antlr4 -suppress-warnings";
|
||||
return runProcess(argsString, tmpdir);
|
||||
}
|
||||
|
||||
private static boolean runProcess(String argsString, String execPath) throws IOException, InterruptedException {
|
||||
String[] args = argsString.split(" ");
|
||||
// System.err.println("Starting build " + argsString);//Utils.join(args, " "))
|
||||
private static Pair<String,String> runProcess(String execPath, String... args) throws IOException, InterruptedException {
|
||||
Process process = Runtime.getRuntime().exec(args, null, new File(execPath));
|
||||
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
|
||||
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
|
||||
|
@ -259,46 +217,26 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
process.waitFor();
|
||||
stdoutVacuum.join();
|
||||
stderrVacuum.join();
|
||||
if (stderrVacuum.toString().length() > 0) {
|
||||
//this.stderrDuringParse = stderrVacuum.toString();
|
||||
System.err.println("buildProject stderrVacuum: " + stderrVacuum);
|
||||
return new Pair<>(stdoutVacuum.toString(), stderrVacuum.toString());
|
||||
}
|
||||
|
||||
private static void fastFailRunProcess(String workingDir, String... command) {
|
||||
ProcessBuilder builder = new ProcessBuilder(command);
|
||||
builder.directory(new File(workingDir));
|
||||
try {
|
||||
Process p = builder.start();
|
||||
p.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return process.exitValue() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
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, startRuleName, input, showDiagnosticErrors, false);
|
||||
}
|
||||
|
||||
protected String execParser(String grammarFileName,
|
||||
String grammarStr,
|
||||
String parserName,
|
||||
String lexerName,
|
||||
String startRuleName,
|
||||
String input, boolean debug,boolean profile)
|
||||
private String execParser(String parserName,
|
||||
String lexerName,
|
||||
String parserStartRuleName,
|
||||
boolean debug,
|
||||
boolean profile)
|
||||
{
|
||||
boolean success = rawGenerateRecognizer(grammarFileName,
|
||||
grammarStr,
|
||||
parserName,
|
||||
lexerName,
|
||||
"-visitor");
|
||||
assertTrue(success);
|
||||
writeFile(tmpdir, "input", input);
|
||||
return rawExecRecognizer(parserName,
|
||||
lexerName,
|
||||
startRuleName,
|
||||
debug,profile);
|
||||
}
|
||||
|
||||
protected String rawExecRecognizer(String parserName,
|
||||
String lexerName,
|
||||
String parserStartRuleName,
|
||||
boolean debug,
|
||||
boolean profile)
|
||||
{
|
||||
this.stderrDuringParse = null;
|
||||
if ( parserName==null ) {
|
||||
writeLexerTestFile(lexerName, false);
|
||||
}
|
||||
|
@ -311,24 +249,22 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
addSourceFiles("main.swift");
|
||||
return execRecognizer();
|
||||
String projectName = "testcase-" + System.currentTimeMillis();
|
||||
String projectDir = getTmpDir() + "/" + projectName;
|
||||
buildProject(projectDir);
|
||||
return execTest(projectDir, projectName);
|
||||
}
|
||||
|
||||
public String execRecognizer() {
|
||||
compile();
|
||||
return execTest();
|
||||
}
|
||||
|
||||
protected void writeParserTestFile(String parserName,
|
||||
String lexerName,
|
||||
String parserStartRuleName,
|
||||
boolean debug,
|
||||
boolean profile) {
|
||||
private void writeParserTestFile(String parserName,
|
||||
String lexerName,
|
||||
String parserStartRuleName,
|
||||
boolean debug,
|
||||
boolean profile) {
|
||||
|
||||
ST outputFileST = new ST(
|
||||
"import Antlr4\n" +
|
||||
"import Foundation\n" +
|
||||
"setbuf(__stdoutp, nil)\n" +
|
||||
"setbuf(stdout, nil)\n" +
|
||||
"class TreeShapeListener: ParseTreeListener{\n" +
|
||||
" func visitTerminal(_ node: TerminalNode){ }\n" +
|
||||
" func visitErrorNode(_ node: ErrorNode){ }\n" +
|
||||
|
@ -384,12 +320,12 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
writeFile(tmpdir, "main.swift", outputFileST.render());
|
||||
}
|
||||
|
||||
protected void writeLexerTestFile(String lexerName, boolean showDFA) {
|
||||
private void writeLexerTestFile(String lexerName, boolean showDFA) {
|
||||
ST outputFileST = new ST(
|
||||
"import Antlr4\n" +
|
||||
"import Antlr4\n" +
|
||||
"import Foundation\n" +
|
||||
|
||||
"setbuf(__stdoutp, nil)\n" +
|
||||
"setbuf(stdout, nil)\n" +
|
||||
"let args = CommandLine.arguments\n" +
|
||||
"let input = ANTLRFileStream(args[1])\n" +
|
||||
"let lex = <lexerName>(input)\n" +
|
||||
|
@ -415,39 +351,27 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if all is well
|
||||
* Generates the parser for one test case.
|
||||
*/
|
||||
private boolean rawGenerateRecognizer(String grammarFileName,
|
||||
String grammarStr,
|
||||
String parserName,
|
||||
String lexerName,
|
||||
String... extraOptions) {
|
||||
return rawGenerateRecognizer(grammarFileName, grammarStr, parserName, lexerName, false, extraOptions);
|
||||
}
|
||||
private void generateParser(String grammarFileName,
|
||||
String grammarStr,
|
||||
String parserName,
|
||||
String lexerName,
|
||||
String... extraOptions) {
|
||||
ErrorQueue equeue = antlrOnString(getTmpDir(), "Swift", grammarFileName, grammarStr, false, extraOptions);
|
||||
assertTrue(equeue.errors.isEmpty());
|
||||
// System.out.println(getTmpDir());
|
||||
|
||||
/**
|
||||
* Return true if all is well
|
||||
*/
|
||||
private boolean rawGenerateRecognizer(String grammarFileName,
|
||||
String grammarStr,
|
||||
String parserName,
|
||||
String lexerName,
|
||||
boolean defaultListener,
|
||||
String... extraOptions) {
|
||||
ErrorQueue equeue = antlrOnString(getTmpDir(), "Swift", grammarFileName, grammarStr, defaultListener, extraOptions);
|
||||
if (!equeue.errors.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<String> files = new ArrayList<String>();
|
||||
List<String> files = new ArrayList<>();
|
||||
if (lexerName != null) {
|
||||
files.add(lexerName + ".swift");
|
||||
files.add(lexerName + "ATN.swift");
|
||||
}
|
||||
|
||||
if (parserName != null) {
|
||||
files.add(parserName + ".swift");
|
||||
files.add(parserName + "ATN.swift");
|
||||
Set<String> optionsSet = new HashSet<String>(Arrays.asList(extraOptions));
|
||||
Set<String> optionsSet = new HashSet<>(Arrays.asList(extraOptions));
|
||||
String grammarName = grammarFileName.substring(0, grammarFileName.lastIndexOf('.'));
|
||||
if (!optionsSet.contains("-no-listener")) {
|
||||
files.add(grammarName + "Listener.swift");
|
||||
|
@ -459,19 +383,5 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
}
|
||||
}
|
||||
addSourceFiles(files.toArray(new String[files.size()]));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static void mkdir(String dir) {
|
||||
File f = new File(dir);
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
protected Tool newTool(String[] args) {
|
||||
return new Tool(args);
|
||||
}
|
||||
|
||||
protected Tool newTool() {
|
||||
return new Tool(new String[]{"-o", tmpdir});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeLexers extends BaseRuntimeTest {
|
||||
public TestCompositeLexers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestCompositeParsers extends BaseRuntimeTest {
|
||||
public TestCompositeParsers(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestFullContextParsing extends BaseRuntimeTest {
|
||||
public TestFullContextParsing(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LeftRecursionTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LeftRecursionTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLeftRecursion extends BaseRuntimeTest {
|
||||
public TestLeftRecursion(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerErrors extends BaseRuntimeTest {
|
||||
public TestLexerErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestLexerExec extends BaseRuntimeTest {
|
||||
public TestLexerExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestListeners extends BaseRuntimeTest {
|
||||
public TestListeners(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParseTrees extends BaseRuntimeTest {
|
||||
public TestParseTrees(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserErrors extends BaseRuntimeTest {
|
||||
public TestParserErrors(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestParserExec extends BaseRuntimeTest {
|
||||
public TestParserExec(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestPerformance extends BaseRuntimeTest {
|
||||
public TestPerformance(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -9,10 +9,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalLexer extends BaseRuntimeTest {
|
||||
public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.ParserTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(ParserTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSemPredEvalParser extends BaseRuntimeTest {
|
||||
public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -8,10 +8,13 @@ package org.antlr.v4.test.runtime.swift;
|
|||
|
||||
import org.antlr.v4.test.runtime.BaseRuntimeTest;
|
||||
import org.antlr.v4.test.runtime.RuntimeTestDescriptor;
|
||||
import org.antlr.v4.test.runtime.category.LexerTests;
|
||||
import org.antlr.v4.test.runtime.descriptors.SetsDescriptors;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@Category(LexerTests.class)
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestSets extends BaseRuntimeTest {
|
||||
public TestSets(RuntimeTestDescriptor descriptor) {
|
||||
|
|
|
@ -51,7 +51,7 @@ This is just a quick start. The tool has many useful options to control generati
|
|||
|
||||
The Antlr 4 standard runtime for C# is now available from NuGet.
|
||||
We trust that you know how to do add NuGet references to your project :-).
|
||||
The package id is Antlr.4.Runtime. We do not support other packages.
|
||||
The package id is Antlr4.Runtime.Standard. We do not support other packages.
|
||||
|
||||
|
||||
### Step 6: You're done!
|
||||
|
|
|
@ -1,16 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>4.7</VersionPrefix>
|
||||
<Company>The ANTLR Organization</Company>
|
||||
<Version>4.7.1</Version>
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
<DefineConstants>$(DefineConstants);DOTNETCORE;NET35PLUS;NET40PLUS;NET45PLUS</DefineConstants>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1574;CS1580</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AssemblyName>Antlr4.Runtime.Standard</AssemblyName>
|
||||
<AssemblyName>Antlr4.Runtime.Core</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../Antlr4.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
<PackageId>Antlr4.Runtime.Standard</PackageId>
|
||||
<PackageId>Antlr4.Runtime.Core</PackageId>
|
||||
<Title>ANTLR 4 .NET Core Runtime</Title>
|
||||
<Authors>Eric Vergnaud, Terence Parr, Sam Harwell</Authors>
|
||||
<Description>The .NET Core C# ANTLR 4 runtime from the ANTLR Organization</Description>
|
||||
<Copyright>Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.</Copyright>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<PackageLicenseUrl>https://github.com/antlr/antlr4/blob/master/LICENSE.txt</PackageLicenseUrl>
|
||||
<PackageProjectUrl>https://github.com/antlr/antlr4</PackageProjectUrl>
|
||||
<PackageIconUrl>https://raw.github.com/antlr/website-antlr4/master/images/icons/antlr.png</PackageIconUrl>
|
||||
<PackageReleaseNotes>https://github.com/antlr/antlr4/releases</PackageReleaseNotes>
|
||||
<PackageTags>antlr parsing grammar</PackageTags>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
|
||||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
|
||||
|
@ -22,5 +33,15 @@
|
|||
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
|
||||
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>lib\Debug</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>lib\Release</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1092,7 +1092,10 @@ nextTransition_continue: ;
|
|||
protected internal Guid ReadUUID()
|
||||
{
|
||||
byte[] d = BitConverter.GetBytes (ReadLong ());
|
||||
Array.Reverse(d);
|
||||
if(BitConverter.IsLittleEndian)
|
||||
{
|
||||
Array.Reverse(d);
|
||||
}
|
||||
short c = (short)ReadInt();
|
||||
short b = (short)ReadInt();
|
||||
int a = ReadInt32();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Antlr4.Runtime.Standard</id>
|
||||
<version>4.7</version>
|
||||
<version>4.7.1</version>
|
||||
<language>en-us</language>
|
||||
<title>ANTLR 4 Standard Runtime</title>
|
||||
<description>The standard C# ANTLR 4 runtime from the ANTLR Organization</description>
|
||||
|
@ -20,5 +20,6 @@
|
|||
</metadata>
|
||||
<files>
|
||||
<file src="Antlr4.Runtime/lib/Release/Antlr4.Runtime.Standard.dll" target="lib/net35/"/>
|
||||
<file src="Antlr4.Runtime/lib/Release/netstandard1.3/Antlr4.Runtime.Core.dll" target="lib/netstandard/"/>
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Build a .NET 3.5 compatible DLL using mono
|
||||
# This step can be done by the `dotnet` cli once https://github.com/Microsoft/msbuild/issues/1333 is resolved.
|
||||
echo "Step 1: Building .NET 3.5 DLL"
|
||||
xbuild /p:Configuration=Release Antlr4.mono.sln
|
||||
|
||||
# Build a .NET core DLL using the `dotnet` cli from microsoft
|
||||
echo "Step 2: Building .NET Core DLL"
|
||||
dotnet restore Antlr4.dotnet.sln
|
||||
dotnet build -c Release Antlr4.dotnet.sln
|
||||
|
||||
echo "Step 3: Packaging both DLLs into a single nuget package"
|
||||
nuget pack Package.nuspec
|
|
@ -91,7 +91,7 @@ using namespace antlr4::misc;
|
|||
|
||||
- (void)testANTLRInputStreamUse {
|
||||
std::string text(u8"🚧Lorem ipsum dolor sit amet🕶");
|
||||
std::u32string wtext = utfConverter.from_bytes(text); // Convert to UTF-32.
|
||||
std::u32string wtext = utf8_to_utf32(text.c_str(), text.c_str() + text.size()); // Convert to UTF-32.
|
||||
ANTLRInputStream stream(text);
|
||||
XCTAssertEqual(stream.index(), 0U);
|
||||
XCTAssertEqual(stream.size(), wtext.size());
|
||||
|
@ -116,8 +116,8 @@ using namespace antlr4::misc;
|
|||
|
||||
XCTAssertEqual(stream.LA(0), 0ULL);
|
||||
for (size_t i = 1; i < wtext.size(); ++i) {
|
||||
XCTAssertEqual(stream.LA((ssize_t)i), wtext[i - 1]); // LA(1) means: current char.
|
||||
XCTAssertEqual(stream.LT((ssize_t)i), wtext[i - 1]); // LT is mapped to LA.
|
||||
XCTAssertEqual(stream.LA(static_cast<ssize_t>(i)), wtext[i - 1]); // LA(1) means: current char.
|
||||
XCTAssertEqual(stream.LT(static_cast<ssize_t>(i)), wtext[i - 1]); // LT is mapped to LA.
|
||||
XCTAssertEqual(stream.index(), 0U); // No consumption when looking ahead.
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ using namespace antlr4::misc;
|
|||
XCTAssertEqual(stream.index(), wtext.size() / 2);
|
||||
|
||||
stream.seek(wtext.size() - 1);
|
||||
for (ssize_t i = 1; i < (ssize_t)wtext.size() - 1; ++i) {
|
||||
for (ssize_t i = 1; i < static_cast<ssize_t>(wtext.size()) - 1; ++i) {
|
||||
XCTAssertEqual(stream.LA(-i), wtext[wtext.size() - i - 1]); // LA(-1) means: previous char.
|
||||
XCTAssertEqual(stream.LT(-i), wtext[wtext.size() - i - 1]); // LT is mapped to LA.
|
||||
XCTAssertEqual(stream.index(), wtext.size() - 1); // No consumption when looking ahead.
|
||||
|
@ -150,7 +150,7 @@ using namespace antlr4::misc;
|
|||
|
||||
misc::Interval interval1(2, 10UL); // From - to, inclusive.
|
||||
std::string output = stream.getText(interval1);
|
||||
std::string sub = utfConverter.to_bytes(wtext.substr(2, 9));
|
||||
std::string sub = utf32_to_utf8(wtext.substr(2, 9));
|
||||
XCTAssertEqual(output, sub);
|
||||
|
||||
misc::Interval interval2(200, 10UL); // Start beyond bounds.
|
||||
|
|
|
@ -92,7 +92,7 @@ using namespace antlrcpp;
|
|||
// in a deterministic and a random sequence of 100K values each.
|
||||
std::set<size_t> hashs;
|
||||
for (size_t i = 0; i < 100000; ++i) {
|
||||
std::vector<size_t> data = { i, (size_t)(i * M_PI), arc4random()};
|
||||
std::vector<size_t> data = { i, static_cast<size_t>(i * M_PI), arc4random() };
|
||||
size_t hash = 0;
|
||||
for (auto value : data)
|
||||
hash = MurmurHash::update(hash, value);
|
||||
|
@ -103,7 +103,7 @@ using namespace antlrcpp;
|
|||
|
||||
hashs.clear();
|
||||
for (size_t i = 0; i < 100000; ++i) {
|
||||
std::vector<size_t> data = { i, (size_t)(i * M_PI)};
|
||||
std::vector<size_t> data = { i, static_cast<size_t>(i * M_PI) };
|
||||
size_t hash = 0;
|
||||
for (auto value : data)
|
||||
hash = MurmurHash::update(hash, value);
|
||||
|
@ -232,19 +232,25 @@ using namespace antlrcpp;
|
|||
{ 78, Interval(1000, 1000UL), Interval(20, 100UL), { false, false, true, true, false, true, false, false } },
|
||||
|
||||
// It's possible to add more tests with borders that touch each other (e.g. first starts before/on/after second
|
||||
// and first ends directly before/after second. However, such cases are not handled differently in the Interval class
|
||||
// and first ends directly before/after second. However, such cases are not handled differently in the Interval
|
||||
// class
|
||||
// (only adjacent intervals, where first ends directly before second starts and vice versa. So I ommitted them here.
|
||||
};
|
||||
|
||||
for (auto &entry : testData) {
|
||||
XCTAssert(entry.interval1.startsBeforeDisjoint(entry.interval2) == entry.results[0], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsBeforeNonDisjoint(entry.interval2) == entry.results[1], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsBeforeDisjoint(entry.interval2) == entry.results[0], @"entry: %zu",
|
||||
entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsBeforeNonDisjoint(entry.interval2) == entry.results[1], @"entry: %zu",
|
||||
entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsAfter(entry.interval2) == entry.results[2], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsAfterDisjoint(entry.interval2) == entry.results[3], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsAfterNonDisjoint(entry.interval2) == entry.results[4], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsAfterDisjoint(entry.interval2) == entry.results[3], @"entry: %zu",
|
||||
entry.runningNumber);
|
||||
XCTAssert(entry.interval1.startsAfterNonDisjoint(entry.interval2) == entry.results[4], @"entry: %zu",
|
||||
entry.runningNumber);
|
||||
XCTAssert(entry.interval1.disjoint(entry.interval2) == entry.results[5], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.adjacent(entry.interval2) == entry.results[6], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.properlyContains(entry.interval2) == entry.results[7], @"entry: %zu", entry.runningNumber);
|
||||
XCTAssert(entry.interval1.properlyContains(entry.interval2) == entry.results[7], @"entry: %zu",
|
||||
entry.runningNumber);
|
||||
}
|
||||
|
||||
XCTAssert(Interval().Union(Interval(10, 100UL)) == Interval(-1L, 100));
|
||||
|
@ -327,30 +333,34 @@ using namespace antlrcpp;
|
|||
try {
|
||||
set4.clear();
|
||||
XCTFail(@"Expected exception");
|
||||
}
|
||||
catch (IllegalStateException &e) {
|
||||
} catch (IllegalStateException &e) {
|
||||
}
|
||||
|
||||
try {
|
||||
set4.setReadOnly(false);
|
||||
XCTFail(@"Expected exception");
|
||||
} catch (IllegalStateException &e) {
|
||||
}
|
||||
catch (IllegalStateException &e) {
|
||||
}
|
||||
|
||||
set4 = IntervalSet::of(12345);
|
||||
XCTAssertEqual(set4.getSingleElement(), 12345);
|
||||
XCTAssertEqual(set4.getMinElement(), 12345);
|
||||
XCTAssertEqual(set4.getMaxElement(), 12345);
|
||||
|
||||
IntervalSet set5(10, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50);
|
||||
XCTAssertEqual(set5.getMinElement(), 5);
|
||||
XCTAssertEqual(set5.getMaxElement(), 50);
|
||||
XCTAssertEqual(set5.size(), 10U);
|
||||
set5.add(12, 18);
|
||||
XCTAssertEqual(set5.size(), 16U); // (15, 15) replaced by (12, 18)
|
||||
set5.add(9, 33);
|
||||
XCTAssertEqual(set5.size(), 30U); // (10, 10), (12, 18), (20, 20), (25, 25) and (30, 30) replaced by (9, 33)
|
||||
try {
|
||||
set4 = IntervalSet::of(12345);
|
||||
XCTFail(@"Expected exception");
|
||||
} catch (IllegalStateException &e) {
|
||||
}
|
||||
|
||||
IntervalSet set5 = IntervalSet::of(12345);
|
||||
XCTAssertEqual(set5.getSingleElement(), 12345);
|
||||
XCTAssertEqual(set5.getMinElement(), 12345);
|
||||
XCTAssertEqual(set5.getMaxElement(), 12345);
|
||||
|
||||
IntervalSet set6(10, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50);
|
||||
XCTAssertEqual(set6.getMinElement(), 5);
|
||||
XCTAssertEqual(set6.getMaxElement(), 50);
|
||||
XCTAssertEqual(set6.size(), 10U);
|
||||
set6.add(12, 18);
|
||||
XCTAssertEqual(set6.size(), 16U); // (15, 15) replaced by (12, 18)
|
||||
set6.add(9, 33);
|
||||
XCTAssertEqual(set6.size(), 30U); // (10, 10), (12, 18), (20, 20), (25, 25) and (30, 30) replaced by (9, 33)
|
||||
|
||||
XCTAssert(IntervalSet(3, 1, 2, 10).Or(IntervalSet(3, 1, 2, 5)) == IntervalSet(4, 1, 2, 5, 10));
|
||||
XCTAssert(IntervalSet({ Interval(2, 10UL) }).Or(IntervalSet({ Interval(5, 8UL) })) == IntervalSet({ Interval(2, 10UL) }));
|
||||
|
@ -358,8 +368,10 @@ using namespace antlrcpp;
|
|||
XCTAssert(IntervalSet::of(1, 10).complement(IntervalSet::of(7, 55)) == IntervalSet::of(11, 55));
|
||||
XCTAssert(IntervalSet::of(1, 10).complement(IntervalSet::of(20, 55)) == IntervalSet::of(20, 55));
|
||||
XCTAssert(IntervalSet::of(1, 10).complement(IntervalSet::of(5, 6)) == IntervalSet::EMPTY_SET);
|
||||
XCTAssert(IntervalSet::of(15, 20).complement(IntervalSet::of(7, 55)) == IntervalSet({ Interval(7, 14UL), Interval(21, 55UL) }));
|
||||
XCTAssert(IntervalSet({ Interval(1, 10UL), Interval(30, 35UL) }).complement(IntervalSet::of(7, 55)) == IntervalSet({ Interval(11, 29UL), Interval(36, 55UL) }));
|
||||
XCTAssert(IntervalSet::of(15, 20).complement(IntervalSet::of(7, 55)) ==
|
||||
IntervalSet({ Interval(7, 14UL), Interval(21, 55UL) }));
|
||||
XCTAssert(IntervalSet({ Interval(1, 10UL), Interval(30, 35UL) }).complement(IntervalSet::of(7, 55)) ==
|
||||
IntervalSet({ Interval(11, 29UL), Interval(36, 55UL) }));
|
||||
|
||||
XCTAssert(IntervalSet::of(1, 10).And(IntervalSet::of(7, 55)) == IntervalSet::of(7, 10));
|
||||
XCTAssert(IntervalSet::of(1, 10).And(IntervalSet::of(20, 55)) == IntervalSet::EMPTY_SET);
|
||||
|
@ -368,7 +380,8 @@ using namespace antlrcpp;
|
|||
|
||||
XCTAssert(IntervalSet::of(1, 10).subtract(IntervalSet::of(7, 55)) == IntervalSet::of(1, 6));
|
||||
XCTAssert(IntervalSet::of(1, 10).subtract(IntervalSet::of(20, 55)) == IntervalSet::of(1, 10));
|
||||
XCTAssert(IntervalSet::of(1, 10).subtract(IntervalSet::of(5, 6)) == IntervalSet({ Interval(1, 4UL), Interval(7, 10UL) }));
|
||||
XCTAssert(IntervalSet::of(1, 10).subtract(IntervalSet::of(5, 6)) ==
|
||||
IntervalSet({ Interval(1, 4UL), Interval(7, 10UL) }));
|
||||
XCTAssert(IntervalSet::of(15, 20).subtract(IntervalSet::of(7, 55)) == IntervalSet::EMPTY_SET);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ rem Headers
|
|||
xcopy runtime\src\*.h antlr4-runtime\ /s
|
||||
|
||||
rem Binaries
|
||||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" (
|
||||
rem VS 2013 disabled by default. Change the X to a C to enable it.
|
||||
if exist "X:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" (
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
|
||||
|
||||
pushd runtime
|
||||
|
|
|
@ -321,6 +321,8 @@
|
|||
</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" />
|
||||
|
@ -339,6 +341,7 @@
|
|||
<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" />
|
||||
|
@ -346,6 +349,7 @@
|
|||
<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" />
|
||||
|
@ -412,6 +416,7 @@
|
|||
<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" />
|
||||
|
@ -422,16 +427,23 @@
|
|||
<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" />
|
||||
|
@ -439,6 +451,7 @@
|
|||
<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" />
|
||||
|
@ -454,6 +467,7 @@
|
|||
<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" />
|
||||
|
@ -620,4 +634,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -938,5 +938,47 @@
|
|||
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp">
|
||||
<Filter>Source Files\tree</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\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\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\support\Any.cpp">
|
||||
<Filter>Source Files\support</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\tree\pattern\Chunk.cpp">
|
||||
<Filter>Source Files\tree\pattern</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\misc\Predicate.cpp">
|
||||
<Filter>Source Files\misc</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -334,6 +334,8 @@
|
|||
</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" />
|
||||
|
@ -352,6 +354,7 @@
|
|||
<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" />
|
||||
|
@ -359,6 +362,7 @@
|
|||
<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" />
|
||||
|
@ -425,6 +429,7 @@
|
|||
<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" />
|
||||
|
@ -435,16 +440,23 @@
|
|||
<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" />
|
||||
|
@ -452,6 +464,7 @@
|
|||
<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" />
|
||||
|
@ -467,6 +480,7 @@
|
|||
<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" />
|
||||
|
@ -633,4 +647,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -938,5 +938,47 @@
|
|||
<ClCompile Include="src\tree\IterativeParseTreeWalker.cpp">
|
||||
<Filter>Source Files\tree</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>
|
||||
</Project>
|
|
@ -534,9 +534,6 @@
|
|||
276E5F411CDB57AA003FF4B4 /* IntStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CBF1CDB57AA003FF4B4 /* IntStream.h */; };
|
||||
276E5F421CDB57AA003FF4B4 /* IntStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CBF1CDB57AA003FF4B4 /* IntStream.h */; };
|
||||
276E5F431CDB57AA003FF4B4 /* IntStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CBF1CDB57AA003FF4B4 /* IntStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
276E5F441CDB57AA003FF4B4 /* IRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CC01CDB57AA003FF4B4 /* IRecognizer.h */; };
|
||||
276E5F451CDB57AA003FF4B4 /* IRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CC01CDB57AA003FF4B4 /* IRecognizer.h */; };
|
||||
276E5F461CDB57AA003FF4B4 /* IRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CC01CDB57AA003FF4B4 /* IRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
276E5F471CDB57AA003FF4B4 /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CC11CDB57AA003FF4B4 /* Lexer.cpp */; };
|
||||
276E5F481CDB57AA003FF4B4 /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CC11CDB57AA003FF4B4 /* Lexer.cpp */; };
|
||||
276E5F491CDB57AA003FF4B4 /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CC11CDB57AA003FF4B4 /* Lexer.cpp */; };
|
||||
|
@ -800,6 +797,45 @@
|
|||
27745F081CE49C000067C6A3 /* RuntimeMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 27745EFC1CE49C000067C6A3 /* RuntimeMetaData.h */; };
|
||||
27874F1E1CCB7A0700AF1C53 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */; };
|
||||
27874F211CCB7B1700AF1C53 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */; };
|
||||
2793DC851F08083F00A84290 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC841F08083F00A84290 /* TokenSource.cpp */; };
|
||||
2793DC861F08083F00A84290 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC841F08083F00A84290 /* TokenSource.cpp */; };
|
||||
2793DC871F08083F00A84290 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC841F08083F00A84290 /* TokenSource.cpp */; };
|
||||
2793DC891F08087500A84290 /* Chunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC881F08087500A84290 /* Chunk.cpp */; };
|
||||
2793DC8A1F08087500A84290 /* Chunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC881F08087500A84290 /* Chunk.cpp */; };
|
||||
2793DC8B1F08087500A84290 /* Chunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC881F08087500A84290 /* Chunk.cpp */; };
|
||||
2793DC8D1F08088F00A84290 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC8C1F08088F00A84290 /* ParseTreeListener.cpp */; };
|
||||
2793DC8E1F08088F00A84290 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC8C1F08088F00A84290 /* ParseTreeListener.cpp */; };
|
||||
2793DC8F1F08088F00A84290 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC8C1F08088F00A84290 /* ParseTreeListener.cpp */; };
|
||||
2793DC911F0808A200A84290 /* TerminalNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC901F0808A200A84290 /* TerminalNode.cpp */; };
|
||||
2793DC921F0808A200A84290 /* TerminalNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC901F0808A200A84290 /* TerminalNode.cpp */; };
|
||||
2793DC931F0808A200A84290 /* TerminalNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC901F0808A200A84290 /* TerminalNode.cpp */; };
|
||||
2793DC961F0808E100A84290 /* ErrorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC941F0808E100A84290 /* ErrorNode.cpp */; };
|
||||
2793DC971F0808E100A84290 /* ErrorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC941F0808E100A84290 /* ErrorNode.cpp */; };
|
||||
2793DC981F0808E100A84290 /* ErrorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC941F0808E100A84290 /* ErrorNode.cpp */; };
|
||||
2793DC991F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC951F0808E100A84290 /* ParseTreeVisitor.cpp */; };
|
||||
2793DC9A1F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC951F0808E100A84290 /* ParseTreeVisitor.cpp */; };
|
||||
2793DC9B1F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC951F0808E100A84290 /* ParseTreeVisitor.cpp */; };
|
||||
2793DC9D1F08090D00A84290 /* Any.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC9C1F08090D00A84290 /* Any.cpp */; };
|
||||
2793DC9E1F08090D00A84290 /* Any.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC9C1F08090D00A84290 /* Any.cpp */; };
|
||||
2793DC9F1F08090D00A84290 /* Any.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DC9C1F08090D00A84290 /* Any.cpp */; };
|
||||
2793DCA41F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA01F08095F00A84290 /* ANTLRErrorListener.cpp */; };
|
||||
2793DCA51F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA01F08095F00A84290 /* ANTLRErrorListener.cpp */; };
|
||||
2793DCA61F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA01F08095F00A84290 /* ANTLRErrorListener.cpp */; };
|
||||
2793DCA71F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA11F08095F00A84290 /* ANTLRErrorStrategy.cpp */; };
|
||||
2793DCA81F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA11F08095F00A84290 /* ANTLRErrorStrategy.cpp */; };
|
||||
2793DCA91F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA11F08095F00A84290 /* ANTLRErrorStrategy.cpp */; };
|
||||
2793DCAA1F08095F00A84290 /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA21F08095F00A84290 /* Token.cpp */; };
|
||||
2793DCAB1F08095F00A84290 /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA21F08095F00A84290 /* Token.cpp */; };
|
||||
2793DCAC1F08095F00A84290 /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA21F08095F00A84290 /* Token.cpp */; };
|
||||
2793DCAD1F08095F00A84290 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA31F08095F00A84290 /* WritableToken.cpp */; };
|
||||
2793DCAE1F08095F00A84290 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA31F08095F00A84290 /* WritableToken.cpp */; };
|
||||
2793DCAF1F08095F00A84290 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCA31F08095F00A84290 /* WritableToken.cpp */; };
|
||||
2793DCB31F08099C00A84290 /* BlockStartState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB01F08099C00A84290 /* BlockStartState.cpp */; };
|
||||
2793DCB41F08099C00A84290 /* BlockStartState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB01F08099C00A84290 /* BlockStartState.cpp */; };
|
||||
2793DCB51F08099C00A84290 /* BlockStartState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB01F08099C00A84290 /* BlockStartState.cpp */; };
|
||||
2793DCB61F08099C00A84290 /* LexerAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB11F08099C00A84290 /* LexerAction.cpp */; };
|
||||
2793DCB71F08099C00A84290 /* LexerAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB11F08099C00A84290 /* LexerAction.cpp */; };
|
||||
2793DCB81F08099C00A84290 /* LexerAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2793DCB11F08099C00A84290 /* LexerAction.cpp */; };
|
||||
2794D8561CE7821B00FADD0F /* antlr4-common.h in Headers */ = {isa = PBXBuildFile; fileRef = 2794D8551CE7821B00FADD0F /* antlr4-common.h */; };
|
||||
2794D8571CE7821B00FADD0F /* antlr4-common.h in Headers */ = {isa = PBXBuildFile; fileRef = 2794D8551CE7821B00FADD0F /* antlr4-common.h */; };
|
||||
2794D8581CE7821B00FADD0F /* antlr4-common.h in Headers */ = {isa = PBXBuildFile; fileRef = 2794D8551CE7821B00FADD0F /* antlr4-common.h */; };
|
||||
|
@ -1061,7 +1097,6 @@
|
|||
276E5CBD1CDB57AA003FF4B4 /* InterpreterRuleContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterpreterRuleContext.h; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
276E5CBE1CDB57AA003FF4B4 /* IntStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntStream.cpp; sourceTree = "<group>"; };
|
||||
276E5CBF1CDB57AA003FF4B4 /* IntStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntStream.h; sourceTree = "<group>"; };
|
||||
276E5CC01CDB57AA003FF4B4 /* IRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IRecognizer.h; sourceTree = "<group>"; };
|
||||
276E5CC11CDB57AA003FF4B4 /* Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lexer.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
276E5CC21CDB57AA003FF4B4 /* Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.h; sourceTree = "<group>"; };
|
||||
276E5CC31CDB57AA003FF4B4 /* LexerInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerInterpreter.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
|
@ -1152,6 +1187,19 @@
|
|||
27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||
278E313E1D9D6534001C28F9 /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
||||
278E31401D9D6534001C28F9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
2793DC841F08083F00A84290 /* TokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenSource.cpp; sourceTree = "<group>"; };
|
||||
2793DC881F08087500A84290 /* Chunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Chunk.cpp; sourceTree = "<group>"; };
|
||||
2793DC8C1F08088F00A84290 /* ParseTreeListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeListener.cpp; sourceTree = "<group>"; };
|
||||
2793DC901F0808A200A84290 /* TerminalNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminalNode.cpp; sourceTree = "<group>"; };
|
||||
2793DC941F0808E100A84290 /* ErrorNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorNode.cpp; sourceTree = "<group>"; };
|
||||
2793DC951F0808E100A84290 /* ParseTreeVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeVisitor.cpp; sourceTree = "<group>"; };
|
||||
2793DC9C1F08090D00A84290 /* Any.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Any.cpp; sourceTree = "<group>"; };
|
||||
2793DCA01F08095F00A84290 /* ANTLRErrorListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANTLRErrorListener.cpp; sourceTree = "<group>"; };
|
||||
2793DCA11F08095F00A84290 /* ANTLRErrorStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANTLRErrorStrategy.cpp; sourceTree = "<group>"; };
|
||||
2793DCA21F08095F00A84290 /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = "<group>"; };
|
||||
2793DCA31F08095F00A84290 /* WritableToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableToken.cpp; sourceTree = "<group>"; };
|
||||
2793DCB01F08099C00A84290 /* BlockStartState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlockStartState.cpp; sourceTree = "<group>"; };
|
||||
2793DCB11F08099C00A84290 /* LexerAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerAction.cpp; sourceTree = "<group>"; };
|
||||
2794D8551CE7821B00FADD0F /* antlr4-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "antlr4-common.h"; sourceTree = "<group>"; };
|
||||
27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "antlr4-runtime.h"; sourceTree = "<group>"; };
|
||||
27B36AC41DACE7AF0069C868 /* RuleContextWithAltNum.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuleContextWithAltNum.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1230,7 +1278,9 @@
|
|||
276E5CF91CDB57AA003FF4B4 /* tree */,
|
||||
2794D8551CE7821B00FADD0F /* antlr4-common.h */,
|
||||
27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */,
|
||||
2793DCA01F08095F00A84290 /* ANTLRErrorListener.cpp */,
|
||||
276E5C0C1CDB57AA003FF4B4 /* ANTLRErrorListener.h */,
|
||||
2793DCA11F08095F00A84290 /* ANTLRErrorStrategy.cpp */,
|
||||
276E5C0D1CDB57AA003FF4B4 /* ANTLRErrorStrategy.h */,
|
||||
276E5C0E1CDB57AA003FF4B4 /* ANTLRFileStream.cpp */,
|
||||
276E5C0F1CDB57AA003FF4B4 /* ANTLRFileStream.h */,
|
||||
|
@ -1266,7 +1316,6 @@
|
|||
276E5CBD1CDB57AA003FF4B4 /* InterpreterRuleContext.h */,
|
||||
276E5CBE1CDB57AA003FF4B4 /* IntStream.cpp */,
|
||||
276E5CBF1CDB57AA003FF4B4 /* IntStream.h */,
|
||||
276E5CC01CDB57AA003FF4B4 /* IRecognizer.h */,
|
||||
276E5CC11CDB57AA003FF4B4 /* Lexer.cpp */,
|
||||
276E5CC21CDB57AA003FF4B4 /* Lexer.h */,
|
||||
276E5CC31CDB57AA003FF4B4 /* LexerInterpreter.cpp */,
|
||||
|
@ -1295,8 +1344,10 @@
|
|||
27B36AC51DACE7AF0069C868 /* RuleContextWithAltNum.h */,
|
||||
27745EFB1CE49C000067C6A3 /* RuntimeMetaData.cpp */,
|
||||
27745EFC1CE49C000067C6A3 /* RuntimeMetaData.h */,
|
||||
2793DCA21F08095F00A84290 /* Token.cpp */,
|
||||
276E5CF01CDB57AA003FF4B4 /* Token.h */,
|
||||
276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */,
|
||||
2793DC841F08083F00A84290 /* TokenSource.cpp */,
|
||||
276E5CF41CDB57AA003FF4B4 /* TokenSource.h */,
|
||||
276E5CF51CDB57AA003FF4B4 /* TokenStream.cpp */,
|
||||
276E5CF61CDB57AA003FF4B4 /* TokenStream.h */,
|
||||
|
@ -1308,6 +1359,7 @@
|
|||
276E5D251CDB57AA003FF4B4 /* UnbufferedTokenStream.h */,
|
||||
276E5D271CDB57AA003FF4B4 /* Vocabulary.cpp */,
|
||||
276E5D281CDB57AA003FF4B4 /* Vocabulary.h */,
|
||||
2793DCA31F08095F00A84290 /* WritableToken.cpp */,
|
||||
276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */,
|
||||
);
|
||||
name = runtime;
|
||||
|
@ -1350,6 +1402,7 @@
|
|||
276E5C321CDB57AA003FF4B4 /* BasicState.h */,
|
||||
276E5C331CDB57AA003FF4B4 /* BlockEndState.cpp */,
|
||||
276E5C341CDB57AA003FF4B4 /* BlockEndState.h */,
|
||||
2793DCB01F08099C00A84290 /* BlockStartState.cpp */,
|
||||
276E5C351CDB57AA003FF4B4 /* BlockStartState.h */,
|
||||
276E5C371CDB57AA003FF4B4 /* ContextSensitivityInfo.cpp */,
|
||||
276E5C381CDB57AA003FF4B4 /* ContextSensitivityInfo.h */,
|
||||
|
@ -1365,6 +1418,7 @@
|
|||
276E5C421CDB57AA003FF4B4 /* EpsilonTransition.h */,
|
||||
276E5C431CDB57AA003FF4B4 /* ErrorInfo.cpp */,
|
||||
276E5C441CDB57AA003FF4B4 /* ErrorInfo.h */,
|
||||
2793DCB11F08099C00A84290 /* LexerAction.cpp */,
|
||||
276E5C451CDB57AA003FF4B4 /* LexerAction.h */,
|
||||
276E5C461CDB57AA003FF4B4 /* LexerActionExecutor.cpp */,
|
||||
276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */,
|
||||
|
@ -1483,6 +1537,7 @@
|
|||
276E5CE41CDB57AA003FF4B4 /* support */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2793DC9C1F08090D00A84290 /* Any.cpp */,
|
||||
27F4A8551D4CEB2A00E067EE /* Any.h */,
|
||||
276E5CE51CDB57AA003FF4B4 /* Arrays.cpp */,
|
||||
276E5CE61CDB57AA003FF4B4 /* Arrays.h */,
|
||||
|
@ -1504,6 +1559,7 @@
|
|||
276E5D061CDB57AA003FF4B4 /* pattern */,
|
||||
27DB448A1D045537007E790B /* xpath */,
|
||||
276E5CFA1CDB57AA003FF4B4 /* AbstractParseTreeVisitor.h */,
|
||||
2793DC941F0808E100A84290 /* ErrorNode.cpp */,
|
||||
276E5CFB1CDB57AA003FF4B4 /* ErrorNode.h */,
|
||||
276E5CFC1CDB57AA003FF4B4 /* ErrorNodeImpl.cpp */,
|
||||
276E5CFD1CDB57AA003FF4B4 /* ErrorNodeImpl.h */,
|
||||
|
@ -1511,11 +1567,14 @@
|
|||
27D414511DEB0D3D00D0F3F9 /* IterativeParseTreeWalker.h */,
|
||||
276566DF1DA93BFB000869BE /* ParseTree.cpp */,
|
||||
276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */,
|
||||
2793DC8C1F08088F00A84290 /* ParseTreeListener.cpp */,
|
||||
276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */,
|
||||
276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */,
|
||||
2793DC951F0808E100A84290 /* ParseTreeVisitor.cpp */,
|
||||
276E5D031CDB57AA003FF4B4 /* ParseTreeVisitor.h */,
|
||||
276E5D041CDB57AA003FF4B4 /* ParseTreeWalker.cpp */,
|
||||
276E5D051CDB57AA003FF4B4 /* ParseTreeWalker.h */,
|
||||
2793DC901F0808A200A84290 /* TerminalNode.cpp */,
|
||||
276E5D181CDB57AA003FF4B4 /* TerminalNode.h */,
|
||||
276E5D191CDB57AA003FF4B4 /* TerminalNodeImpl.cpp */,
|
||||
276E5D1A1CDB57AA003FF4B4 /* TerminalNodeImpl.h */,
|
||||
|
@ -1529,6 +1588,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
276E5D071CDB57AA003FF4B4 /* Chunk.h */,
|
||||
2793DC881F08087500A84290 /* Chunk.cpp */,
|
||||
276E5D081CDB57AA003FF4B4 /* ParseTreeMatch.cpp */,
|
||||
276E5D091CDB57AA003FF4B4 /* ParseTreeMatch.h */,
|
||||
276E5D0A1CDB57AA003FF4B4 /* ParseTreePattern.cpp */,
|
||||
|
@ -1707,7 +1767,6 @@
|
|||
27DB44CC1D0463DB007E790B /* XPathElement.h in Headers */,
|
||||
276E5F581CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
|
||||
276E5D811CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
|
||||
276E5F461CDB57AA003FF4B4 /* IRecognizer.h in Headers */,
|
||||
27DB44B61D0463CC007E790B /* XPathLexer.h in Headers */,
|
||||
276E5FC41CDB57AA003FF4B4 /* guid.h in Headers */,
|
||||
276E602D1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
|
||||
|
@ -1875,7 +1934,6 @@
|
|||
276E60141CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */,
|
||||
276E5F571CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
|
||||
276E5D801CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
|
||||
276E5F451CDB57AA003FF4B4 /* IRecognizer.h in Headers */,
|
||||
276E5FC31CDB57AA003FF4B4 /* guid.h in Headers */,
|
||||
276E602C1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
|
||||
276E5E941CDB57AA003FF4B4 /* RuleStopState.h in Headers */,
|
||||
|
@ -2033,7 +2091,6 @@
|
|||
276E60131CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */,
|
||||
276E5F561CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
|
||||
276E5D7F1CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
|
||||
276E5F441CDB57AA003FF4B4 /* IRecognizer.h in Headers */,
|
||||
276E5FC21CDB57AA003FF4B4 /* guid.h in Headers */,
|
||||
276E602B1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
|
||||
276E5E931CDB57AA003FF4B4 /* RuleStopState.h in Headers */,
|
||||
|
@ -2225,10 +2282,12 @@
|
|||
276E60451CDB57AA003FF4B4 /* TerminalNodeImpl.cpp in Sources */,
|
||||
276E5DD21CDB57AA003FF4B4 /* ErrorInfo.cpp in Sources */,
|
||||
276E5F551CDB57AA003FF4B4 /* LexerNoViableAltException.cpp in Sources */,
|
||||
2793DCB81F08099C00A84290 /* LexerAction.cpp in Sources */,
|
||||
276E5E561CDB57AA003FF4B4 /* PlusBlockStartState.cpp in Sources */,
|
||||
276E5E1D1CDB57AA003FF4B4 /* LexerSkipAction.cpp in Sources */,
|
||||
276E5EBC1CDB57AA003FF4B4 /* StarLoopEntryState.cpp in Sources */,
|
||||
276E5D721CDB57AA003FF4B4 /* ATNDeserializer.cpp in Sources */,
|
||||
2793DC8B1F08087500A84290 /* Chunk.cpp in Sources */,
|
||||
276E5E2F1CDB57AA003FF4B4 /* LookaheadEventInfo.cpp in Sources */,
|
||||
276E5DFF1CDB57AA003FF4B4 /* LexerIndexedCustomAction.cpp in Sources */,
|
||||
276E60511CDB57AA003FF4B4 /* Trees.cpp in Sources */,
|
||||
|
@ -2256,6 +2315,8 @@
|
|||
276E5E921CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */,
|
||||
276E60631CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */,
|
||||
276E5DDB1CDB57AA003FF4B4 /* LexerActionExecutor.cpp in Sources */,
|
||||
2793DC981F0808E100A84290 /* ErrorNode.cpp in Sources */,
|
||||
2793DCAF1F08095F00A84290 /* WritableToken.cpp in Sources */,
|
||||
276E5E9E1CDB57AA003FF4B4 /* SemanticContext.cpp in Sources */,
|
||||
276E5EC81CDB57AA003FF4B4 /* Transition.cpp in Sources */,
|
||||
276E601E1CDB57AA003FF4B4 /* ParseTreePatternMatcher.cpp in Sources */,
|
||||
|
@ -2263,12 +2324,15 @@
|
|||
276E5D481CDB57AA003FF4B4 /* ActionTransition.cpp in Sources */,
|
||||
276E5DC61CDB57AA003FF4B4 /* EmptyPredictionContext.cpp in Sources */,
|
||||
276E5ED41CDB57AA003FF4B4 /* BailErrorStrategy.cpp in Sources */,
|
||||
2793DC9B1F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */,
|
||||
2793DCAC1F08095F00A84290 /* Token.cpp in Sources */,
|
||||
276E5FA31CDB57AA003FF4B4 /* Recognizer.cpp in Sources */,
|
||||
276E5D6C1CDB57AA003FF4B4 /* ATNDeserializationOptions.cpp in Sources */,
|
||||
276E60361CDB57AA003FF4B4 /* TokenTagToken.cpp in Sources */,
|
||||
27DB44D51D0463DB007E790B /* XPathTokenElement.cpp in Sources */,
|
||||
27DB44D11D0463DB007E790B /* XPathRuleElement.cpp in Sources */,
|
||||
276E5DED1CDB57AA003FF4B4 /* LexerATNSimulator.cpp in Sources */,
|
||||
2793DCB51F08099C00A84290 /* BlockStartState.cpp in Sources */,
|
||||
276E606C1CDB57AA003FF4B4 /* Vocabulary.cpp in Sources */,
|
||||
276E5F1C1CDB57AA003FF4B4 /* LexerDFASerializer.cpp in Sources */,
|
||||
276E60181CDB57AA003FF4B4 /* ParseTreePattern.cpp in Sources */,
|
||||
|
@ -2293,7 +2357,9 @@
|
|||
276E5D781CDB57AA003FF4B4 /* ATNSerializer.cpp in Sources */,
|
||||
27745F051CE49C000067C6A3 /* RuntimeMetaData.cpp in Sources */,
|
||||
276E5DAE1CDB57AA003FF4B4 /* ContextSensitivityInfo.cpp in Sources */,
|
||||
2793DCA61F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */,
|
||||
276E5D661CDB57AA003FF4B4 /* ATNConfigSet.cpp in Sources */,
|
||||
2793DC9F1F08090D00A84290 /* Any.cpp in Sources */,
|
||||
276E5FAF1CDB57AA003FF4B4 /* Arrays.cpp in Sources */,
|
||||
276E5ECE1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */,
|
||||
276E5E861CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
|
||||
|
@ -2301,6 +2367,7 @@
|
|||
276E5D9C1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
|
||||
276E5FC11CDB57AA003FF4B4 /* guid.cpp in Sources */,
|
||||
276E5E801CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
|
||||
2793DCA91F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
|
||||
276E5F401CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
|
||||
276E5F5B1CDB57AA003FF4B4 /* ListTokenSource.cpp in Sources */,
|
||||
276E5F6D1CDB57AA003FF4B4 /* MurmurHash.cpp in Sources */,
|
||||
|
@ -2315,6 +2382,7 @@
|
|||
27DB44CF1D0463DB007E790B /* XPathRuleAnywhereElement.cpp in Sources */,
|
||||
276E5E441CDB57AA003FF4B4 /* OrderedATNConfigSet.cpp in Sources */,
|
||||
276E5DCC1CDB57AA003FF4B4 /* EpsilonTransition.cpp in Sources */,
|
||||
2793DC8F1F08088F00A84290 /* ParseTreeListener.cpp in Sources */,
|
||||
276E5D5A1CDB57AA003FF4B4 /* ATN.cpp in Sources */,
|
||||
276E5EE61CDB57AA003FF4B4 /* CharStream.cpp in Sources */,
|
||||
276E5EE01CDB57AA003FF4B4 /* BufferedTokenStream.cpp in Sources */,
|
||||
|
@ -2333,6 +2401,8 @@
|
|||
276E5DC01CDB57AA003FF4B4 /* DecisionState.cpp in Sources */,
|
||||
276E5E981CDB57AA003FF4B4 /* RuleTransition.cpp in Sources */,
|
||||
276E5EF81CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */,
|
||||
2793DC871F08083F00A84290 /* TokenSource.cpp in Sources */,
|
||||
2793DC931F0808A200A84290 /* TerminalNode.cpp in Sources */,
|
||||
276E60121CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */,
|
||||
276566E21DA93BFB000869BE /* ParseTree.cpp in Sources */,
|
||||
276E5EEC1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */,
|
||||
|
@ -2365,10 +2435,12 @@
|
|||
276E60441CDB57AA003FF4B4 /* TerminalNodeImpl.cpp in Sources */,
|
||||
276E5DD11CDB57AA003FF4B4 /* ErrorInfo.cpp in Sources */,
|
||||
276E5F541CDB57AA003FF4B4 /* LexerNoViableAltException.cpp in Sources */,
|
||||
2793DCB71F08099C00A84290 /* LexerAction.cpp in Sources */,
|
||||
276E5E551CDB57AA003FF4B4 /* PlusBlockStartState.cpp in Sources */,
|
||||
276E5E1C1CDB57AA003FF4B4 /* LexerSkipAction.cpp in Sources */,
|
||||
276E5EBB1CDB57AA003FF4B4 /* StarLoopEntryState.cpp in Sources */,
|
||||
276E5D711CDB57AA003FF4B4 /* ATNDeserializer.cpp in Sources */,
|
||||
2793DC8A1F08087500A84290 /* Chunk.cpp in Sources */,
|
||||
276E5E2E1CDB57AA003FF4B4 /* LookaheadEventInfo.cpp in Sources */,
|
||||
276E5DFE1CDB57AA003FF4B4 /* LexerIndexedCustomAction.cpp in Sources */,
|
||||
276E60501CDB57AA003FF4B4 /* Trees.cpp in Sources */,
|
||||
|
@ -2396,6 +2468,8 @@
|
|||
276E5E911CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */,
|
||||
276E60621CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */,
|
||||
276E5DDA1CDB57AA003FF4B4 /* LexerActionExecutor.cpp in Sources */,
|
||||
2793DC971F0808E100A84290 /* ErrorNode.cpp in Sources */,
|
||||
2793DCAE1F08095F00A84290 /* WritableToken.cpp in Sources */,
|
||||
276E5E9D1CDB57AA003FF4B4 /* SemanticContext.cpp in Sources */,
|
||||
276E5EC71CDB57AA003FF4B4 /* Transition.cpp in Sources */,
|
||||
276E601D1CDB57AA003FF4B4 /* ParseTreePatternMatcher.cpp in Sources */,
|
||||
|
@ -2403,12 +2477,15 @@
|
|||
276E5D471CDB57AA003FF4B4 /* ActionTransition.cpp in Sources */,
|
||||
276E5DC51CDB57AA003FF4B4 /* EmptyPredictionContext.cpp in Sources */,
|
||||
276E5ED31CDB57AA003FF4B4 /* BailErrorStrategy.cpp in Sources */,
|
||||
2793DC9A1F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */,
|
||||
2793DCAB1F08095F00A84290 /* Token.cpp in Sources */,
|
||||
276E5FA21CDB57AA003FF4B4 /* Recognizer.cpp in Sources */,
|
||||
276E5D6B1CDB57AA003FF4B4 /* ATNDeserializationOptions.cpp in Sources */,
|
||||
276E60351CDB57AA003FF4B4 /* TokenTagToken.cpp in Sources */,
|
||||
27DB44C31D0463DA007E790B /* XPathTokenElement.cpp in Sources */,
|
||||
27DB44BF1D0463DA007E790B /* XPathRuleElement.cpp in Sources */,
|
||||
276E5DEC1CDB57AA003FF4B4 /* LexerATNSimulator.cpp in Sources */,
|
||||
2793DCB41F08099C00A84290 /* BlockStartState.cpp in Sources */,
|
||||
276E606B1CDB57AA003FF4B4 /* Vocabulary.cpp in Sources */,
|
||||
276E5F1B1CDB57AA003FF4B4 /* LexerDFASerializer.cpp in Sources */,
|
||||
276E60171CDB57AA003FF4B4 /* ParseTreePattern.cpp in Sources */,
|
||||
|
@ -2433,7 +2510,9 @@
|
|||
276E5D771CDB57AA003FF4B4 /* ATNSerializer.cpp in Sources */,
|
||||
27745F041CE49C000067C6A3 /* RuntimeMetaData.cpp in Sources */,
|
||||
276E5DAD1CDB57AA003FF4B4 /* ContextSensitivityInfo.cpp in Sources */,
|
||||
2793DCA51F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */,
|
||||
276E5D651CDB57AA003FF4B4 /* ATNConfigSet.cpp in Sources */,
|
||||
2793DC9E1F08090D00A84290 /* Any.cpp in Sources */,
|
||||
276E5FAE1CDB57AA003FF4B4 /* Arrays.cpp in Sources */,
|
||||
276E5ECD1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */,
|
||||
276E5E851CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
|
||||
|
@ -2441,6 +2520,7 @@
|
|||
276E5D9B1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
|
||||
276E5FC01CDB57AA003FF4B4 /* guid.cpp in Sources */,
|
||||
276E5E7F1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
|
||||
2793DCA81F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
|
||||
276E5F3F1CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
|
||||
276E5F5A1CDB57AA003FF4B4 /* ListTokenSource.cpp in Sources */,
|
||||
276E5F6C1CDB57AA003FF4B4 /* MurmurHash.cpp in Sources */,
|
||||
|
@ -2455,6 +2535,7 @@
|
|||
27DB44BD1D0463DA007E790B /* XPathRuleAnywhereElement.cpp in Sources */,
|
||||
276E5E431CDB57AA003FF4B4 /* OrderedATNConfigSet.cpp in Sources */,
|
||||
276E5DCB1CDB57AA003FF4B4 /* EpsilonTransition.cpp in Sources */,
|
||||
2793DC8E1F08088F00A84290 /* ParseTreeListener.cpp in Sources */,
|
||||
276E5D591CDB57AA003FF4B4 /* ATN.cpp in Sources */,
|
||||
276E5EE51CDB57AA003FF4B4 /* CharStream.cpp in Sources */,
|
||||
276E5EDF1CDB57AA003FF4B4 /* BufferedTokenStream.cpp in Sources */,
|
||||
|
@ -2473,6 +2554,8 @@
|
|||
276E5DBF1CDB57AA003FF4B4 /* DecisionState.cpp in Sources */,
|
||||
276E5E971CDB57AA003FF4B4 /* RuleTransition.cpp in Sources */,
|
||||
276E5EF71CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */,
|
||||
2793DC861F08083F00A84290 /* TokenSource.cpp in Sources */,
|
||||
2793DC921F0808A200A84290 /* TerminalNode.cpp in Sources */,
|
||||
276E60111CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */,
|
||||
276566E11DA93BFB000869BE /* ParseTree.cpp in Sources */,
|
||||
276E5EEB1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */,
|
||||
|
@ -2505,10 +2588,12 @@
|
|||
276E5DB21CDB57AA003FF4B4 /* DecisionEventInfo.cpp in Sources */,
|
||||
276E60431CDB57AA003FF4B4 /* TerminalNodeImpl.cpp in Sources */,
|
||||
276E5DD01CDB57AA003FF4B4 /* ErrorInfo.cpp in Sources */,
|
||||
2793DCB61F08099C00A84290 /* LexerAction.cpp in Sources */,
|
||||
276E5F531CDB57AA003FF4B4 /* LexerNoViableAltException.cpp in Sources */,
|
||||
276E5E541CDB57AA003FF4B4 /* PlusBlockStartState.cpp in Sources */,
|
||||
276E5E1B1CDB57AA003FF4B4 /* LexerSkipAction.cpp in Sources */,
|
||||
276E5EBA1CDB57AA003FF4B4 /* StarLoopEntryState.cpp in Sources */,
|
||||
2793DC891F08087500A84290 /* Chunk.cpp in Sources */,
|
||||
276E5D701CDB57AA003FF4B4 /* ATNDeserializer.cpp in Sources */,
|
||||
276E5E2D1CDB57AA003FF4B4 /* LookaheadEventInfo.cpp in Sources */,
|
||||
276E5DFD1CDB57AA003FF4B4 /* LexerIndexedCustomAction.cpp in Sources */,
|
||||
|
@ -2536,6 +2621,8 @@
|
|||
276E60611CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */,
|
||||
276E5DD91CDB57AA003FF4B4 /* LexerActionExecutor.cpp in Sources */,
|
||||
27DB449D1D045537007E790B /* XPath.cpp in Sources */,
|
||||
2793DC961F0808E100A84290 /* ErrorNode.cpp in Sources */,
|
||||
2793DCAD1F08095F00A84290 /* WritableToken.cpp in Sources */,
|
||||
276E5E9C1CDB57AA003FF4B4 /* SemanticContext.cpp in Sources */,
|
||||
27DB44AD1D045537007E790B /* XPathWildcardElement.cpp in Sources */,
|
||||
276E5EC61CDB57AA003FF4B4 /* Transition.cpp in Sources */,
|
||||
|
@ -2543,12 +2630,15 @@
|
|||
27DB44A51D045537007E790B /* XPathRuleElement.cpp in Sources */,
|
||||
276E5F201CDB57AA003FF4B4 /* DiagnosticErrorListener.cpp in Sources */,
|
||||
276E5D461CDB57AA003FF4B4 /* ActionTransition.cpp in Sources */,
|
||||
2793DC991F0808E100A84290 /* ParseTreeVisitor.cpp in Sources */,
|
||||
2793DCAA1F08095F00A84290 /* Token.cpp in Sources */,
|
||||
276E5DC41CDB57AA003FF4B4 /* EmptyPredictionContext.cpp in Sources */,
|
||||
276E5ED21CDB57AA003FF4B4 /* BailErrorStrategy.cpp in Sources */,
|
||||
276E5FA11CDB57AA003FF4B4 /* Recognizer.cpp in Sources */,
|
||||
276E5D6A1CDB57AA003FF4B4 /* ATNDeserializationOptions.cpp in Sources */,
|
||||
276E60341CDB57AA003FF4B4 /* TokenTagToken.cpp in Sources */,
|
||||
276E5DEB1CDB57AA003FF4B4 /* LexerATNSimulator.cpp in Sources */,
|
||||
2793DCB31F08099C00A84290 /* BlockStartState.cpp in Sources */,
|
||||
276E606A1CDB57AA003FF4B4 /* Vocabulary.cpp in Sources */,
|
||||
276E5F1A1CDB57AA003FF4B4 /* LexerDFASerializer.cpp in Sources */,
|
||||
276E60161CDB57AA003FF4B4 /* ParseTreePattern.cpp in Sources */,
|
||||
|
@ -2573,7 +2663,9 @@
|
|||
276E5D761CDB57AA003FF4B4 /* ATNSerializer.cpp in Sources */,
|
||||
27745F031CE49C000067C6A3 /* RuntimeMetaData.cpp in Sources */,
|
||||
276E5DAC1CDB57AA003FF4B4 /* ContextSensitivityInfo.cpp in Sources */,
|
||||
2793DCA41F08095F00A84290 /* ANTLRErrorListener.cpp in Sources */,
|
||||
276E5D641CDB57AA003FF4B4 /* ATNConfigSet.cpp in Sources */,
|
||||
2793DC9D1F08090D00A84290 /* Any.cpp in Sources */,
|
||||
276E5FAD1CDB57AA003FF4B4 /* Arrays.cpp in Sources */,
|
||||
276E5ECC1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */,
|
||||
276E5E841CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
|
||||
|
@ -2581,6 +2673,7 @@
|
|||
276E5D9A1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
|
||||
276E5FBF1CDB57AA003FF4B4 /* guid.cpp in Sources */,
|
||||
276E5E7E1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
|
||||
2793DCA71F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
|
||||
276E5F3E1CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
|
||||
276E5F591CDB57AA003FF4B4 /* ListTokenSource.cpp in Sources */,
|
||||
276E5F6B1CDB57AA003FF4B4 /* MurmurHash.cpp in Sources */,
|
||||
|
@ -2595,6 +2688,7 @@
|
|||
276E5D581CDB57AA003FF4B4 /* ATN.cpp in Sources */,
|
||||
276E5EE41CDB57AA003FF4B4 /* CharStream.cpp in Sources */,
|
||||
27DB44AB1D045537007E790B /* XPathWildcardAnywhereElement.cpp in Sources */,
|
||||
2793DC8D1F08088F00A84290 /* ParseTreeListener.cpp in Sources */,
|
||||
276E5EDE1CDB57AA003FF4B4 /* BufferedTokenStream.cpp in Sources */,
|
||||
276E5F021CDB57AA003FF4B4 /* DefaultErrorStrategy.cpp in Sources */,
|
||||
276E5D401CDB57AA003FF4B4 /* AbstractPredicateTransition.cpp in Sources */,
|
||||
|
@ -2613,6 +2707,8 @@
|
|||
276E5DBE1CDB57AA003FF4B4 /* DecisionState.cpp in Sources */,
|
||||
276E5E961CDB57AA003FF4B4 /* RuleTransition.cpp in Sources */,
|
||||
276E5EF61CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */,
|
||||
2793DC851F08083F00A84290 /* TokenSource.cpp in Sources */,
|
||||
2793DC911F0808A200A84290 /* TerminalNode.cpp in Sources */,
|
||||
276E60101CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */,
|
||||
276566E01DA93BFB000869BE /* ParseTree.cpp in Sources */,
|
||||
276E5EEA1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */,
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#include "ANTLRErrorListener.h"
|
||||
|
||||
antlr4::ANTLRErrorListener::~ANTLRErrorListener()
|
||||
{
|
||||
}
|
|
@ -16,7 +16,7 @@ namespace antlr4 {
|
|||
/// How to emit recognition errors (an interface in Java).
|
||||
class ANTLR4CPP_PUBLIC ANTLRErrorListener {
|
||||
public:
|
||||
virtual ~ANTLRErrorListener() {};
|
||||
virtual ~ANTLRErrorListener();
|
||||
|
||||
/// <summary>
|
||||
/// Upon syntax error, notify any interested parties. This is not how to
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#include "ANTLRErrorStrategy.h"
|
||||
|
||||
antlr4::ANTLRErrorStrategy::~ANTLRErrorStrategy()
|
||||
{
|
||||
}
|
|
@ -32,7 +32,7 @@ namespace antlr4 {
|
|||
/// <summary>
|
||||
/// Reset the error handler state for the specified {@code recognizer}. </summary>
|
||||
/// <param name="recognizer"> the parser instance </param>
|
||||
virtual ~ANTLRErrorStrategy() {};
|
||||
virtual ~ANTLRErrorStrategy();
|
||||
|
||||
virtual void reset(Parser *recognizer) = 0;
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ void ANTLRInputStream::load(const std::string &input) {
|
|||
// Remove the UTF-8 BOM if present.
|
||||
const char bom[4] = "\xef\xbb\xbf";
|
||||
if (input.compare(0, 3, bom, 3) == 0)
|
||||
_data = antlrcpp::utfConverter.from_bytes(input.data() + 3, input.data() + input.size());
|
||||
_data = antlrcpp::utf8_to_utf32(input.data() + 3, input.data() + input.size());
|
||||
else
|
||||
_data = antlrcpp::utfConverter.from_bytes(input);
|
||||
_data = antlrcpp::utf8_to_utf32(input.data(), input.data() + input.size());
|
||||
p = 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ size_t ANTLRInputStream::LA(ssize_t i) {
|
|||
return 0; // undefined
|
||||
}
|
||||
|
||||
ssize_t position = (ssize_t)p;
|
||||
ssize_t position = static_cast<ssize_t>(p);
|
||||
if (i < 0) {
|
||||
i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1]
|
||||
if ((position + i - 1) < 0) {
|
||||
|
@ -79,11 +79,11 @@ size_t ANTLRInputStream::LA(ssize_t i) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((position + i - 1) >= (ssize_t)_data.size()) {
|
||||
if ((position + i - 1) >= static_cast<ssize_t>(_data.size())) {
|
||||
return IntStream::EOF;
|
||||
}
|
||||
|
||||
return _data[(size_t)(position + i - 1)];
|
||||
return _data[static_cast<size_t>((position + i - 1))];
|
||||
}
|
||||
|
||||
size_t ANTLRInputStream::LT(ssize_t i) {
|
||||
|
@ -123,8 +123,8 @@ std::string ANTLRInputStream::getText(const Interval &interval) {
|
|||
return "";
|
||||
}
|
||||
|
||||
size_t start = interval.a;
|
||||
size_t stop = interval.b;
|
||||
size_t start = static_cast<size_t>(interval.a);
|
||||
size_t stop = static_cast<size_t>(interval.b);
|
||||
|
||||
|
||||
if (stop >= _data.size()) {
|
||||
|
@ -136,7 +136,7 @@ std::string ANTLRInputStream::getText(const Interval &interval) {
|
|||
return "";
|
||||
}
|
||||
|
||||
return antlrcpp::utfConverter.to_bytes(_data.substr(start, count));
|
||||
return antlrcpp::utf32_to_utf8(_data.substr(start, count));
|
||||
}
|
||||
|
||||
std::string ANTLRInputStream::getSourceName() const {
|
||||
|
@ -147,7 +147,7 @@ std::string ANTLRInputStream::getSourceName() const {
|
|||
}
|
||||
|
||||
std::string ANTLRInputStream::toString() const {
|
||||
return antlrcpp::utfConverter.to_bytes(_data);
|
||||
return antlrcpp::utf32_to_utf8(_data);
|
||||
}
|
||||
|
||||
void ANTLRInputStream::InitializeInstanceFields() {
|
||||
|
|
|
@ -16,11 +16,7 @@ namespace antlr4 {
|
|||
protected:
|
||||
/// The data being scanned.
|
||||
// UTF-32
|
||||
#if defined(_MSC_VER) && _MSC_VER == 1900
|
||||
i32string _data; // Custom type for VS 2015.
|
||||
#else
|
||||
std::u32string _data;
|
||||
#endif
|
||||
UTF32String _data;
|
||||
|
||||
/// 0..n-1 index into string of next char </summary>
|
||||
size_t p;
|
||||
|
|
|
@ -18,7 +18,7 @@ void BailErrorStrategy::recover(Parser *recognizer, std::exception_ptr e) {
|
|||
context->exception = e;
|
||||
if (context->parent == nullptr)
|
||||
break;
|
||||
context = (ParserRuleContext *)context->parent;
|
||||
context = static_cast<ParserRuleContext *>(context->parent);
|
||||
} while (true);
|
||||
|
||||
try {
|
||||
|
@ -42,7 +42,7 @@ Token* BailErrorStrategy::recoverInline(Parser *recognizer) {
|
|||
context->exception = exception;
|
||||
if (context->parent == nullptr)
|
||||
break;
|
||||
context = (ParserRuleContext *)context->parent;
|
||||
context = static_cast<ParserRuleContext *>(context->parent);
|
||||
} while (true);
|
||||
|
||||
try {
|
||||
|
|
|
@ -96,7 +96,7 @@ size_t BufferedTokenStream::fetch(size_t n) {
|
|||
std::unique_ptr<Token> t(_tokenSource->nextToken());
|
||||
|
||||
if (is<WritableToken *>(t.get())) {
|
||||
(static_cast<WritableToken *>(t.get()))->setTokenIndex((int)_tokens.size());
|
||||
(static_cast<WritableToken *>(t.get()))->setTokenIndex(_tokens.size());
|
||||
}
|
||||
|
||||
_tokens.push_back(std::move(t));
|
||||
|
@ -272,7 +272,7 @@ ssize_t BufferedTokenStream::previousTokenOnChannel(size_t i, size_t channel) {
|
|||
}
|
||||
|
||||
if (i == 0)
|
||||
return i;
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
return i;
|
||||
|
@ -289,7 +289,7 @@ std::vector<Token *> BufferedTokenStream::getHiddenTokensToRight(size_t tokenInd
|
|||
size_t from = tokenIndex + 1;
|
||||
// if none onchannel to right, nextOnChannel=-1 so set to = last token
|
||||
if (nextOnChannel == -1) {
|
||||
to = (ssize_t)size() - 1;
|
||||
to = static_cast<ssize_t>(size() - 1);
|
||||
} else {
|
||||
to = nextOnChannel;
|
||||
}
|
||||
|
@ -313,11 +313,11 @@ std::vector<Token *> BufferedTokenStream::getHiddenTokensToLeft(size_t tokenInde
|
|||
}
|
||||
|
||||
ssize_t prevOnChannel = previousTokenOnChannel(tokenIndex - 1, Lexer::DEFAULT_TOKEN_CHANNEL);
|
||||
if (prevOnChannel == (ssize_t)tokenIndex - 1) {
|
||||
if (prevOnChannel == static_cast<ssize_t>(tokenIndex - 1)) {
|
||||
return { };
|
||||
}
|
||||
// if none onchannel to left, prevOnChannel=-1 then from=0
|
||||
size_t from = (size_t)(prevOnChannel + 1);
|
||||
size_t from = static_cast<size_t>(prevOnChannel + 1);
|
||||
size_t to = tokenIndex - 1;
|
||||
|
||||
return filterForChannel(from, to, channel);
|
||||
|
@ -336,7 +336,7 @@ std::vector<Token *> BufferedTokenStream::filterForChannel(size_t from, size_t t
|
|||
hidden.push_back(t);
|
||||
}
|
||||
} else {
|
||||
if (t->getChannel() == (size_t)channel) {
|
||||
if (t->getChannel() == static_cast<size_t>(channel)) {
|
||||
hidden.push_back(t);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace antlr4 {
|
|||
/// A source of characters for an ANTLR lexer.
|
||||
class ANTLR4CPP_PUBLIC CharStream : public IntStream {
|
||||
public:
|
||||
virtual ~CharStream() = 0;
|
||||
virtual ~CharStream();
|
||||
|
||||
/// This method returns the text for a range of characters within this input
|
||||
/// stream. This method is guaranteed to not throw an exception if the
|
||||
|
|
|
@ -35,7 +35,7 @@ CommonToken::CommonToken(std::pair<TokenSource*, CharStream*> source, size_t typ
|
|||
_start = start;
|
||||
_stop = stop;
|
||||
if (_source.first != nullptr) {
|
||||
_line = (int)source.first->getLine();
|
||||
_line = static_cast<int>(source.first->getLine());
|
||||
_charPositionInLine = source.first->getCharPositionInLine();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace antlr4;
|
|||
|
||||
const Ref<TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT = std::make_shared<CommonTokenFactory>();
|
||||
|
||||
CommonTokenFactory::CommonTokenFactory(bool copyText) : copyText(copyText) {
|
||||
CommonTokenFactory::CommonTokenFactory(bool copyText_) : copyText(copyText_) {
|
||||
}
|
||||
|
||||
CommonTokenFactory::CommonTokenFactory() : CommonTokenFactory(false) {
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
|
||||
using namespace antlr4;
|
||||
|
||||
CommonTokenStream::CommonTokenStream(TokenSource *tokenSource) : BufferedTokenStream(tokenSource) {
|
||||
InitializeInstanceFields();
|
||||
CommonTokenStream::CommonTokenStream(TokenSource *tokenSource) : CommonTokenStream(tokenSource, Token::DEFAULT_CHANNEL) {
|
||||
}
|
||||
|
||||
CommonTokenStream::CommonTokenStream(TokenSource *tokenSource, int channel) : BufferedTokenStream(tokenSource) {
|
||||
this->channel = channel;
|
||||
CommonTokenStream::CommonTokenStream(TokenSource *tokenSource, size_t channel_)
|
||||
: BufferedTokenStream(tokenSource), channel(channel_) {
|
||||
}
|
||||
|
||||
ssize_t CommonTokenStream::adjustSeekIndex(size_t i) {
|
||||
|
@ -26,7 +25,7 @@ Token* CommonTokenStream::LB(size_t k) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ssize_t i = (ssize_t)_p;
|
||||
ssize_t i = static_cast<ssize_t>(_p);
|
||||
size_t n = 1;
|
||||
// find k good tokens looking backwards
|
||||
while (n <= k) {
|
||||
|
@ -47,7 +46,7 @@ Token* CommonTokenStream::LT(ssize_t k) {
|
|||
return nullptr;
|
||||
}
|
||||
if (k < 0) {
|
||||
return LB((size_t)-k);
|
||||
return LB(static_cast<size_t>(-k));
|
||||
}
|
||||
size_t i = _p;
|
||||
ssize_t n = 1; // we know tokens[p] is a good one
|
||||
|
@ -77,7 +76,3 @@ int CommonTokenStream::getNumberOfOnChannelTokens() {
|
|||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void CommonTokenStream::InitializeInstanceFields() {
|
||||
channel = Token::DEFAULT_CHANNEL;
|
||||
}
|
||||
|
|
|
@ -34,16 +34,6 @@ namespace antlr4 {
|
|||
* channel.</p>
|
||||
*/
|
||||
class ANTLR4CPP_PUBLIC CommonTokenStream : public BufferedTokenStream {
|
||||
protected:
|
||||
/**
|
||||
* Specifies the channel to use for filtering tokens.
|
||||
*
|
||||
* <p>
|
||||
* The default value is {@link Token#DEFAULT_CHANNEL}, which matches the
|
||||
* default channel assigned to tokens created by the lexer.</p>
|
||||
*/
|
||||
size_t channel;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs a new {@link CommonTokenStream} using the specified token
|
||||
|
@ -63,21 +53,27 @@ namespace antlr4 {
|
|||
* @param tokenSource The token source.
|
||||
* @param channel The channel to use for filtering tokens.
|
||||
*/
|
||||
CommonTokenStream(TokenSource *tokenSource, int channel);
|
||||
CommonTokenStream(TokenSource *tokenSource, size_t channel);
|
||||
|
||||
protected:
|
||||
virtual ssize_t adjustSeekIndex(size_t i) override;
|
||||
|
||||
virtual Token* LB(size_t k) override;
|
||||
|
||||
public:
|
||||
virtual Token* LT(ssize_t k) override;
|
||||
|
||||
/// Count EOF just once.
|
||||
virtual int getNumberOfOnChannelTokens();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Specifies the channel to use for filtering tokens.
|
||||
*
|
||||
* <p>
|
||||
* The default value is {@link Token#DEFAULT_CHANNEL}, which matches the
|
||||
* default channel assigned to tokens created by the lexer.</p>
|
||||
*/
|
||||
size_t channel;
|
||||
|
||||
virtual ssize_t adjustSeekIndex(size_t i) override;
|
||||
|
||||
virtual Token* LB(size_t k) override;
|
||||
|
||||
private:
|
||||
void InitializeInstanceFields();
|
||||
};
|
||||
|
||||
} // namespace antlr4
|
||||
|
|
|
@ -62,18 +62,18 @@ void DefaultErrorStrategy::reportError(Parser *recognizer, const RecognitionExce
|
|||
|
||||
beginErrorCondition(recognizer);
|
||||
if (is<const NoViableAltException *>(&e)) {
|
||||
reportNoViableAlternative(recognizer, (const NoViableAltException &)e);
|
||||
reportNoViableAlternative(recognizer, static_cast<const NoViableAltException &>(e));
|
||||
} else if (is<const InputMismatchException *>(&e)) {
|
||||
reportInputMismatch(recognizer, (const InputMismatchException &)e);
|
||||
reportInputMismatch(recognizer, static_cast<const InputMismatchException &>(e));
|
||||
} else if (is<const FailedPredicateException *>(&e)) {
|
||||
reportFailedPredicate(recognizer, (const FailedPredicateException &)e);
|
||||
reportFailedPredicate(recognizer, static_cast<const FailedPredicateException &>(e));
|
||||
} else if (is<const RecognitionException *>(&e)) {
|
||||
recognizer->notifyErrorListeners(e.getOffendingToken(), e.what(), std::current_exception());
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultErrorStrategy::recover(Parser *recognizer, std::exception_ptr /*e*/) {
|
||||
if (lastErrorIndex == (int)recognizer->getInputStream()->index() &&
|
||||
if (lastErrorIndex == static_cast<int>(recognizer->getInputStream()->index()) &&
|
||||
lastErrorStates.contains(recognizer->getState())) {
|
||||
|
||||
// uh oh, another error at same token index and previously-visited
|
||||
|
@ -82,7 +82,7 @@ void DefaultErrorStrategy::recover(Parser *recognizer, std::exception_ptr /*e*/)
|
|||
// at least to prevent an infinite loop; this is a failsafe.
|
||||
recognizer->consume();
|
||||
}
|
||||
lastErrorIndex = (int)recognizer->getInputStream()->index();
|
||||
lastErrorIndex = static_cast<int>(recognizer->getInputStream()->index());
|
||||
lastErrorStates.add(recognizer->getState());
|
||||
misc::IntervalSet followSet = getErrorRecoverySet(recognizer);
|
||||
consumeUntil(recognizer, followSet);
|
||||
|
@ -312,7 +312,7 @@ misc::IntervalSet DefaultErrorStrategy::getErrorRecoverySet(Parser *recognizer)
|
|||
|
||||
if (ctx->parent == nullptr)
|
||||
break;
|
||||
ctx = (RuleContext *)ctx->parent;
|
||||
ctx = static_cast<RuleContext *>(ctx->parent);
|
||||
}
|
||||
recoverSet.remove(Token::EPSILON);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ using namespace antlr4;
|
|||
DiagnosticErrorListener::DiagnosticErrorListener() : DiagnosticErrorListener(true) {
|
||||
}
|
||||
|
||||
DiagnosticErrorListener::DiagnosticErrorListener(bool exactOnly) : exactOnly(exactOnly) {
|
||||
DiagnosticErrorListener::DiagnosticErrorListener(bool exactOnly_) : exactOnly(exactOnly_) {
|
||||
}
|
||||
|
||||
void DiagnosticErrorListener::reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
||||
|
@ -53,7 +53,7 @@ void DiagnosticErrorListener::reportContextSensitivity(Parser *recognizer, const
|
|||
|
||||
std::string DiagnosticErrorListener::getDecisionDescription(Parser *recognizer, const dfa::DFA &dfa) {
|
||||
size_t decision = dfa.decision;
|
||||
size_t ruleIndex = ((atn::ATNState*)dfa.atnStartState)->ruleIndex;
|
||||
size_t ruleIndex = (reinterpret_cast<atn::ATNState*>(dfa.atnStartState))->ruleIndex;
|
||||
|
||||
const std::vector<std::string>& ruleNames = recognizer->getRuleNames();
|
||||
if (ruleIndex == INVALID_INDEX || ruleIndex >= ruleNames.size()) {
|
||||
|
|
|
@ -22,3 +22,43 @@ IOException::IOException(const std::string &msg) : std::exception(), _message(ms
|
|||
const char* IOException::what() const NOEXCEPT {
|
||||
return _message.c_str();
|
||||
}
|
||||
|
||||
//------------------ IllegalStateException -----------------------------------------------------------------------------
|
||||
|
||||
IllegalStateException::~IllegalStateException() {
|
||||
}
|
||||
|
||||
//------------------ IllegalArgumentException --------------------------------------------------------------------------
|
||||
|
||||
IllegalArgumentException::~IllegalArgumentException() {
|
||||
}
|
||||
|
||||
//------------------ NullPointerException ------------------------------------------------------------------------------
|
||||
|
||||
NullPointerException::~NullPointerException() {
|
||||
}
|
||||
|
||||
//------------------ IndexOutOfBoundsException -------------------------------------------------------------------------
|
||||
|
||||
IndexOutOfBoundsException::~IndexOutOfBoundsException() {
|
||||
}
|
||||
|
||||
//------------------ UnsupportedOperationException ---------------------------------------------------------------------
|
||||
|
||||
UnsupportedOperationException::~UnsupportedOperationException() {
|
||||
}
|
||||
|
||||
//------------------ EmptyStackException -------------------------------------------------------------------------------
|
||||
|
||||
EmptyStackException::~EmptyStackException() {
|
||||
}
|
||||
|
||||
//------------------ CancellationException -----------------------------------------------------------------------------
|
||||
|
||||
CancellationException::~CancellationException() {
|
||||
}
|
||||
|
||||
//------------------ ParseCancellationException ------------------------------------------------------------------------
|
||||
|
||||
ParseCancellationException::~ParseCancellationException() {
|
||||
}
|
||||
|
|
|
@ -21,32 +21,51 @@ namespace antlr4 {
|
|||
|
||||
class ANTLR4CPP_PUBLIC IllegalStateException : public RuntimeException {
|
||||
public:
|
||||
IllegalStateException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
IllegalStateException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
IllegalStateException(IllegalStateException const&) = default;
|
||||
~IllegalStateException();
|
||||
IllegalStateException& operator=(IllegalStateException const&) = default;
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC IllegalArgumentException : public RuntimeException {
|
||||
public:
|
||||
IllegalArgumentException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
IllegalArgumentException(IllegalArgumentException const&) = default;
|
||||
IllegalArgumentException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
~IllegalArgumentException();
|
||||
IllegalArgumentException& operator=(IllegalArgumentException const&) = default;
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC NullPointerException : public RuntimeException {
|
||||
public:
|
||||
NullPointerException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
NullPointerException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
NullPointerException(NullPointerException const&) = default;
|
||||
~NullPointerException();
|
||||
NullPointerException& operator=(NullPointerException const&) = default;
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC IndexOutOfBoundsException : public RuntimeException {
|
||||
public:
|
||||
IndexOutOfBoundsException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
IndexOutOfBoundsException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
IndexOutOfBoundsException(IndexOutOfBoundsException const&) = default;
|
||||
~IndexOutOfBoundsException();
|
||||
IndexOutOfBoundsException& operator=(IndexOutOfBoundsException const&) = default;
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC UnsupportedOperationException : public RuntimeException {
|
||||
public:
|
||||
UnsupportedOperationException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
UnsupportedOperationException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
UnsupportedOperationException(UnsupportedOperationException const&) = default;
|
||||
~UnsupportedOperationException();
|
||||
UnsupportedOperationException& operator=(UnsupportedOperationException const&) = default;
|
||||
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC EmptyStackException : public RuntimeException {
|
||||
public:
|
||||
EmptyStackException(const std::string &msg = "") : RuntimeException(msg) {};
|
||||
EmptyStackException(const std::string &msg = "") : RuntimeException(msg) {}
|
||||
EmptyStackException(EmptyStackException const&) = default;
|
||||
~EmptyStackException();
|
||||
EmptyStackException& operator=(EmptyStackException const&) = default;
|
||||
};
|
||||
|
||||
// IOException is not a runtime exception (in the java hierarchy).
|
||||
|
@ -63,12 +82,18 @@ namespace antlr4 {
|
|||
|
||||
class ANTLR4CPP_PUBLIC CancellationException : public IllegalStateException {
|
||||
public:
|
||||
CancellationException(const std::string &msg = "") : IllegalStateException(msg) {};
|
||||
CancellationException(const std::string &msg = "") : IllegalStateException(msg) {}
|
||||
CancellationException(CancellationException const&) = default;
|
||||
~CancellationException();
|
||||
CancellationException& operator=(CancellationException const&) = default;
|
||||
};
|
||||
|
||||
class ANTLR4CPP_PUBLIC ParseCancellationException : public CancellationException {
|
||||
public:
|
||||
ParseCancellationException(const std::string &msg = "") : CancellationException(msg) {};
|
||||
ParseCancellationException(const std::string &msg = "") : CancellationException(msg) {}
|
||||
ParseCancellationException(ParseCancellationException const&) = default;
|
||||
~ParseCancellationException();
|
||||
ParseCancellationException& operator=(ParseCancellationException const&) = default;
|
||||
};
|
||||
|
||||
} // namespace antlr4
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue