Sha256: 5f79801f40d7a20f1b7a927ff71147ff5410b5794561d82abf4f17ccd330377c

Contents?: true

Size: 637 Bytes

Versions: 6

Compression:

Stored size: 637 Bytes

Contents

module Ruty
  class Parser
    # tokenize the sourcecode and return an array of tokens
    def tokenize
      result = Datastructure::TokenStream.new
      @source.scan(TAG_REGEX).each do |match|
        result << [:text, match[0]] if match[0] and not match[0].empty?
        if data = match[1]
          result << [:block, data.strip]
        elsif data = match[2]
          result << [:var, data.strip]
        elsif data = match[3]
          result << [:comment, data.strip]
        end
      end
      rest = $~ ? @source[$~.end(0)..-1] : @source
      result << [:text, rest] if not rest.empty?
      result.close
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alfa-0.0.8.pre lib/ruty/bugfix.rb
alfa-0.0.7.pre lib/ruty/bugfix.rb
alfa-0.0.6.pre lib/ruty/bugfix.rb
alfa-0.0.5.pre lib/ruty/bugfix.rb
alfa-0.0.4.pre lib/ruty/bugfix.rb
alfa-0.0.2.pre lib/ruty/bugfix.rb