Class: Sass::SCSS::Parser
- Inherits:
- Object
- Object
- Sass::SCSS::Parser
- Includes:
- RX
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/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
Instance Attribute Summary (collapse)
- - offset
Expose for the SASS parser.
Instance Method Summary (collapse)
- - (Parser) initialize(str, filename, importer, line = 1, offset = 1) constructor
A new instance of Parser.
- - (Sass::Tree::RootNode) parse
Parses an SCSS document.
- - (Array<String, Sass::Script;:Tree::Node>) parse_at_root_query
Parses an at-root query.
- - (Array<String, Sass::Script::Tree::Node>?) parse_interp_ident
Parses an identifier with interpolation.
- - (Sass::Media::QueryList) parse_media_query_list
Parses a media query list.
- - parse_supports_clause
Parses a supports clause for an @import directive.
- - (Sass::Supports::Condition) parse_supports_condition
Parses a supports query condition.
Methods included from RX
Constructor Details
- (Parser) initialize(str, filename, importer, line = 1, offset = 1)
Returns a new instance of Parser
24 25 26 27 28 29 30 31 32 33 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 24
def initialize(str, filename, importer, line = 1, offset = 1)
@template = str
@filename = filename
@importer = importer
@line = line
@offset = offset
@strs = []
@expected = nil
@throw_error = false
end |
Instance Attribute Details
- offset
Expose for the SASS parser.
10 11 12 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 10
def offset
@offset
end |
Instance Method Details
- (Sass::Tree::RootNode) parse
Parses an SCSS document.
39 40 41 42 43 44 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 39
def parse
init_scanner!
root = stylesheet
expected("selector or at-rule") unless root && @scanner.eos?
root
end |
- (Array<String, Sass::Script;:Tree::Node>) parse_at_root_query
Parses an at-root query.
83 84 85 86 87 88 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 83
def parse_at_root_query
init_scanner!
query = at_root_query
expected("@at-root query list") unless query && @scanner.eos?
query
end |
- (Array<String, Sass::Script::Tree::Node>?) parse_interp_ident
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.
52 53 54 55 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 52
def parse_interp_ident
init_scanner!
interp_ident
end |
- (Sass::Media::QueryList) parse_media_query_list
Parses a media query list.
71 72 73 74 75 76 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 71
def parse_media_query_list
init_scanner!
ql = media_query_list
expected("media query list") unless ql && @scanner.eos?
ql
end |
- parse_supports_clause
Parses a supports clause for an @import directive
58 59 60 61 62 63 64 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 58
def parse_supports_clause
init_scanner!
ss
clause = supports_clause
ss
clause
end |
- (Sass::Supports::Condition) parse_supports_condition
Parses a supports query condition.
95 96 97 98 99 100 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/scss/parser.rb', line 95
def parse_supports_condition
init_scanner!
condition = supports_condition
expected("supports condition") unless condition && @scanner.eos?
condition
end |