get(expected_types = nil, expected_value = nil)
public
Show source
def get expected_types = nil, expected_value = nil
token = @tokens.shift
if expected_types and not Array(expected_types).include? token.type then
unget token
message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
"expected #{expected_types.inspect}"
raise Gem::RequestSet::Lockfile::ParseError.new message, token.column, token.line, @filename
end
if expected_value and expected_value != token.value then
unget token
message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
"expected [#{expected_types.inspect}, " +
"#{expected_value.inspect}]"
raise Gem::RequestSet::Lockfile::ParseError.new message, token.column, token.line, @filename
end
token
end