MediaWiki
1.23.0
|
Public Member Functions | |
__construct ($lessc, $sourceName=null) | |
parse ($buffer) | |
propertyValue (&$value, $keyName=null) | |
throwError ($msg="parse error", $count=null) | |
Protected Member Functions | |
append ($prop, $pos=null) | |
argumentDef (&$args, &$isVararg) | |
assign ($name=null) | |
Consume an assignment operator Can optionally take a name that will be set to the current property name. More... | |
color (&$out) | |
end () | |
expHelper ($lhs, $minP) | |
recursively parse infix equation with $lhs at precedence $minP More... | |
expression (&$out) | |
Attempt to consume an expression. More... | |
expressionList (&$exps) | |
fixTags ($tags) | |
func (&$func) | |
genericList (&$out, $parseItem, $delim="", $flatten=true) | |
guard (&$guard) | |
guardGroup (&$guardGroup) | |
guards (&$guards) | |
import (&$out) | |
interpolation (&$out) | |
isDirective ($dirname, $directives) | |
keyword (&$word) | |
literal ($what, $eatWhitespace=null) | |
match ($regex, &$out, $eatWhitespace=null) | |
mediaExpression (&$out) | |
mediaQuery (&$out) | |
mediaQueryList (&$out) | |
mixinTags (&$tags) | |
openString ($end, &$out, $nestingOpen=null, $rejectStrs=null) | |
parenValue (&$out) | |
parseChunk () | |
Parse a single chunk off the head of the buffer and append it to the current parse environment. More... | |
peek ($regex, &$out=null, $from=null) | |
pop () | |
pushBlock ($selectors=null, $type=null) | |
pushSpecialBlock ($type) | |
removeComments ($text) | |
seek ($where=null) | |
string (&$out) | |
tag (&$tag, $simple=false) | |
tagBracket (&$parts, &$hasExpression) | |
tags (&$tags, $simple=false, $delim=',') | |
to ($what, &$out, $until=false, $allowNewline=false) | |
unit (&$unit) | |
value (&$value) | |
variable (&$name) | |
whitespace () | |
Protected Attributes | |
$blockDirectives = array("font-face", "keyframes", "page", "-moz-document", "viewport", "-moz-viewport", "-o-viewport", "-ms-viewport") | |
$inParens = false | |
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. More... | |
$lineDirectives = array("charset") | |
Static Protected Attributes | |
static | $commentMulti |
static | $commentMultiLeft = "/*" |
static | $commentMultiRight = "*/" |
static | $commentSingle = "//" |
static | $literalCache = array() |
static | $nextBlockId = 0 |
static | $operatorString |
static | $precedence |
static | $supressDivisionProps |
static | $whitePattern |
Definition at line 2300 of file lessc.inc.php.
lessc_parser::__construct | ( | $lessc, | |
$sourceName = null |
|||
) |
Definition at line 2348 of file lessc.inc.php.
References $commentMultiLeft, $commentMultiRight, $commentSingle, array(), and lessc::preg_quote().
|
protected |
Definition at line 3610 of file lessc.inc.php.
Referenced by parseChunk(), and whitespace().
|
protected |
Definition at line 3045 of file lessc.inc.php.
References $args, $s, $value, array(), as, assign(), literal(), seek(), and throwError().
Referenced by parseChunk().
|
protected |
Consume an assignment operator Can optionally take a name that will be set to the current property name.
Definition at line 3370 of file lessc.inc.php.
References $name, and literal().
Referenced by argumentDef(), and parseChunk().
|
protected |
|
protected |
Definition at line 3385 of file lessc.inc.php.
References literal().
Referenced by openString(), and parseChunk().
|
protected |
recursively parse infix equation with $lhs at precedence $minP
Definition at line 2649 of file lessc.inc.php.
References $inParens, array(), as, match(), peek(), seek(), and value().
Referenced by expression().
|
protected |
Attempt to consume an expression.
http://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code
Definition at line 2625 of file lessc.inc.php.
References $out, $s, array(), expHelper(), literal(), seek(), and value().
Referenced by expressionList(), guard(), mediaExpression(), and parenValue().
|
protected |
Definition at line 2608 of file lessc.inc.php.
References array(), lessc::compressList(), and expression().
Referenced by func(), and propertyValue().
|
protected |
|
protected |
Definition at line 3305 of file lessc.inc.php.
References $args, $fname, $name, $s, $value, array(), expressionList(), keyword(), literal(), match(), openString(), and seek().
Referenced by value().
|
protected |
Definition at line 3477 of file lessc.inc.php.
References $out, $s, $value, array(), literal(), and seek().
Referenced by mediaQuery(), and mediaQueryList().
|
protected |
Definition at line 3438 of file lessc.inc.php.
References $s, array(), expression(), literal(), and seek().
Referenced by guardGroup().
|
protected |
|
protected |
Definition at line 3395 of file lessc.inc.php.
References $s, array(), guardGroup(), literal(), and seek().
Referenced by parseChunk().
|
protected |
Definition at line 2799 of file lessc.inc.php.
References $out, $value, array(), literal(), and propertyValue().
|
protected |
Definition at line 2992 of file lessc.inc.php.
References $out, $s, array(), literal(), openString(), seek(), and whitespace().
Referenced by openString(), string(), tag(), and tagBracket().
|
protected |
|
protected |
Definition at line 3376 of file lessc.inc.php.
References match().
Referenced by func(), mediaExpression(), mediaQuery(), parseChunk(), tagBracket(), value(), and variable().
|
protected |
Definition at line 3454 of file lessc.inc.php.
References match(), and lessc::preg_quote().
Referenced by argumentDef(), assign(), end(), expression(), func(), genericList(), guard(), guardGroup(), guards(), import(), interpolation(), mediaExpression(), mediaQuery(), mixinTags(), parenValue(), parseChunk(), propertyValue(), string(), tag(), tagBracket(), tags(), value(), and variable().
|
protected |
Definition at line 3518 of file lessc.inc.php.
References $out, and whitespace().
Referenced by color(), expHelper(), func(), keyword(), literal(), openString(), string(), tag(), tagBracket(), to(), unit(), value(), and whitespace().
|
protected |
Definition at line 2853 of file lessc.inc.php.
References $out, $s, $value, array(), expression(), keyword(), literal(), seek(), and variable().
|
protected |
Definition at line 2820 of file lessc.inc.php.
References $out, $s, array(), genericList(), keyword(), literal(), and seek().
|
protected |
Definition at line 2812 of file lessc.inc.php.
References $out, and genericList().
Referenced by parseChunk().
|
protected |
Definition at line 3158 of file lessc.inc.php.
References array(), literal(), and tag().
Referenced by parseChunk().
|
protected |
Definition at line 2874 of file lessc.inc.php.
References $out, array(), end(), interpolation(), and match().
Referenced by func(), interpolation(), and parseChunk().
|
protected |
Definition at line 2719 of file lessc.inc.php.
References $inParens, $out, $s, expression(), literal(), and seek().
Referenced by value().
lessc_parser::parse | ( | $buffer | ) |
Definition at line 2371 of file lessc.inc.php.
References array(), line, parseChunk(), pushSpecialBlock(), removeComments(), throwError(), and whitespace().
|
protected |
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.
Definition at line 2437 of file lessc.inc.php.
References $args, $dir, $e, $s, $value, append(), argumentDef(), array(), as, assign(), end(), fixTags(), guards(), isDirective(), keyword(), literal(), mediaQueryList(), mixinTags(), openString(), pop(), propertyValue(), pushBlock(), pushSpecialBlock(), seek(), tag(), tags(), throwError(), variable(), and whitespace().
Referenced by parse().
|
protected |
Definition at line 3550 of file lessc.inc.php.
References $count, $from, and $out.
Referenced by expHelper(), and throwError().
|
protected |
Definition at line 3616 of file lessc.inc.php.
Referenced by parseChunk().
lessc_parser::propertyValue | ( | & | $value, |
$keyName = null |
|||
) |
Definition at line 2697 of file lessc.inc.php.
References $s, $value, array(), lessc::compressList(), expressionList(), literal(), and seek().
Referenced by import(), and parseChunk().
|
protected |
Definition at line 3587 of file lessc.inc.php.
References $type, and array().
Referenced by parseChunk(), and pushSpecialBlock().
|
protected |
Definition at line 3605 of file lessc.inc.php.
References $type, and pushBlock().
Referenced by parse(), and parseChunk().
|
protected |
|
protected |
Definition at line 3559 of file lessc.inc.php.
References $count.
Referenced by argumentDef(), expHelper(), expression(), func(), genericList(), guard(), guardGroup(), guards(), interpolation(), mediaExpression(), mediaQuery(), parenValue(), parseChunk(), propertyValue(), string(), tag(), tagBracket(), value(), and variable().
|
protected |
Definition at line 2941 of file lessc.inc.php.
References $out, $s, array(), interpolation(), literal(), match(), lessc::preg_quote(), and seek().
|
protected |
Definition at line 3241 of file lessc.inc.php.
References $s, array(), interpolation(), literal(), match(), seek(), tagBracket(), unit(), and whitespace().
Referenced by mixinTags(), parseChunk(), and tags().
|
protected |
|
protected |
Definition at line 3145 of file lessc.inc.php.
References array(), literal(), and tag().
Referenced by parseChunk().
lessc_parser::throwError | ( | $msg = "parse error" , |
|
$count = null |
|||
) |
Definition at line 3567 of file lessc.inc.php.
References $count, $line, line, and peek().
Referenced by argumentDef(), parse(), and parseChunk().
Definition at line 3505 of file lessc.inc.php.
References $out, match(), and lessc::preg_quote().
|
protected |
|
protected |
Definition at line 2744 of file lessc.inc.php.
References $s, $value, array(), color(), func(), keyword(), literal(), match(), parenValue(), seek(), unit(), and variable().
Referenced by expHelper(), and expression().
|
protected |
Definition at line 3348 of file lessc.inc.php.
References $name, $s, array(), keyword(), literal(), and seek().
Referenced by mediaExpression(), parseChunk(), and value().
|
protected |
Definition at line 3531 of file lessc.inc.php.
References $count, append(), array(), and match().
Referenced by interpolation(), match(), parse(), parseChunk(), and tag().
|
protected |
Definition at line 2331 of file lessc.inc.php.
|
staticprotected |
Definition at line 2318 of file lessc.inc.php.
|
staticprotected |
Definition at line 2321 of file lessc.inc.php.
Referenced by __construct().
|
staticprotected |
Definition at line 2322 of file lessc.inc.php.
Referenced by __construct().
|
staticprotected |
Definition at line 2320 of file lessc.inc.php.
Referenced by __construct().
|
protected |
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.
Consider: property1: 10 -5; // is two numbers, 10 and -5 property2: (10 -5); // should evaluate to 5
Definition at line 2343 of file lessc.inc.php.
Referenced by expHelper(), and parenValue().
|
protected |
Definition at line 2332 of file lessc.inc.php.
|
staticprotected |
Definition at line 2346 of file lessc.inc.php.
|
staticprotected |
Definition at line 2301 of file lessc.inc.php.
|
staticprotected |
Definition at line 2325 of file lessc.inc.php.
|
staticprotected |
Definition at line 2303 of file lessc.inc.php.
|
staticprotected |
Definition at line 2328 of file lessc.inc.php.
|
staticprotected |
Definition at line 2317 of file lessc.inc.php.