Sha256: 60311a77e37c4ef0239b211efbb428b0ae427c1a83289fd720100b339fa4d7af

Contents?: true

Size: 1.07 KB

Versions: 240

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: false
require_relative "../child"
module REXML
  module DTD
    class NotationDecl < Child
      START = "<!NOTATION"
      START_RE = /^\s*#{START}/um
      PUBLIC = /^\s*#{START}\s+(\w[\w-]*)\s+(PUBLIC)\s+((["']).*?\4)\s*>/um
      SYSTEM = /^\s*#{START}\s+(\w[\w-]*)\s+(SYSTEM)\s+((["']).*?\4)\s*>/um
      def initialize src
        super()
        if src.match( PUBLIC )
          md = src.match( PUBLIC, true )
        elsif src.match( SYSTEM )
          md = src.match( SYSTEM, true )
        else
          raise ParseException.new( "error parsing notation: no matching pattern", src )
        end
        @name = md[1]
        @middle = md[2]
        @rest = md[3]
      end

      def to_s
        "<!NOTATION #@name #@middle #@rest>"
      end

      def write( output, indent )
        indent( output, indent )
        output << to_s
      end

      def NotationDecl.parse_source source, listener
        md = source.match( PATTERN_RE, true )
        thing = md[0].squeeze(" \t\n\r")
        listener.send inspect.downcase, thing
      end
    end
  end
end

Version data entries

240 entries across 233 versions & 35 rubygems

Version Path
rexml-3.3.1 lib/rexml/dtd/notationdecl.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rexml-3.3.0/lib/rexml/dtd/notationdecl.rb
rexml-3.3.0 lib/rexml/dtd/notationdecl.rb
rexml-3.2.9 lib/rexml/dtd/notationdecl.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.13 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.12 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.11 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.10 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.9 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
cloudsmith-api-2.0.8 vendor/bundle/ruby/2.6.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
brakeman-6.1.2 bundle/ruby/3.3.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/rexml-3.2.6/lib/rexml/dtd/notationdecl.rb