Documentation

EasyBlogStylesheetLessc_parser
in package

Table of Contents

Properties

$blockDirectives  : mixed
$commentMulti  : mixed
$commentMultiLeft  : mixed
$commentMultiRight  : mixed
$commentSingle  : mixed
$inParens  : mixed
if we are in parens we can be more liberal with whitespace around operators because it must evaluate to a single value and thus is less ambiguous.
$lineDirectives  : mixed
$literalCache  : mixed
$nextBlockId  : mixed
$operatorString  : mixed
$precedence  : mixed
$supressDivisionProps  : mixed
$whitePattern  : mixed

Methods

__construct()  : mixed
parse()  : mixed
propertyValue()  : mixed
throwError()  : mixed
append()  : mixed
argumentDef()  : mixed
assign()  : mixed
Consume an assignment operator Can optionally take a name that will be set to the current property name
color()  : mixed
end()  : mixed
expHelper()  : mixed
recursively parse infix equation with $lhs at precedence $minP
expression()  : mixed
Attempt to consume an expression.
expressionList()  : mixed
fixTags()  : mixed
func()  : mixed
genericList()  : mixed
guard()  : mixed
guardGroup()  : mixed
guards()  : mixed
import()  : mixed
interpolation()  : mixed
isDirective()  : mixed
keyword()  : mixed
literal()  : mixed
match()  : mixed
mediaExpression()  : mixed
mediaQuery()  : mixed
mediaQueryList()  : mixed
mixinTags()  : mixed
openString()  : mixed
parenValue()  : mixed
parseChunk()  : mixed
Parse a single chunk off the head of the buffer and append it to the current parse environment.
peek()  : mixed
pop()  : mixed
pushBlock()  : mixed
pushSpecialBlock()  : mixed
removeComments()  : mixed
seek()  : mixed
string()  : mixed
tag()  : mixed
tagBracket()  : mixed
tags()  : mixed
to()  : mixed
unit()  : mixed
value()  : mixed
variable()  : mixed
whitespace()  : mixed

Properties

$blockDirectives

protected mixed $blockDirectives = array("font-face", "keyframes", "page", "-moz-document", "viewport", "-moz-viewport", "-o-viewport", "-ms-viewport")

$commentMulti

protected static mixed $commentMulti

$commentMultiLeft

protected static mixed $commentMultiLeft = "/*"

$commentMultiRight

protected static mixed $commentMultiRight = "*/"

$commentSingle

protected static mixed $commentSingle = "//"

$inParens

if we are in parens we can be more liberal with whitespace around operators because it must evaluate to a single value and thus is less ambiguous.

protected mixed $inParens = \false

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

$lineDirectives

protected mixed $lineDirectives = array("charset")

$literalCache

protected static mixed $literalCache = array()

$nextBlockId

protected static mixed $nextBlockId = 0

$operatorString

protected static mixed $operatorString

$precedence

protected static mixed $precedence = array('=<' => 0, '>=' => 0, '=' => 0, '<' => 0, '>' => 0, '+' => 1, '-' => 1, '*' => 2, '/' => 2, '%' => 2)

$supressDivisionProps

protected static mixed $supressDivisionProps = array('/border-radius$/i', '/^font$/i')

$whitePattern

protected static mixed $whitePattern

Methods

__construct()

public __construct(mixed $lessc[, mixed $sourceName = null ]) : mixed
Parameters
$lessc : mixed
$sourceName : mixed = null

parse()

public parse(mixed $buffer) : mixed
Parameters
$buffer : mixed

propertyValue()

public propertyValue(mixed &$value[, mixed $keyName = null ]) : mixed
Parameters
$value : mixed
$keyName : mixed = null

throwError()

public throwError([mixed $msg = "parse error" ][, mixed $count = null ]) : mixed
Parameters
$msg : mixed = "parse error"
$count : mixed = null

append()

protected append(mixed $prop[, mixed $pos = null ]) : mixed
Parameters
$prop : mixed
$pos : mixed = null

argumentDef()

protected argumentDef(mixed &$args, mixed &$isVararg) : mixed
Parameters
$args : mixed
$isVararg : mixed

assign()

Consume an assignment operator Can optionally take a name that will be set to the current property name

protected assign([mixed $name = null ]) : mixed
Parameters
$name : mixed = null

color()

protected color(mixed &$out) : mixed
Parameters
$out : mixed

end()

protected end() : mixed

expHelper()

recursively parse infix equation with $lhs at precedence $minP

