Class: MODL::Parser::Parsed::ParsedValue
- Inherits:
-
MODLParserBaseListener
- Object
- Antlr4::Runtime::ParseTreeListener
- MODLParserListener
- MODLParserBaseListener
- MODL::Parser::Parsed::ParsedValue
- Defined in:
- lib/modl/parser/parsed.rb
Overview
Class to represent a parsed grammar object
Instance Attribute Summary collapse
-
#array ⇒ Object
Returns the value of attribute array.
-
#map ⇒ Object
Returns the value of attribute map.
-
#nbArray ⇒ Object
Returns the value of attribute nbArray.
-
#pair ⇒ Object
Returns the value of attribute pair.
-
#primitive ⇒ Object
Returns the value of attribute primitive.
-
#text ⇒ Object
The simple text value rather than the object.
Instance Method Summary collapse
- #enterModl_value(ctx) ⇒ Object
- #evaluate ⇒ Object
- #extract_hash ⇒ Object
- #find_property(key) ⇒ Object
-
#initialize(global) ⇒ ParsedValue
constructor
A new instance of ParsedValue.
- #value_obj ⇒ Object
Methods inherited from MODLParserBaseListener
#enterModl, #enterModl_array, #enterModl_array_conditional, #enterModl_array_conditional_return, #enterModl_array_item, #enterModl_array_value_item, #enterModl_condition, #enterModl_condition_group, #enterModl_condition_test, #enterModl_map, #enterModl_map_conditional, #enterModl_map_conditional_return, #enterModl_map_item, #enterModl_nb_array, #enterModl_operator, #enterModl_pair, #enterModl_primitive, #enterModl_structure, #enterModl_top_level_conditional, #enterModl_top_level_conditional_return, #enterModl_value_conditional, #enterModl_value_conditional_return, #enterModl_value_item, #enter_every_rule, #exitModl, #exitModl_array, #exitModl_array_conditional, #exitModl_array_conditional_return, #exitModl_array_item, #exitModl_array_value_item, #exitModl_condition, #exitModl_condition_group, #exitModl_condition_test, #exitModl_map, #exitModl_map_conditional, #exitModl_map_conditional_return, #exitModl_map_item, #exitModl_nb_array, #exitModl_operator, #exitModl_pair, #exitModl_primitive, #exitModl_structure, #exitModl_top_level_conditional, #exitModl_top_level_conditional_return, #exitModl_value, #exitModl_value_conditional, #exitModl_value_conditional_return, #exitModl_value_item, #exit_every_rule, #visit_error_node, #visit_terminal
Methods inherited from MODLParserListener
#enterModl, #enterModl_array, #enterModl_array_conditional, #enterModl_array_conditional_return, #enterModl_array_item, #enterModl_array_value_item, #enterModl_condition, #enterModl_condition_group, #enterModl_condition_test, #enterModl_map, #enterModl_map_conditional, #enterModl_map_conditional_return, #enterModl_map_item, #enterModl_nb_array, #enterModl_operator, #enterModl_pair, #enterModl_primitive, #enterModl_structure, #enterModl_top_level_conditional, #enterModl_top_level_conditional_return, #enterModl_value_conditional, #enterModl_value_conditional_return, #enterModl_value_item, #exitModl, #exitModl_array, #exitModl_array_conditional, #exitModl_array_conditional_return, #exitModl_array_item, #exitModl_array_value_item, #exitModl_condition, #exitModl_condition_group, #exitModl_condition_test, #exitModl_map, #exitModl_map_conditional, #exitModl_map_conditional_return, #exitModl_map_item, #exitModl_nb_array, #exitModl_operator, #exitModl_pair, #exitModl_primitive, #exitModl_structure, #exitModl_top_level_conditional, #exitModl_top_level_conditional_return, #exitModl_value, #exitModl_value_conditional, #exitModl_value_conditional_return, #exitModl_value_item
Constructor Details
#initialize(global) ⇒ ParsedValue
Returns a new instance of ParsedValue.
584 585 586 |
# File 'lib/modl/parser/parsed.rb', line 584 def initialize(global) @global = global end |
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
578 579 580 |
# File 'lib/modl/parser/parsed.rb', line 578 def array @array end |
#map ⇒ Object
Returns the value of attribute map.
577 578 579 |
# File 'lib/modl/parser/parsed.rb', line 577 def map @map end |
#nbArray ⇒ Object
Returns the value of attribute nbArray.
579 580 581 |
# File 'lib/modl/parser/parsed.rb', line 579 def nbArray @nbArray end |
#pair ⇒ Object
Returns the value of attribute pair.
580 581 582 |
# File 'lib/modl/parser/parsed.rb', line 580 def pair @pair end |
#primitive ⇒ Object
Returns the value of attribute primitive.
581 582 583 |
# File 'lib/modl/parser/parsed.rb', line 581 def primitive @primitive end |
#text ⇒ Object
The simple text value rather than the object
582 583 584 |
# File 'lib/modl/parser/parsed.rb', line 582 def text @text end |
Instance Method Details
#enterModl_value(ctx) ⇒ Object
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/modl/parser/parsed.rb', line 620 def enterModl_value(ctx) modl_map = ctx.modl_map modl_nb_array = ctx.modl_nb_array modl_array = ctx.modl_array modl_pair = ctx.modl_pair modl_primitive = ctx.modl_primitive if !modl_map.nil? @map = ParsedMap.new @global modl_map.enter_rule(@map) elsif !modl_nb_array.nil? @nbArray = ParsedNbArray.new @global modl_nb_array.enter_rule(@nbArray) elsif !modl_array.nil? @array = ParsedArray.new @global modl_array.enter_rule(@array) elsif !modl_pair.nil? @pair = ParsedPair.new @global modl_pair.enter_rule(@pair) elsif !modl_primitive.nil? @primitive = ParsedPrimitive.new @global modl_primitive.enter_rule(@primitive) @text = @primitive.text end # ignoring comments! end |
#evaluate ⇒ Object
606 607 608 609 610 |
# File 'lib/modl/parser/parsed.rb', line 606 def evaluate return @primitive.evaluate if @primitive true end |
#extract_hash ⇒ Object
596 597 598 599 600 601 602 603 604 |
# File 'lib/modl/parser/parsed.rb', line 596 def extract_hash return @map.extract_hash if @map return @array.extract_hash if @array return @nbArray.extract_hash if @nbArray return @pair.extract_hash if @pair return @primitive.extract_hash if @primitive @text end |
#find_property(key) ⇒ Object
588 589 590 591 592 593 594 |
# File 'lib/modl/parser/parsed.rb', line 588 def find_property(key) return @map.find_property(key) if @map return @array.find_property(key) if @array return @nbArray.find_property(key) if @nbArray return @pair.find_property(key) if @pair return @primitive.find_property(key) if @primitive end |
#value_obj ⇒ Object
612 613 614 615 616 617 618 |
# File 'lib/modl/parser/parsed.rb', line 612 def value_obj return @map if @map return @array if @array return @nbArray if @nbArray return @pair if @pair return @primitive if @primitive end |