CWIS Developer Documentation
|
SCSS parser. More...
Public Member Functions | |
__construct ($sourceName=null, $rootParser=true) | |
Constructor. More... | |
parse ($buffer) | |
Parser buffer. More... | |
valueList (&$out) | |
Parse list. More... | |
throwParseError ($msg="parse error", $count=null) | |
getLineNo ($pos) | |
Static Public Member Functions | |
static | preg_quote ($what) |
Protected Member Functions | |
parseChunk () | |
Parse a single chunk off the head of the buffer and append it to the current parse environment. More... | |
stripDefault (&$value) | |
literal ($what, $eatWhitespace=null) | |
pushBlock ($selectors) | |
pushSpecialBlock ($type) | |
popBlock () | |
append ($statement, $pos=null) | |
last () | |
mediaQueryList (&$out) | |
mediaQuery (&$out) | |
mediaExpression (&$out) | |
argValues (&$out) | |
argValue (&$out) | |
spaceList (&$out) | |
genericList (&$out, $parseItem, $delim="", $flatten=true) | |
expression (&$out) | |
expHelper ($lhs, $minP) | |
value (&$out) | |
parenValue (&$out) | |
progid (&$out) | |
func (&$func) | |
argumentList (&$out) | |
argumentDef (&$out) | |
color (&$out) | |
unit (&$unit) | |
string (&$out) | |
mixedKeyword (&$out) | |
openString ($end, &$out, $nestingOpen=null) | |
interpolation (&$out, $lookWhite=true) | |
propertyName (&$out) | |
selectors (&$out) | |
selector (&$out) | |
selectorSingle (&$out) | |
variable (&$out) | |
keyword (&$word, $eatWhitespace=null) | |
placeholder (&$placeholder) | |
end () | |
to ($what, &$out, $until=false, $allowNewline=false) | |
matchString (&$m, $delim) | |
Match string looking for either ending delim, escape, or string interpolation. More... | |
match ($regex, &$out, $eatWhitespace=null) | |
whitespace () | |
peek ($regex, &$out, $from=null) | |
seek ($where=null) | |
show () | |
flattenList ($value) | |
Static Protected Member Functions | |
static | makeOperatorStr ($operators) |
Static Protected Attributes | |
static | $precedence |
static | $operators |
static | $operatorStr |
static | $whitePattern |
static | $commentMulti |
static | $commentSingle = "//" |
static | $commentMultiLeft = "/*" |
static | $commentMultiRight = "*/" |
scss_parser::__construct | ( | $sourceName = null , |
|
$rootParser = true |
|||
) |
Constructor.
string | $sourceName | |
boolean | $rootParser |
Definition at line 2696 of file scssc.php.
References $commentMultiLeft, $commentMultiRight, $commentSingle, makeOperatorStr(), and preg_quote().
|
protected |
Definition at line 3151 of file scssc.php.
Referenced by parseChunk(), and whitespace().
|
protected |
Definition at line 3507 of file scssc.php.
References genericList(), literal(), seek(), throwParseError(), and variable().
Referenced by parseChunk().
|
protected |
|
protected |
Definition at line 3228 of file scssc.php.
References genericList(), literal(), seek(), and variable().
|
protected |
Definition at line 3220 of file scssc.php.
References genericList().
Referenced by func(), and parseChunk().
|
protected |
|
protected |
Definition at line 4014 of file scssc.php.
References literal().
Referenced by openString(), parseChunk(), and stripDefault().
|
protected |
|
protected |
Definition at line 3292 of file scssc.php.
References expHelper(), literal(), seek(), value(), and valueList().
Referenced by argumentList(), mediaExpression(), parenValue(), and parseChunk().
|
protected |
Definition at line 4159 of file scssc.php.
Referenced by stripDefault().
|
protected |
Definition at line 3439 of file scssc.php.
References argumentList(), argValues(), keyword(), literal(), openString(), and seek().
Referenced by value().
|
protected |
Definition at line 3268 of file scssc.php.
References literal(), and seek().
Referenced by argumentDef(), argValue(), argValues(), mediaQuery(), mediaQueryList(), spaceList(), and valueList().
scss_parser::getLineNo | ( | $pos | ) |
Definition at line 4057 of file scssc.php.
Referenced by throwParseError().
|
protected |
Definition at line 3723 of file scssc.php.
References literal(), seek(), valueList(), and whitespace().
Referenced by mixedKeyword(), openString(), propertyName(), selectorSingle(), string(), and value().
|
protected |
Definition at line 3995 of file scssc.php.
References match().
Referenced by argumentList(), func(), mixedKeyword(), parseChunk(), propertyName(), selectorSingle(), value(), and variable().
|
protected |
Definition at line 3160 of file scssc.php.
Referenced by parseChunk().
|
protected |
Definition at line 3102 of file scssc.php.
References match(), and preg_quote().
Referenced by argumentDef(), argumentList(), argValue(), end(), expression(), func(), genericList(), interpolation(), mediaExpression(), mediaQuery(), parenValue(), parseChunk(), progid(), selectors(), selectorSingle(), string(), value(), and variable().
|
staticprotected |
Definition at line 2711 of file scssc.php.
References $operators.
Referenced by __construct().
|
protected |
Definition at line 4104 of file scssc.php.
References whitespace().
Referenced by color(), expHelper(), keyword(), literal(), openString(), placeholder(), propertyName(), selector(), selectorSingle(), to(), and unit().
|
protected |
|
protected |
Definition at line 3203 of file scssc.php.
References expression(), literal(), and seek().
|
protected |
Definition at line 3172 of file scssc.php.
References genericList(), literal(), mixedKeyword(), and seek().
|
protected |
Definition at line 3168 of file scssc.php.
References genericList().
Referenced by parseChunk().
|
protected |
Definition at line 3628 of file scssc.php.
References interpolation(), keyword(), seek(), and whitespace().
Referenced by mediaQuery(), and selectorSingle().
|
protected |
Definition at line 3663 of file scssc.php.
References end(), interpolation(), and match().
Referenced by func(), parseChunk(), progid(), and selectorSingle().
|
protected |
scss_parser::parse | ( | $buffer | ) |
Parser buffer.
string | $buffer,; |
Definition at line 2723 of file scssc.php.
References parseChunk(), pushBlock(), throwParseError(), 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 scssc::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 scssc::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, scssc::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 2790 of file scssc.php.
References append(), argumentDef(), argValues(), end(), expression(), keyword(), last(), literal(), mediaQueryList(), openString(), popBlock(), propertyName(), pushBlock(), pushSpecialBlock(), seek(), selectors(), stripDefault(), valueList(), and variable().
Referenced by parse().
|
protected |
Definition at line 4132 of file scssc.php.
Referenced by expHelper(), show(), and throwParseError().
|
protected |
Definition at line 4005 of file scssc.php.
References match().
Referenced by selectorSingle().
|
protected |
Definition at line 3140 of file scssc.php.
References throwParseError().
Referenced by parseChunk().
|
static |
Definition at line 4147 of file scssc.php.
Referenced by __construct(), and literal().
|
protected |
|
protected |
Definition at line 3753 of file scssc.php.
References interpolation(), keyword(), match(), seek(), and whitespace().
Referenced by parseChunk().
|
protected |
Definition at line 3123 of file scssc.php.
Referenced by parse(), parseChunk(), and pushSpecialBlock().
|
protected |
Definition at line 3134 of file scssc.php.
References pushBlock().
Referenced by parseChunk().
|
protected |
Definition at line 4141 of file scssc.php.
Referenced by argumentDef(), argumentList(), argValue(), expHelper(), expression(), func(), genericList(), interpolation(), mediaExpression(), mediaQuery(), mixedKeyword(), parenValue(), parseChunk(), progid(), propertyName(), selectors(), selectorSingle(), string(), value(), and variable().
|
protected |
Definition at line 3812 of file scssc.php.
References match(), selectorSingle(), and whitespace().
Referenced by selectors().
|
protected |
Definition at line 3793 of file scssc.php.
References literal(), seek(), and selector().
Referenced by parseChunk().
|
protected |
Definition at line 3839 of file scssc.php.
References scssc\$selfSelector, interpolation(), keyword(), literal(), match(), mixedKeyword(), openString(), placeholder(), seek(), and unit().
Referenced by selector().
|
protected |
Definition at line 3263 of file scssc.php.
References genericList().
|
protected |
Definition at line 3582 of file scssc.php.
References interpolation(), literal(), matchString(), and seek().
|
protected |
Definition at line 3087 of file scssc.php.
References end(), and flattenList().
Referenced by parseChunk().
scss_parser::throwParseError | ( | $msg = "parse error" , |
|
$count = null |
|||
) |
Definition at line 4039 of file scssc.php.
References getLineNo(), and peek().
Referenced by argumentDef(), parse(), and popBlock().
|
protected |
|
protected |
Definition at line 3574 of file scssc.php.
References match().
Referenced by selectorSingle(), and value().
|
protected |
Definition at line 3350 of file scssc.php.
References color(), func(), interpolation(), keyword(), literal(), parenValue(), progid(), seek(), unit(), variable(), and whitespace().
Referenced by expHelper(), and expression().
scss_parser::valueList | ( | & | $out | ) |
Parse list.
string | $out |
Definition at line 3258 of file scssc.php.
References genericList().
Referenced by expression(), interpolation(), and parseChunk().
|
protected |
Definition at line 3985 of file scssc.php.
References keyword(), literal(), and seek().
Referenced by argumentDef(), argValue(), parseChunk(), and value().
|
protected |
Definition at line 4117 of file scssc.php.
References append().
Referenced by interpolation(), match(), mixedKeyword(), parse(), propertyName(), selector(), and value().
|
staticprotected |
Definition at line 2687 of file scssc.php.
Referenced by __construct().
|
staticprotected |
Definition at line 2688 of file scssc.php.
Referenced by __construct().
|
staticprotected |
Definition at line 2686 of file scssc.php.
Referenced by __construct().
|
staticprotected |
Definition at line 2679 of file scssc.php.
Referenced by makeOperatorStr().
|
staticprotected |