protected function parseLines($document)
    {
        // Including files
        $document = str_replace("\r\n", "\n", $document);
        $document = "\n$document\n";
        $document = $this->includeFiles($document);
        
        // Removing UTF-8 BOM
        $bom = "\xef\xbb\xbf";
        $document = str_replace($bom, '', $document);

        $lines = explode("\n", $document);
        $this->state = self::STATE_BEGIN;

        foreach ($lines as $n => $line) {
            $this->currentLine = $n;
            while (!$this->parseLine($line));
        }

        // Document is flushed twice to trigger the directives
        $this->flush();
        $this->flush();
    }