class Gem::RequestSet::Lockfile::Tokenizer
Constants
- EOF
- Token
Public Class Methods
from_file
(file)
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 10 def self.from_file(file) new File.read(file), file end
new
(input, filename = nil, line = 0, pos = 0)
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 14 def initialize(input, filename = nil, line = 0, pos = 0) @line = line @line_pos = pos @tokens = [] @filename = filename tokenize input end
Public Instance Methods
empty?
()
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 42 def empty? @tokens.empty? end
make_parser
(set, platforms)
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 22 def make_parser(set, platforms) Gem::RequestSet::Lockfile::Parser.new self, set, platforms, @filename end
next_token
()
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 50 def next_token @tokens.shift end
Also aliased as: shift
peek
()
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 55 def peek @tokens.first || EOF end
skip
(type)
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 30 def skip(type) @tokens.shift while !@tokens.empty? && peek.type == type end
to_a
()
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 26 def to_a @tokens.map {|token| [token.type, token.value, token.column, token.line] } end
unshift
(token)
# File lib/rubygems/request_set/lockfile/tokenizer.rb, line 46 def unshift(token) @tokens.unshift token end