forked from jasder/antlr
Merge pull request #2302 from ericvergnaud/python-3-fix-2301
Fixes #2301
This commit is contained in:
commit
c9df334af8
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue