From 287a34ae0dfc23e4158f67cb7783d239f202c368 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 6 Mar 2009 03:56:38 +0000 Subject: * {ext,lib,test}/**/*.rb: removed trailing spaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/validation/relaxng.rb | 34 +++++++++++++++++----------------- lib/rexml/validation/validation.rb | 6 +++--- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'lib/rexml/validation') diff --git a/lib/rexml/validation/relaxng.rb b/lib/rexml/validation/relaxng.rb index 2b863710b4..2441901d7b 100644 --- a/lib/rexml/validation/relaxng.rb +++ b/lib/rexml/validation/relaxng.rb @@ -79,7 +79,7 @@ module REXML when "mixed" states << Interleave.new( self ) states[-2] << states[-1] - states[-1] << TEXT + states[-1] << TEXT when "define" states << [ event[2]["name"] ] when "ref" @@ -102,7 +102,7 @@ module REXML case event[1] when "element", "attribute" states[-1] << event - when "zeroOrMore", "oneOrMore", "choice", "optional", + when "zeroOrMore", "oneOrMore", "choice", "optional", "interleave", "group", "mixed" states.pop when "define" @@ -139,7 +139,7 @@ module REXML @events.each {|s| s.reset if s.kind_of? State } end - def previous=( previous ) + def previous=( previous ) @previous << previous end @@ -183,7 +183,7 @@ module REXML end def inspect - "< #{to_s} #{@events.collect{|e| + "< #{to_s} #{@events.collect{|e| pre = e == @events[@current] ? '#' : '' pre + e.inspect unless self == e }.join(', ')} >" @@ -201,15 +201,15 @@ module REXML protected def expand_ref_in( arry, ind ) new_events = [] - @references[ arry[ind].to_s ].each{ |evt| + @references[ arry[ind].to_s ].each{ |evt| add_event_to_arry(new_events,evt) } arry[ind,1] = new_events end - def add_event_to_arry( arry, evt ) + def add_event_to_arry( arry, evt ) evt = generate_event( evt ) - if evt.kind_of? String + if evt.kind_of? String arry[-1].event_arg = evt if arry[-1].kind_of? Event and @value @value = false else @@ -272,7 +272,7 @@ module REXML end def matches?(event) - @events[@current].matches?(event) || + @events[@current].matches?(event) || (@current == 0 and @previous[-1].matches?(event)) end @@ -319,7 +319,7 @@ module REXML end def reset - super + super @ord = 0 end @@ -345,7 +345,7 @@ module REXML end def matches?( event ) - @events[@current].matches?(event) || + @events[@current].matches?(event) || (@current == 0 and @ord > 0 and @previous[-1].matches?(event)) end @@ -412,7 +412,7 @@ module REXML #puts "IN CHOICE EXPECTED" #puts "EVENTS = #{@events.inspect}" return [@events[@current]] if @events.size > 0 - return @choices.collect do |x| + return @choices.collect do |x| if x[0].kind_of? State x[0].expected else @@ -426,12 +426,12 @@ module REXML end protected - def add_event_to_arry( arry, evt ) + def add_event_to_arry( arry, evt ) if evt.kind_of? State or evt.class == Ref arry << [evt] - elsif evt[0] == :text + elsif evt[0] == :text if arry[-1] and - arry[-1][-1].kind_of?( Event ) and + arry[-1][-1].kind_of?( Event ) and arry[-1][-1].event_type == :text and @value arry[-1][-1].event_arg = evt[1] @@ -478,7 +478,7 @@ module REXML @choices[idx] = old @choice += 1 end - + #puts "In next with #{event.inspect}." #puts "events is #{@events.inspect}" @events = [] unless @events @@ -490,7 +490,7 @@ module REXML next_current(event) unless @events[@current] return nil unless @events[@current] - expand_ref_in( @events, @current ) if @events[@current].class == Ref + 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 ) @@ -530,7 +530,7 @@ module REXML #puts "IN CHOICE EXPECTED" #puts "EVENTS = #{@events.inspect}" return [@events[@current]] if @events[@current] - return @choices[@choice..-1].collect do |x| + return @choices[@choice..-1].collect do |x| if x[0].kind_of? State x[0].expected else diff --git a/lib/rexml/validation/validation.rb b/lib/rexml/validation/validation.rb index 93f5bfb329..f0ffa78912 100644 --- a/lib/rexml/validation/validation.rb +++ b/lib/rexml/validation/validation.rb @@ -14,7 +14,7 @@ module REXML def dump puts @root.inspect end - def validate( event ) + def validate( event ) #puts "Current: #@current" #puts "Event: #{event.inspect}" @attr_stack = [] unless defined? @attr_stack @@ -33,12 +33,12 @@ module REXML sattr = [:start_attribute, nil] eattr = [:end_attribute] text = [:text, nil] - k,v = event[2].find { |key,value| + k,v = event[2].find { |key,value| sattr[1] = key #puts "Looking for #{sattr.inspect}" m = @current.next( sattr ) #puts "Got #{m.inspect}" - if m + if m # If the state has text children... #puts "Looking for #{eattr.inspect}" #puts "Expect #{m.expected}" -- cgit v1.2.3