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::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::W
Instance Method Summary collapse
-
#initialize(str, 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, line = 1) ⇒ Parser
Returns a new instance of Parser.
14 15 16 17 18 |
# File 'lib/sass/scss/parser.rb', line 14
def initialize(str, line = 1)
@template = str
@line = line
@strs = []
end
|
Instance Method Details
#parse ⇒ Sass::Tree::RootNode
Parses an SCSS document.
24 25 26 27 28 29 |
# File 'lib/sass/scss/parser.rb', line 24
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.
37 38 39 40 |
# File 'lib/sass/scss/parser.rb', line 37
def parse_interp_ident
init_scanner!
interp_ident
end
|