From 43b082d90c135d45f8157fcfd1cee2fedbb5d411 Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 10 Aug 2013 03:46:43 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/rexml/parsers/baseparser.rb | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc25ed4314..cb7cb957d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Aug 10 12:43:15 2013 Kouhei Sutou + + * 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 * test/rexml/parse/test_document_type_declaration.rb: Add tests for diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index 04a23f4428..e937b169be 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -61,11 +61,11 @@ module REXML ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um - ENTITY_START = /^\s*/um - SYSTEMENTITY = /^\s*(%.*?;)\s*$/um + ELEMENTDECL_START = /\A\s*/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 DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))" ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}" ATTDEF_RE = /#{ATTDEF}/ - ATTLISTDECL_START = /^\s*/um - NOTATIONDECL_START = /^\s*/um + NOTATIONDECL_START = /\A\s*/um SYSTEM = /\A\s*/um