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.
459 460 461 |
# File 'lib/modl/parser/parsed.rb', line 459 def initialize(global) @global = global end |
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
454 455 456 |
# File 'lib/modl/parser/parsed.rb', line 454 def array @array end |
#map ⇒ Object
Returns the value of attribute map.
453 454 455 |
# File 'lib/modl/parser/parsed.rb', line 453 def map @map end |
#pair ⇒ Object
Returns the value of attribute pair.
455 456 457 |
# File 'lib/modl/parser/parsed.rb', line 455 def pair @pair end |
#primitive ⇒ Object
Returns the value of attribute primitive.
456 457 458 |
# File 'lib/modl/parser/parsed.rb', line 456 def primitive @primitive end |
#text ⇒ Object
The simple text value rather than the object
457 458 459 |
# File 'lib/modl/parser/parsed.rb', line 457 def text @text end |
Instance Method Details
#enterModl_array_value_item(ctx) ⇒ Object
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/modl/parser/parsed.rb', line 481 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
471 472 473 474 475 476 477 478 479 |
# File 'lib/modl/parser/parsed.rb', line 471 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
463 464 465 466 467 468 469 |
# File 'lib/modl/parser/parsed.rb', line 463 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 |