class

Hwaro::Assets::Sass::Expr::Parser

Inherits Reference < Object

Grammar, loosest first: comma-list > space-list > or > and > equality > relational > additive > multiplicative (*, /, %) > unary (-, +, not) > concat/primary / parses at multiplicative precedence (dart-sass): whether it divides or renders as a literal slash is decided at eval time. :nodoc:

Constants

MAX_DEPTH = 512

Cap on expression nesting depth. This is a recursive-descent parser, so every level of (, [, call argument or unary operator in the source maps 1:1 onto native stack frames — a stylesheet with a few thousand nested parens (width: ((((…1…))))) exhausted the stack and killed the whole build with SIGSEGV, where every other Sass limit (MAX_INCLUDE_DEPTH, MAX_CALL_DEPTH, MAX_WHILE_ITERATIONS in the evaluator) reports a clean located error. Counted in parse_unary because every path from parse_comma down to a primary passes through it exactly once per nesting level, so one counter bounds parens, brackets, call arguments and unary chains alike. 512 is far past anything a hand-written or generated stylesheet nests, and exceeding it degrades to the same outcome as any other unparsable expression: verbatim text in lenient value contexts, a located error where parse! is used.

Constructors

new(toks : Array(Tok))
Source

Instance methods

parse
Source