In Files

  • rubygems/request_set/lockfile/tokenizer.rb

Class/Module Index [+]

Quicksearch

Gem::RequestSet::Lockfile::Tokenizer

Constants

EOF
Token

Public Class Methods

from_file(file) click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 7
def self.from_file file
  new File.read(file), file
end
            
new(input, filename = nil, line = 0, pos = 0) click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 11
def initialize input, filename = nil, line = 0, pos = 0
  @line     = line
  @line_pos = pos
  @tokens   = []
  @filename = filename
  tokenize input
end
            

Public Instance Methods

empty?() click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 39
def empty?
  @tokens.empty?
end
            
make_parser(set, platforms) click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 19
def make_parser set, platforms
  Gem::RequestSet::Lockfile::Parser.new self, set, platforms, @filename
end
            
next_token() click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 47
def next_token
  @tokens.shift
end
            
Also aliased as: shift
peek() click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 52
def peek
  @tokens.first || EOF
end
            
shift() click to toggle source
Alias for: next_token
skip(type) click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 27
def skip type
  @tokens.shift while not @tokens.empty? and peek.type == type
end
            
to_a() click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 23
def to_a
  @tokens.map { |token| [token.type, token.value, token.column, token.line] }
end
            
unshift(token) click to toggle source
 
               # File rubygems/request_set/lockfile/tokenizer.rb, line 43
def unshift token
  @tokens.unshift token
end