Parsers class

Here in, the parsing rules/functions

The basic structure of the syntax tree generated is as follows:

Ruleset -> Declaration -> Value -> Expression -> Entity

Here's some Less code:

.class {
  color: #fff;
  border: 1px solid #000;
  width: @w + 4px;
  > .child {...}
}

And here's what the parse tree might look like:

Ruleset (Selector '.class', [
    Declaration ("color",  Value ([Expression [Color #fff]]))
    Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]]))
    Declaration ("width",  Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]]))
    Ruleset (Selector [Element '>', '.child'], [...])
])

In general, most rules will try to parse a token with the $re() function, and if the return value is truly, will return a new node, of the relevant type. Sometimes, we need to check first, before parsing, that's when we use peek().

Constructors

Parsers(String input, Contexts context)
The Parsers class constructor. [...]

Properties

context Contexts
Environment variables
read / write
entities Entities
Reference to Entities class with additional parser functions
read / write
fileInfo FileInfo
Data about the file being parsed
read / write
input ↔ String
String to be parsed
read / write
mixin Mixin
Mixin class reference with additional parser functions
read / write
parserInput ParserInput
Input management
read / write
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addition() Node
Search for: [...]
anonymousValue() Anonymous
Anonymous is almost anything. Example: [...]
apply() Apply
Search for something like: [...]
atomicCondition({bool needsParens: false }) Condition
The simplest condition, such as [...]
atrule() Node
A CSS AtRule, such as: [...]
attribute() Attribute
Attribute is a operation inside []: [...]
block() → List<Node>
The block rule is used by ruleset and mixin.definition. [...]
blockRuleset() Ruleset
The rules inside the: [...]
combinator() Combinator
Combinators combine elements together, in a Selector. [...]
comment() Comment
Comments are collected by the main parsing mechanism and then assigned to nodes where the current structure allows it [...]
condition({bool needsParens: false }) Condition
Inside a MixinDefinition, conditions such as when, and, or, not, ... [...]
conditionAnd({bool needsParens: false }) Condition
Search for conditions such as: [...]
conditions() Node
Function to be passed to ParserInput.expect(). [...]
declaration() Declaration
Declaration is [...]
detachedRuleset() Node
Search for [...]
element() Element
A Selector Element [...]
end() → bool
A Declaration terminator. [...]
entity() Node
Entities are the smallest recognized token, and can be found inside a rule's value.
expression() Expression
Expressions either represent mathematical operations, or white-space delimited Entities. [...]
extend({bool isRule: false }) → List<Extend>
extend syntax - used to extend selectors: [...]
extendRule() → List<Extend>
extendRule - used in a rule to extend all the parent selectors
getDebugInfo(int index, [ String xinputStream, Contexts xcontext ]) DebugInfo
Returns filename and line corresponding to index
import() Import
An @import atrule [...]
important() → String
Search for: [...]
importOption() → String
The option in @import(option). Example: [...]
importOptions() ImportOptions
For @import(options) returns the activated options. Example: [...]
isFinished() → void
Check if input is empty. Else throw error.
media() Media
Search for something like: [...]
mediaFeature() Expression
Search for something like: [...]
mediaFeatures() → List<Node>
Search for a list of mediaFeature, such as: [...]
multiplication() Node
Search for: [...]
negatedCondition({bool needsParens: false }) Condition
Search for conditions such as: [...]
operand() Node
An operand is anything that can be part of an operation. [...]
options() Options
Search for something like: [...]
parenthesisCondition({bool needsParens: false }) Condition
Search for a condition inside a parenthesis: [...]
permissiveValue({String untilTokensString, RegExp untilTokensRegExp }) Node
Used for custom properties, at-rules, and variables (as fallback) Parses almost anything inside of {} [] () "" blocks until it reaches outer-most tokens. [...]
plugin() Options
A @plugin directive, used to import plugins dynamically. [...]
pluginArgs() → String
list of options, surrounded by parens, to be processed by the plugin. [...]
primary() → List<Node>
The primary rule is the entry and exit point of the parser. The rules here can appear at any level of the parse tree. [...]
property() → String
Something like: [...]
ruleProperty() → List<Node>
Search for something like: [...]
ruleset() Ruleset
A Ruleset is something like: [...]
selector({bool isLess: true }) Selector
A CSS Selector [...]
selectors() → List<Selector>
sub() Expression
Search for parens subexpressions like: [...]
value() Value
A Value is a comma-delimited list of Expressions [...]
variable() → String
The variable part of a variable definition. Used in the rule parser [...]
variableCall([String parsedName ]) Node
Call a variable value to retrieve a detached ruleset or a value from a detached ruleset's rules. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited