mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rexml/**/*.rb: removed commented-out code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
091cdca65e
commit
be1206c0ac
8 changed files with 4 additions and 178 deletions
|
@ -145,7 +145,6 @@ module REXML
|
|||
|
||||
def next( event )
|
||||
#print "In next with #{event.inspect}. "
|
||||
#puts "Next (#@current) is #{@events[@current]}"
|
||||
#p @previous
|
||||
return @previous.pop.next( event ) if @events[@current].nil?
|
||||
expand_ref_in( @events, @current ) if @events[@current].class == Ref
|
||||
|
@ -154,19 +153,15 @@ module REXML
|
|||
@events[@current-1].previous = self
|
||||
return @events[@current-1].next( event )
|
||||
end
|
||||
#puts "Current isn't a state"
|
||||
if ( @events[@current].matches?(event) )
|
||||
@current += 1
|
||||
if @events[@current].nil?
|
||||
#puts "#{inspect[0,5]} 1RETURNING #{@previous.inspect[0,5]}"
|
||||
return @previous.pop
|
||||
elsif @events[@current].kind_of? State
|
||||
@current += 1
|
||||
#puts "#{inspect[0,5]} 2RETURNING (#{@current-1}) #{@events[@current-1].inspect[0,5]}; on return, next is #{@events[@current]}"
|
||||
@events[@current-1].previous = self
|
||||
return @events[@current-1]
|
||||
else
|
||||
#puts "#{inspect[0,5]} RETURNING self w/ next(#@current) = #{@events[@current]}"
|
||||
return self
|
||||
end
|
||||
else
|
||||
|
@ -393,13 +388,10 @@ module REXML
|
|||
# Remove the references
|
||||
# Find the events
|
||||
end
|
||||
#puts "In next with #{event.inspect}."
|
||||
#puts "events is #{@events.inspect}"
|
||||
unless @events
|
||||
@events = []
|
||||
return nil
|
||||
end
|
||||
#puts "current = #@current"
|
||||
super
|
||||
end
|
||||
|
||||
|
@ -409,8 +401,6 @@ module REXML
|
|||
end
|
||||
|
||||
def expected
|
||||
#puts "IN CHOICE EXPECTED"
|
||||
#puts "EVENTS = #{@events.inspect}"
|
||||
return [@events[@current]] if @events.size > 0
|
||||
return @choices.collect do |x|
|
||||
if x[0].kind_of? State
|
||||
|
@ -479,8 +469,6 @@ module REXML
|
|||
@choice += 1
|
||||
end
|
||||
|
||||
#puts "In next with #{event.inspect}."
|
||||
#puts "events is #{@events.inspect}"
|
||||
@events = [] unless @events
|
||||
end
|
||||
|
||||
|
@ -491,29 +479,22 @@ module REXML
|
|||
return nil unless @events[@current]
|
||||
|
||||
expand_ref_in( @events, @current ) if @events[@current].class == Ref
|
||||
#puts "In next with #{event.inspect}."
|
||||
#puts "Next (#@current) is #{@events[@current]}"
|
||||
if ( @events[@current].kind_of? State )
|
||||
@current += 1
|
||||
@events[@current-1].previous = self
|
||||
return @events[@current-1].next( event )
|
||||
end
|
||||
#puts "Current isn't a state"
|
||||
return @previous.pop.next( event ) if @events[@current].nil?
|
||||
if ( @events[@current].matches?(event) )
|
||||
@current += 1
|
||||
if @events[@current].nil?
|
||||
#puts "#{inspect[0,5]} 1RETURNING self" unless @choices[@choice].nil?
|
||||
return self unless @choices[@choice].nil?
|
||||
#puts "#{inspect[0,5]} 1RETURNING #{@previous[-1].inspect[0,5]}"
|
||||
return @previous.pop
|
||||
elsif @events[@current].kind_of? State
|
||||
@current += 1
|
||||
#puts "#{inspect[0,5]} 2RETURNING (#{@current-1}) #{@events[@current-1].inspect[0,5]}; on return, next is #{@events[@current]}"
|
||||
@events[@current-1].previous = self
|
||||
return @events[@current-1]
|
||||
else
|
||||
#puts "#{inspect[0,5]} RETURNING self w/ next(#@current) = #{@events[@current]}"
|
||||
return self
|
||||
end
|
||||
else
|
||||
|
@ -527,8 +508,6 @@ module REXML
|
|||
end
|
||||
|
||||
def expected
|
||||
#puts "IN CHOICE EXPECTED"
|
||||
#puts "EVENTS = #{@events.inspect}"
|
||||
return [@events[@current]] if @events[@current]
|
||||
return @choices[@choice..-1].collect do |x|
|
||||
if x[0].kind_of? State
|
||||
|
|
|
@ -15,8 +15,6 @@ module REXML
|
|||
puts @root.inspect
|
||||
end
|
||||
def validate( event )
|
||||
#puts "Current: #@current"
|
||||
#puts "Event: #{event.inspect}"
|
||||
@attr_stack = [] unless defined? @attr_stack
|
||||
match = @current.next(event)
|
||||
raise ValidationException.new( "Validation error. Expected: "+
|
||||
|
@ -27,7 +25,6 @@ module REXML
|
|||
# Check for attributes
|
||||
case event[0]
|
||||
when :start_element
|
||||
#puts "Checking attributes"
|
||||
@attr_stack << event[2]
|
||||
begin
|
||||
sattr = [:start_attribute, nil]
|
||||
|
@ -35,22 +32,14 @@ module REXML
|
|||
text = [:text, nil]
|
||||
k, = event[2].find { |key,value|
|
||||
sattr[1] = key
|
||||
#puts "Looking for #{sattr.inspect}"
|
||||
m = @current.next( sattr )
|
||||
#puts "Got #{m.inspect}"
|
||||
if m
|
||||
# If the state has text children...
|
||||
#puts "Looking for #{eattr.inspect}"
|
||||
#puts "Expect #{m.expected}"
|
||||
if m.matches?( eattr )
|
||||
#puts "Got end"
|
||||
@current = m
|
||||
else
|
||||
#puts "Didn't get end"
|
||||
text[1] = value
|
||||
#puts "Looking for #{text.inspect}"
|
||||
m = m.next( text )
|
||||
#puts "Got #{m.inspect}"
|
||||
text[1] = nil
|
||||
return false unless m
|
||||
@current = m if m
|
||||
|
@ -94,7 +83,6 @@ module REXML
|
|||
end
|
||||
|
||||
def matches?( event )
|
||||
#puts "#@event_type =? #{event[0]} && #@event_arg =? #{event[1]} "
|
||||
return false unless event[0] == @event_type
|
||||
case event[0]
|
||||
when nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue