Lines Matching +full:- +full:m
44 '-' => 1,
62 ['/border-radius$/i', '/^font$/i'];
65 'font-face',
68 '-moz-document',
70 '-moz-viewport',
71 '-o-viewport',
72 '-ms-viewport'
82 * property1: 10 -5; // is two numbers, 10 and -5
83 * property2: (10 -5); // should evaluate to 5
97 $this->eatWhiteDefault = true;
98 $this->sourceName = $sourceName; // name used for error messages
100 $this->writeComments = false;
123 $this->count = 0;
124 $this->line = 1;
126 $this->env = null; // block stack
127 $this->buffer = $this->writeComments ? $buffer : $this->removeComments($buffer);
128 $this->pushSpecialBlock('root');
129 $this->eatWhiteDefault = true;
130 $this->seenComments = [];
133 // if (preg_match('/^\s+/', $this->buffer, $m)) {
134 // $this->line += substr_count($m[0], "\n");
135 // $this->buffer = ltrim($this->buffer);
137 $this->whitespace();
140 while (false !== $this->parseChunk()) {
141 // no-op
144 if ($this->count != strlen($this->buffer)) {
145 $this->throwError(sprintf(
147 $this->count,
148 strlen($this->buffer)
153 if (!property_exists($this->env, 'parent') || !is_null($this->env->parent)) {
154 $this->throwError('parse error: unclosed block');
157 return $this->env;
192 * Before parsing a chain, use $s = $this->seek() to remember the current
193 * position into $s. Then if a chain fails, use $this->seek($s) to
200 if (empty($this->buffer)) return false;
201 $s = $this->seek();
203 if ($this->whitespace()) {
208 if ($this->keyword($key) && $this->assign() &&
209 $this->propertyValue($value, $key) && $this->end()) {
210 $this->append(['assign', $key, $value], $s);
213 $this->seek($s);
218 if ($this->literal('@', false)) {
219 $this->count--;
222 if ($this->literal('@media')) {
223 if (($this->mediaQueryList($mediaQueries) || true)
224 && $this->literal('{')) {
225 $media = $this->pushSpecialBlock('media');
226 $media->queries = is_null($mediaQueries) ? [] : $mediaQueries;
229 $this->seek($s);
234 if ($this->literal('@', false) && $this->keyword($dirName)) {
235 if ($this->isDirective($dirName, $this->blockDirectives)) {
236 if (($this->openString('{', $dirValue, null, [';']) || true) &&
237 $this->literal('{')) {
238 $dir = $this->pushSpecialBlock('directive');
239 $dir->name = $dirName;
240 if (isset($dirValue)) $dir->value = $dirValue;
243 } elseif ($this->isDirective($dirName, $this->lineDirectives)) {
244 if ($this->propertyValue($dirValue) && $this->end()) {
245 $this->append(['directive', $dirName, $dirValue]);
248 } elseif ($this->literal(':', true)) {
250 if (($this->openString('{', $dirValue, null, [';']) || true) &&
251 $this->literal('{')) {
252 $dir = $this->pushBlock($this->fixTags(['@' . $dirName]));
253 $dir->name = $dirName;
254 if (isset($dirValue)) $dir->value = $dirValue;
260 $this->seek($s);
264 if ($this->variable($var) && $this->assign() &&
265 $this->propertyValue($value) && $this->end()) {
266 $this->append(['assign', $var, $value], $s);
269 $this->seek($s);
272 if ($this->import($importValue)) {
273 $this->append($importValue, $s);
278 if ($this->tag($tag, true) && $this->argumentDef($args, $isVararg) &&
279 ($this->guards($guards) || true) &&
280 $this->literal('{')) {
281 $block = $this->pushBlock($this->fixTags([$tag]));
282 $block->args = $args;
283 $block->isVararg = $isVararg;
284 if (!empty($guards)) $block->guards = $guards;
287 $this->seek($s);
291 if ($this->tags($tags) && $this->literal('{', false)) {
292 $tags = $this->fixTags($tags);
293 $this->pushBlock($tags);
296 $this->seek($s);
300 if ($this->literal('}', false)) {
302 $block = $this->pop();
304 $this->seek($s);
305 $this->throwError($e->getMessage());
309 if (is_null($block->type)) {
311 if (!isset($block->args)) {
312 foreach ($block->tags as $tag) {
320 foreach ($block->tags as $tag) {
322 $this->env->children[$tag][] = $block;
328 $this->append(['block', $block], $s);
333 $this->whitespace();
338 if ($this->mixinTags($tags) &&
339 ($this->argumentDef($argv, $isVararg) || true) &&
340 ($this->keyword($suffix) || true) && $this->end()) {
341 $tags = $this->fixTags($tags);
342 $this->append(['mixin', $tags, $argv, $suffix], $s);
345 $this->seek($s);
349 if ($this->literal(';')) return true;
361 $pattern = '/^(-[a-z-]+-)?(' . $pattern . ')$/i';
381 while ($this->expression($exp)) {
393 * @link http://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code
397 if ($this->value($lhs)) {
398 $out = $this->expHelper($lhs, 0);
401 if (!empty($this->env->supressedDivision)) {
402 unset($this->env->supressedDivision);
403 $s = $this->seek();
404 if ($this->literal('/') && $this->value($rhs)) {
407 $this->seek($s);
421 $this->inExp = true;
422 $ss = $this->seek();
425 $whiteBefore = isset($this->buffer[$this->count - 1]) &&
426 ctype_space($this->buffer[$this->count - 1]);
430 $needWhite = $whiteBefore && !$this->inParens;
433 $this->match(self::$operatorString . ($needWhite ? '\s' : ''), $m) &&
434 self::$precedence[$m[1]] >= $minP
437 !$this->inParens && isset($this->env->currentProperty) && $m[1] == '/' &&
438 empty($this->env->supressedDivision)
441 if (preg_match($pattern, $this->env->currentProperty)) {
442 $this->env->supressedDivision = true;
449 $whiteAfter = isset($this->buffer[$this->count - 1]) &&
450 ctype_space($this->buffer[$this->count - 1]);
452 if (!$this->value($rhs)) break;
456 $this->peek(self::$operatorString, $next) &&
457 self::$precedence[$next[1]] > self::$precedence[$m[1]]
459 $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]);
462 $lhs = ['expression', $m[1], $lhs, $rhs, $whiteBefore, $whiteAfter];
463 $ss = $this->seek();
471 $this->seek($ss);
481 if ($keyName !== null) $this->env->currentProperty = $keyName;
484 while ($this->expressionList($v)) {
486 $s = $this->seek();
487 if (!$this->literal(',')) break;
490 if ($s) $this->seek($s);
492 if ($keyName !== null) unset($this->env->currentProperty);
502 $s = $this->seek();
505 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != '(') {
509 $inParens = $this->inParens;
510 if ($this->literal('(') &&
511 ($this->inParens = true) && $this->expression($exp) &&
512 $this->literal(')')) {
514 $this->inParens = $inParens;
517 $this->inParens = $inParens;
518 $this->seek($s);
527 $s = $this->seek();
530 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == '-') {
532 if ($this->literal('-', false) &&
533 (($this->variable($inner) && $inner = ['variable', $inner]) ||
534 $this->unit($inner) ||
535 $this->parenValue($inner))) {
536 $value = ['unary', '-', $inner];
539 $this->seek($s);
543 if ($this->parenValue($value)) return true;
544 if ($this->unit($value)) return true;
545 if ($this->color($value)) return true;
546 if ($this->func($value)) return true;
547 if ($this->stringValue($value)) return true;
549 if ($this->keyword($word)) {
555 if ($this->variable($var)) {
561 if ($this->literal('~') && $this->stringValue($str)) {
565 $this->seek($s);
569 if ($this->literal('\\') && $this->match('([0-9]+)', $m)) {
570 $value = ['keyword', '\\' . $m[1]];
573 $this->seek($s);
582 if (!$this->literal('@import')) return false;
588 if ($this->propertyValue($value)) {
597 if ($this->genericList($list, 'mediaQuery', ',', false)) {
606 $s = $this->seek();
613 $this->literal('only') && ($only = true) ||
614 $this->literal('not') && ($not = true) ||
617 $this->keyword($mediaType)
625 $this->seek($s);
629 if (!empty($mediaType) && !$this->literal('and')) {
632 $this->genericList($expressions, 'mediaExpression', 'and', false);
637 $this->seek($s);
647 $s = $this->seek();
649 if ($this->literal('(') &&
650 $this->keyword($feature) &&
651 ($this->literal(':') && $this->expression($value) || true) &&
652 $this->literal(')')) {
656 } elseif ($this->variable($variable)) {
661 $this->seek($s);
668 $oldWhite = $this->eatWhiteDefault;
669 $this->eatWhiteDefault = false;
684 while ($this->match($patt, $m, false)) {
685 if (!empty($m[1])) {
686 $content[] = $m[1];
688 $nestingLevel += substr_count($m[1], $nestingOpen);
692 $tok = $m[2];
694 $this->count -= strlen($tok);
699 $nestingLevel--;
703 if (($tok == "'" || $tok == '"') && $this->stringValue($str)) {
708 if ($tok == '@{' && $this->interpolation($inter)) {
718 $this->count += strlen($tok);
721 $this->eatWhiteDefault = $oldWhite;
727 $content[count($content) - 1] = rtrim(end($content));
736 $s = $this->seek();
737 if ($this->literal('"', false)) {
739 } elseif ($this->literal("'", false)) {
750 $oldWhite = $this->eatWhiteDefault;
751 $this->eatWhiteDefault = false;
753 while ($this->match($patt, $m, false)) {
754 $content[] = $m[1];
755 if ($m[2] == '@{') {
756 $this->count -= strlen($m[2]);
757 if ($this->interpolation($inter)) {
760 $this->count += strlen($m[2]);
763 } elseif ($m[2] == '\\') {
764 $content[] = $m[2];
765 if ($this->literal($delim, false)) {
769 $this->count -= strlen($delim);
774 $this->eatWhiteDefault = $oldWhite;
776 if ($this->literal($delim)) {
781 $this->seek($s);
787 $oldWhite = $this->eatWhiteDefault;
788 $this->eatWhiteDefault = true;
790 $s = $this->seek();
791 if ($this->literal('@{') &&
792 $this->openString('}', $interp, null, ["'", '"', ';']) &&
793 $this->literal('}', false)) {
795 $this->eatWhiteDefault = $oldWhite;
796 if ($this->eatWhiteDefault) $this->whitespace();
800 $this->eatWhiteDefault = $oldWhite;
801 $this->seek($s);
808 if (isset($this->buffer[$this->count])) {
809 $char = $this->buffer[$this->count];
813 if ($this->match('([0-9]+(?:\.[0-9]*)?|\.[0-9]+)([%a-zA-Z]+)?', $m)) {
814 $unit = ['number', $m[1], empty($m[2]) ? '' : $m[2]];
823 if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) {
824 if (strlen($m[1]) > 7) {
825 $out = ['string', '', [$m[1]]];
827 $out = ['raw_color', $m[1]];
846 $s = $this->seek();
847 if (!$this->literal('(')) return false;
858 if ($this->literal('...')) {
863 if ($this->$method($value)) {
866 $ss = $this->seek();
868 if ($this->assign() && $this->$method($rhs)) {
871 $this->seek($ss);
872 if ($this->literal('...')) {
887 if (!$this->literal($delim)) {
888 if ($delim == ',' && $this->literal(';')) {
900 $this->throwError('Cannot mix ; and , as delimiter types');
908 $this->throwError('Unexpected rest before semicolon');
935 if (!$this->literal(')')) {
936 $this->seek($s);
950 while ($this->tag($tt, $simple)) {
952 if (!$this->literal($delim)) break;
964 while ($this->tag($tt, true)) {
966 $this->literal('>');
978 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != '[') {
982 $s = $this->seek();
986 if ($this->literal('[', false)) {
990 if ($this->literal(']', false)) {
991 $this->count--;
995 if ($this->match('\s+', $m)) {
999 if ($this->stringValue($str)) {
1012 if ($this->keyword($word)) {
1017 if ($this->interpolation($inter)) {
1024 if ($this->match('[|-~\$\*\^=]+', $m)) {
1025 $attrParts[] = $m[0];
1032 if ($this->literal(']', false)) {
1040 $this->seek($s);
1043 $this->seek($s);
1054 $s = $this->seek();
1058 while ($this->tagBracket($parts, $hasExpression)) {
1059 // no-op
1062 $oldWhite = $this->eatWhiteDefault;
1063 $this->eatWhiteDefault = false;
1066 if ($this->match('([' . $chars . '0-9][' . $chars . ']*)', $m)) {
1067 $parts[] = $m[1];
1070 while ($this->tagBracket($parts, $hasExpression)) {
1071 // no-op
1076 if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == '@') {
1077 if ($this->interpolation($interp)) {
1084 if ($this->literal('@')) {
1090 if ($this->unit($unit)) { // for keyframes
1099 $this->eatWhiteDefault = $oldWhite;
1101 $this->seek($s);
1111 $this->whitespace();
1118 $s = $this->seek();
1120 if ($this->match('(%|[\w\-_][\w\-_:\.]+|[\w_])', $m) && $this->literal('(')) {
1121 $fname = $m[1];
1123 $sPreArgs = $this->seek();
1127 $ss = $this->seek();
1129 if ($this->keyword($name) && $this->literal('=') && $this->expressionList($value)) {
1132 $this->seek($ss);
1133 if ($this->expressionList($value)) {
1138 if (!$this->literal(',')) break;
1142 if ($this->literal(')')) {
1147 $this->seek($sPreArgs);
1148 if ($this->openString(')', $string) && $this->literal(')')) {
1155 $this->seek($s);
1162 $s = $this->seek();
1163 if ($this->literal(Constants::VPREFIX, false) &&
1164 ($this->variable($sub) || $this->keyword($name))) {
1174 $this->seek($s);
1184 if ($name) $this->currentProperty = $name;
1185 return $this->literal(':') || $this->literal('=');
1191 if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) {
1192 $word = $m[1];
1201 if ($this->literal(';', false)) {
1203 } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {
1212 $s = $this->seek();
1214 if (!$this->literal('when')) {
1215 $this->seek($s);
1221 while ($this->guardGroup($g)) {
1223 if (!$this->literal(',')) break;
1228 $this->seek($s);
1239 $s = $this->seek();
1241 while ($this->guard($guard)) {
1243 if (!$this->literal('and')) break;
1248 $this->seek($s);
1257 $s = $this->seek();
1258 $negate = $this->literal('not');
1260 if ($this->literal('(') && $this->expression($exp) && $this->literal(')')) {
1266 $this->seek($s);
1274 if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
1277 if (!isset($what[1]) && isset($this->buffer[$this->count])) {
1278 if ($this->buffer[$this->count] == $what) {
1280 $this->count++;
1293 return $this->match(self::$literalCache[$what], $m, $eatWhitespace);
1298 $s = $this->seek();
1301 while ($this->$parseItem($value)) {
1304 if (!$this->literal($delim)) break;
1309 $this->seek($s);
1324 // $until - don't include $what in advance
1333 …if (!$this->match('(' . $validChars . '*?)' . Lessc::preg_quote($what), $m, !$until)) return false;
1334 if ($until) $this->count -= strlen($what); // give back $what
1335 $out = $m[1];
1342 if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
1344 $r = '/' . $regex . ($eatWhitespace && !$this->writeComments ? '\s*' : '') . '/Ais';
1345 if (preg_match($r, $this->buffer, $out, 0, $this->count)) {
1346 $this->count += strlen($out[0]);
1347 if ($eatWhitespace && $this->writeComments) $this->whitespace();
1356 if ($this->writeComments) {
1358 while (preg_match(self::$whitePattern, $this->buffer, $m, 0, $this->count)) {
1359 if (isset($m[1]) && empty($this->seenComments[$this->count])) {
1360 $this->append(['comment', $m[1]]);
1361 $this->seenComments[$this->count] = true;
1363 $this->count += strlen($m[0]);
1368 $this->match('', $m);
1369 return strlen($m[0]) > 0;
1376 if (is_null($from)) $from = $this->count;
1378 return preg_match($r, $this->buffer, $out, 0, $from);
1384 if ($where === null) return $this->count;
1385 else $this->count = $where;
1404 $count = is_null($count) ? $this->count : $count;
1406 $line = $this->line + substr_count(substr($this->buffer, 0, $count), "\n");
1408 if ($this->peek("(.*?)(\n|$)", $m, $count)) {
1409 $culprit = $m[1];
1415 $this->sourceName,
1424 $b->parent = $this->env;
1426 $b->type = $type;
1427 $b->id = self::$nextBlockId++;
1429 $b->isVararg = false; // TODO: kill me from here
1430 $b->tags = $selectors;
1432 $b->props = [];
1433 $b->children = [];
1438 $b->parser = $this;
1441 $b->count = $this->count;
1443 $this->env = $b;
1450 return $this->pushBlock(null, $type);
1456 if ($pos !== null) $prop[-1] = $pos;
1457 $this->env->props[] = $prop;
1463 $old = $this->env;
1464 $this->env = $this->env->parent;
1492 if (preg_match('/url\(.*?\)/', $text, $m, 0, $count))
1493 $count += strlen($m[0]) - strlen($min[0]);
1497 … if (preg_match('/' . $min[0] . '.*?(?<!\\\\)' . $min[0] . '/', $text, $m, 0, $count))
1498 $count += strlen($m[0]) - 1;
1502 if ($skip === false) $skip = strlen($text) - $count;
1503 else $skip -= $count;
1506 if (preg_match('/\/\*.*?\*\//s', $text, $m, 0, $count)) {
1507 $skip = strlen($m[0]);
1508 $newlines = substr_count($m[0], "\n");