Lines Matching refs:this

82         foreach ((array)$this->importDir as $dir) {
84 if ($this->fileExists($file = $full.'.less') || $this->fileExists($file = $full)) {
107 $importPath = $this->flattenList($importPath[2]);
110 $str = $this->coerceString($importPath);
113 $url = $this->compileValue($this->lib_e($str));
118 $realPath = $this->findImport($url);
122 if ($this->importDisabled) {
126 if (isset($this->allParsedFiles[realpath($realPath)])) {
130 $this->addParsedFile($realPath);
131 $parser = $this->makeParser($realPath);
157 [$top, $bottom] = $this->sortProps($root->props, true);
158 $this->compileImportedProps($top, $parentBlock, $out, $parser, $dir);
164 $oldSourceParser = $this->sourceParser;
166 $oldImport = $this->importDir;
169 $this->importDir = (array)$this->importDir;
170 array_unshift($this->importDir, $importDir);
173 $this->compileProp($prop, $block, $out);
176 $this->importDir = $oldImport;
177 $this->sourceParser = $oldSourceParser;
204 $this->compileRoot($block);
207 $this->compileCSSBlock($block);
210 $this->compileMedia($block);
215 $name .= " " . $this->compileValue($this->reduce($block->value));
218 $this->compileNestedBlock($block, array($name));
226 $env = $this->pushEnv();
228 $selectors = $this->compileSelectors($block->tags);
229 $env->selectors = $this->multiplySelectors($selectors);
230 $out = $this->makeOutputBlock(null, $env->selectors);
232 $this->scope->children[] = $out;
233 $this->compileProps($block, $out);
236 $this->popEnv();
240 $env = $this->pushEnv($media);
241 $parentScope = $this->mediaParent($this->scope);
243 $query = $this->compileMediaQuery($this->multiplyMedia($env));
245 $this->scope = $this->makeOutputBlock($media->type, array($query));
246 $parentScope->children[] = $this->scope;
248 $this->compileProps($media, $this->scope);
250 if (count($this->scope->lines) > 0) {
251 $orphanSelelectors = $this->findClosestSelectors();
253 $orphan = $this->makeOutputBlock(null, $orphanSelelectors);
254 $orphan->lines = $this->scope->lines;
255 array_unshift($this->scope->children, $orphan);
256 $this->scope->lines = array();
260 $this->scope = $this->scope->parent;
261 $this->popEnv();
276 $this->pushEnv($block);
277 $this->scope = $this->makeOutputBlock($block->type, $selectors);
278 $this->scope->parent->children[] = $this->scope;
280 $this->compileProps($block, $this->scope);
282 $this->scope = $this->scope->parent;
283 $this->popEnv();
287 $this->pushEnv();
288 $this->scope = $this->makeOutputBlock($root->type);
289 $this->compileProps($root, $this->scope);
290 $this->popEnv();
294 foreach ($this->sortProps($block->props) as $prop) {
295 $this->compileProp($prop, $block, $out);
297 $out->lines = $this->deduplicate($out->lines);
336 if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) {
379 $this->compileValue($this->reduce($q[2])) . ")";
385 $parts[] = $this->compileValue($this->reduce($q));
398 implode($this->formatter->selectorSeparator, $compiledQueries);
412 return $this->multiplyMedia($env->parent, $childQueries);
427 return $this->multiplyMedia($env->parent, $out);
434 $part = str_replace($this->parentSelector, $replace, $part, $c);
437 $tag = implode($this->parentSelector, $parts);
442 $env = $this->env;
460 $parentSelectors = $this->findClosestSelectors();
464 $this->expandParentSelectors($s, "");
473 $count = $this->expandParentSelectors($child, $parent);
494 $out[] = trim($this->compileValue($this->reduce($value)));
514 $this->pushEnv();
515 $this->zipSetArgs($block->args, $orderedArgs, $keywordArgs);
523 $passed = $this->reduce($guard) == self::$TRUE;
526 $this->popEnv();
565 if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) {
598 if ($this->patternMatch($block, $orderedArgs, $keywordArgs)) {
617 $matches = $this->patternMatchAll($blocks, $orderedArgs, $keywordArgs, $seen);
626 $subMatches = $this->findBlocks($subBlock,
640 return $this->findBlocks($searchIn->parent, $path, $orderedArgs, $keywordArgs, $seen);
662 $this->throwError("Failed to assign arg " . $a[1]);
666 $value = $this->reduce($value);
667 $this->set($a[1], $value);
679 $this->set($last[1], $this->reduce(array("list", " ", $rest)));
683 $this->env->arguments = $assignedValues + $orderedValues;
689 $this->sourceLoc = isset($prop[-1]) ? $prop[-1] : -1;
694 if ($name[0] == $this->vPrefix) {
695 $this->set($name, $value);
697 $out->lines[] = $this->formatter->property($name,
698 $this->compileValue($this->reduce($value)));
703 $this->compileBlock($child);
716 $orderedArgs[] = $this->reduce(array("variable", $arg[1]));
718 $keywordArgs[$arg[1]] = $this->reduce($arg[2]);
723 $orderedArgs[] = $this->reduce($arg[1]);
726 $this->throwError("Unknown arg type: " . $arg[0]);
730 $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs);
749 $mixinParentEnv = $this->pushEnv();
756 $this->pushEnv();
757 $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs);
763 foreach ($this->sortProps($mixin->props) as $subProp) {
767 $subProp[1][0] != $this->vPrefix)
775 $this->compileProp($subProp, $mixin, $out);
780 if ($haveArgs) $this->popEnv();
781 if ($haveScope) $this->popEnv();
790 $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';';
797 $importPath = $this->reduce($importPath);
799 if (!isset($this->env->imports)) {
800 $this->env->imports = array();
803 $result = $this->tryImport($importPath, $block, $out);
805 $this->env->imports[$importId] = $result === false ?
806 array(false, "@import " . $this->compileValue($importPath).";") :
812 $import = $this->env->imports[$importId];
819 $this->compileImportedProps($bottom, $block, $out, $parser, $importDir);
845 return implode($value[1], array_map(array($this, 'compileValue'), $value[2]));
847 if (!empty($this->formatter->compressColors)) {
848 return $this->compileValue($this->coerceColor($value));
858 if ($this->numberPrecision !== null) {
859 $num = round($num, $this->numberPrecision);
867 $part = $this->compileValue($part);
887 if (!empty($this->formatter->compressColors)) {
898 return $name.'('.$this->compileValue($args).')';
900 $this->throwError("unknown value type: $value[0]");
905 [$base, $exp] = $this->assertArgs($args, 2, "pow");
906 …return array( "number", pow($this->assertNumber($base), $this->assertNumber($exp)), $args[2][0][2]…
914 [$a, $b] = $this->assertArgs($args, 2, "mod");
915 return array( "number", $this->assertNumber($a) % $this->assertNumber($b), $args[2][0][2] );
919 [$value, $to] = $this->assertArgs($args, 2, "convert");
925 return $this->convert( $value, $to );
929 return array( "number", abs($this->assertNumber($num)), $num[2] );
933 $values = $this->assertMinArgs($args, 1, "min");
942 $converted = $this->convert( $values[$a], $first_format );
955 $values = $this->assertMinArgs($args, 1, "max");
964 $converted = $this->convert( $values[$a], $first_format );
977 return tan($this->assertNumber($num));
981 return sin($this->assertNumber($num));
985 return cos($this->assertNumber($num));
989 $num = atan($this->assertNumber($num));
994 $num = asin($this->assertNumber($num));
999 $num = acos($this->assertNumber($num));
1004 return sqrt($this->assertNumber($num));
1008 [$list, $idx] = $this->assertArgs($value, 2, "extract");
1009 $idx = $this->assertNumber($idx);
1017 return $this->toBool($value[0] == "number");
1021 return $this->toBool($value[0] == "string");
1025 return $this->toBool($this->coerceColor($value));
1029 return $this->toBool($value[0] == "keyword");
1033 return $this->toBool($value[0] == "number" && $value[2] == "px");
1037 return $this->toBool($value[0] == "number" && $value[2] == "%");
1041 return $this->toBool($value[0] == "number" && $value[2] == "em");
1045 return $this->toBool($value[0] == "number" && $value[2] == "rem");
1049 $color = $this->coerceColor($color);
1051 $this->throwError("color expected for rgbahex");
1059 return $this->lib_rgbahex($color);
1072 $fullpath = $this->findImport($url);
1101 return $this->lib_e($items[0]);
1103 $this->throwError("unrecognised input");
1110 return array("keyword", $this->compileValue($arg));
1118 $template = $this->compileValue($this->lib_e($string));
1124 $this->reduce($values[$i]) : array('keyword', '');
1127 if ($color = $this->coerceColor($val)) {
1132 $rep = $this->compileValue($this->lib_e($val));
1143 $value = $this->assertNumber($arg);
1148 $value = $this->assertNumber($arg);
1154 $value = $this->assertNumber($arg);
1157 $value = $this->assertNumber($arg[2][0]);
1158 $precision = $this->assertNumber($arg[2][1]);
1166 return array("number", $this->assertNumber($number),
1167 $this->compileValue($this->lib_e($newUnit)));
1169 return array("number", $this->assertNumber($arg), "");
1182 $color = $this->assertColor($color);
1189 [$color, $delta] = $this->colorArgs($args);
1191 $hsl = $this->toHSL($color);
1192 $hsl[3] = $this->clamp($hsl[3] - $delta, 100);
1193 return $this->toRGB($hsl);
1197 [$color, $delta] = $this->colorArgs($args);
1199 $hsl = $this->toHSL($color);
1200 $hsl[3] = $this->clamp($hsl[3] + $delta, 100);
1201 return $this->toRGB($hsl);
1205 [$color, $delta] = $this->colorArgs($args);
1207 $hsl = $this->toHSL($color);
1208 $hsl[2] = $this->clamp($hsl[2] + $delta, 100);
1209 return $this->toRGB($hsl);
1213 [$color, $delta] = $this->colorArgs($args);
1215 $hsl = $this->toHSL($color);
1216 $hsl[2] = $this->clamp($hsl[2] - $delta, 100);
1217 return $this->toRGB($hsl);
1221 [$color, $delta] = $this->colorArgs($args);
1223 $hsl = $this->toHSL($color);
1228 return $this->toRGB($hsl);
1232 [$color, $delta] = $this->colorArgs($args);
1233 $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) - $delta/100);
1238 [$color, $delta] = $this->colorArgs($args);
1239 $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) + $delta/100);
1244 $hsl = $this->toHSL($this->assertColor($color));
1249 $hsl = $this->toHSL($this->assertColor($color));
1254 $hsl = $this->toHSL($this->assertColor($color));
1261 if (!is_null($color = $this->coerceColor($value))) {
1268 [$color, $alpha] = $this->colorArgs($args);
1269 $color[4] = $this->clamp($alpha / 100.0);
1274 $num = $this->assertNumber($arg);
1283 $this->throwError("mix expects (color1, color2, weight)");
1286 $first = $this->assertColor($first);
1287 $second = $this->assertColor($second);
1289 $first_a = $this->lib_alpha($first);
1290 $second_a = $this->lib_alpha($second);
1314 return $this->fixColor($new);
1323 $inputColor = ( isset($args[2][0]) ) ? $this->assertColor($args[2][0]) : $lightColor;
1324 $darkColor = ( isset($args[2][1]) ) ? $this->assertColor($args[2][1]) : $darkColor;
1325 $lightColor = ( isset($args[2][2]) ) ? $this->assertColor($args[2][2]) : $lightColor;
1331 $threshold = $this->assertNumber($args[2][3]);
1335 $inputColor = $this->assertColor($args);
1338 $inputColor = $this->coerceColor($inputColor);
1339 $darkColor = $this->coerceColor($darkColor);
1340 $lightColor = $this->coerceColor($lightColor);
1343 if ( $this->lib_luma($darkColor) > $this->lib_luma($lightColor) ) {
1349 $inputColor_alpha = $this->lib_alpha($inputColor);
1350 if ( ( $this->lib_luma($inputColor) * $inputColor_alpha) < $threshold) {
1357 $color = $this->coerceColor($color);
1363 $color = $this->coerceColor($value);
1364 if (is_null($color)) $this->throwError($error);
1370 $this->throwError($error);
1377 if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list");
1385 $this->throwError("{$name}expecting $expectedArgs arguments, got $numValues");
1393 if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list");
1401 … $this->throwError("{$name}expecting at least $expectedMinArgs arguments, got $numValues");
1473 $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2);
1474 $g = $this->toRGB_helper($H, $temp1, $temp2);
1475 $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2);
1501 $val = $this->reduce($c);
1508 $hsl[] = $this->clamp($val, $clamp);
1513 return $this->toRGB($hsl);
1519 $c = $this->reduce($c);
1538 return $this->fixColor($components);
1547 $reduced = $this->reduce($value[1]);
1548 $var = $this->compileValue($reduced);
1549 $res = $this->reduce(array("variable", $this->vPrefix . $var));
1552 $res = $this->coerceColor($res);
1555 if (empty($value[2])) $res = $this->lib_e($res);
1561 $key = $this->reduce($key);
1562 $key = $this->vPrefix . $this->compileValue($this->lib_e($key));
1565 $seen =& $this->env->seenNames;
1568 $this->throwError("infinite loop detected: $key");
1572 $out = $this->reduce($this->get($key));
1577 $item = $this->reduce($item, $forExpression);
1581 return $this->evaluate($value);
1586 $part = $this->reduce($part);
1587 if ($strip) $part = $this->lib_e($part);
1593 return $this->lib_e($this->reduce($inner));
1595 $color = $this->funcToColor($value);
1601 $f = isset($this->libFunctions[$name]) ?
1602 $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name));
1608 $ret = call_user_func($f, $this->reduce($args, true), $this);
1624 $value[2] = $this->reduce($value[2]);
1628 $exp = $this->reduce($exp);
1645 if ($color = $this->coerceColor($value)) {
1650 return $this->coerceColor($value);
1704 return $this->flattenList($value[2][0]);
1718 $left = $this->reduce($left, true);
1719 $right = $this->reduce($right, true);
1721 if ($leftColor = $this->coerceColor($left)) {
1725 if ($rightColor = $this->coerceColor($right)) {
1734 return $this->toBool($left == self::$TRUE && $right == self::$TRUE);
1738 return $this->toBool($this->eq($left, $right) );
1741 if ($op == "+" && !is_null($str = $this->stringConcatenate($left, $right))) {
1747 if (is_callable(array($this, $fname))) {
1748 $out = $this->$fname($op, $left, $right);
1761 if ($strLeft = $this->coerceString($left)) {
1769 if ($strRight = $this->coerceString($right)) {
1777 $value = $this->assertNumber( $number );
1845 $this->throwError( "Cannot convert {$from} to {$to}" );
1860 return $this->op_color_number($op, $rgt, $lft);
1867 return $this->op_color_color($op, $lft,
1891 if ($rval == 0) $this->throwError("evaluate error: can't divide by zero");
1895 $this->throwError('evaluate error: color op number failed on op '.$op);
1898 return $this->fixColor($out);
1902 $color = $this->coerceColor($color);
1904 $this->throwError('color expected for red()');
1911 $color = $this->coerceColor($color);
1913 $this->throwError('color expected for green()');
1920 $color = $this->coerceColor($color);
1922 $this->throwError('color expected for blue()');
1948 if ($right[1] == 0) $this->throwError('parse error: divide by zero');
1952 return $this->toBool($left[1] < $right[1]);
1954 return $this->toBool($left[1] > $right[1]);
1956 return $this->toBool($left[1] >= $right[1]);
1958 return $this->toBool($left[1] <= $right[1]);
1960 $this->throwError('parse error: unknown number operator: '.$op);
1975 $b->parent = $this->scope;
1982 $e->parent = $this->env;
1986 $this->env = $e;
1992 $old = $this->env;
1993 $this->env = $this->env->parent;
1999 $this->env->store[$name] = $value;
2005 $current = $this->env;
2010 $isArguments = $name == $this->vPrefix . 'arguments';
2053 $this->throwError("variable $name is undefined");
2058 $this->pushEnv();
2059 $parser = new lessc_parser($this, __METHOD__);
2068 $this->set($name, $value);
2079 $this->_parseFile = $fname;
2087 $this->parser = $this->makeParser($name);
2088 $root = $this->parser->parse($string);
2090 $this->env = null;
2091 $this->scope = null;
2092 $this->allParsedFiles = array();
2094 $this->formatter = $this->newFormatter();
2096 if (!empty($this->registeredVars)) {
2097 $this->injectVariables($this->registeredVars);
2100 $this->sourceParser = $this->parser; // used for error messages
2101 $this->compileBlock($root);
2104 $this->formatter->block($this->scope);
2117 $oldImport = $this->importDir;
2119 $this->importDir = (array)$this->importDir;
2120 $this->importDir[] = $pi['dirname'].'/';
2122 $this->addParsedFile($fname);
2124 $out = $this->compile(file_get_contents($fname), $fname);
2126 $this->importDir = $oldImport;
2158 $output = $this->cachedCompile($metadata ? $metadata : $in);
2175 $this->compileFile($in, $out);
2233 $out['compiled'] = $this->compileFile($root);
2234 $out['files'] = $this->allParsedFiles();
2253 $oldVars = $this->registeredVars;
2255 $this->setVariables($initialVariables);
2259 if (empty($this->_parseFile)) {
2263 $out = $this->compileFile($this->_parseFile);
2265 $out = $this->compile($str);
2268 $this->registeredVars = $oldVars;
2273 $parser = new lessc_parser($this, $name);
2274 $parser->writeComments = $this->preserveComments;
2280 $this->formatterName = $name;
2285 if (!empty($this->formatterName)) {
2286 if (!is_string($this->formatterName))
2287 return $this->formatterName;
2288 $className = "lessc_formatter_$this->formatterName";
2295 $this->preserveComments = $preserve;
2299 $this->libFunctions[$name] = $func;
2303 unset($this->libFunctions[$name]);
2307 $this->registeredVars = array_merge($this->registeredVars, $variables);
2311 unset($this->registeredVars[$name]);
2315 $this->importDir = (array)$dirs;
2319 $this->importDir = (array)$this->importDir;
2320 $this->importDir[] = $dir;
2324 return $this->allParsedFiles;
2328 $this->allParsedFiles[realpath($file)] = filemtime($file);
2335 if ($this->sourceLoc >= 0) {
2336 $this->sourceParser->throwError($msg, $this->sourceLoc);
2572 $this->eatWhiteDefault = true;
2574 $this->lessc = $lessc;
2576 $this->sourceName = $sourceName; // name used for error messages
2578 $this->writeComments = false;
2595 $this->count = 0;
2596 $this->line = 1;
2598 $this->env = null; // block stack
2599 $this->buffer = $this->writeComments ? $buffer : $this->removeComments($buffer);
2600 $this->pushSpecialBlock("root");
2601 $this->eatWhiteDefault = true;
2602 $this->seenComments = array();
2609 $this->whitespace();
2612 while (false !== $this->parseChunk());
2614 if ($this->count != strlen($this->buffer))
2615 $this->throwError();
2618 if ( !property_exists($this->env, 'parent') || !is_null($this->env->parent) )
2621 return $this->env;
2661 if (empty($this->buffer)) return false;
2662 $s = $this->seek();
2664 if ($this->whitespace()) {
2669 if ($this->keyword($key) && $this->assign() &&
2670 $this->propertyValue($value, $key) && $this->end())
2672 $this->append(array('assign', $key, $value), $s);
2675 $this->seek($s);
2680 if ($this->literal('@', false)) {
2681 $this->count--;
2684 if ($this->literal('@media')) {
2685 if (($this->mediaQueryList($mediaQueries) || true)
2686 && $this->literal('{'))
2688 $media = $this->pushSpecialBlock("media");
2692 $this->seek($s);
2697 if ($this->literal("@", false) && $this->keyword($dirName)) {
2698 if ($this->isDirective($dirName, $this->blockDirectives)) {
2699 if (($this->openString("{", $dirValue, null, array(";")) || true) &&
2700 $this->literal("{"))
2702 $dir = $this->pushSpecialBlock("directive");
2707 } elseif ($this->isDirective($dirName, $this->lineDirectives)) {
2708 if ($this->propertyValue($dirValue) && $this->end()) {
2709 $this->append(array("directive", $dirName, $dirValue));
2712 } elseif ($this->literal(":", true)) {
2714 if (($this->openString("{", $dirValue, null, array(";")) || true) &&
2715 $this->literal("{"))
2717 $dir = $this->pushBlock($this->fixTags(array("@".$dirName)));
2725 $this->seek($s);
2729 if ($this->variable($var) && $this->assign() &&
2730 $this->propertyValue($value) && $this->end())
2732 $this->append(array('assign', $var, $value), $s);
2735 $this->seek($s);
2738 if ($this->import($importValue)) {
2739 $this->append($importValue, $s);
2744 if ($this->tag($tag, true) && $this->argumentDef($args, $isVararg) &&
2745 ($this->guards($guards) || true) &&
2746 $this->literal('{'))
2748 $block = $this->pushBlock($this->fixTags(array($tag)));
2754 $this->seek($s);
2758 if ($this->tags($tags) && $this->literal('{', false)) {
2759 $tags = $this->fixTags($tags);
2760 $this->pushBlock($tags);
2763 $this->seek($s);
2767 if ($this->literal('}', false)) {
2769 $block = $this->pop();
2771 $this->seek($s);
2772 $this->throwError($e->getMessage());
2780 if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
2789 $this->env->children[$tag][] = $block;
2795 $this->append(array('block', $block), $s);
2800 $this->whitespace();
2805 if ($this->mixinTags($tags) &&
2806 ($this->argumentDef($argv, $isVararg) || true) &&
2807 ($this->keyword($suffix) || true) && $this->end())
2809 $tags = $this->fixTags($tags);
2810 $this->append(array('mixin', $tags, $argv, $suffix), $s);
2813 $this->seek($s);
2817 if ($this->literal(';')) return true;
2834 if ($tag[0] == $this->lessc->vPrefix)
2835 $tag[0] = $this->lessc->mPrefix;
2844 while ($this->expression($exp)) {
2859 if ($this->value($lhs)) {
2860 $out = $this->expHelper($lhs, 0);
2863 if (!empty($this->env->supressedDivision)) {
2864 unset($this->env->supressedDivision);
2865 $s = $this->seek();
2866 if ($this->literal("/") && $this->value($rhs)) {
2870 $this->seek($s);
2883 $this->inExp = true;
2884 $ss = $this->seek();
2887 $whiteBefore = isset($this->buffer[$this->count - 1]) &&
2888 ctype_space($this->buffer[$this->count - 1]);
2892 $needWhite = $whiteBefore && !$this->inParens;
2894 …if ($this->match(self::$operatorString.($needWhite ? '\s' : ''), $m) && self::$precedence[$m[1]] >…
2895 …if (!$this->inParens && isset($this->env->currentProperty) && $m[1] == "/" && empty($this->env->su…
2897 if (preg_match($pattern, $this->env->currentProperty)) {
2898 $this->env->supressedDivision = true;
2905 $whiteAfter = isset($this->buffer[$this->count - 1]) &&
2906 ctype_space($this->buffer[$this->count - 1]);
2908 if (!$this->value($rhs)) break;
2911 …if ($this->peek(self::$operatorString, $next) && self::$precedence[$next[1]] > self::$precedence[$…
2912 $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]);
2916 $ss = $this->seek();
2924 $this->seek($ss);
2933 if ($keyName !== null) $this->env->currentProperty = $keyName;
2936 while ($this->expressionList($v)) {
2938 $s = $this->seek();
2939 if (!$this->literal(',')) break;
2942 if ($s) $this->seek($s);
2944 if ($keyName !== null) unset($this->env->currentProperty);
2953 $s = $this->seek();
2956 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "(") {
2960 $inParens = $this->inParens;
2961 if ($this->literal("(") &&
2962 ($this->inParens = true) && $this->expression($exp) &&
2963 $this->literal(")"))
2966 $this->inParens = $inParens;
2969 $this->inParens = $inParens;
2970 $this->seek($s);
2978 $s = $this->seek();
2981 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "-") {
2983 if ($this->literal("-", false) &&
2984 (($this->variable($inner) && $inner = array("variable", $inner)) ||
2985 $this->unit($inner) ||
2986 $this->parenValue($inner)))
2991 $this->seek($s);
2995 if ($this->parenValue($value)) return true;
2996 if ($this->unit($value)) return true;
2997 if ($this->color($value)) return true;
2998 if ($this->func($value)) return true;
2999 if ($this->stringValue($value)) return true;
3001 if ($this->keyword($word)) {
3007 if ($this->variable($var)) {
3013 if ($this->literal("~") && $this->stringValue($str)) {
3017 $this->seek($s);
3021 if ($this->literal('\\') && $this->match('([0-9]+)', $m)) {
3025 $this->seek($s);
3033 if (!$this->literal('@import')) return false;
3039 if ($this->propertyValue($value)) {
3046 if ($this->genericList($list, "mediaQuery", ",", false)) {
3054 $s = $this->seek();
3059 …if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) &…
3066 $this->seek($s);
3070 if (!empty($mediaType) && !$this->literal("and")) {
3073 $this->genericList($expressions, "mediaExpression", "and", false);
3078 $this->seek($s);
3087 $s = $this->seek();
3089 if ($this->literal("(") &&
3090 $this->keyword($feature) &&
3091 ($this->literal(":") && $this->expression($value) || true) &&
3092 $this->literal(")"))
3097 } elseif ($this->variable($variable)) {
3102 $this->seek($s);
3108 $oldWhite = $this->eatWhiteDefault;
3109 $this->eatWhiteDefault = false;
3124 while ($this->match($patt, $m, false)) {
3134 $this->count-= strlen($tok);
3143 if (($tok == "'" || $tok == '"') && $this->stringValue($str)) {
3148 if ($tok == "@{" && $this->interpolation($inter)) {
3158 $this->count+= strlen($tok);
3161 $this->eatWhiteDefault = $oldWhite;
3175 $s = $this->seek();
3176 if ($this->literal('"', false)) {
3178 } elseif ($this->literal("'", false)) {
3190 $oldWhite = $this->eatWhiteDefault;
3191 $this->eatWhiteDefault = false;
3193 while ($this->match($patt, $m, false)) {
3196 $this->count -= strlen($m[2]);
3197 if ($this->interpolation($inter, false)) {
3200 $this->count += strlen($m[2]);
3205 if ($this->literal($delim, false)) {
3209 $this->count -= strlen($delim);
3214 $this->eatWhiteDefault = $oldWhite;
3216 if ($this->literal($delim)) {
3221 $this->seek($s);
3226 $oldWhite = $this->eatWhiteDefault;
3227 $this->eatWhiteDefault = true;
3229 $s = $this->seek();
3230 if ($this->literal("@{") &&
3231 $this->openString("}", $interp, null, array("'", '"', ";")) &&
3232 $this->literal("}", false))
3235 $this->eatWhiteDefault = $oldWhite;
3236 if ($this->eatWhiteDefault) $this->whitespace();
3240 $this->eatWhiteDefault = $oldWhite;
3241 $this->seek($s);
3247 if (isset($this->buffer[$this->count])) {
3248 $char = $this->buffer[$this->count];
3252 if ($this->match('([0-9]+(?:\.[0-9]*)?|\.[0-9]+)([%a-zA-Z]+)?', $m)) {
3261 if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) {
3279 $s = $this->seek();
3280 if (!$this->literal('(')) return false;
3288 if ($this->literal("...")) {
3293 if ($this->$method($value)) {
3296 $ss = $this->seek();
3298 if ($this->assign() && $this->$method($rhs)) {
3301 $this->seek($ss);
3302 if ($this->literal("...")) {
3317 if (!$this->literal($delim)) {
3318 if ($delim == "," && $this->literal(";")) {
3330 $this->throwError("Cannot mix ; and , as delimiter types");
3338 $this->throwError("Unexpected rest before semicolon");
3366 if (!$this->literal(')')) {
3367 $this->seek($s);
3380 while ($this->tag($tt, $simple)) {
3382 if (!$this->literal($delim)) break;
3393 while ($this->tag($tt, true)) {
3395 $this->literal(">");
3406 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "[") {
3410 $s = $this->seek();
3414 if ($this->literal("[", false)) {
3418 if ($this->literal("]", false)) {
3419 $this->count--;
3423 if ($this->match('\s+', $m)) {
3427 if ($this->stringValue($str)) {
3431 $chunk = str_replace($this->lessc->parentSelector, "$&$", $chunk);
3440 if ($this->keyword($word)) {
3445 if ($this->interpolation($inter, false)) {
3452 if ($this->match('[|-~\$\*\^=]+', $m)) {
3460 if ($this->literal("]", false)) {
3468 $this->seek($s);
3471 $this->seek($s);
3482 $s = $this->seek();
3486 while ($this->tagBracket($parts, $hasExpression));
3488 $oldWhite = $this->eatWhiteDefault;
3489 $this->eatWhiteDefault = false;
3492 if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) {
3496 while ($this->tagBracket($parts, $hasExpression));
3500 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
3501 if ($this->interpolation($interp)) {
3508 if ($this->literal("@")) {
3514 if ($this->unit($unit)) { // for keyframes
3523 $this->eatWhiteDefault = $oldWhite;
3525 $this->seek($s);
3535 $this->whitespace();
3541 $s = $this->seek();
3543 if ($this->match('(%|[\w\-_][\w\-_:\.]+|[\w_])', $m) && $this->literal('(')) {
3546 $sPreArgs = $this->seek();
3550 $ss = $this->seek();
3552 if ($this->keyword($name) && $this->literal('=') && $this->expressionList($value)) {
3555 $this->seek($ss);
3556 if ($this->expressionList($value)) {
3561 if (!$this->literal(',')) break;
3565 if ($this->literal(')')) {
3570 $this->seek($sPreArgs);
3571 if ($this->openString(")", $string) && $this->literal(")")) {
3578 $this->seek($s);
3584 $s = $this->seek();
3585 if ($this->literal($this->lessc->vPrefix, false) &&
3586 ($this->variable($sub) || $this->keyword($name)))
3591 $name = $this->lessc->vPrefix.$name;
3597 $this->seek($s);
3606 if ($name) $this->currentProperty = $name;
3607 return $this->literal(':') || $this->literal('=');
3612 if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) {
3621 if ($this->literal(';', false)) {
3623 } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {
3631 $s = $this->seek();
3633 if (!$this->literal("when")) {
3634 $this->seek($s);
3640 while ($this->guardGroup($g)) {
3642 if (!$this->literal(",")) break;
3647 $this->seek($s);
3657 $s = $this->seek();
3659 while ($this->guard($guard)) {
3661 if (!$this->literal("and")) break;
3666 $this->seek($s);
3674 $s = $this->seek();
3675 $negate = $this->literal("not");
3677 if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) {
3683 $this->seek($s);
3690 if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
3693 if (!isset($what[1]) && isset($this->buffer[$this->count])) {
3694 if ($this->buffer[$this->count] == $what) {
3696 $this->count++;
3709 return $this->match(self::$literalCache[$what], $m, $eatWhitespace);
3713 $s = $this->seek();
3715 while ($this->$parseItem($value)) {
3718 if (!$this->literal($delim)) break;
3723 $this->seek($s);
3746 … if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false;
3747 if ($until) $this->count -= strlen($what); // give back $what
3754 if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
3756 $r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais';
3757 if (preg_match($r, $this->buffer, $out, 0, $this->count)) {
3758 $this->count += strlen($out[0]);
3759 if ($eatWhitespace && $this->writeComments) $this->whitespace();
3767 if ($this->writeComments) {
3769 while (preg_match(self::$whitePattern, $this->buffer, $m, 0, $this->count)) {
3770 if (isset($m[1]) && empty($this->seenComments[$this->count])) {
3771 $this->append(array("comment", $m[1]));
3772 $this->seenComments[$this->count] = true;
3774 $this->count += strlen($m[0]);
3779 $this->match("", $m);
3786 if (is_null($from)) $from = $this->count;
3788 $result = preg_match($r, $this->buffer, $out, 0, $from);
3795 if ($where === null) return $this->count;
3796 else $this->count = $where;
3803 $count = is_null($count) ? $this->count : $count;
3805 $line = $this->line +
3806 substr_count(substr($this->buffer, 0, $count), "\n");
3808 if (!empty($this->sourceName)) {
3809 $loc = "$this->sourceName on line $line";
3815 if ($this->peek("(.*?)(\n|$)", $m, $count)) {
3824 $b->parent = $this->env;
3838 $b->parser = $this;
3841 $b->count = $this->count;
3843 $this->env = $b;
3849 return $this->pushBlock(null, $type);
3855 $this->env->props[] = $prop;
3860 $old = $this->env;
3861 $this->env = $this->env->parent;
3942 $this->indentLevel = 0;
3946 return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
3950 return $name . $this->assignSeparator . $value . ";";
3956 if (!$this->isEmpty($child)) return false;
3965 if ($this->isEmpty($block)) return;
3967 $inner = $pre = $this->indentStr();
3969 $isSingle = !$this->disableSingle &&
3973 $this->indentLevel++;
3975 if ($this->breakSelectors) {
3976 $selectorSeparator = $this->selectorSeparator . $this->break . $pre;
3978 $selectorSeparator = $this->selectorSeparator;
3984 echo $this->openSingle;
3987 echo $this->open . $this->break;
3988 $inner = $this->indentStr();
3994 $glue = $this->break.$inner;
3997 echo $this->break;
4002 $this->block($child);
4006 if (!$isSingle && empty($block->children)) echo $this->break;
4009 echo $this->closeSingle . $this->break;
4011 echo $pre . $this->close . $this->break;
4014 $this->indentLevel--;