Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Use strpos (much faster than preg_match) to determine if a char is a white space #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,15 @@ private function forget(){
array_pop($this->saveStack);
}


/**
* Determine if the character at the specified offset from the current position is a white space.
*
* @param int $offset
*
* @return bool
*/
private function isWhitespace($offset = 0) {
return preg_match('/\s/',$this->input[ $this->pos + $offset]);
return strpos(" \t\n\r\v\f", $this->input[$this->pos + $offset]) !== false;
}

/**
Expand Down