PHP Класс lessc_parser, Beans

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$blockDirectives
$commentMulti
$commentMultiLeft
$commentMultiRight
$commentSingle
$inParens Consider: property1: 10 -5; // is two numbers, 10 and -5 property2: (10 -5); // should evaluate to 5
$lineDirectives
$literalCache caches preg escaped literals
$nextBlockId
$operatorString regex string to match any of the operators
$precedence used to uniquely identify blocks
$supressDivisionProps these properties will supress division unless it's inside parenthases
$whitePattern

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

Метод Описание
__construct ( $lessc, $sourceName = null )
parse ( $buffer )
propertyValue ( &$value, $keyName = null ) consume a list of values for a property
throwError ( $msg = "parse error", $count = null ) * misc functions

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

Метод Описание
append ( $prop, $pos = null ) append a property to the current block
argumentDef ( &$args, &$isVararg ) delimiter.
assign ( $name = null ) Consume an assignment operator Can optionally take a name that will be set to the current property name
color ( &$out ) a # color
end ( ) consume an end of statement delimiter
expHelper ( $lhs, $minP ) recursively parse infix equation with $lhs at precedence $minP
expression ( &$out ) Attempt to consume an expression.
expressionList ( &$exps ) a list of expressions
fixTags ( $tags )
func ( &$func ) a css function
genericList ( &$out, $parseItem, $delim = "", $flatten = true )
guard ( &$guard )
guardGroup ( &$guardGroup ) TODO rename to guardGroup
guards ( &$guards )
import ( &$out ) an import statement
interpolation ( &$out )
isDirective ( $dirname, $directives )
keyword ( &$word ) consume a keyword
literal ( $what, $eatWhitespace = null ) * raw parsing functions
match ( $regex, &$out, $eatWhitespace = null ) try to match something on head of buffer
mediaExpression ( &$out )
mediaQuery ( &$out )
mediaQueryList ( &$out )
mixinTags ( &$tags ) optionally separated by > (lazy, accepts extra >)
openString ( $end, &$out, $nestingOpen = null, $rejectStrs = null ) an unbounded string stopped by $end
parenValue ( &$out )
parseChunk ( ) Parse a single chunk off the head of the buffer and append it to the current parse environment.
peek ( $regex, &$out = null, $from = null ) match something without consuming it
pop ( ) pop something off the stack
pushBlock ( $selectors = null, $type = null )
pushSpecialBlock ( $type ) push a block that doesn't multiply tags
removeComments ( $text ) todo: make it work for all functions, not just url
seek ( $where = null ) seek to a spot in the buffer or return where we are on no argument
string ( &$out )
tag ( &$tag, $simple = false ) a space separated list of selectors
tagBracket ( &$parts, &$hasExpression ) a bracketed value (contained within in a tag definition)
tags ( &$tags, $simple = false, $delim = ',' ) this accepts a hanging delimiter
to ( $what, &$out, $until = false, $allowNewline = false ) $allowNewline, if string, will be used as valid char set
unit ( &$unit )
value ( &$value ) a single value
variable ( &$name ) consume a less variable
whitespace ( ) match some whitespace

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

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

public __construct ( $lessc, $sourceName = null )

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

append a property to the current block
protected append ( $prop, $pos = null )

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

delimiter.
protected argumentDef ( &$args, &$isVararg )

assign() защищенный метод

Consume an assignment operator Can optionally take a name that will be set to the current property name
protected assign ( $name = null )

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

a # color
protected color ( &$out )

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

consume an end of statement delimiter
protected end ( )

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

recursively parse infix equation with $lhs at precedence $minP
protected expHelper ( $lhs, $minP )

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

Attempt to consume an expression.
protected expression ( &$out )

expressionList() защищенный метод

a list of expressions
protected expressionList ( &$exps )

fixTags() защищенный метод

protected fixTags ( $tags )

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

a css function
protected func ( &$func )

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

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

guard() защищенный метод

protected guard ( &$guard )

guardGroup() защищенный метод

TODO rename to guardGroup
protected guardGroup ( &$guardGroup )

guards() защищенный метод

protected guards ( &$guards )

import() защищенный метод

an import statement
protected import ( &$out )

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

protected interpolation ( &$out )

isDirective() защищенный метод

protected isDirective ( $dirname, $directives )

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

consume a keyword
protected keyword ( &$word )

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

* raw parsing functions
protected literal ( $what, $eatWhitespace = null )

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

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

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

protected mediaExpression ( &$out )

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

protected mediaQuery ( &$out )

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

protected mediaQueryList ( &$out )

mixinTags() защищенный метод

optionally separated by > (lazy, accepts extra >)
protected mixinTags ( &$tags )

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

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

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

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 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.
protected parseChunk ( )

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

match something without consuming it
protected peek ( $regex, &$out = null, $from = null )

pop() защищенный метод

pop something off the stack
protected pop ( )

propertyValue() публичный метод

consume a list of values for a property
public propertyValue ( &$value, $keyName = null )

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

protected pushBlock ( $selectors = null, $type = null )

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

push a block that doesn't multiply tags
protected pushSpecialBlock ( $type )

removeComments() защищенный метод

todo: make it work for all functions, not just url
protected removeComments ( $text )

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

seek to a spot in the buffer or return where we are on no argument
protected seek ( $where = null )

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

protected string ( &$out )

tag() защищенный метод

a space separated list of selectors
protected tag ( &$tag, $simple = false )

tagBracket() защищенный метод

a bracketed value (contained within in a tag definition)
protected tagBracket ( &$parts, &$hasExpression )

tags() защищенный метод

this accepts a hanging delimiter
protected tags ( &$tags, $simple = false, $delim = ',' )

throwError() публичный метод

* misc functions
public throwError ( $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() защищенный метод

a single value
protected value ( &$value )

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

consume a less variable
protected variable ( &$name )

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

match some whitespace
protected whitespace ( )

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

$blockDirectives защищенное свойство

protected $blockDirectives

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

protected static $commentMulti

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

protected static $commentMultiLeft

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

protected static $commentMultiRight

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

protected static $commentSingle

$inParens защищенное свойство

Consider: property1: 10 -5; // is two numbers, 10 and -5 property2: (10 -5); // should evaluate to 5
protected $inParens

$lineDirectives защищенное свойство

protected $lineDirectives

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

caches preg escaped literals
protected static $literalCache

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

protected static $nextBlockId

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

regex string to match any of the operators
protected static $operatorString

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

used to uniquely identify blocks
protected static $precedence

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

these properties will supress division unless it's inside parenthases
protected static $supressDivisionProps

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

protected static $whitePattern