You are here

private function HamlParser::getNextLine in Sassy 7

* Gets the next line. *

Parameters

array remaining source lines: * @return array the next line

1 call to HamlParser::getNextLine()
HamlParser::buildTree in phamlp/haml/HamlParser.php
* Builds a parse tree under the parent node. *

File

phamlp/haml/HamlParser.php, line 585

Class

HamlParser
HamlParser class. Parses {@link http://haml-lang.com/ Haml} view files. @package PHamlP @subpackage Haml

Code

private function getNextLine() {
  $line = array_shift($this->source);

  // Blank lines ore OK
  $haml = trim($line[self::HAML_HAML]);
  if (empty($haml)) {
    $this->line++;
    return null;
  }

  // The regex will strip off a '<' at the start of a line
  if ($line[self::HAML_WHITESPACE_REMOVAL] === self::INNER_WHITESPACE_REMOVAL && empty($line[self::HAML_TAG])) {
    $line[self::HAML_CONTENT] = $line[self::HAML_WHITESPACE_REMOVAL] . $line[self::HAML_TOKEN] . $line[self::HAML_CONTENT];
  }

  // The regex treats lines starting with [.+] as an object reference; they are just content
  if (!empty($line[self::HAML_OBJECT_REFERENCE]) && empty($line[self::HAML_TAG])) {
    unset($line[self::HAML_OBJECT_REFERENCE]);
    $line[self::HAML_CONTENT] = $line[self::HAML_SOURCE];
  }
  $line['line'] = $this->line++;
  $line['level'] = $this
    ->getLevel($line, $this->line);
  $line['filename'] = $this->filename;
  if ($this
    ->isMultiline($line)) {
    $line = $this
      ->getMultiline($line);
  }
  return $line;
}