class MODL::Parser::Parsed::ParsedStructure

Class to represent a parsed grammar object

Attributes

array[RW]
map[RW]
pair[RW]
top_level_conditional[RW]

Public Class Methods

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

Public Instance Methods

enterModl_structure(ctx) click to toggle source
# File lib/modl/parser/parsed.rb, line 167
def enterModl_structure(ctx)
  modl_pair = ctx.modl_pair
  modl_top_level_conditional = ctx.modl_top_level_conditional
  modl_map = ctx.modl_map
  modl_array = ctx.modl_array

  if !modl_pair.nil?
    @pair = ParsedPair.new @global
    modl_pair.enter_rule(@pair)
  elsif !modl_top_level_conditional.nil?
    @top_level_conditional = ParsedTopLevelConditional.new @global
    modl_top_level_conditional.enter_rule(@top_level_conditional)
  elsif !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)
  end
end
extract_hash() click to toggle source
# File lib/modl/parser/parsed.rb, line 188
def extract_hash
  return @array.extract_hash if @array
  return @pair.extract_hash if @pair
  return @top_level_conditional.extract_hash if @top_level_conditional
  return @map.extract_hash if @map
end