Class: Antlr4::Runtime::SemanticContext::PrecedencePredicate
Constant Summary
NONE
Instance Attribute Summary collapse
Instance Method Summary
collapse
and, filter_precedence_predicates, or
Constructor Details
Returns a new instance of PrecedencePredicate.
57
58
59
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 57
def initialize(precedence = 0)
@precedence = precedence
end
|
Instance Attribute Details
#precedence ⇒ Object
Returns the value of attribute precedence.
55
56
57
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 55
def precedence
@precedence
end
|
Instance Method Details
#compare_to(o) ⇒ Object
69
70
71
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 69
def compare_to(o)
@precedence - o.precedence
end
|
#eql?(other) ⇒ Boolean
78
79
80
81
82
83
84
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 78
def eql?(other)
return false unless other.is_a? PrecedencePredicate
return true if self == other
@precedence == other.precedence
end
|
#eval(parser, parser_call_stack) ⇒ Object
61
62
63
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 61
def eval(parser, parser_call_stack)
parser.precpred(parser_call_stack, @precedence)
end
|
#eval_precedence(parser, parser_call_stack) ⇒ Object
65
66
67
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 65
def eval_precedence(parser, parser_call_stack)
SemanticContext::NONE if parser.precpred(parser_call_stack, @precedence)
end
|
#hash ⇒ Object
73
74
75
76
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 73
def hash
hash_code = 1
31 * hash_code + @precedence
end
|
#to_s ⇒ Object
precedence >= _precedenceStack.peek()
87
88
89
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 87
def to_s
'{' + @precedence + '>=prec}?'
end
|