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::ANY, RX::CDC, RX::CDO, RX::COMMENT, RX::DASHMATCH, RX::DEFAULT, RX::DOMAIN, 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::NAME, RX::NL, RX::NMCHAR, RX::NMSTART, RX::NONASCII, RX::NOT, RX::NUM, RX::NUMBER, RX::OPTIONAL, 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::URL_PREFIX, 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.
-
#parse_media_query_list ⇒ Sass::Media::QueryList
Parses a media query list.
Methods included from RX
Constructor Details
#initialize(str, filename, line = 1) ⇒ Parser
Returns a new instance of Parser.
14 15 16 17 18 19 |
# File 'lib/sass/scss/parser.rb', line 14
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.
25 26 27 28 29 30 |
# File 'lib/sass/scss/parser.rb', line 25
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.
38 39 40 41 |
# File 'lib/sass/scss/parser.rb', line 38
def parse_interp_ident
init_scanner!
interp_ident
end
|
#parse_media_query_list ⇒ Sass::Media::QueryList
Parses a media query list.
48 49 50 51 52 53 |
# File 'lib/sass/scss/parser.rb', line 48
def parse_media_query_list
init_scanner!
ql = media_query_list
expected("media query list") unless @scanner.eos?
ql
end
|