Merge branch 'master' into patch-2
This commit is contained in:
commit
ed5f07575d
|
@ -1,5 +1,8 @@
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
[*.{java,stg}]
|
[*.{java,stg}]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
|
@ -151,7 +151,14 @@ YYYY/MM/DD, github id, Full name, email
|
||||||
2017/06/11, erikbra, Erik A. Brandstadmoen, erik@brandstadmoen.net
|
2017/06/11, erikbra, Erik A. Brandstadmoen, erik@brandstadmoen.net
|
||||||
2017/06/10, jm-mikkelsen, Jan Martin Mikkelsen, janm@transactionware.com
|
2017/06/10, jm-mikkelsen, Jan Martin Mikkelsen, janm@transactionware.com
|
||||||
2017/06/25, alimg, Alim Gökkaya, alim.gokkaya@gmail.com
|
2017/06/25, alimg, Alim Gökkaya, alim.gokkaya@gmail.com
|
||||||
|
2017/06/28, jBugman, Sergey Parshukov, codedby@bugman.me
|
||||||
|
2017/07/09, neatnerd, Mike Arshinskiy, neatnerd@users.noreply.github.com
|
||||||
2017/07/11, dhalperi, Daniel Halperin, daniel@halper.in
|
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
|
2017/07/27, shirou, WAKAYAMA Shirou, shirou.faw@gmail.com
|
||||||
2017/07/09, neatnerd, Mike Arshinskiy, neatnerd@users.noreply.github.com
|
2017/07/09, neatnerd, Mike Arshinskiy, neatnerd@users.noreply.github.com
|
||||||
2017/09/11, sachinjain024, Sachin Jain, sachinjain024@gmail.com
|
2017/07/27, matthauck, Matt Hauck, matthauck@gmail.com
|
||||||
|
2017/07/27, shirou, WAKAYAMA Shirou, shirou.faw@gmail.com
|
||||||
|
2017/08/20, tiagomazzutti, Tiago Mazzutti, tiagomzt@gmail.com
|
||||||
|
2017/09/11, sachinjain024, Sachin Jain, sachinjain024@gmail.com
|
|
@ -21,11 +21,13 @@ $ curl -O http://www.antlr.org/download/antlr-4.5.3-complete.jar
|
||||||
Or just download in browser from website:
|
Or just download in browser from website:
|
||||||
[http://www.antlr.org/download.html](http://www.antlr.org/download.html)
|
[http://www.antlr.org/download.html](http://www.antlr.org/download.html)
|
||||||
and put it somewhere rational like `/usr/local/lib`.
|
and put it somewhere rational like `/usr/local/lib`.
|
||||||
|
|
||||||
2. Add `antlr-4.5.3-complete.jar` to your `CLASSPATH`:
|
2. Add `antlr-4.5.3-complete.jar` to your `CLASSPATH`:
|
||||||
```
|
```
|
||||||
$ export CLASSPATH=".:/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH"
|
$ export CLASSPATH=".:/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH"
|
||||||
```
|
```
|
||||||
It's also a good idea to put this in your `.bash_profile` or whatever your startup script is.
|
It's also a good idea to put this in your `.bash_profile` or whatever your startup script is.
|
||||||
|
|
||||||
3. Create aliases for the ANTLR Tool, and `TestRig`.
|
3. Create aliases for the ANTLR Tool, and `TestRig`.
|
||||||
```
|
```
|
||||||
$ alias antlr4='java -Xmx500M -cp "/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
|
$ alias antlr4='java -Xmx500M -cp "/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
|
||||||
|
@ -39,7 +41,7 @@ $ alias grun='java org.antlr.v4.gui.TestRig'
|
||||||
0. Install Java (version 1.6 or higher)
|
0. Install Java (version 1.6 or higher)
|
||||||
1. Download antlr-4.5.3-complete.jar (or whatever version) from [http://www.antlr.org/download/](http://www.antlr.org/download/)
|
1. Download antlr-4.5.3-complete.jar (or whatever version) from [http://www.antlr.org/download/](http://www.antlr.org/download/)
|
||||||
Save to your directory for 3rd party Java libraries, say `C:\Javalib`
|
Save to your directory for 3rd party Java libraries, say `C:\Javalib`
|
||||||
2. Add `antlr-4.5-complete.jar` to CLASSPATH, either:
|
2. Add `antlr-4.5.3-complete.jar` to CLASSPATH, either:
|
||||||
* Permanently: Using System Properties dialog > Environment variables > Create or append to `CLASSPATH` variable
|
* Permanently: Using System Properties dialog > Environment variables > Create or append to `CLASSPATH` variable
|
||||||
* Temporarily, at command line:
|
* Temporarily, at command line:
|
||||||
```
|
```
|
||||||
|
|
|
@ -1092,7 +1092,10 @@ nextTransition_continue: ;
|
||||||
protected internal Guid ReadUUID()
|
protected internal Guid ReadUUID()
|
||||||
{
|
{
|
||||||
byte[] d = BitConverter.GetBytes (ReadLong ());
|
byte[] d = BitConverter.GetBytes (ReadLong ());
|
||||||
Array.Reverse(d);
|
if(BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
|
Array.Reverse(d);
|
||||||
|
}
|
||||||
short c = (short)ReadInt();
|
short c = (short)ReadInt();
|
||||||
short b = (short)ReadInt();
|
short b = (short)ReadInt();
|
||||||
int a = ReadInt32();
|
int a = ReadInt32();
|
||||||
|
|
|
@ -33,6 +33,7 @@ endif()
|
||||||
if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR
|
if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR
|
||||||
CMAKE_VERSION VERSION_GREATER "3.3.0")
|
CMAKE_VERSION VERSION_GREATER "3.3.0")
|
||||||
CMAKE_POLICY(SET CMP0059 OLD)
|
CMAKE_POLICY(SET CMP0059 OLD)
|
||||||
|
CMAKE_POLICY(SET CMP0054 OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace atn {
|
||||||
* utility methods for analyzing configuration sets for conflicts and/or
|
* utility methods for analyzing configuration sets for conflicts and/or
|
||||||
* ambiguities.
|
* ambiguities.
|
||||||
*/
|
*/
|
||||||
enum class ANTLR4CPP_PUBLIC PredictionMode {
|
enum class PredictionMode {
|
||||||
/**
|
/**
|
||||||
* The SLL(*) prediction mode. This prediction mode ignores the current
|
* The SLL(*) prediction mode. This prediction mode ignores the current
|
||||||
* parser context when making predictions. This is the fastest prediction
|
* parser context when making predictions. This is the fastest prediction
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
<plugin> <!-- create src jar -->
|
<plugin> <!-- create src jar -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|
|
@ -401,11 +401,11 @@ DoubleDict.prototype.set = function (a, b, o) {
|
||||||
|
|
||||||
|
|
||||||
function escapeWhitespace(s, escapeSpaces) {
|
function escapeWhitespace(s, escapeSpaces) {
|
||||||
s = s.replace("\t", "\\t");
|
s = s.replace(/\t/g, "\\t")
|
||||||
s = s.replace("\n", "\\n");
|
.replace(/\n/g, "\\n")
|
||||||
s = s.replace("\r", "\\r");
|
.replace(/\r/g, "\\r");
|
||||||
if (escapeSpaces) {
|
if (escapeSpaces) {
|
||||||
s = s.replace(" ", "\u00B7");
|
s = s.replace(/ /g, "\u00B7");
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -443,4 +443,4 @@ exports.hashStuff = hashStuff;
|
||||||
exports.escapeWhitespace = escapeWhitespace;
|
exports.escapeWhitespace = escapeWhitespace;
|
||||||
exports.arrayToString = arrayToString;
|
exports.arrayToString = arrayToString;
|
||||||
exports.titleCase = titleCase;
|
exports.titleCase = titleCase;
|
||||||
exports.equalArrays = equalArrays;
|
exports.equalArrays = equalArrays;
|
||||||
|
|
|
@ -218,6 +218,13 @@ class Parser (Recognizer):
|
||||||
self._ctx.exitRule(listener)
|
self._ctx.exitRule(listener)
|
||||||
listener.exitEveryRule(self._ctx)
|
listener.exitEveryRule(self._ctx)
|
||||||
|
|
||||||
|
# Gets the number of syntax errors reported during parsing. This value is
|
||||||
|
# incremented each time {@link #notifyErrorListeners} is called.
|
||||||
|
#
|
||||||
|
# @see #notifyErrorListeners
|
||||||
|
#
|
||||||
|
def getNumberOfSyntaxErrors(self):
|
||||||
|
return self._syntaxErrors
|
||||||
|
|
||||||
def getTokenFactory(self):
|
def getTokenFactory(self):
|
||||||
return self._input.tokenSource._factory
|
return self._input.tokenSource._factory
|
||||||
|
|
|
@ -227,6 +227,14 @@ class Parser (Recognizer):
|
||||||
listener.exitEveryRule(self._ctx)
|
listener.exitEveryRule(self._ctx)
|
||||||
|
|
||||||
|
|
||||||
|
# Gets the number of syntax errors reported during parsing. This value is
|
||||||
|
# incremented each time {@link #notifyErrorListeners} is called.
|
||||||
|
#
|
||||||
|
# @see #notifyErrorListeners
|
||||||
|
#
|
||||||
|
def getNumberOfSyntaxErrors(self):
|
||||||
|
return self._syntaxErrors
|
||||||
|
|
||||||
def getTokenFactory(self):
|
def getTokenFactory(self):
|
||||||
return self._input.tokenSource._factory
|
return self._input.tokenSource._factory
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from antlr4.atn.LexerATNSimulator import LexerATNSimulator
|
||||||
from antlr4.atn.ParserATNSimulator import ParserATNSimulator
|
from antlr4.atn.ParserATNSimulator import ParserATNSimulator
|
||||||
from antlr4.atn.PredictionMode import PredictionMode
|
from antlr4.atn.PredictionMode import PredictionMode
|
||||||
from antlr4.PredictionContext import PredictionContextCache
|
from antlr4.PredictionContext import PredictionContextCache
|
||||||
from antlr4.ParserRuleContext import ParserRuleContext
|
from antlr4.ParserRuleContext import RuleContext, ParserRuleContext
|
||||||
from antlr4.tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode
|
from antlr4.tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode
|
||||||
from antlr4.error.Errors import RecognitionException, IllegalStateException, NoViableAltException
|
from antlr4.error.Errors import RecognitionException, IllegalStateException, NoViableAltException
|
||||||
from antlr4.error.ErrorStrategy import BailErrorStrategy
|
from antlr4.error.ErrorStrategy import BailErrorStrategy
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.antlr.v4.test.tool;
|
||||||
|
|
||||||
import org.antlr.v4.Tool;
|
import org.antlr.v4.Tool;
|
||||||
import org.antlr.v4.tool.ErrorType;
|
import org.antlr.v4.tool.ErrorType;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -60,6 +61,16 @@ public class TestToolSyntaxErrors extends BaseJavaToolTest {
|
||||||
super.testSetUp();
|
super.testSetUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void AllErrorCodesDistinct() {
|
||||||
|
ErrorType[] errorTypes = ErrorType.class.getEnumConstants();
|
||||||
|
for (int i = 0; i < errorTypes.length; i++) {
|
||||||
|
for (int j = i + 1; j < errorTypes.length; j++) {
|
||||||
|
Assert.assertNotEquals(errorTypes[i].code, errorTypes[j].code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test public void testA() { super.testErrors(A, true); }
|
@Test public void testA() { super.testErrors(A, true); }
|
||||||
|
|
||||||
@Test public void testExtraColon() {
|
@Test public void testExtraColon() {
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<plugin> <!-- create src jar -->
|
<plugin> <!-- create src jar -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
<plugin> <!-- include code-generated sources -->
|
<plugin> <!-- include code-generated sources -->
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>generate-sources</phase>
|
<phase>generate-sources</phase>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fileHeader(grammarFileName, ANTLRVersion) ::= <<
|
fileHeader(grammarFileName, ANTLRVersion) ::= <<
|
||||||
// Generated from <grammarFileName; format="java-escape"> by ANTLR <ANTLRVersion>.
|
// Code generated from <grammarFileName; format="java-escape"> by ANTLR <ANTLRVersion>. DO NOT EDIT.
|
||||||
>>
|
>>
|
||||||
|
|
||||||
ParserFile(file, parser, namedActions, contextSuperClass) ::= <<
|
ParserFile(file, parser, namedActions, contextSuperClass) ::= <<
|
||||||
|
|
|
@ -36,12 +36,12 @@
|
||||||
* REQUIRED.
|
* REQUIRED.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pythonTypeInitMap ::= [
|
javascriptTypeInitMap ::= [
|
||||||
"bool":"False",
|
"bool":"false",
|
||||||
"int":"0",
|
"int":"0",
|
||||||
"float":"0.0",
|
"float":"0.0",
|
||||||
"str":"",
|
"str":"",
|
||||||
default:"None" // anything other than a primitive type is an object
|
default:"{}" // anything other than a primitive type is an object
|
||||||
]
|
]
|
||||||
|
|
||||||
// args must be <object-model-object>, <fields-resulting-in-STs>
|
// args must be <object-model-object>, <fields-resulting-in-STs>
|
||||||
|
@ -802,6 +802,9 @@ var antlr4 = require('antlr4/index');
|
||||||
>>
|
>>
|
||||||
|
|
||||||
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= <<
|
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= <<
|
||||||
|
<if(superClass)>
|
||||||
|
var <superClass> = require('./<superClass>').<superClass>;
|
||||||
|
<endif>
|
||||||
|
|
||||||
<atn>
|
<atn>
|
||||||
|
|
||||||
|
@ -860,7 +863,7 @@ var serializedATN = ["<model.serialized; wrap={",<\n> "}>"].join("");
|
||||||
* must be an object, default value is "null".
|
* must be an object, default value is "null".
|
||||||
*/
|
*/
|
||||||
initValue(typeName) ::= <<
|
initValue(typeName) ::= <<
|
||||||
<javaTypeInitMap.(typeName)>
|
<javacriptTypeInitMap.(typeName)>
|
||||||
>>
|
>>
|
||||||
|
|
||||||
codeFileExtension() ::= ".js"
|
codeFileExtension() ::= ".js"
|
||||||
|
|
|
@ -809,7 +809,7 @@ def serializedATN():
|
||||||
* must be an object, default value is "null".
|
* must be an object, default value is "null".
|
||||||
*/
|
*/
|
||||||
initValue(typeName) ::= <<
|
initValue(typeName) ::= <<
|
||||||
<javaTypeInitMap.(typeName)>
|
<pythonTypeInitMap.(typeName)>
|
||||||
>>
|
>>
|
||||||
|
|
||||||
codeFileExtension() ::= ".py"
|
codeFileExtension() ::= ".py"
|
||||||
|
|
|
@ -816,7 +816,7 @@ def serializedATN():
|
||||||
* must be an object, default value is "null".
|
* must be an object, default value is "null".
|
||||||
*/
|
*/
|
||||||
initValue(typeName) ::= <<
|
initValue(typeName) ::= <<
|
||||||
<javaTypeInitMap.(typeName)>
|
<pythonTypeInitMap.(typeName)>
|
||||||
>>
|
>>
|
||||||
|
|
||||||
codeFileExtension() ::= ".py"
|
codeFileExtension() ::= ".py"
|
||||||
|
|
|
@ -394,11 +394,11 @@ public enum ErrorType {
|
||||||
*/
|
*/
|
||||||
IMPORT_NAME_CLASH(113, "<arg.typeString> grammar <arg.name> and imported <arg2.typeString> grammar <arg2.name> both generate <arg2.recognizerName>", ErrorSeverity.ERROR),
|
IMPORT_NAME_CLASH(113, "<arg.typeString> grammar <arg.name> and imported <arg2.typeString> grammar <arg2.name> both generate <arg2.recognizerName>", ErrorSeverity.ERROR),
|
||||||
/**
|
/**
|
||||||
* Compiler Error 160.
|
* Compiler Error 114.
|
||||||
*
|
*
|
||||||
* <p>cannot find tokens file <em>filename</em></p>
|
* <p>cannot find tokens file <em>filename</em></p>
|
||||||
*/
|
*/
|
||||||
CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR(160, "cannot find tokens file <arg>", ErrorSeverity.ERROR),
|
CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR(114, "cannot find tokens file <arg>", ErrorSeverity.ERROR),
|
||||||
/**
|
/**
|
||||||
* Compiler Warning 118.
|
* Compiler Warning 118.
|
||||||
*
|
*
|
||||||
|
@ -522,7 +522,7 @@ public enum ErrorType {
|
||||||
*/
|
*/
|
||||||
USE_OF_BAD_WORD(134, "symbol <arg> conflicts with generated code in target language or runtime", ErrorSeverity.ERROR),
|
USE_OF_BAD_WORD(134, "symbol <arg> conflicts with generated code in target language or runtime", ErrorSeverity.ERROR),
|
||||||
/**
|
/**
|
||||||
* Compiler Error 134.
|
* Compiler Error 183.
|
||||||
*
|
*
|
||||||
* <p>rule reference <em>rule</em> is not currently supported in a set</p>
|
* <p>rule reference <em>rule</em> is not currently supported in a set</p>
|
||||||
*
|
*
|
||||||
|
@ -530,7 +530,7 @@ public enum ErrorType {
|
||||||
* Note: This error has the same number as the unrelated error
|
* Note: This error has the same number as the unrelated error
|
||||||
* {@link #USE_OF_BAD_WORD}.</p>
|
* {@link #USE_OF_BAD_WORD}.</p>
|
||||||
*/
|
*/
|
||||||
UNSUPPORTED_REFERENCE_IN_LEXER_SET(134, "rule reference <arg> is not currently supported in a set", ErrorSeverity.ERROR),
|
UNSUPPORTED_REFERENCE_IN_LEXER_SET(183, "rule reference <arg> is not currently supported in a set", ErrorSeverity.ERROR),
|
||||||
/**
|
/**
|
||||||
* Compiler Error 135.
|
* Compiler Error 135.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue