Class: Sass::Script::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/scss_lint/sass/script.rb

Instance Method Summary collapse

Instance Method Details

#identObject

We redefine the ident parser to specially handle color keywords.



31
32
33
34
35
36
37
38
39
40
# File 'lib/scss_lint/sass/script.rb', line 31

def ident
  return funcall unless @lexer.peek && @lexer.peek.type == :ident
  return if @stop_at && @stop_at.include?(@lexer.peek.value)

  name = @lexer.next
  if (color = Value::Color::COLOR_NAMES[name.value.downcase])
    return literal_node(Value::Color.from_string(name.value, color), name.source_range)
  end
  literal_node(Value::String.new(name.value, :identifier), name.source_range)
end