The parser for SCSS. It parses a string of code into a tree of {Sass::Tree::Node}s.
Avoid allocating lots of new strings for `tok`. This is important because `tok` is called all the time.
@param 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 {Sass::Engine} or {Sass::CSS}.
@param line [Fixnum] The line on which the source string appeared,
if it's part of another document
# File lib/sass/scss/parser.rb, line 14 def initialize(str, line = 1) @template = str @line = line @strs = [] end
Parses an SCSS document.
@return [Sass::Tree::RootNode] The root node of the document tree @raise [Sass::SyntaxError] if there's a syntax error in the document
# File lib/sass/scss/parser.rb, line 24 def parse init_scanner! root = stylesheet expected("selector or at-rule") unless @scanner.eos? root end
Parses an identifier with interpolation. Note that this won't assert that the identifier takes up the entire input string; it's meant to be used with `StringScanner`s as part of other parsers.
@return [Array<String, Sass::Script::Node>, nil]
The interpolated identifier, or nil if none could be parsed
# File lib/sass/scss/parser.rb, line 37 def parse_interp_ident init_scanner! interp_ident end
Generated with the Darkfish Rdoc Generator 2.