Class: MODL::Parser::Parsed::ParsedArrayValueItem
- Inherits:
-
MODLParserBaseListener
- Object
- Antlr4::Runtime::ParseTreeListener
- MODLParserListener
- MODLParserBaseListener
- MODL::Parser::Parsed::ParsedArrayValueItem
- 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.
-
#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_array_value_item(ctx) ⇒ Object
- #extract_hash ⇒ Object
- #find_property(key) ⇒ Object
-
#initialize(global) ⇒ ParsedArrayValueItem
constructor
A new instance of ParsedArrayValueItem.
Methods inherited from MODLParserBaseListener
#enterModl, #enterModl_array, #enterModl_array_conditional, #enterModl_array_conditional_return, #enterModl_array_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, #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_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, #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) ⇒ ParsedArrayValueItem
Returns a new instance of ParsedArrayValueItem.
495 496 497 |
# File 'lib/modl/parser/parsed.rb', line 495 def initialize(global) @global = global end |
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
490 491 492 |
# File 'lib/modl/parser/parsed.rb', line 490 def array @array end |
#map ⇒ Object
Returns the value of attribute map.
489 490 491 |
# File 'lib/modl/parser/parsed.rb', line 489 def map @map end |
#pair ⇒ Object
Returns the value of attribute pair.
491 492 493 |
# File 'lib/modl/parser/parsed.rb', line 491 def pair @pair end |
#primitive ⇒ Object
Returns the value of attribute primitive.
492 493 494 |
# File 'lib/modl/parser/parsed.rb', line 492 def primitive @primitive end |
#text ⇒ Object
The simple text value rather than the object
493 494 495 |
# File 'lib/modl/parser/parsed.rb', line 493 def text @text end |
Instance Method Details
#enterModl_array_value_item(ctx) ⇒ Object
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/modl/parser/parsed.rb', line 517 def enterModl_array_value_item(ctx) @text = nil modl_map = ctx.modl_map 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_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 |
#extract_hash ⇒ Object
507 508 509 510 511 512 513 514 515 |
# File 'lib/modl/parser/parsed.rb', line 507 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
499 500 501 502 503 504 505 |
# File 'lib/modl/parser/parsed.rb', line 499 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 |