Merge branch 'master' into master
This commit is contained in:
commit
73170a2076
|
@ -181,5 +181,8 @@ YYYY/MM/DD, github id, Full name, email
|
|||
2017/12/20, kbsletten, Kyle Sletten, kbsletten@gmail.com
|
||||
2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com
|
||||
2018/02/11, io7m, Mark Raynsford, code@io7m.com
|
||||
2018/15/05, johnvanderholt, jan dillingh johnvanderholte@gmail.com
|
||||
2018/17/05, sinopsysHK, Eric Bardes, sinofwd@gmail.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();
|
||||
}
|
||||
```
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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