Class: Sass::SCSS::Parser
- Inherits:
-
Object
- Object
- Sass::SCSS::Parser
- Includes:
- RX
- Defined in:
- lib/sass/scss/parser.rb
Overview
The parser for SCSS. It parses a string of code into a tree of Tree::Nodes.
Direct Known Subclasses
Constant Summary
Constants included from RX
RX::CDC, RX::CDO, RX::COMMENT, RX::DASHMATCH, RX::DEFAULT, RX::ESCAPE, RX::FUNCTION, RX::GREATER, RX::H, RX::HASH, RX::HEXCOLOR, RX::IDENT, RX::IDENT_HYPHEN_INTERP, RX::IMPORTANT, RX::INCLUDES, RX::INTERP_START, RX::MOZ_ANY, RX::NAME, RX::NL, RX::NMCHAR, RX::NMSTART, RX::NONASCII, RX::NOT, RX::NUM, RX::NUMBER, RX::PLUS, RX::PREFIXMATCH, RX::RANGE, RX::S, RX::SINGLE_LINE_COMMENT, RX::STATIC_SELECTOR, RX::STATIC_VALUE, RX::STRING, RX::STRING1, RX::STRING1_NOINTERP, RX::STRING2, RX::STRING2_NOINTERP, RX::STRING_NOINTERP, RX::SUBSTRINGMATCH, RX::SUFFIXMATCH, RX::TILDE, RX::UNICODE, RX::UNICODERANGE, RX::URI, RX::URL, RX::URLCHAR, RX::VARIABLE, RX::W
Instance Method Summary collapse
-
#initialize(str, filename, line = 1) ⇒ Parser
constructor
A new instance of Parser.
-
#parse ⇒ Sass::Tree::RootNode
Parses an SCSS document.
-
#parse_interp_ident ⇒ Array<String, Sass::Script::Node>?
Parses an identifier with interpolation.
Methods included from RX
Constructor Details
#initialize(str, filename, line = 1) ⇒ Parser
Returns a new instance of Parser.
15 16 17 18 19 20 |
# File 'lib/sass/scss/parser.rb', line 15
def initialize(str, filename, line = 1)
@template = str
@filename = filename
@line = line
@strs = []
end
|
Instance Method Details
#parse ⇒ Sass::Tree::RootNode
Parses an SCSS document.
26 27 28 29 30 31 |
# File 'lib/sass/scss/parser.rb', line 26
def parse
init_scanner!
root = stylesheet
expected("selector or at-rule") unless @scanner.eos?
root
end
|
#parse_interp_ident ⇒ Array<String, Sass::Script::Node>?
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.
39 40 41 42 |
# File 'lib/sass/scss/parser.rb', line 39
def parse_interp_ident
init_scanner!
interp_ident
end
|