PHP Class titanscss_parser

Author: Leaf Corcoran ([email protected])
Afficher le fichier Open project: gambitph/titan-framework Class Usage Examples

Protected Properties

Свойство Type Description
$commentMulti
$commentMultiLeft
$commentMultiRight
$commentSingle
$operatorStr
$operators
$precedence
$whitePattern

Méthodes publiques

Méthode Description
__construct ( $sourceName = null, $rootParser = true )
getLineNo ( $pos )
parse ( $buffer )
preg_quote ( $what )
throwParseError ( $msg = "parse error", $count = null )

Méthodes protégées

Méthode Description
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

Method Details

__construct() public méthode

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

append() protected méthode

protected append ( $statement, $pos = null )

argValue() protected méthode

protected argValue ( &$out )

argValues() protected méthode

protected argValues ( &$out )

argumentDef() protected méthode

protected argumentDef ( &$out )

argumentList() protected méthode

protected argumentList ( &$out )

color() protected méthode

protected color ( &$out )

end() protected méthode

consume an end of statement delimiter
protected end ( )

expHelper() protected méthode

protected expHelper ( $lhs, $minP )

expression() protected méthode

protected expression ( &$out )

flattenList() protected méthode

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

func() protected méthode

protected func ( &$func )

genericList() protected méthode

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

getLineNo() public méthode

public getLineNo ( $pos )

interpolation() protected méthode

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

keyword() protected méthode

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

last() protected méthode

last child that was appended
protected last ( )

literal() protected méthode

protected literal ( $what, $eatWhitespace = null )

makeOperatorStr() protected static méthode

protected static makeOperatorStr ( $operators )

match() protected méthode

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

matchString() protected méthode

{@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
Résultat boolean True if match; false otherwise

mediaExpression() protected méthode

protected mediaExpression ( &$out )

mediaQuery() protected méthode

protected mediaQuery ( &$out )

mediaQueryList() protected méthode

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

mixedKeyword() protected méthode

protected mixedKeyword ( &$out )

openString() protected méthode

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

parenValue() protected méthode

value wrappen in parentheses
protected parenValue ( &$out )

parse() public méthode

public parse ( $buffer )

parseChunk() protected méthode

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
Résultat boolean

peek() protected méthode

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

placeholder() protected méthode

protected placeholder ( &$placeholder )

popBlock() protected méthode

protected popBlock ( )

preg_quote() static public méthode

static public preg_quote ( $what )

progid() protected méthode

protected progid ( &$out )

propertyName() protected méthode

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

pushBlock() protected méthode

tree builders
protected pushBlock ( $selectors )

pushSpecialBlock() protected méthode

protected pushSpecialBlock ( $type )

seek() protected méthode

protected seek ( $where = null )

selector() protected méthode

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

selectorSingle() protected méthode

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

selectors() protected méthode

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

show() protected méthode

protected show ( )

spaceList() protected méthode

protected spaceList ( &$out )

string() protected méthode

protected string ( &$out )

stripDefault() protected méthode

protected stripDefault ( &$value )

throwParseError() public méthode

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

to() protected méthode

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

unit() protected méthode

protected unit ( &$unit )

value() protected méthode

protected value ( &$out )

valueList() protected méthode

protected valueList ( &$out )

variable() protected méthode

protected variable ( &$out )

whitespace() protected méthode

match some whitespace
protected whitespace ( )

Property Details

$commentMulti protected_oe static_oe property

protected static $commentMulti

$commentMultiLeft protected_oe static_oe property

protected static $commentMultiLeft

$commentMultiRight protected_oe static_oe property

protected static $commentMultiRight

$commentSingle protected_oe static_oe property

protected static $commentSingle

$operatorStr protected_oe static_oe property

protected static $operatorStr

$operators protected_oe static_oe property

protected static $operators

$precedence protected_oe static_oe property

protected static $precedence

$whitePattern protected_oe static_oe property

protected static $whitePattern