\lessc
The less compiler and parser.
Converting LESS to CSS is a two stage process. First the incoming document
must be parsed. Parsing creates a tree in memory that represents the
structure of the document. Then, the tree of the document is recursively
compiled into the CSS text. The compile step has an implicit step called
reduction, where values are brought to their lowest form before being
turned to text, eg. mathematical equations are solved, and variables are
dereferenced.
The parsing stage produces the final structure of the document, for this
reason mixins are mixed in and attribute accessors are referenced during
the parse step. A reduction is done on the mixed in block as it is mixed in.
See the following:
- entry point for parsing and compiling: lessc::parse()
- parsing: lessc::parseChunk()
- compiling: lessc::compileBlock()
Synopsis
- // members
- protected $buffer;
- protected $count;
- protected $line;
- protected $expandStack;
- public $indentLevel;
- public string $indentChar = ' ';
- protected $env = NULL;
- protected array $allParsedFiles = ;
- public string $vPrefix = '@';
- public string $mPrefix = '$';
- public string $imPrefix = '!';
- public string $selfSelector = '&';
- protected static array $precedence = ;
- protected static $operatorString;
- protected static array $dtypes = ;
- protected static array $units = ;
- public boolean $importDisabled = false;
- public string $importDir = '';
- // methods
- public false parseChunk()
- public void fileExists()
- public void expressionList()
- public void expression()
- public void expHelper()
- public void propertyValue()
- public void value()
- public void import()
- public void mediaTypes()
- public void accessor()
- public void string()
- public void unit()
- public void color()
- public void argumentValues()
- public void argumentDef()
- public void tags()
- public void tagBracket()
- public void tag()
- public void func()
- public void variable()
- public void assign()
- public void keyword()
- public void end()
- public void compressList()
- public void compileBlock()
- public void indent()
- public void compileProperty()
- public void compileValue()
- public void lib_rgbahex()
- public void lib_quote()
- public void lib_unquote()
- public void lib_floor()
- public void lib_round()
- public void quoted()
- public void funcToColor()
- public void reduceBlock()
- public void reduce()
- public void evaluate()
- public void fixColor()
- public void op_number_color()
- public void op_color_number()
- public void op_color_color()
- public void op_number_number()
- public void pushName()
- public void popName()
- public void push()
- public void pop()
- public void set()
- public void setLiteral()
- public void append()
- public void appendAll()
- public void prepend()
- public void getRaw()
- public void get()
- public void getVal()
- public void getEnv()
- public void merge()
- public void isProperty()
- public void isBlock()
- public void literal()
- public void preg_quote()
- public void to()
- public void match()
- public void peek()
- public void seek()
- protected void prepareParser()
- public void parse()
- public void throwParseError()
- public void __construct()
- public void removeComments()
- public void allParsedFiles()
- protected void addParsedFile()
- public static void ccompile()
- public static array cexecute()
Members
protected
- $allParsedFiles
- $buffer
- $count
- $dtypes
- $env
- $expandStack
- $line
- $operatorString
- $precedence
- $units
public
- $imPrefix
- $importDir
- $importDisabled
- $indentChar
- $indentLevel
- $mPrefix
- $selfSelector
- $vPrefix
Methods
protected
- addParsedFile()
- prepareParser() — Initialize state for a fresh parse
public
- __construct() — Initialize any static state, can initialize parser for a file
- accessor()
- allParsedFiles()
- append()
- appendAll()
- argumentDef()
- argumentValues()
- assign()
- ccompile()
- cexecute() — Execute lessphp on a .less file or a lessphp cache structure
- color()
- compileBlock() — Recursively compiles a block.
- compileProperty()
- compileValue() — Compiles a typed value into a CSS string.
- compressList()
- end()
- evaluate()
- expHelper()
- expression()
- expressionList()
- fileExists()
- fixColor()
- func()
- funcToColor()
- get()
- getEnv()
- getRaw()
- getVal()
- import()
- indent()
- isBlock()
- isProperty()
- keyword()
- lib_floor()
- lib_quote()
- lib_rgbahex()
- lib_round()
- lib_unquote()
- literal()
- match()
- mediaTypes()
- merge() — Merge a block into the current environment.
- op_color_color()
- op_color_number()
- op_number_color()
- op_number_number()
- parse()
- parseChunk() — Parse a single chunk off the head of the buffer and place it.
- peek()
- pop()
- popName()
- preg_quote()
- prepend()
- propertyValue()
- push()
- pushName()
- quoted()
- reduce()
- reduceBlock()
- removeComments()
- seek()
- set()
- setLiteral()
- string()
- tag()
- tagBracket()
- throwParseError()
- to()
- unit()
- value()
- variable()