Method: Sass::Script::Parser#initialize

Defined in:
lib/sass/script/parser.rb

#initialize(str, line, offset, options = {}) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • str (String, StringScanner)

    The source text to parse

  • line (Integer)

    The line on which the SassScript appears. Used for error reporting and sourcemap building

  • offset (Integer)

    The character (not byte) offset where the script starts in the line. Used for error reporting and sourcemap building

  • options ({Symbol => Object}) (defaults to: {})

    An options hash; see the Sass options documentation. This supports an additional :allow_extra_text option that controls whether the parser throws an error when extra text is encountered after the parsed construct.



32
33
34
35
36
37
# File 'lib/sass/script/parser.rb', line 32

def initialize(str, line, offset, options = {})
  @options = options
  @allow_extra_text = options.delete(:allow_extra_text)
  @lexer = lexer_class.new(str, line, offset, options)
  @stop_at = nil
end