PHP Класс titanscss_parser

Автор: Leaf Corcoran ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$commentMulti
$commentMultiLeft
$commentMultiRight
$commentSingle
$operatorStr
$operators
$precedence
$whitePattern

Открытые методы

Метод Описание
__construct ( $sourceName = null, $rootParser = true )
getLineNo ( $pos )
parse ( $buffer )
preg_quote ( $what )
throwParseError ( $msg = "parse error", $count = null )

Защищенные методы

Метод Описание
append ( $statement, $pos = null )
argValue ( &$out )
argValues ( &$out )
argumentDef ( &$out )
argumentList ( &$out )
color ( &$out )
end ( ) consume an end of statement delimiter
expHelper ( $lhs, $minP )
expression ( &$out )
flattenList ( $value ) turn list of length 1 into value type
func ( &$func )
genericList ( &$out, $parseItem, $delim = "", $flatten = true )
interpolation ( &$out, $lookWhite = true ) $lookWhite: save information about whitespace before and after
keyword ( &$word, $eatWhitespace = null )
last ( ) last child that was appended
literal ( $what, $eatWhitespace = null )
makeOperatorStr ( $operators )
match ( $regex, &$out, $eatWhitespace = null ) try to match something on head of buffer
matchString ( array &$m, string $delim ) : boolean Match string looking for either ending delim, escape, or string interpolation
mediaExpression ( &$out )
mediaQuery ( &$out )
mediaQueryList ( &$out ) high level parsers (they return parts of ast)
mixedKeyword ( &$out )
openString ( $end, &$out, $nestingOpen = null ) an unbounded string stopped by $end
parenValue ( &$out ) value wrappen in parentheses
parseChunk ( ) : boolean Parse a single chunk off the head of the buffer and append it to the current parse environment.
peek ( $regex, &$out, $from = null )
placeholder ( &$placeholder )
popBlock ( )
progid ( &$out )
propertyName ( &$out ) returns an array of parts or a string
pushBlock ( $selectors ) tree builders
pushSpecialBlock ( $type )
seek ( $where = null )
selector ( &$out ) whitespace separated list of selectorSingle
selectorSingle ( &$out ) div[yes=no]#something.hello.world:nth-child(-2n+1)%placeholder
selectors ( &$out ) comma separated list of selectors
show ( )
spaceList ( &$out )
string ( &$out )
stripDefault ( &$value )
to ( $what, &$out, $until = false, $allowNewline = false ) $allowNewline, if string, will be used as valid char set
unit ( &$unit )
value ( &$out )
valueList ( &$out )
variable ( &$out )
whitespace ( ) match some whitespace

Описание методов

__construct() публичный Метод

public __construct ( $sourceName = null, $rootParser = true )

append() защищенный Метод

protected append ( $statement, $pos = null )

argValue() защищенный Метод

protected argValue ( &$out )

argValues() защищенный Метод

protected argValues ( &$out )

argumentDef() защищенный Метод

protected argumentDef ( &$out )

argumentList() защищенный Метод

protected argumentList ( &$out )

color() защищенный Метод

protected color ( &$out )

end() защищенный Метод

consume an end of statement delimiter
protected end ( )

expHelper() защищенный Метод

protected expHelper ( $lhs, $minP )

expression() защищенный Метод

protected expression ( &$out )

flattenList() защищенный Метод

turn list of length 1 into value type
protected flattenList ( $value )

func() защищенный Метод

protected func ( &$func )

genericList() защищенный Метод

protected genericList ( &$out, $parseItem, $delim = "", $flatten = true )

getLineNo() публичный Метод

public getLineNo ( $pos )

interpolation() защищенный Метод

$lookWhite: save information about whitespace before and after
protected interpolation ( &$out, $lookWhite = true )

keyword() защищенный Метод

protected keyword ( &$word, $eatWhitespace = null )

last() защищенный Метод

last child that was appended
protected last ( )

literal() защищенный Метод

protected literal ( $what, $eatWhitespace = null )

makeOperatorStr() защищенный статический Метод

protected static makeOperatorStr ( $operators )

match() защищенный Метод

try to match something on head of buffer
protected match ( $regex, &$out, $eatWhitespace = null )

matchString() защищенный Метод

{@internal This is a workaround for preg_match's 250K string match limit.}}
protected matchString ( array &$m, string $delim ) : boolean
$m array Matches (passed by reference)
$delim string Delimeter
Результат boolean True if match; false otherwise

mediaExpression() защищенный Метод

protected mediaExpression ( &$out )

mediaQuery() защищенный Метод

protected mediaQuery ( &$out )

mediaQueryList() защищенный Метод

high level parsers (they return parts of ast)
protected mediaQueryList ( &$out )

mixedKeyword() защищенный Метод

protected mixedKeyword ( &$out )

openString() защищенный Метод

an unbounded string stopped by $end
protected openString ( $end, &$out, $nestingOpen = null )

parenValue() защищенный Метод

value wrappen in parentheses
protected parenValue ( &$out )

parse() публичный Метод

public parse ( $buffer )

parseChunk() защищенный Метод

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.
protected parseChunk ( ) : boolean
Результат boolean

peek() защищенный Метод

protected peek ( $regex, &$out, $from = null )

placeholder() защищенный Метод

protected placeholder ( &$placeholder )

popBlock() защищенный Метод

protected popBlock ( )

preg_quote() статический публичный Метод

static public preg_quote ( $what )

progid() защищенный Метод

protected progid ( &$out )

propertyName() защищенный Метод

returns an array of parts or a string
protected propertyName ( &$out )

pushBlock() защищенный Метод

tree builders
protected pushBlock ( $selectors )

pushSpecialBlock() защищенный Метод

protected pushSpecialBlock ( $type )

seek() защищенный Метод

protected seek ( $where = null )

selector() защищенный Метод

whitespace separated list of selectorSingle
protected selector ( &$out )

selectorSingle() защищенный Метод

div[yes=no]#something.hello.world:nth-child(-2n+1)%placeholder
protected selectorSingle ( &$out )

selectors() защищенный Метод

comma separated list of selectors
protected selectors ( &$out )

show() защищенный Метод

protected show ( )

spaceList() защищенный Метод

protected spaceList ( &$out )

string() защищенный Метод

protected string ( &$out )

stripDefault() защищенный Метод

protected stripDefault ( &$value )

throwParseError() публичный Метод

public throwParseError ( $msg = "parse error", $count = null )

to() защищенный Метод

$allowNewline, if string, will be used as valid char set
protected to ( $what, &$out, $until = false, $allowNewline = false )

unit() защищенный Метод

protected unit ( &$unit )

value() защищенный Метод

protected value ( &$out )

valueList() защищенный Метод

protected valueList ( &$out )

variable() защищенный Метод

protected variable ( &$out )

whitespace() защищенный Метод

match some whitespace
protected whitespace ( )

Описание свойств

$commentMulti защищенное статическое свойство

protected static $commentMulti

$commentMultiLeft защищенное статическое свойство

protected static $commentMultiLeft

$commentMultiRight защищенное статическое свойство

protected static $commentMultiRight

$commentSingle защищенное статическое свойство

protected static $commentSingle

$operatorStr защищенное статическое свойство

protected static $operatorStr

$operators защищенное статическое свойство

protected static $operators

$precedence защищенное статическое свойство

protected static $precedence

$whitePattern защищенное статическое свойство

protected static $whitePattern