protected expHelper(mixed $lhs, mixed $minP) : mixed
Parameters
$lhs : mixed
$minP : mixed

expressionList()

protected expressionList(mixed &$exps) : mixed
Parameters
$exps : mixed

fixTags()

protected fixTags(mixed $tags) : mixed
Parameters
$tags : mixed

func()

protected func(mixed &$func) : mixed
Parameters
$func : mixed

genericList()

protected genericList(mixed &$out, mixed $parseItem[, mixed $delim = "" ][, mixed $flatten = true ]) : mixed
Parameters
$out : mixed
$parseItem : mixed
$delim : mixed = ""
$flatten : mixed = true

guard()

protected guard(mixed &$guard) : mixed
Parameters
$guard : mixed

guardGroup()

protected guardGroup(mixed &$guardGroup) : mixed
Parameters
$guardGroup : mixed

guards()

protected guards(mixed &$guards) : mixed
Parameters
$guards : mixed

import()

protected import(mixed &$out) : mixed
Parameters
$out : mixed

interpolation()

protected interpolation(mixed &$out) : mixed
Parameters
$out : mixed

isDirective()

protected isDirective(mixed $dirname, mixed $directives) : mixed
Parameters
$dirname : mixed
$directives : mixed

keyword()

protected keyword(mixed &$word) : mixed
Parameters
$word : mixed

literal()

protected literal(mixed $what[, mixed $eatWhitespace = null ]) : mixed
Parameters
$what : mixed
$eatWhitespace : mixed = null

match()

protected match(mixed $regex, mixed &$out[, mixed $eatWhitespace = null ]) : mixed
Parameters
$regex : mixed
$out : mixed
$eatWhitespace : mixed = null

mediaExpression()

protected mediaExpression(mixed &$out) : mixed
Parameters
$out : mixed

mediaQuery()

protected mediaQuery(mixed &$out) : mixed
Parameters
$out : mixed

mediaQueryList()

protected mediaQueryList(mixed &$out) : mixed
Parameters
$out : mixed

mixinTags()

protected mixinTags(mixed &$tags) : mixed
Parameters
$tags : mixed

openString()

protected openString(mixed $end, mixed &$out[, mixed $nestingOpen = null ][, mixed $rejectStrs = null ]) : mixed
Parameters
$end : mixed
$out : mixed
$nestingOpen : mixed = null
$rejectStrs : mixed = null

parenValue()

protected parenValue(mixed &$out) : mixed
Parameters
$out : mixed

parseChunk()

Parse a single chunk off the head of the buffer and append it to the current parse environment.

protected parseChunk() : mixed

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 EasyBlogStylesheetLessc::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 EasyBlogStylesheetLessc::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, EasyBlogStylesheetLessc::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.

peek()

protected peek(mixed $regex[, mixed &$out = null ][, mixed $from = null ]) : mixed
Parameters
$regex : mixed
$out : mixed = null
$from : mixed = null

pop()

protected pop() : mixed

pushBlock()

protected pushBlock([mixed $selectors = null ][, mixed $type = null ]) : mixed
Parameters
$selectors : mixed = null
$type : mixed = null

pushSpecialBlock()

protected pushSpecialBlock(mixed $type) : mixed
Parameters
$type : mixed

removeComments()

protected removeComments(mixed $text) : mixed
Parameters
$text : mixed

seek()

protected seek([mixed $where = null ]) : mixed
Parameters
$where : mixed = null

string()

protected string(mixed &$out) : mixed
Parameters
$out : mixed

tag()

protected tag(mixed &$tag[, mixed $simple = false ]) : mixed
Parameters
$tag : mixed
$simple : mixed = false

tagBracket()

protected tagBracket(mixed &$parts, mixed &$hasExpression) : mixed
Parameters
$parts : mixed
$hasExpression : mixed

tags()

protected tags(mixed &$tags[, mixed $simple = false ][, mixed $delim = ',' ]) : mixed
Parameters
$tags : mixed
$simple : mixed = false
$delim : mixed = ','

to()

protected to(mixed $what, mixed &$out[, mixed $until = false ][, mixed $allowNewline = false ]) : mixed
Parameters
$what : mixed
$out : mixed
$until : mixed = false
$allowNewline : mixed = false

unit()

protected unit(mixed &$unit) : mixed
Parameters
$unit : mixed

value()

protected value(mixed &$value) : mixed
Parameters
$value : mixed

variable()

protected variable(mixed &$name) : mixed
Parameters
$name : mixed

whitespace()

protected whitespace() : mixed

        
On this page

Search results