Class: Antlr4::Runtime::SemanticContext
- Inherits:
-
Object
- Object
- Antlr4::Runtime::SemanticContext
show all
- Defined in:
- lib/antlr4/runtime/semantic_context.rb
Defined Under Namespace
Classes: AND, OR, Operator, PrecedencePredicate, Predicate
Constant Summary
collapse
- NONE =
Predicate.new
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.and(a, b) ⇒ Object
283
284
285
286
287
288
289
290
291
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 283
def self.and(a, b)
return b if a.nil? || a == NONE
return a if b.nil? || b == NONE
result = AND.new(a, b)
return result.opnds[0] if result.opnds.length == 1
result
end
|
.filter_precedence_predicates(collection) ⇒ Object
304
305
306
307
308
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 304
def self.filter_precedence_predicates(collection)
result = collection.select {|item| item.is_a? PrecedencePredicate}
collection.reject! {|item| (item.is_a? PrecedencePredicate)}
result
end
|
.or(a, b) ⇒ Object
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 293
def self.or(a, b)
return b if a.nil?
return a if b.nil?
return NONE if a == NONE || b == NONE
OR result = OR.new(a, b)
return result.opnds[0] if result.opnds.length == 1
result
end
|
Instance Method Details
#eval(parser, parser_call_stack) ⇒ Object
3
4
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 3
def eval(parser, parser_call_stack)
end
|
#eval_precedence(_parser, _parser_call_stack) ⇒ Object
6
7
8
|
# File 'lib/antlr4/runtime/semantic_context.rb', line 6
def eval_precedence(_parser, _parser_call_stack)
self
end
|