Merge branch 'master' into fix-js-examples
This commit is contained in:
commit
7bd2c3fbe1
|
@ -178,5 +178,13 @@ YYYY/MM/DD, github id, Full name, email
|
|||
2017/12/01, DavidMoraisFerreira, David Morais Ferreira, david.moraisferreira@gmail.com
|
||||
2017/12/01, SebastianLng, Sebastian Lang, sebastian.lang@outlook.com
|
||||
2017/12/03, oranoran, Oran Epelbaum, oran / epelbaum me
|
||||
2017/12/20, kbsletten, Kyle Sletten, kbsletten@gmail.com
|
||||
2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com
|
||||
2018/01/06, kasbah, Kaspar Emanuel, kaspar@monostable.co.uk
|
||||
2018/02/08, razfriman, Raz Friman, raz@razfriman.com
|
||||
2018/02/11, io7m, Mark Raynsford, code@io7m.com
|
||||
2018/05/15, johnvanderholt, jan dillingh johnvanderholte@gmail.com
|
||||
2018/05/17, sinopsysHK, Eric Bardes, sinofwd@gmail.com
|
||||
2018/05/23, srvance, Stephen Vance, steve@vance.com
|
||||
2018/06/14, alecont, Alessandro Contenti, alecontenti@hotmail.com
|
||||
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
|
|
@ -21,7 +21,7 @@ You will find full instructions on the [Git repo page for ANTLR C# runtime](http
|
|||
|
||||
Let's suppose that your grammar is named `MyGrammar`. The tool will generate for you the following files:
|
||||
|
||||
* MyGrammarLexer.cs
|
||||
* MyGrammarLexer.cs
|
||||
* MyGrammarParser.cs
|
||||
* MyGrammarListener.cs (if you have not activated the -no-listener option)
|
||||
* MyGrammarBaseListener.cs (if you have not activated the -no-listener option)
|
||||
|
@ -32,6 +32,7 @@ Now a fully functioning code might look like the following for start rule `Start
|
|||
|
||||
```
|
||||
using Antlr4.Runtime;
|
||||
using Antlr4.Runtime.Tree;
|
||||
|
||||
public void MyParseMethod() {
|
||||
String input = "your text to parse here";
|
||||
|
@ -39,7 +40,7 @@ public void MyParseMethod() {
|
|||
ITokenSource lexer = new MyGrammarLexer(stream);
|
||||
ITokenStream tokens = new CommonTokenStream(lexer);
|
||||
MyGrammarParser parser = new MyGrammarParser(tokens);
|
||||
parser.buildParseTrees = true;
|
||||
parser.BuildParseTree = true;
|
||||
IParseTree tree = parser.StartRule();
|
||||
}
|
||||
```
|
||||
|
|
|
@ -62,7 +62,7 @@ The steps to create your parsing code are the following:
|
|||
You are now ready to bundle your parsing code as follows:
|
||||
- following webpack specs, create a webpack.config file
|
||||
- in the webpack.config file, exclude node.js only modules using: node: { module: "empty", net: "empty", fs: "empty" }
|
||||
- from the cmd line, nag-vigate to the directory containing webpack.config and type: webpack
|
||||
- from the cmd line, navigate to the directory containing webpack.config and type: webpack
|
||||
|
||||
This will produce a single js file containing all your parsing code. Easy to include in your web pages!
|
||||
|
||||
|
|
|
@ -172,6 +172,7 @@ alias java='/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/
|
|||
alias javac='/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/javac'
|
||||
alias javadoc='/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/javadoc'
|
||||
alias jar='/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/jar'
|
||||
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
|
||||
```
|
||||
|
||||
You should see 0x33 in generated .class files after 0xCAFEBABE; see [Java SE 7 = 51 (0x33 hex)](https://en.wikipedia.org/wiki/Java_class_file):
|
||||
|
|
|
@ -854,4 +854,39 @@ public class ParserExecDescriptors {
|
|||
@CommentHasStringValue
|
||||
public String grammar;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a regression test for antlr/antlr4#2301.
|
||||
*/
|
||||
public static class OrderingPredicates extends BaseParserTestDescriptor {
|
||||
public String input = "POINT AT X";
|
||||
public String output = null;
|
||||
public String errors = null;
|
||||
public String startRule = "expr";
|
||||
public String grammarName = "Issue2301";
|
||||
|
||||
/**
|
||||
grammar Issue2301;
|
||||
|
||||
SPACES: [ \t\r\n]+ -> skip;
|
||||
|
||||
AT: 'AT';
|
||||
X : 'X';
|
||||
Y : 'Y';
|
||||
|
||||
ID: [A-Z]+;
|
||||
|
||||
constant
|
||||
: 'DUMMY'
|
||||
;
|
||||
|
||||
expr
|
||||
: ID constant?
|
||||
| expr AT X
|
||||
| expr AT Y
|
||||
;
|
||||
*/
|
||||
@CommentHasStringValue
|
||||
public String grammar;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,13 @@ 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 Antlr4.Runtime.Standard. We do not support other packages.
|
||||
The package id is [Antlr4.Runtime.Standard](https://www.nuget.org/packages/Antlr4.Runtime.Standard/). We do not support other packages.
|
||||
|
||||
Use the GUI or the following command in the Package Manager Console:
|
||||
|
||||
```
|
||||
Install-Package Antlr4.Runtime.Standard
|
||||
```
|
||||
|
||||
|
||||
### Step 6: You're done!
|
||||
|
|
|
@ -250,8 +250,8 @@
|
|||
37D727A21867AF1E007B6D10 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Dan McLaughlin";
|
||||
LastUpgradeCheck = 0920;
|
||||
ORGANIZATIONNAME = "ANTLR4 Project";
|
||||
TargetAttributes = {
|
||||
27C66A661C9591280021E494 = {
|
||||
CreatedOnToolsVersion = 7.2.1;
|
||||
|
@ -415,14 +415,20 @@
|
|||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
@ -469,14 +475,20 @@
|
|||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0920"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
|
@ -56,6 +57,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0920"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -10,6 +10,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
|
@ -30,6 +31,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1191,8 +1191,6 @@
|
|||
27745EFB1CE49C000067C6A3 /* RuntimeMetaData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeMetaData.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
27745EFC1CE49C000067C6A3 /* RuntimeMetaData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeMetaData.h; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
|
@ -1626,15 +1624,6 @@
|
|||
name = "Linked Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
278E313D1D9D6534001C28F9 /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
278E313E1D9D6534001C28F9 /* Tests.m */,
|
||||
278E31401D9D6534001C28F9 /* Info.plist */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
27DB448A1D045537007E790B /* xpath */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1667,7 +1656,6 @@
|
|||
children = (
|
||||
270C67F11CDB4F1E00116E17 /* antlrcpp-ios */,
|
||||
27874F221CCBB34200AF1C53 /* Linked Frameworks */,
|
||||
278E313D1D9D6534001C28F9 /* Tests */,
|
||||
37D727AB1867AF1E007B6D10 /* Products */,
|
||||
276E5C0A1CDB57AA003FF4B4 /* runtime */,
|
||||
);
|
||||
|
@ -2238,7 +2226,7 @@
|
|||
37D727A21867AF1E007B6D10 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 0910;
|
||||
ORGANIZATIONNAME = ANTLR;
|
||||
TargetAttributes = {
|
||||
270C67EF1CDB4F1E00116E17 = {
|
||||
|
@ -2855,7 +2843,9 @@
|
|||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
|
@ -2863,6 +2853,8 @@
|
|||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
|
@ -2908,7 +2900,9 @@
|
|||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
|
@ -2916,6 +2910,8 @@
|
|||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0910"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -36,6 +37,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0920"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -36,6 +37,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "0920"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,6 +26,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -36,6 +37,7 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -66,6 +66,7 @@ void ATNState::addTransition(size_t index, Transition *e) {
|
|||
}
|
||||
|
||||
Transition *ATNState::removeTransition(size_t index) {
|
||||
Transition *result = transitions[index];
|
||||
transitions.erase(transitions.begin() + index);
|
||||
return nullptr;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
* Use of this file is governed by the BSD 3-clause license that
|
||||
* can be found in the LICENSE.txt file in the project root.
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ void LexerATNSimulator::clearDFA() {
|
|||
size_t size = _decisionToDFA.size();
|
||||
_decisionToDFA.clear();
|
||||
for (size_t d = 0; d < size; ++d) {
|
||||
_decisionToDFA.push_back(dfa::DFA(atn.getDecisionState(d), d));
|
||||
_decisionToDFA.emplace_back(atn.getDecisionState(d), d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ dfa::DFAState *LexerATNSimulator::getExistingTargetState(dfa::DFAState *s, size_
|
|||
#endif
|
||||
|
||||
if (iterator != s->edges.end())
|
||||
retval = iterator->second;
|
||||
retval = iterator->second;
|
||||
}
|
||||
_edgeLock.readUnlock();
|
||||
return retval;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
* Use of this file is governed by the BSD 3-clause license that
|
||||
* can be found in the LICENSE.txt file in the project root.
|
||||
*/
|
||||
|
@ -127,8 +127,10 @@ size_t ParserATNSimulator::adaptivePredict(TokenStream *input, size_t decision,
|
|||
dfa::DFAState *newState = new dfa::DFAState(std::move(s0_closure)); /* mem-check: managed by the DFA or deleted below */
|
||||
s0 = addDFAState(dfa, newState);
|
||||
|
||||
delete dfa.s0; // Delete existing s0 DFA state, if there's any.
|
||||
dfa.s0 = s0;
|
||||
if (dfa.s0 != s0) {
|
||||
delete dfa.s0; // Delete existing s0 DFA state, if there's any.
|
||||
dfa.s0 = s0;
|
||||
}
|
||||
if (s0 != newState) {
|
||||
delete newState; // If there was already a state with this config set we don't need the new one.
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ size_t ProfilingATNSimulator::adaptivePredict(TokenStream *input, size_t decisio
|
|||
_sllStopIndex = -1;
|
||||
_llStopIndex = -1;
|
||||
_currentDecision = decision;
|
||||
high_resolution_clock::time_point start = high_resolution_clock::now(); // expensive but useful info
|
||||
high_resolution_clock::time_point start = high_resolution_clock::now();
|
||||
size_t alt = ParserATNSimulator::adaptivePredict(input, decision, outerContext);
|
||||
high_resolution_clock::time_point stop = high_resolution_clock::now();
|
||||
_decisions[decision].timeInPrediction += duration_cast<nanoseconds>(stop - start).count();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
||||
* Use of this file is governed by the BSD 3-clause license that
|
||||
* can be found in the LICENSE.txt file in the project root.
|
||||
*/
|
||||
|
@ -40,11 +40,10 @@ namespace misc {
|
|||
IntervalSet(IntervalSet&& set);
|
||||
|
||||
template<typename T1, typename... T_NEXT>
|
||||
IntervalSet(int, T1 t1, T_NEXT&&... next) : IntervalSet()
|
||||
{
|
||||
// The first int argument is an ignored count for compatibility
|
||||
// with the previous varargs based interface.
|
||||
addItems(t1, std::forward<T_NEXT>(next)...);
|
||||
IntervalSet(int, T1 t1, T_NEXT&&... next) : IntervalSet() {
|
||||
// The first int argument is an ignored count for compatibility
|
||||
// with the previous varargs based interface.
|
||||
addItems(t1, std::forward<T_NEXT>(next)...);
|
||||
}
|
||||
|
||||
IntervalSet& operator=(IntervalSet const& set);
|
||||
|
@ -78,10 +77,9 @@ namespace misc {
|
|||
IntervalSet& addAll(const IntervalSet &set);
|
||||
|
||||
template<typename T1, typename... T_NEXT>
|
||||
void addItems(T1 t1, T_NEXT&&... next)
|
||||
{
|
||||
add(t1);
|
||||
addItems(std::forward<T_NEXT>(next)...);
|
||||
void addItems(T1 t1, T_NEXT&&... next) {
|
||||
add(t1);
|
||||
addItems(std::forward<T_NEXT>(next)...);
|
||||
}
|
||||
|
||||
IntervalSet complement(ssize_t minElement, ssize_t maxElement) const;
|
||||
|
|
|
@ -11,6 +11,3 @@ Any::~Any()
|
|||
{
|
||||
delete _ptr;
|
||||
}
|
||||
|
||||
Any::Base::~Base() {
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ struct ANTLR4CPP_PUBLIC Any
|
|||
|
||||
private:
|
||||
struct Base {
|
||||
virtual ~Base();
|
||||
virtual ~Base() {};
|
||||
virtual Base* clone() const = 0;
|
||||
};
|
||||
|
||||
|
@ -112,10 +112,21 @@ private:
|
|||
|
||||
T value;
|
||||
|
||||
Base* clone() const {
|
||||
return clone<>();
|
||||
}
|
||||
|
||||
private:
|
||||
template<int N = 0, typename std::enable_if<N == N && std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
|
||||
Base* clone() const {
|
||||
return new Derived<T>(value);
|
||||
}
|
||||
|
||||
template<int N = 0, typename std::enable_if<N == N && !std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
|
||||
Base* clone() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Base* clone() const
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
<phase>process-classes</phase>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Automatic-Module-Name>org.antlr.antlr4.runtime</Automatic-Module-Name>
|
||||
<Bundle-SymbolicName>org.antlr.antlr4-runtime</Bundle-SymbolicName>
|
||||
</instructions>
|
||||
</configuration>
|
||||
|
|
|
@ -11,7 +11,7 @@ require('./polyfills/fromcodepoint');
|
|||
|
||||
// Vacuum all input from a string and then treat it like a buffer.
|
||||
|
||||
function _loadString(stream, decodeToUnicodeCodePoints) {
|
||||
function _loadString(stream) {
|
||||
stream._index = 0;
|
||||
stream.data = [];
|
||||
if (stream.decodeToUnicodeCodePoints) {
|
||||
|
|
|
@ -1608,7 +1608,7 @@ class ParserATNSimulator(ATNSimulator):
|
|||
|
||||
def reportAttemptingFullContext(self, dfa:DFA, conflictingAlts:set, configs:ATNConfigSet, startIndex:int, stopIndex:int):
|
||||
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
|
||||
interval = range(startIndex, stopIndex + 1)
|
||||
interval = (startIndex, stopIndex + 1)
|
||||
print("reportAttemptingFullContext decision=" + str(dfa.decision) + ":" + str(configs) +
|
||||
", input=" + self.parser.getTokenStream().getText(interval))
|
||||
if self.parser is not None:
|
||||
|
@ -1616,7 +1616,7 @@ class ParserATNSimulator(ATNSimulator):
|
|||
|
||||
def reportContextSensitivity(self, dfa:DFA, prediction:int, configs:ATNConfigSet, startIndex:int, stopIndex:int):
|
||||
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
|
||||
interval = range(startIndex, stopIndex + 1)
|
||||
interval = (startIndex, stopIndex + 1)
|
||||
print("reportContextSensitivity decision=" + str(dfa.decision) + ":" + str(configs) +
|
||||
", input=" + self.parser.getTokenStream().getText(interval))
|
||||
if self.parser is not None:
|
||||
|
@ -1642,7 +1642,7 @@ class ParserATNSimulator(ATNSimulator):
|
|||
# }
|
||||
# i++;
|
||||
# }
|
||||
interval = range(startIndex, stopIndex + 1)
|
||||
interval = (startIndex, stopIndex + 1)
|
||||
print("reportAmbiguity " + str(ambigAlts) + ":" + str(configs) +
|
||||
", input=" + self.parser.getTokenStream().getText(interval))
|
||||
if self.parser is not None:
|
||||
|
|
|
@ -135,8 +135,8 @@ class PrecedencePredicate(SemanticContext):
|
|||
else:
|
||||
return None
|
||||
|
||||
def __cmp__(self, other):
|
||||
return self.precedence - other.precedence
|
||||
def __lt__(self, other):
|
||||
return self.precedence < other.precedence
|
||||
|
||||
def __hash__(self):
|
||||
return 31
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>58.2</version>
|
||||
<version>61.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
|
|
@ -236,9 +236,12 @@ public class <parser.name> extends <superClass; null="Parser"> {
|
|||
<endif>
|
||||
public static final int
|
||||
<parser.rules:{r | RULE_<r.name> = <r.index>}; separator=", ", wrap, anchor>;
|
||||
public static final String[] ruleNames = {
|
||||
<parser.ruleNames:{r | "<r>"}; separator=", ", wrap, anchor>
|
||||
};
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
<parser.ruleNames:{r | "<r>"}; separator=", ", wrap, anchor>
|
||||
};
|
||||
}
|
||||
public static final String[] ruleNames = makeRuleNames();
|
||||
|
||||
<vocabulary(parser.literalNames, parser.symbolicNames)>
|
||||
|
||||
|
@ -275,12 +278,18 @@ case <f.ruleIndex>:
|
|||
>>
|
||||
|
||||
vocabulary(literalNames, symbolicNames) ::= <<
|
||||
private static final String[] _LITERAL_NAMES = {
|
||||
<literalNames:{t | <t>}; null="null", separator=", ", wrap, anchor>
|
||||
};
|
||||
private static final String[] _SYMBOLIC_NAMES = {
|
||||
<symbolicNames:{t | <t>}; null="null", separator=", ", wrap, anchor>
|
||||
};
|
||||
private static String[] makeLiteralNames() {
|
||||
return new String[] {
|
||||
<literalNames:{t | <t>}; null="null", separator=", ", wrap, anchor>
|
||||
};
|
||||
}
|
||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||
private static String[] makeSymbolicNames() {
|
||||
return new String[] {
|
||||
<symbolicNames:{t | <t>}; null="null", separator=", ", wrap, anchor>
|
||||
};
|
||||
}
|
||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
|
||||
|
||||
/**
|
||||
|
@ -914,9 +923,12 @@ public class <lexer.name> extends <superClass; null="Lexer"> {
|
|||
<lexer.modes:{m| "<m>"}; separator=", ", wrap, anchor>
|
||||
};
|
||||
|
||||
public static final String[] ruleNames = {
|
||||
<lexer.ruleNames:{r | "<r>"}; separator=", ", wrap, anchor>
|
||||
};
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
<lexer.ruleNames:{r | "<r>"}; separator=", ", wrap, anchor>
|
||||
};
|
||||
}
|
||||
public static final String[] ruleNames = makeRuleNames();
|
||||
|
||||
<vocabulary(lexer.literalNames, lexer.symbolicNames)>
|
||||
|
||||
|
|
Loading…
Reference in New Issue