Properties

$precedence

$precedence

$operators

$operators

$operatorStr

$operatorStr

$whitePattern

$whitePattern

$commentMulti

$commentMulti

$commentSingle

$commentSingle

$commentMultiLeft

$commentMultiLeft

$commentMultiRight

$commentMultiRight

Methods

__construct()

__construct( $sourceName,  $rootParser)

Parameters

$sourceName
$rootParser

parse()

parse( $buffer)

Parameters

$buffer

throwParseError()

throwParseError( $msg,  $count)

Parameters

$msg
$count

getLineNo()

getLineNo( $pos)

Parameters

$pos

preg_quote()

preg_quote( $what)

Parameters

$what

makeOperatorStr()

makeOperatorStr( $operators)

Parameters

$operators

parseChunk()

parseChunk() : boolean

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.

Returns

boolean

stripDefault()

stripDefault( $value)

Parameters

$value

literal()

literal( $what,  $eatWhitespace)

Parameters

$what
$eatWhitespace

pushBlock()

pushBlock( $selectors)

Parameters

$selectors

pushSpecialBlock()

pushSpecialBlock( $type)

Parameters

$type

popBlock()

popBlock()

append()

append( $statement,  $pos)

Parameters

$statement
$pos

last()

last()

mediaQueryList()

mediaQueryList( $out)

Parameters

$out

mediaQuery()

mediaQuery( $out)

Parameters

$out

mediaExpression()

mediaExpression( $out)

Parameters

$out

argValues()

argValues( $out)

Parameters

$out

argValue()

argValue( $out)

Parameters

$out

valueList()

valueList( $out)

Parameters

$out

spaceList()

spaceList( $out)

Parameters

$out

genericList()

genericList( $out,  $parseItem,  $delim,  $flatten)

Parameters

$out
$parseItem
$delim
$flatten

expression()

expression( $out)

Parameters

$out

expHelper()

expHelper( $lhs,  $minP)

Parameters

$lhs
$minP

value()

value( $out)

Parameters

$out

parenValue()

parenValue( $out)

Parameters

$out

progid()

progid( $out)

Parameters

$out

func()

func( $func)

Parameters

$func

argumentList()

argumentList( $out)

Parameters

$out

argumentDef()

argumentDef( $out)

Parameters

$out

color()

color( $out)

Parameters

$out

unit()

unit( $unit)

Parameters

$unit

string()

string( $out)

Parameters

$out

mixedKeyword()

mixedKeyword( $out)

Parameters

$out

openString()

openString( $end,  $out,  $nestingOpen)

Parameters

$end
$out
$nestingOpen

interpolation()

interpolation( $out,  $lookWhite)

Parameters

$out
$lookWhite

propertyName()

propertyName( $out)

Parameters

$out

selectors()

selectors( $out)

Parameters

$out

selector()

selector( $out)

Parameters

$out

selectorSingle()

selectorSingle( $out)

Parameters

$out

variable()

variable( $out)

Parameters

$out

keyword()

keyword( $word,  $eatWhitespace)

Parameters

$word
$eatWhitespace

placeholder()

placeholder( $placeholder)

Parameters

$placeholder

end()

end()

to()

to( $what,  $out,  $until,  $allowNewline)

Parameters

$what
$out
$until
$allowNewline

matchString()

matchString(array $m, string $delim) : boolean

Match string looking for either ending delim, escape, or string interpolation

Parameters

array $m

Matches (passed by reference)

string $delim

Delimeter

Returns

boolean —

True if match; false otherwise

match()

match( $regex,  $out,  $eatWhitespace)

Parameters

$regex
$out
$eatWhitespace

whitespace()

whitespace()

peek()

peek( $regex,  $out,  $from)

Parameters

$regex
$out
$from

seek()

seek( $where)

Parameters

$where

show()

show()

flattenList()

flattenList( $value)

Parameters

$value