/**
  * Uses the current value of $this->count to show line and line number
  *
  * @param   type  $msg  X
  *
  * @return  void
  */
 protected function throwError($msg = null)
 {
     if ($this->sourceLoc >= 0) {
         $this->sourceParser->throwError($msg, $this->sourceLoc);
     }
     throw new exception($msg);
 }
 /**
  * Constructor
  *
  * @param   [type]  $lessc       [description]
  * @param   string  $sourceName  [description]
  */
 public function __construct($lessc, $sourceName = null)
 {
     $this->eatWhiteDefault = true;
     // Reference to less needed for vPrefix, mPrefix, and parentSelector
     $this->lessc = $lessc;
     // Name used for error messages
     $this->sourceName = $sourceName;
     $this->writeComments = false;
     if (!self::$operatorString) {
         self::$operatorString = '(' . implode('|', array_map(array('FOFLess', 'preg_quote'), array_keys(self::$precedence))) . ')';
         $commentSingle = FOFLess::preg_quote(self::$commentSingle);
         $commentMultiLeft = FOFLess::preg_quote(self::$commentMultiLeft);
         $commentMultiRight = FOFLess::preg_quote(self::$commentMultiRight);
         self::$commentMulti = $commentMultiLeft . '.*?' . $commentMultiRight;
         self::$whitePattern = '/' . $commentSingle . '[^\\n]*\\s*|(' . self::$commentMulti . ')\\s*|\\s+/Ais';
     }
 }
示例#3
0
 protected function injectVariables($args)
 {
     $this->pushEnv();
     /** FOF -- BEGIN CHANGE * */
     $parser = new FOFLessParser($this, __METHOD__);
     /** FOF -- END CHANGE * */
     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);
     }
 }