class MODL::Parser::Parsed::ParsedValue
Class to represent a parsed grammar object
Attributes
array[RW]
map[RW]
nbArray[RW]
pair[RW]
primitive[RW]
text[RW]
Public Class Methods
new(global)
click to toggle source
# File lib/modl/parser/parsed.rb, line 584 def initialize(global) @global = global end
Public Instance Methods
enterModl_value(ctx)
click to toggle source
# File lib/modl/parser/parsed.rb, line 620 def enterModl_value(ctx) modl_map = ctx.modl_map modl_nb_array = ctx.modl_nb_array 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_nb_array.nil? @nbArray = ParsedNbArray.new @global modl_nb_array.enter_rule(@nbArray) 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
evaluate()
click to toggle source
# File lib/modl/parser/parsed.rb, line 606 def evaluate return @primitive.evaluate if @primitive true end
extract_hash()
click to toggle source
# File lib/modl/parser/parsed.rb, line 596 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 588 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
value_obj()
click to toggle source
# File lib/modl/parser/parsed.rb, line 612 def value_obj return @map if @map return @array if @array return @nbArray if @nbArray return @pair if @pair return @primitive if @primitive end