bootstrap/peg_cbyte.rb
# note: a simpler implementation might create an intermediate parent for each child
a simpler implementation might create an intermediate parent for each child
a simpler implementation might create an intermediate parent for each child
def parse_setup
                    @parse_state = @root.alloc_state(self)
                    @child_succ_states = {}
                    @child_fail_states = {}
                    if @data.kind_of? Array
                        @data.each do |c|
                            c.parse_setup
                            @child_succ_states[c] = @root.alloc_state(self)
                            @child_fail_states[c] = @root.alloc_state(self)
                        end
                    end
                    @failure_state = @root.alloc_state(self)
                end
def parse_setup @parse_state = @root . alloc_state ( self ) @child_succ_states = { } @child_fail_states = { } if @data . kind_of? Array @data . each do | c | c . parse_setup @child_succ_states [ c ] = @root . alloc_state ( self ) @child_fail_states [ c ] = @root . alloc_state ( self ) end end @failure_state = @root . alloc_state ( self ) end
note: a simpler implementation might create an intermediate parent for each child
note : a simpler implementation might create an intermediate parent for each child