Class: Sass::SCSS::StaticParser
- Defined in:
- lib/sass/scss/static_parser.rb
Overview
A parser for a static SCSS tree. Parses with SCSS extensions, like nested rules and parent selectors, but without dynamic SassScript. This is useful for e.g. parsing selectors after resolving the interpolation.
Direct Known Subclasses
Constant Summary
Constants included from RX
RX::ANY, RX::CDC, RX::CDO, RX::COMMENT, RX::DASHMATCH, 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_COMPONENT, 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 Attribute Summary
Attributes inherited from Parser
Instance Method Summary collapse
-
#parse_selector ⇒ Selector::CommaSequence
Parses the text as a selector.
-
#parse_static_at_root_query ⇒ (Symbol, Array<String>)
Parses a static at-root query.
Methods inherited from Parser
#initialize, #parse, #parse_at_root_query, #parse_interp_ident, #parse_media_query_list, #parse_supports_condition
Methods included from RX
Constructor Details
This class inherits a constructor from Sass::SCSS::Parser
Instance Method Details
#parse_selector ⇒ Selector::CommaSequence
Parses the text as a selector.
18 19 20 21 22 23 24 25 |
# File 'lib/sass/scss/static_parser.rb', line 18
def parse_selector
init_scanner!
seq = expr!(:selector_comma_sequence)
expected("selector") unless @scanner.eos?
seq.line = @line
seq.filename = @filename
seq
end
|
#parse_static_at_root_query ⇒ (Symbol, Array<String>)
Parses a static at-root query.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sass/scss/static_parser.rb', line 33
def parse_static_at_root_query
init_scanner!
tok!(/\(/); ss
type = tok!(/\b(without|with)\b/).to_sym; ss
tok!(/:/); ss
directives = expr!(:at_root_directive_list); ss
tok!(/\)/)
expected("@at-root query list") unless @scanner.eos?
return type, directives
end
|