PHP 클래스 lessc_parser, Beans

파일 보기 프로젝트 열기: Getbeans/Beans 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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