class MODL::Parser::Parsed::ParsedArrayValueItem

Class to represent a parsed grammar object

Attributes

array[RW]
map[RW]
pair[RW]
primitive[RW]
text[RW]

Public Class Methods

new(global) click to toggle source
# File lib/modl/parser/parsed.rb, line 495
def initialize(global)
  @global = global
end

Public Instance Methods

enterModl_array_value_item(ctx) click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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