private function SassParser::setIndentChar in Sassy 7
Same name and namespace in other branches
- 7.3 phpsass/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 phamlp/
sass/ SassParser.php - * Parse Sass source into a document tree. * If the tree is already created return that. *
File
- phamlp/
sass/ SassParser.php, line 833
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;
throw new SassException('Mixed indentation not allowed', array(), $this);
}
$this->indentSpaces = $this->indentChar == ' ' ? $i : 1;
return;
}
}
// foreach
$this->indentChar = ' ';
$this->indentSpaces = 2;
}