Example #1
0
 public function __construct($lessc, $sourceName = null)
 {
     $this->eatWhiteDefault = true;
     // reference to less needed for vPrefix, mPrefix, and parentSelector
     $this->lessc = $lessc;
     $this->sourceName = $sourceName;
     // name used for error messages
     $this->writeComments = false;
     if (!self::$operatorString) {
         self::$operatorString = '(' . implode('|', array_map(array('HTML_CSS_Less', 'preg_quote'), array_keys(self::$precedence))) . ')';
         $commentSingle = HTML_CSS_Less::preg_quote(self::$commentSingle);
         $commentMultiLeft = HTML_CSS_Less::preg_quote(self::$commentMultiLeft);
         $commentMultiRight = HTML_CSS_Less::preg_quote(self::$commentMultiRight);
         self::$commentMulti = $commentMultiLeft . '.*?' . $commentMultiRight;
         self::$whitePattern = '/' . $commentSingle . '[^\\n]*\\s*|(' . self::$commentMulti . ')\\s*|\\s+/Ais';
     }
 }
Example #2
0
File: Less.php Project: roojs/pear
 protected function injectVariables($args)
 {
     $this->pushEnv();
     require_once 'Less/Parser.php';
     $parser = new HTML_CSS_Less_Parser($this, __METHOD__);
     foreach ($args as $name => $strValue) {
         if ($name[0] != '@') {
             $name = '@' . $name;
         }
         $parser->count = 0;
         $parser->buffer = (string) $strValue;
         if (!$parser->propertyValue($value)) {
             throw new Exception("failed to parse passed in variable {$name}: {$strValue}");
         }
         $this->set($name, $value);
     }
 }