PHP Класс FOF30\Less\Parser\Parser

lessphp v0.3.9 http://leafo.net/lessphp LESS css compiler, adapted from http://lesscss.org Copyright 2012, Leaf Corcoran Licensed under MIT or GPLv3, see LICENSE Responsible for taking a string of LESS code and converting it into a syntax tree
С версии: 2.0
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (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 Used to uniquely identify blocks
$operatorString Regex string to match any of the operators
$precedence
$supressDivisionProps These properties will supress division unless it's inside parenthases
$whitePattern

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

Метод Описание
__construct ( [type] $lessc, string $sourceName = null ) Constructor
parse ( string $buffer ) : [type] Parse text
propertyValue ( &$value, [type] $keyName = null ) : boolean Consume a list of values for a property
throwError ( string $msg = "parse error", [type] $count = null ) : void [throwError description]

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

Метод Описание
append ( [type] $prop, [type] $pos = null ) : void Append a property to the current block
argumentDef ( &$args, &$isVararg, [type] $delim = ',' ) : boolean Consume an argument definition list surrounded by () each argument is a variable name with optional value or at the end a .
argumentValues ( &$args, [type] $delim = ',' ) : boolean Consume a list of property values delimited by ; and wrapped in ()
assign ( string $name = null ) : boolean Consume an assignment operator Can optionally take a name that will be set to the current property name
color ( &$out ) : boolean a # color
end ( ) : boolean Consume an end of statement delimiter
expHelper ( type $lhs, type $minP ) : string Recursively parse infix equation with $lhs at precedence $minP
expression ( &$out ) : boolean Attempt to consume an expression.
expressionList ( &$exps ) : boolean a list of expressions
fixTags ( [type] $tags ) : [type] [fixTags description]
func ( &$func ) : boolean A css function
genericList ( &$out, [type] $parseItem, string $delim = "", boolean $flatten = true ) : boolean [genericList description]
guard ( &$guard ) : boolean [guard description]
guardGroup ( &$guardGroup ) : boolean A bunch of guards that are and'd together
guards ( &$guards ) : boolean [guards description]
import ( &$out ) : boolean an import statement
interpolation ( &$out ) : boolean [interpolation description]
isDirective ( string $dirname, [type] $directives ) : boolean [isDirective description]
keyword ( &$word ) : boolean Consume a keyword
literal ( [type] $what, [type] $eatWhitespace = null ) : boolean [literal description]
match ( [type] $regex, &$out, [type] $eatWhitespace = null ) : boolean Try to match something on head of buffer
mediaExpression ( &$out ) : boolean [mediaExpression description]
mediaQuery ( &$out ) : [type] [mediaQuery description]
mediaQueryList ( &$out ) : boolean [mediaQueryList description]
mixinTags ( &$tags ) : boolean List of tags of specifying mixin path Optionally separated by > (lazy, accepts extra >)
openString ( [type] $end, &$out, [type] $nestingOpen = null, [type] $rejectStrs = null ) : boolean An unbounded string stopped by $end
parenValue ( &$out ) : boolean [parenValue description]
parseChunk ( ) : boolean Parse a single chunk off the head of the buffer and append it to the current parse environment.
peek ( [type] $regex, &$out = null, [type] $from = null ) : boolean Match something without consuming it
pop ( ) : [type] Pop something off the stack
pushBlock ( [type] $selectors = null, [type] $type = null ) : stdClass [pushBlock description]
pushSpecialBlock ( [type] $type ) : stdClass Push a block that doesn't multiply tags
removeComments ( [type] $text ) : [type] Remove comments from $text
seek ( [type] $where = null ) : boolean Seek to a spot in the buffer or return where we are on no argument
string ( &$out ) : boolean [string description]
tag ( &$tag, boolean $simple = false ) : boolean A single tag
tagBracket ( &$value ) : boolean A bracketed value (contained within in a tag definition)
tagExpression ( &$value ) : boolean [tagExpression description]
tags ( &$tags, [type] $simple = false, [type] $delim = ',' ) : boolean Consume a list of tags This accepts a hanging delimiter
to ( [type] $what, &$out, boolean $until = false, boolean $allowNewline = false ) : boolean Advance counter to next occurrence of $what $until - don't include $what in advance $allowNewline, if string, will be used as valid char set
unit ( &$unit ) : boolean [unit description]
value ( &$value ) : boolean a single value
variable ( &$name ) : boolean Consume a less variable
whitespace ( ) : boolean Watch some whitespace

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

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

Constructor
public __construct ( [type] $lessc, string $sourceName = null )
$lessc [type]
$sourceName string [description]

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

Append a property to the current block
protected append ( [type] $prop, [type] $pos = null ) : void
$prop [type]
$pos [type]
Результат void

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

.. or a variable named followed by ...
protected argumentDef ( &$args, &$isVararg, [type] $delim = ',' ) : boolean
$delim [type]
Результат boolean

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

Consume a list of property values delimited by ; and wrapped in ()
protected argumentValues ( &$args, [type] $delim = ',' ) : boolean
$delim [type]
Результат boolean

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

Consume an assignment operator Can optionally take a name that will be set to the current property name
protected assign ( string $name = null ) : boolean
$name string [description]
Результат boolean

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

a # color
protected color ( &$out ) : boolean
Результат boolean

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

Consume an end of statement delimiter
protected end ( ) : boolean
Результат boolean

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

Recursively parse infix equation with $lhs at precedence $minP
protected expHelper ( type $lhs, type $minP ) : string
$lhs type [description]
$minP type [description]
Результат string

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

Attempt to consume an expression.
protected expression ( &$out ) : boolean
Результат boolean

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

a list of expressions
protected expressionList ( &$exps ) : boolean
Результат boolean

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

[fixTags description]
protected fixTags ( [type] $tags ) : [type]
$tags [type]
Результат [type]

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

A css function
protected func ( &$func ) : boolean
Результат boolean

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

[genericList description]
protected genericList ( &$out, [type] $parseItem, string $delim = "", boolean $flatten = true ) : boolean
$parseItem [type]
$delim string [description]
$flatten boolean [description]
Результат boolean

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

[guard description]
protected guard ( &$guard ) : boolean
Результат boolean

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

A bunch of guards that are and'd together
protected guardGroup ( &$guardGroup ) : boolean
Результат boolean

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

[guards description]
protected guards ( &$guards ) : boolean
Результат boolean

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

an import statement
protected import ( &$out ) : boolean
Результат boolean

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

[interpolation description]
protected interpolation ( &$out ) : boolean
Результат boolean

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

[isDirective description]
protected isDirective ( string $dirname, [type] $directives ) : boolean
$dirname string [description]
$directives [type]
Результат boolean

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

Consume a keyword
protected keyword ( &$word ) : boolean
Результат boolean

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

[literal description]
protected literal ( [type] $what, [type] $eatWhitespace = null ) : boolean
$what [type]
$eatWhitespace [type]
Результат boolean

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

Try to match something on head of buffer
protected match ( [type] $regex, &$out, [type] $eatWhitespace = null ) : boolean
$regex [type]
$eatWhitespace [type]
Результат boolean

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

[mediaExpression description]
protected mediaExpression ( &$out ) : boolean
Результат boolean

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

[mediaQuery description]
protected mediaQuery ( &$out ) : [type]
Результат [type]

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

[mediaQueryList description]
protected mediaQueryList ( &$out ) : boolean
Результат boolean

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

List of tags of specifying mixin path Optionally separated by > (lazy, accepts extra >)
protected mixinTags ( &$tags ) : boolean
Результат boolean

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

An unbounded string stopped by $end
protected openString ( [type] $end, &$out, [type] $nestingOpen = null, [type] $rejectStrs = null ) : boolean
$end [type]
$nestingOpen [type]
$rejectStrs [type]
Результат boolean

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

[parenValue description]
protected parenValue ( &$out ) : boolean
Результат boolean

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

Parse text
public parse ( string $buffer ) : [type]
$buffer string [description]
Результат [type]

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

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

Match something without consuming it
protected peek ( [type] $regex, &$out = null, [type] $from = null ) : boolean
$regex [type]
$from [type]
Результат boolean

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

Pop something off the stack
protected pop ( ) : [type]
Результат [type]

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

Consume a list of values for a property
public propertyValue ( &$value, [type] $keyName = null ) : boolean
$keyName [type]
Результат boolean

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

[pushBlock description]
protected pushBlock ( [type] $selectors = null, [type] $type = null ) : stdClass
$selectors [type]
$type [type]
Результат stdClass

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

Push a block that doesn't multiply tags
protected pushSpecialBlock ( [type] $type ) : stdClass
$type [type]
Результат stdClass

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

Remove comments from $text
protected removeComments ( [type] $text ) : [type]
$text [type]
Результат [type]

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

Seek to a spot in the buffer or return where we are on no argument
protected seek ( [type] $where = null ) : boolean
$where [type]
Результат boolean

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

[string description]
protected string ( &$out ) : boolean
Результат boolean

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

A single tag
protected tag ( &$tag, boolean $simple = false ) : boolean
$simple boolean [description]
Результат boolean

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

A bracketed value (contained within in a tag definition)
protected tagBracket ( &$value ) : boolean
Результат boolean

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

[tagExpression description]
protected tagExpression ( &$value ) : boolean
Результат boolean

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

Consume a list of tags This accepts a hanging delimiter
protected tags ( &$tags, [type] $simple = false, [type] $delim = ',' ) : boolean
$simple [type]
$delim [type]
Результат boolean

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

[throwError description]
public throwError ( string $msg = "parse error", [type] $count = null ) : void
$msg string [description]
$count [type]
Результат void

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

Advance counter to next occurrence of $what $until - don't include $what in advance $allowNewline, if string, will be used as valid char set
protected to ( [type] $what, &$out, boolean $until = false, boolean $allowNewline = false ) : boolean
$what [type]
$until boolean [description]
$allowNewline boolean [description]
Результат boolean

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

[unit description]
protected unit ( &$unit ) : boolean
Результат boolean

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

a single value
protected value ( &$value ) : boolean
Результат boolean

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

Consume a less variable
protected variable ( &$name ) : boolean
Результат boolean

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

Watch some whitespace
protected whitespace ( ) : boolean
Результат boolean

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

$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 защищенное статическое свойство

Used to uniquely identify blocks
protected static $nextBlockId

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

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

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

protected static $precedence

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

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

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

protected static $whitePattern