ruby-changes:35580
From: hsbt <ko1@a...>
Date: Sun, 21 Sep 2014 12:10:38 +0900 (JST)
Subject: [ruby-changes:35580] hsbt:r47662 (trunk): * lib/rexml/**/*.rb: removed commented-out code.
hsbt 2014-09-21 12:10:27 +0900 (Sun, 21 Sep 2014) New Revision: 47662 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47662 Log: * lib/rexml/**/*.rb: removed commented-out code. Modified files: trunk/ChangeLog trunk/lib/rexml/comment.rb trunk/lib/rexml/parent.rb trunk/lib/rexml/parsers/sax2parser.rb trunk/lib/rexml/parsers/xpathparser.rb trunk/lib/rexml/validation/relaxng.rb trunk/lib/rexml/validation/validation.rb trunk/lib/rexml/xpath_parser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47661) +++ ChangeLog (revision 47662) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Sep 21 12:10:18 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/rexml/**/*.rb: removed commented-out code. + Sat Sep 20 03:46:58 2014 Masaki Matsushita <glass.saga@g...> * array.c: use rb_equal_opt() for performance improvement. Index: lib/rexml/parsers/xpathparser.rb =================================================================== --- lib/rexml/parsers/xpathparser.rb (revision 47661) +++ lib/rexml/parsers/xpathparser.rb (revision 47662) @@ -184,7 +184,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L184 # | '/' RelativeLocationPath? # | '//' RelativeLocationPath def LocationPath path, parsed - #puts "LocationPath '#{path}'" path = path.strip if path[0] == ?/ parsed << :document @@ -196,7 +195,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L195 path = path[1..-1] end end - #puts parsed.inspect return RelativeLocationPath( path, parsed ) if path.size > 0 end @@ -210,7 +208,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L208 # | RelativeLocationPath '//' Step AXIS = /^(ancestor|ancestor-or-self|attribute|child|descendant|descendant-or-self|following|following-sibling|namespace|parent|preceding|preceding-sibling|self)::/ def RelativeLocationPath path, parsed - #puts "RelativeLocationPath #{path}" while path.size > 0 # (axis or @ or <child::>) nodetest predicate > # OR > / Step @@ -227,7 +224,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L224 end else if path[0] == ?@ - #puts "ATTRIBUTE" parsed << :attribute path = path[1..-1] # Goto Nodetest @@ -239,10 +235,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L235 parsed << :child end - #puts "NODETESTING '#{path}'" n = [] path = NodeTest( path, n) - #puts "NODETEST RETURNED '#{path}'" if path[0] == ?[ path = Predicate( path, n ) @@ -282,7 +276,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L276 NODE_TYPE = /^(comment|text|node)\(\s*\)/m PI = /^processing-instruction\(/ def NodeTest path, parsed - #puts "NodeTest with #{path}" case path when /^\*/ path = $' @@ -304,13 +297,11 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L297 parsed << :processing_instruction parsed << (literal || '') when NCNAMETEST - #puts "NCNAMETEST" prefix = $1 path = $' parsed << :namespace parsed << prefix when QNAME - #puts "QNAME" prefix = $1 name = $2 path = $' @@ -324,22 +315,18 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L315 # Filters the supplied nodeset on the predicate(s) def Predicate path, parsed - #puts "PREDICATE with #{path}" return nil unless path[0] == ?[ predicates = [] while path[0] == ?[ path, expr = get_group(path) predicates << expr[1..-2] if expr end - #puts "PREDICATES = #{predicates.inspect}" predicates.each{ |pred| - #puts "ORING #{pred}" preds = [] parsed << :predicate parsed << preds OrExpr(pred, preds) } - #puts "PREDICATES = #{predicates.inspect}" path end @@ -350,10 +337,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L337 #| OrExpr S 'or' S AndExpr #| AndExpr def OrExpr path, parsed - #puts "OR >>> #{path}" n = [] rest = AndExpr( path, n ) - #puts "OR <<< #{rest}" if rest != path while rest =~ /^\s*( or )/ n = [ :or, n, [] ] @@ -371,16 +356,12 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L356 #| AndExpr S 'and' S EqualityExpr #| EqualityExpr def AndExpr path, parsed - #puts "AND >>> #{path}" n = [] rest = EqualityExpr( path, n ) - #puts "AND <<< #{rest}" if rest != path while rest =~ /^\s*( and )/ n = [ :and, n, [] ] - #puts "AND >>> #{rest}" rest = EqualityExpr( $', n[-1] ) - #puts "AND <<< #{rest}" end end if parsed.size == 0 and n.size != 0 @@ -394,10 +375,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L375 #| EqualityExpr ('=' | '!=') RelationalExpr #| RelationalExpr def EqualityExpr path, parsed - #puts "EQUALITY >>> #{path}" n = [] rest = RelationalExpr( path, n ) - #puts "EQUALITY <<< #{rest}" if rest != path while rest =~ /^\s*(!?=)\s*/ if $1[0] == ?! @@ -419,10 +398,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L398 #| RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr #| AdditiveExpr def RelationalExpr path, parsed - #puts "RELATION >>> #{path}" n = [] rest = AdditiveExpr( path, n ) - #puts "RELATION <<< #{rest}" if rest != path while rest =~ /^\s*([<>]=?)\s*/ if $1[0] == ?< @@ -446,10 +423,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L423 #| AdditiveExpr ('+' | S '-') MultiplicativeExpr #| MultiplicativeExpr def AdditiveExpr path, parsed - #puts "ADDITIVE >>> #{path}" n = [] rest = MultiplicativeExpr( path, n ) - #puts "ADDITIVE <<< #{rest}" if rest != path while rest =~ /^\s*(\+| -)\s*/ if $1[0] == ?+ @@ -471,10 +446,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L446 #| MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr #| UnaryExpr def MultiplicativeExpr path, parsed - #puts "MULT >>> #{path}" n = [] rest = UnaryExpr( path, n ) - #puts "MULT <<< #{rest}" if rest != path while rest =~ /^\s*(\*| div | mod )\s*/ if $1[0] == ?* @@ -507,10 +480,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L480 end parsed << :neg if mult < 0 - #puts "UNARY >>> #{path}" n = [] path = UnionExpr( path, n ) - #puts "UNARY <<< #{path}" parsed.concat( n ) path end @@ -518,10 +489,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L489 #| UnionExpr '|' PathExpr #| PathExpr def UnionExpr path, parsed - #puts "UNION >>> #{path}" n = [] rest = PathExpr( path, n ) - #puts "UNION <<< #{rest}" if rest != path while rest =~ /^\s*(\|)\s*/ n = [ :union, n, [] ] @@ -541,16 +510,13 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L510 def PathExpr path, parsed path =~ /^\s*/ path = $' - #puts "PATH >>> #{path}" n = [] rest = FilterExpr( path, n ) - #puts "PATH <<< '#{rest}'" if rest != path if rest and rest[0] == ?/ return RelativeLocationPath(rest, n) end end - #puts "BEFORE WITH '#{rest}'" rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w*]/ parsed.concat(n) return rest @@ -559,12 +525,9 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L525 #| FilterExpr Predicate #| PrimaryExpr def FilterExpr path, parsed - #puts "FILTER >>> #{path}" n = [] path = PrimaryExpr( path, n ) - #puts "FILTER <<< #{path}" path = Predicate(path, n) if path and path[0] == ?[ - #puts "FILTER <<< #{path}" parsed.concat(n) path end @@ -586,23 +549,19 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/xpathparser.rb#L549 parsed << varname #arry << @variables[ varname ] when /^(\w[-\w]*)(?:\()/ - #puts "PrimaryExpr :: Function >>> #$1 -- '#$''" fname = $1 tmp = $' - #puts "#{fname} =~ #{NT.inspect}" return path if fname =~ NT path = tmp parsed << :function parsed << fname path = FunctionCall(path, parsed) when NUMBER - #puts "LITERAL or NUMBER: #$1" varname = $1.nil? ? $2 : $1 path = $' parsed << :literal parsed << (varname.include?('.') ? varname.to_f : varname.to_i) when LITERAL - #puts "LITERAL or NUMBER: #$1" varname = $1.nil? ? $2 : $1 path = $' parsed << :literal Index: lib/rexml/parsers/sax2parser.rb =================================================================== --- lib/rexml/parsers/sax2parser.rb (revision 47661) +++ lib/rexml/parsers/sax2parser.rb (revision 47662) @@ -229,7 +229,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/sax2parser.rb#L229 def get_procs( symbol, name ) return nil if @procs.size == 0 @procs.find_all do |sym, match, block| - #puts sym.inspect+"=="+symbol.inspect+ "\t"+match.inspect+"=="+name.inspect+ "\t"+( (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( (name == match) or (match.kind_of? Regexp and name =~ match)))).to_s ( (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( Index: lib/rexml/validation/relaxng.rb =================================================================== --- lib/rexml/validation/relaxng.rb (revision 47661) +++ lib/rexml/validation/relaxng.rb (revision 47662) @@ -145,7 +145,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L145 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L153 @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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L388 # 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L401 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L469 @choice += 1 end - #puts "In next with #{event.inspect}." - #puts "events is #{@events.inspect}" @events = [] unless @events end @@ -491,29 +479,22 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L479 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/relaxng.rb#L508 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 Index: lib/rexml/validation/validation.rb =================================================================== --- lib/rexml/validation/validation.rb (revision 47661) +++ lib/rexml/validation/validation.rb (revision 47662) @@ -15,8 +15,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/validation.rb#L15 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/validation.rb#L25 # 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/validation.rb#L32 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 https://github.com/ruby/ruby/blob/trunk/lib/rexml/validation/validation.rb#L83 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 Index: lib/rexml/parent.rb =================================================================== --- lib/rexml/parent.rb (revision 47661) +++ lib/rexml/parent.rb (revision 47662) @@ -15,10 +15,8 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parent.rb#L15 end def add( object ) - #puts "PARENT GOTS #{size} CHILDREN" object.parent = self @children << object - #puts "PARENT NOW GOTS #{size} CHILDREN" object end Index: lib/rexml/comment.rb =================================================================== --- lib/rexml/comment.rb (revision 47661) +++ lib/rexml/comment.rb (revision 47662) @@ -21,7 +21,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/comment.rb#L21 # should be nil, not supplied, or a Parent to be set as the parent # of this object def initialize( first, second = nil ) - #puts "IN COMMENT CONSTRUCTOR; SECOND IS #{second.type}" super(second) if first.kind_of? String @string = first Index: lib/rexml/xpath_parser.rb =================================================================== --- lib/rexml/xpath_parser.rb (revision 47661) +++ lib/rexml/xpath_parser.rb (revision 47662) @@ -63,18 +63,12 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/xpath_parser.rb#L63 end def parse path, nodeset - #puts "#"*40 path_stack = @parser.parse( path ) - #puts "PARSE: #{path} => #{path_stack.inspect}" - #puts "PARSE: nodeset = #{nodeset.inspect}" match( path_stack, nodeset ) end def get_first path, nodeset - #puts "#"*40 path_stack = @parser.parse( path ) - #puts "PARSE: #{path} => #{path_stack.inspect}" - #puts "PARSE: nodeset = #{nodeset.inspect}" first( path_stack, nodeset ) end @@ -93,7 +87,6 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/xpath_parser.rb#L87 # # FIXME: This method is incomplete! def first( path_stack, node ) - #puts "#{depth}) Entering match( #{path.inspect}, #{tree.inspect} )" return nil if path.size == 0 case path[0] @@ -102,16 +95,12 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/xpath_parser.rb#L95 return first( path[1..-1], node ) when :child for c in node.children - #puts "#{depth}) CHILD checking #{name(c)}" r = first( path[1..-1], c ) - #puts "#{depth}) RETURNING #{r.inspect}" if r return r if r end when :qname name = path[2] - #puts "#{depth}) QNAME #{name(tree)} == #{name} (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/