[前][次][番号順一覧][スレッド一覧]

ruby-changes:30408

From: kou <ko1@a...>
Date: Sat, 10 Aug 2013 12:46:48 +0900 (JST)
Subject: [ruby-changes:30408] kou:r42487 (trunk): * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):

kou	2013-08-10 12:46:43 +0900 (Sat, 10 Aug 2013)

  New Revision: 42487

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42487

  Log:
    * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
      Use "\A" instead of "^" in document type declaration patterns
      because they are used as the head match in content not the head
      match in line. They don't cause any problems in the current code
      but it should be fixed.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rexml/parsers/baseparser.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42486)
+++ ChangeLog	(revision 42487)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug 10 12:43:15 2013  Kouhei Sutou  <kou@c...>
+
+	* lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser):
+	  Use "\A" instead of "^" in document type declaration patterns
+	  because they are used as the head match in content not the head
+	  match in line. They don't cause any problems in the current code
+	  but it should be fixed.
+
 Sat Aug 10 12:39:00 2013  Kouhei Sutou  <kou@c...>
 
 	* test/rexml/parse/test_document_type_declaration.rb: Add tests for
Index: lib/rexml/parsers/baseparser.rb
===================================================================
--- lib/rexml/parsers/baseparser.rb	(revision 42486)
+++ lib/rexml/parsers/baseparser.rb	(revision 42487)
@@ -61,11 +61,11 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/baseparser.rb#L61
       ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um
       STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um
 
-      ENTITY_START = /^\s*<!ENTITY/
+      ENTITY_START = /\A\s*<!ENTITY/
       IDENTITY = /^([!\*\w\-]+)(\s+#{NCNAME_STR})?(\s+["'](.*?)['"])?(\s+['"](.*?)["'])?/u
-      ELEMENTDECL_START = /^\s*<!ELEMENT/um
-      ELEMENTDECL_PATTERN = /^\s*(<!ELEMENT.*?)>/um
-      SYSTEMENTITY = /^\s*(%.*?;)\s*$/um
+      ELEMENTDECL_START = /\A\s*<!ELEMENT/um
+      ELEMENTDECL_PATTERN = /\A\s*(<!ELEMENT.*?)>/um
+      SYSTEMENTITY = /\A\s*(%.*?;)\s*$/um
       ENUMERATION = "\\(\\s*#{NMTOKEN}(?:\\s*\\|\\s*#{NMTOKEN})*\\s*\\)"
       NOTATIONTYPE = "NOTATION\\s+\\(\\s*#{NAME}(?:\\s*\\|\\s*#{NAME})*\\s*\\)"
       ENUMERATEDTYPE = "(?:(?:#{NOTATIONTYPE})|(?:#{ENUMERATION}))"
@@ -74,9 +74,9 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/baseparser.rb#L74
       DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))"
       ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}"
       ATTDEF_RE = /#{ATTDEF}/
-      ATTLISTDECL_START = /^\s*<!ATTLIST/um
-      ATTLISTDECL_PATTERN = /^\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
-      NOTATIONDECL_START = /^\s*<!NOTATION/um
+      ATTLISTDECL_START = /\A\s*<!ATTLIST/um
+      ATTLISTDECL_PATTERN = /\A\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
+      NOTATIONDECL_START = /\A\s*<!NOTATION/um
       PUBLIC = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
       SYSTEM = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]