FOFLessParserThis class is taken verbatim from:
lessphp v0.3.8 http://leafo.net/lessphp
LESS css compiler, adapted from http://lesscss.org
Copyright 2012, Leaf Corcoran <leafot@gmail.com> Licensed under MIT or GPLv3, see LICENSE
Responsible for taking a string of LESS code and converting it into a syntax tree
Located in /libraries/fof/less/parser/parser.php (line 26)
boolean
genericList
([type] &$out, [type] $parseItem, [string $delim = ""], [boolean $flatten = true])
boolean
openString
([type] $end, [type] &$out, [[type] $nestingOpen = null], [[type] $rejectStrs = null])
static mixed
$commentMulti
(line 46)
static mixed
$commentMultiLeft
= "/*" (line 50)
static mixed
$commentMultiRight
= "*/" (line 52)
static mixed
$commentSingle
= "//" (line 48)
static mixed
$literalCache
= array() (line 76)
static mixed
$nextBlockId
= 0 (line 29)
static mixed
$operatorString
(line 55)
static mixed
$precedence
= array(
static mixed
$supressDivisionProps
= array('/border-radius$/i', '/^font$/i') (line 58)
static mixed
$whitePattern
(line 44)
mixed
$blockDirectives
= array("font-face", "keyframes", "page", "-moz-document") (line 60)
mixed
$inParens
= false (line 73)
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
mixed
$lineDirectives
= array("charset") (line 62)
Constructor
Append a property to the current block
Consume an argument definition list surrounded by () each argument is a variable name with optional value or at the end a ... or a variable named followed by ...
Consume a list of property values delimited by ; and wrapped in ()
Consume an assignment operator Can optionally take a name that will be set to the current property name
Recursively parse infix equation with $lhs at precedence $minP
Attempt to consume an expression.
a list of expressions
[genericList description]
A bunch of guards that are and'd together
[guards description]
[interpolation description]
[isDirective description]
[literal description]
Try to match something on head of buffer
[mediaExpression description]
[mediaQuery description]
[mediaQueryList description]
List of tags of specifying mixin path Optionally separated by > (lazy, accepts extra >)
An unbounded string stopped by $end
[parenValue description]
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.
Match something without consuming it
Consume a list of values for a property
[pushBlock description]
Push a block that doesn't multiply tags
Remove comments from $text
Seek to a spot in the buffer or return where we are on no argument
A single tag
A bracketed value (contained within in a tag definition)
[tagExpression description]
Consume a list of tags This accepts a hanging delimiter
[throwError description]
Advance counter to next occurrence of $what $until - don't include $what in advance $allowNewline, if string, will be used as valid char set
Consume a less variable
Documentation generated on Tue, 19 Nov 2013 15:10:17 +0100 by phpDocumentor 1.4.3