ruby-changes:15340
From: naruse <ko1@a...>
Date: Tue, 6 Apr 2010 06:10:19 +0900 (JST)
Subject: [ruby-changes:15340] Ruby:r27228 (trunk): * lib/rexml/parsers/baseparser.rb (LETTER, DIGIT):
naruse 2010-04-06 06:08:12 +0900 (Tue, 06 Apr 2010) New Revision: 27228 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27228 Log: * lib/rexml/parsers/baseparser.rb (LETTER, DIGIT): always use POSIX charclass. * lib/rexml/parsers/baseparser.rb (NAMECHAR): remove duplicated range. * lib/rexml/xmltokens.rb (NCNAME_STR, NAMECHAR): ditto. * lib/rexml/parsers/xpathparser.rb (PathExpr): ditto. * lib/rexml/text.rb (REXML::Text#initialize): initialize @parent. Modified files: trunk/ChangeLog trunk/lib/rexml/parsers/baseparser.rb trunk/lib/rexml/parsers/xpathparser.rb trunk/lib/rexml/text.rb trunk/lib/rexml/xmltokens.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27227) +++ ChangeLog (revision 27228) @@ -1,3 +1,18 @@ +Tue Apr 6 05:59:12 2010 NARUSE, Yui <naruse@r...> + + * lib/rexml/parsers/baseparser.rb (LETTER, DIGIT): + always use POSIX charclass. + + * lib/rexml/parsers/baseparser.rb (NAMECHAR): + remove duplicated range. + + * lib/rexml/xmltokens.rb (NCNAME_STR, NAMECHAR): ditto. + + * lib/rexml/parsers/xpathparser.rb (PathExpr): ditto. + + * lib/rexml/text.rb (REXML::Text#initialize): + initialize @parent. + Mon Apr 5 19:54:58 2010 NARUSE, Yui <naruse@r...> * re.c (make_regexp): use onig_new_with_source to keep Index: lib/rexml/parsers/xpathparser.rb =================================================================== --- lib/rexml/parsers/xpathparser.rb (revision 27227) +++ lib/rexml/parsers/xpathparser.rb (revision 27228) @@ -551,7 +551,7 @@ end end #puts "BEFORE WITH '#{rest}'" - rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w_*]/ + rest = LocationPath(rest, n) if rest =~ /\A[\/\.\@\[\w*]/ parsed.concat(n) return rest end Index: lib/rexml/parsers/baseparser.rb =================================================================== --- lib/rexml/parsers/baseparser.rb (revision 27227) +++ lib/rexml/parsers/baseparser.rb (revision 27228) @@ -25,15 +25,8 @@ # # Nat Price gave me some good ideas for the API. class BaseParser - if String.method_defined? :encode - # Oniguruma / POSIX [understands unicode] - LETTER = '[[:alpha:]]' - DIGIT = '[[:digit:]]' - else - # Ruby < 1.9 [doesn't understand unicode] - LETTER = 'a-zA-Z' - DIGIT = '\d' - end + LETTER = '[:alpha:]' + DIGIT = '[:digit:]' COMBININGCHAR = '' # TODO EXTENDER = '' # TODO @@ -42,7 +35,7 @@ NAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})" UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" - NAMECHAR = '[\-\w\d\.:]' + NAMECHAR = '[\-\w:]' NAME = "([\\w:]#{NAMECHAR}*)" NMTOKEN = "(?:#{NAMECHAR})+" NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*" Index: lib/rexml/xmltokens.rb =================================================================== --- lib/rexml/xmltokens.rb (revision 27227) +++ lib/rexml/xmltokens.rb (revision 27228) @@ -2,10 +2,10 @@ # Defines a number of tokens used for parsing XML. Not for general # consumption. module XMLTokens - NCNAME_STR= '[\w:][\-\w\d.]*' + NCNAME_STR= '[\w:][\-\w.]*' NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" - NAMECHAR = '[\-\w\d\.:]' + NAMECHAR = '[\-\w\.:]' NAME = "([\\w:]#{NAMECHAR}*)" NMTOKEN = "(?:#{NAMECHAR})+" NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*" Index: lib/rexml/text.rb =================================================================== --- lib/rexml/text.rb (revision 27227) +++ lib/rexml/text.rb (revision 27228) @@ -93,12 +93,11 @@ entity_filter=nil, illegal=NEEDS_A_SECOND_CHECK ) @raw = false + @parent = nil if parent super( parent ) @raw = parent.raw - else - @parent = nil end @raw = raw unless raw.nil? -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/