Changeset 219:68433480f3f5

Show
Ignore:
Timestamp:
04/25/03 00:39:07 (6 years ago)
Author:
ser
Branch:
3.0
convert_revision:
svn:877f57f0-f5bd-0310-8c13-bb9e5bdefd87/rexml/branches/3.0@781
Message:

* Lightparser needed a rewind method.
* Fixes to base parser, and improved error reporting.
* Fixes to require_with_version, to allow it to grab the highest version of

a package even when not specifically asked for.

* Minor doc fixes -- not the ones we really need.

Files:
5 modified

Legend:

Unmodified
Added
Removed
  • INSTALL

    r206 r219  
    1 Run bin/install.rb 
     1Run "bin/install.rb --help" 
     2 
     3If you want to upgrade REXML (or install it as the default version of REXML) 
     4run install.rb with no arguments.  If you want to have multiple versions of 
     5REXML installed at the same time, run install.rb with the "-c" argument.  If 
     6you do this, you will need to require REXML differently, since you will need 
     7a "require" command that supports versioning.  This is installed with REXML; 
     8all you need to do is: 
     9 
     10        require "require_with_version" 
     11        require "rexml" 
     12 
     13or 
     14 
     15        require( "rexml" ) { |v| v >= "2.7" } 
     16 
     17to place restrictions on the version of REXML that you are loading. 
  • README

    r202 r219  
    3131http://www.germane-software.com/software/rexml_doc_ja. 
    3232 
     33This is the third major iteration of REXML. 
     34 
    3335--- SER 
  • src/require_with_version.rb

    r218 r219  
    9191                base = File.basename( file ) 
    9292                files = [] 
     93                $:.each {|dir| 
     94                        files += Dir.new(dir).entries.delete_if {|f|  
     95                                fpath = File.join( dir, f ) 
     96                                f !~ /^#{package}/ or !File.directory?(fpath) or  
     97                                Dir.new(fpath).entries.include?( file+".rb" ) 
     98                        } if File.exists? dir 
     99                } 
     100                files.uniq! 
    93101    if b #block_given? 
    94       $:.each {|dir| 
    95         files += Dir.new(dir).entries.delete_if {|f|  
    96           f !~ /^#{package}/ 
    97         } if File.exists? dir 
    98       } 
    99                         files.uniq! 
    100102      files = files.delete_if { |f| 
    101103        (f.include?('-') and yield( Version.new( f.split('-')[1] ) )) ? false : true 
    102104      } 
    103105                end 
     106                p files 
    104107                if files.size > 0 
    105108      files = files.sort 
    106109      files.reverse! 
    107       #puts <<-EOL 
     110                        #puts <<-EOL 
    108111      old_require "#{files[0]}/#{base}" 
    109       #EOL 
     112                        #EOL 
    110113                else 
    111       #puts <<-EOL 
     114                        #puts <<-EOL 
    112115      old_require "#{file}" 
    113       #EOL 
     116                        #EOL 
    114117    end 
    115118  end 
  • src/rexml/parsers/baseparser.rb

    r217 r219  
    11require 'rexml/parseexception' 
     2require 'rexml/source' 
    23 
    34module REXML 
     
    274275                                                        last_tag = @tags.pop 
    275276                                                        md = @source.match( CLOSE_MATCH, true ) 
    276                                                         raise REXML::ParseException.new( "Missing end tag for #{last_tag} "+ 
     277                                                        raise REXML::ParseException.new( "Missing end tag for '#{last_tag}' "+ 
    277278                                                                "(got \"#{md[1]}\")", @source) unless last_tag == md[1] 
    278279                                                        return [ :end_element, last_tag ] 
     
    319320                                                return [ :text, md[1] ] 
    320321                                        end 
     322        rescue REXML::ParseException 
     323          raise $! 
    321324                                rescue Exception, NameError => error 
    322                                         raise REXML::ParseException.new( "Exception parsing",  
     325                                        raise REXML::ParseException.new( "Exception parsing", 
    323326                                                @source, self, error ) 
    324327                                end 
  • src/rexml/parsers/lightparser.rb

    r217 r219  
    1010                        end 
    1111 
     12      def rewind 
     13        @stream.rewind 
     14        @parser.stream = @stream 
     15      end 
     16 
    1217                        def parse 
    13                                 @parser.stream = @stream 
    1418                                root = context = [] 
    1519                                while true