private function SassParser::setIndentChar in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/SassParser.php \SassParser::setIndentChar()
Determine the indent character and indent spaces. The first character of the first indented line determines the character. If this is a space the number of spaces determines the indentSpaces; this is always 1 if the indent character is a tab. Only used for .sass files.
Throws
SassException if the indent is mixed or the indent character can not be determined
1 call to SassParser::setIndentChar()
- SassParser::toTree in phpsass/
SassParser.php - Parse Sass source into a document tree. If the tree is already created return that.
File
- phpsass/
SassParser.php, line 921
Class
- SassParser
- SassParser class. Parses {@link http://sass-lang.com/ .sass and .sccs} files. @package PHamlP @subpackage Sass
Code
private function setIndentChar() {
foreach ($this->source as $l => $source) {
if (!empty($source) && in_array($source[0], $this->indentChars)) {
$this->indentChar = $source[0];
for ($i = 0, $len = strlen($source); $i < $len && $source[$i] == $this->indentChar; $i++) {
}
if ($i < $len && in_array($source[$i], $this->indentChars)) {
$this->line = ++$l;
$this->source = $source;
if ($this->debug) {
throw new SassException('Mixed indentation not allowed', $this);
}
}
$this->indentSpaces = $this->indentChar == ' ' ? $i : 1;
return;
}
}
// foreach
$this->indentChar = ' ';
$this->indentSpaces = 2;
}