Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include private_constant-ed module #155

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/rexml/parsers/baseparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ module Private
ENTITYDECL_PATTERN = /(?:#{GEDECL_PATTERN})|(?:#{PEDECL_PATTERN})/um
end
private_constant :Private
include Private

def initialize( source )
self.stream = source
Expand Down Expand Up @@ -302,7 +301,7 @@ def pull_event
raise REXML::ParseException.new( "Bad ELEMENT declaration!", @source ) if md.nil?
return [ :elementdecl, "<!ELEMENT" + md[1] ]
elsif @source.match("ENTITY", true)
match = [:entitydecl, *@source.match(ENTITYDECL_PATTERN, true).captures.compact]
match = [:entitydecl, *@source.match(Private::ENTITYDECL_PATTERN, true).captures.compact]
ref = false
if match[1] == '%'
ref = true
Expand All @@ -328,7 +327,7 @@ def pull_event
match << '%' if ref
return match
elsif @source.match("ATTLIST", true)
md = @source.match(ATTLISTDECL_END, true)
md = @source.match(Private::ATTLISTDECL_END, true)
raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
element = md[1]
contents = md[0]
Expand Down Expand Up @@ -397,7 +396,7 @@ def pull_event
if @source.match("/", true)
@nsstack.shift
last_tag = @tags.pop
md = @source.match(CLOSE_PATTERN, true)
md = @source.match(Private::CLOSE_PATTERN, true)
if md and !last_tag
message = "Unexpected top-level end tag (got '#{md[1]}')"
raise REXML::ParseException.new(message, @source)
Expand Down Expand Up @@ -431,7 +430,7 @@ def pull_event
return process_instruction(start_position)
else
# Get the next tag
md = @source.match(TAG_PATTERN, true)
md = @source.match(Private::TAG_PATTERN, true)
unless md
@source.position = start_position
raise REXML::ParseException.new("malformed XML: missing tag start", @source)
Expand Down Expand Up @@ -539,7 +538,7 @@ def need_source_encoding_update?(xml_declaration_encoding)
end

def parse_name(base_error_message)
md = @source.match(NAME_PATTERN, true)
md = @source.match(Private::NAME_PATTERN, true)
unless md
if @source.match(/\s*\S/um)
message = "#{base_error_message}: invalid name"
Expand Down Expand Up @@ -618,7 +617,7 @@ def parse_id_invalid_details(accept_external_id:,
end

def process_instruction(start_position)
match_data = @source.match(INSTRUCTION_END, true)
match_data = @source.match(Private::INSTRUCTION_END, true)
unless match_data
message = "Invalid processing instruction node"
@source.position = start_position
Expand Down
1 change: 0 additions & 1 deletion lib/rexml/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ module Private
end
end
private_constant :Private
include Private

# Constructor
# @param arg must be a String, and should be a valid XML document
Expand Down
Loading