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.
56
57
58
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 56
def initialize(precedence = 0)
@precedence = precedence
end
|
Instance Attribute Details
#precedence ⇒ Object
Returns the value of attribute precedence.
54
55
56
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 54
def precedence
@precedence
end
|
Instance Method Details
#compare_to(o) ⇒ Object
68
69
70
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 68
def compare_to(o)
@precedence - o.precedence
end
|
#eql?(other) ⇒ Boolean
77
78
79
80
81
82
83
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 77
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
60
61
62
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 60
def eval(parser, parser_call_stack)
parser.precpred(parser_call_stack, @precedence)
end
|
#eval_precedence(parser, parser_call_stack) ⇒ Object
64
65
66
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 64
def eval_precedence(parser, parser_call_stack)
SemanticContext::NONE if parser.precpred(parser_call_stack, @precedence)
end
|
#hash ⇒ Object
72
73
74
75
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 72
def hash
hash_code = 1
31 * hash_code + @precedence
end
|
#to_s ⇒ Object
precedence >= _precedenceStack.peek()
86
87
88
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 86
def to_s
'' + @precedence + '>=precend?'
end
|