lessc_parser
class lessc_parser (View source)
Properties
| static protected | $nextBlockId | ||
| static protected | $precedence | ||
| static protected | $whitePattern | ||
| static protected | $commentMulti | ||
| static protected | $commentSingle | ||
| static protected | $commentMultiLeft | ||
| static protected | $commentMultiRight | ||
| static protected | $operatorString | ||
| static protected | $supressDivisionProps | ||
| protected | $blockDirectives | ||
| protected | $lineDirectives | ||
| protected | $inParens | if we are in parens we can be more liberal with whitespace around operators because it must evaluate to a single value and thus is less ambiguous. |
|
| static protected | $literalCache | ||
| $env | |||
| $buffer | |||
| $count | |||
| $line | |||
| $eatWhiteDefault | |||
| $lessc | |||
| $sourceName | |||
| $writeComments | |||
| $seenComments | |||
| $currentProperty | |||
| $inExp |
Methods
No description
Parse a single chunk off the head of the buffer and append it to the current parse environment.
No description
No description
No description
Attempt to consume an expression.
recursively parse infix equation with $lhs at precedence $minP
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Consume an assignment operator Can optionally take a name that will be set to the current property name
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
__construct($lessc, $sourceName = null)
No description
null|stdclass
parse(string $buffer)
Parse a string
protected
parseChunk()
Parse a single chunk off the head of the buffer and append it to the current parse environment.
Returns false when the buffer is empty, or when there is an error.
This function is called repeatedly until the entire document is parsed.
This parser is most similar to a recursive descent parser. Single functions represent discrete grammatical rules for the language, and they are able to capture the text that represents those rules.
Consider the function Lessc::keyword(). (all parse functions are structured the same)
The function takes a single reference argument. When calling the function it will attempt to match a keyword on the head of the buffer. If it is successful, it will place the keyword in the referenced argument, advance the position in the buffer, and return true. If it fails then it won't advance the buffer and it will return false.
All of these parse functions are powered by Lessc::match(), which behaves the same way, but takes a literal regular expression. Sometimes it is more convenient to use match instead of creating a new function.
Because of the format of the functions, to parse an entire string of grammatical rules, you can chain them together using &&.
But, if some of the rules in the chain succeed before one fails, then the buffer position will be left at an invalid state. In order to avoid this, Lessc::seek() is used to remember and set buffer positions.
Before parsing a chain, use $s = $this->seek() to remember the current position into $s. Then if a chain fails, use $this->seek($s) to go back where we started.
protected
isDirective($dirname, $directives)
No description
protected
fixTags($tags)
No description
protected
expressionList($exps)
No description
protected
expression($out)
Attempt to consume an expression.
protected
expHelper($lhs, $minP)
recursively parse infix equation with $lhs at precedence $minP
propertyValue($value, $keyName = null)
No description
protected
parenValue($out)
No description
protected
value($value)
No description
protected
import($out, $value = '')
No description
protected
mediaQueryList($out)
No description
protected
mediaQuery($out)
No description
protected
mediaExpression($out)
No description
protected
openString($end, $out, $nestingOpen = null, $rejectStrs = null)
No description
protected
string($out)
No description
protected
interpolation($out)
No description
protected
unit($unit)
No description
protected
color($out)
No description
protected
argumentDef($args, $isVararg)
No description
protected
tags($tags, $simple = false, $delim = ',')
No description
protected
mixinTags($tags)
No description
protected
tagBracket($parts, $hasExpression)
No description
protected
tag($tag, $simple = false)
No description
protected
func($func)
No description
protected
variable($name)
No description
protected
assign($name = null)
Consume an assignment operator Can optionally take a name that will be set to the current property name
protected
keyword($word)
No description
protected
end()
No description
protected
guards($guards)
No description
protected
guardGroup($guardGroup)
No description
protected
guard($guard)
No description
protected
literal($what, $eatWhitespace = null)
No description
protected
genericList($out, $parseItem, $delim = "", $flatten = true)
No description
protected
to($what, $out, $until = false, $allowNewline = false)
No description
protected
match($regex, $out, $eatWhitespace = null)
No description
protected
whitespace()
No description
protected
peek($regex, $out = null, $from = null)
No description
protected
seek($where = null)
No description
throwError($msg = "parse error", $count = null)
No description
protected
pushBlock($selectors = null, $type = null)
No description
protected
pushSpecialBlock($type)
No description
protected
append($prop, $pos = null)
No description
protected
pop()
No description
protected
removeComments($text)
No description