class MODL::Parser::Parsed::ParsedTopLevelConditionalReturn

Class to represent a parsed grammar object

Attributes

structures[RW]

Public Class Methods

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

Public Instance Methods

enterModl_top_level_conditional_return(ctx) click to toggle source
# File lib/modl/parser/parsed.rb, line 1006
def enterModl_top_level_conditional_return(ctx)
  modl_structure = ctx.modl_structure
  return if modl_structure.empty?

  modl_structure.each do |str|
    structure = ParsedStructure.new @global
    str.enter_rule(structure)
    @structures << structure
  end
end
extract_hash() click to toggle source
# File lib/modl/parser/parsed.rb, line 994
def extract_hash
  return @structures[0].extract_hash if @structures.length == 1

  result = []
  @structures.each do |s|
    hash = s.extract_hash
    result << hash unless hash.nil?
  end
  return result unless result.length == 1
  return result[0] if result.length == 1
end