MDL-63422 lib: lessphp - review core loop / switch / case / continue

This commit is contained in:
Eloy Lafuente (stronk7) 2018-10-14 22:20:48 +02:00
parent 77331aed27
commit b702dbf6dd
2 changed files with 12 additions and 10 deletions

View file

@ -67,7 +67,7 @@ class Less_Exception_Chunk extends Less_Exception_Parser{
case 40: case 40:
$parenLevel++; $parenLevel++;
$lastParen = $this->parserCurrentIndex; $lastParen = $this->parserCurrentIndex;
continue; break;
// ) // )
case 41: case 41:
@ -75,18 +75,18 @@ class Less_Exception_Chunk extends Less_Exception_Parser{
if( $parenLevel < 0 ){ if( $parenLevel < 0 ){
return $this->fail("missing opening `(`"); return $this->fail("missing opening `(`");
} }
continue; break;
// ; // ;
case 59: case 59:
//if (!$parenLevel) { $this->emitChunk(); } //if (!$parenLevel) { $this->emitChunk(); }
continue; break;
// { // {
case 123: case 123:
$level++; $level++;
$lastOpening = $this->parserCurrentIndex; $lastOpening = $this->parserCurrentIndex;
continue; break;
// } // }
case 125: case 125:
@ -96,10 +96,10 @@ class Less_Exception_Chunk extends Less_Exception_Parser{
} }
//if (!$level && !$parenLevel) { $this->emitChunk(); } //if (!$level && !$parenLevel) { $this->emitChunk(); }
continue; break;
// \ // \
case 92: case 92:
if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; continue; } if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; break; }
return $this->fail("unescaped `\\`"); return $this->fail("unescaped `\\`");
// ", ' and ` // ", ' and `
@ -119,12 +119,12 @@ class Less_Exception_Chunk extends Less_Exception_Parser{
$this->parserCurrentIndex++; $this->parserCurrentIndex++;
} }
} }
if ($matched) { continue; } if ($matched) { break; }
return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex); return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex);
// /, check for comment // /, check for comment
case 47: case 47:
if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { continue; } if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { break; }
$cc2 = $this->CharCode($this->parserCurrentIndex+1); $cc2 = $this->CharCode($this->parserCurrentIndex+1);
if ($cc2 == 47) { if ($cc2 == 47) {
// //, find lnfeed // //, find lnfeed
@ -145,14 +145,14 @@ class Less_Exception_Chunk extends Less_Exception_Parser{
return $this->fail("missing closing `*/`", $currentChunkStartIndex); return $this->fail("missing closing `*/`", $currentChunkStartIndex);
} }
} }
continue; break;
// *, check for unmatched */ // *, check for unmatched */
case 42: case 42:
if (($this->parserCurrentIndex < $this->input_len - 1) && ($this->CharCode($this->parserCurrentIndex+1) == 47)) { if (($this->parserCurrentIndex < $this->input_len - 1) && ($this->CharCode($this->parserCurrentIndex+1) == 47)) {
return $this->fail("unmatched `/*`"); return $this->fail("unmatched `/*`");
} }
continue; break;
} }
} }

View file

@ -8,6 +8,8 @@ All the files from the folder lib/Less are copied in
this directory. Only exception made for the directory this directory. Only exception made for the directory
'.easymin' which is not included. '.easymin' which is not included.
Verify that https://github.com/oyejorge/less.php/pull/367 has been applied to the imported version or apply it locally.
Also copy the license file from the project root. Also copy the license file from the project root.
Licensed under the Apache license 2.0. Licensed under the Apache license 2.0.