Method: Sass::SCSS::Parser#initialize

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

#initialize(str, filename, importer, line = 1, offset = 1) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • str (String, StringScanner)

    The source document to parse. Note that Parser won't raise a nice error message if this isn't properly parsed; for that, you should use the higher-level Engine or CSS.

  • filename (String)

    The name of the file being parsed. Used for warnings and source maps.

  • importer (Sass::Importers::Base)

    The importer used to import the file being parsed. Used for source maps.

  • line (Integer) (defaults to: 1)

    The 1-based line on which the source string appeared, if it's part of another document.

  • offset (Integer) (defaults to: 1)

    The 1-based character (not byte) offset in the line on which the source string starts. Used for error reporting and sourcemap building.



24
25
26
27
28
29
30
31
32
33
# File 'lib/sass/scss/parser.rb', line 24

def initialize(str, filename, importer, line = 1, offset = 1)
  @template = str
  @filename = filename
  @importer = importer
  @line = line
  @offset = offset
  @strs = []
  @expected = nil
  @throw_error = false
end