Parse each line and look into it to see whats need to be done.

@return array with the resulting text and optional additional items.
486869
public function parseLines()
    {
        $text = [];

        while (($line = $this->nextLine()) !== false) {
            $line = rtrim($line);

            // Skip empty lines
            if ($line == "") {
                $text[] = null;
                continue;
            }

            // Look at start of line to detect valid blocktypes
            $blockTypes = [];
            $marker = $line[0];
            if (isset($this->blockTypes[$marker])) {
                foreach ($this->blockTypes[$marker] as $blockType) {
                    $blockTypes[] = $blockType;
                }
            }

            // Check if line is matching a detected blocktype
            foreach ($blockTypes as $blockType) {
                if ($this->{"block".$blockType}($line)) {
                    continue;
                }
            }
        }

        $text = implode("\n", $this->lines);

        return [
            "text" => $text,
            "frontmatter" => $this->frontmatter,
        ];
    }
1038831
protected function _parseArgs()
    {
        $inString = false;
        $cpt = 0;
        $last = $char = $value = $name = '';
        $args = [];
        $body = '';
        while ($token = $this->_stream->current(true)) {
            $body .= $token[1];
            switch ($token[0]) {
                case '(':
                    if ($cpt) {
                        $value .= $token[1];
                    }
                    $cpt++;
                break;
                case '=':
                    $name = $value;
                    $value = '';
                break;
                case ')':
                    $cpt--;
                    if ($cpt) {
                        $value .= $token[1];
                        break;
                    }
                case ',':
                    $value = trim($value);
                    if ($value !== '') {
                        $name ? $args[trim($name)] = $value : $args[] = $value;
                    }
                    $name = $value = '';
                break;
                default:
                    $value .= $token[1];
                break;
            }
            if ($token[1] === ')' && $cpt === 0) {
                break;
            }
            $this->_stream->next();
        }
        return compact('args', 'body');
    }
638354
protected function parseMessages($lines) {
    $messages = array();

    $message = array();
    foreach ($lines as $line) {
      if (empty($line) & !empty($message)) {
        $messages[] = $message;
        $message = array();
        continue;
      }
      $message[] = $line;
    }

    return $messages;
  }
1136891
public function __toArray()
    {
        $result = array();
        $idx = 0;
        foreach ($this->var as $idx => $line) {
            $result[] = $line->__toFields();
        }
        return $result;
    }
539362
protected function _parse_quotes()
    {
        // Matches quote types
        $re = '/(\'[^\']*\')|(\"[^\"]*\")/';

        $quotes = $this->_frame->get_style()->quotes;

        // split on spaces, except within quotes
        if (!preg_match_all($re, "$quotes", $matches, PREG_SET_ORDER)) {
            return null;
        }

        $quotes_array = array();
        foreach ($matches as $_quote) {
            $quotes_array[] = $this->_parse_string($_quote[0], true);
        }

        if (empty($quotes_array)) {
            $quotes_array = array('"', '"');
        }

        return array_chunk($quotes_array, 2);
    }
1253905
def parse_lines(self, lines: Iterable[str]) -> List[ParseResults]:
        """"""
        return [
            self.parseString(line, line_number)
            for line_number, line in enumerate(lines)
        ]
115525
private function parsing() : void
    {
        $lines = explode("\n", $this->raw);

        foreach ($lines as $line) {
            // check "at" mark
            if (false === strpos($line, '@')) {
                continue;
            }

            // check inline annotation
            if ($anp = strpos($line, '//')) {
                $line = substr($line, 0, $anp);
            }

            // trim blanks
            $line = trim(ltrim($line, ' *'));

            // analyze expr
            if (false === $fws = strpos($line, ' ')) {
                // @some-key
                $key = substr($line, 1);
                $val = true;
            } else {
                // @some-key some-val
                $key = substr($line, 1, $fws - 1);
                $val = trim(substr($line, $fws));
            }

            $this->lines[] = [$key, $val];

            $this->declares[$key][] = $val;
        }
    }
1063241
private function parse() {

		$lines = file($this -> viewmodel -> getFile());

		$this -> code = '';

		$classes = [

			'MatchEcho',
			'MatchForeach',
			'MatchEndForeach',
			'MatchFor',
			'MatchEndFor',
			'MatchIf',
			'MatchIsset',
			'MatchNotIsset',
			'MatchEmpty',
			'MatchNotEmpty',
			'MatchElseIf',
			'MatchElse',
			'MatchEndIf',
			'MatchEndIsset',
			'MatchEndNotIsset',
			'MatchEndEmpty',
			'MatchEndNotEmpty',
			'MatchForm',
			'MatchTranslation',
			'MatchEscape',
			'MatchRouter',
			'MatchHelper',
			'MatchPartial',
			'MatchFails',
			'MatchPasses',
			'MatchPHPTags'
		];

		foreach($lines as $linenumber => $line) {
			
			foreach($classes as $class) {
				
				$class = self :: NAMESPACE_MATCH . $class;
				$match = new $class($line);
				$line  = $match -> replace() -> getLine();
			}

			//User defined functions
			foreach(TemplateData :: getTemplateFunctions() as $action => $closure) {

				$class = self :: NAMESPACE_MATCH . 'MatchUserDefined';
				$match = new $class($line, $action);
				$line  = $match -> replace() -> getLine();
			}
			
			$this -> code .= trim($line) . "\n";
		}

		$this -> code = trim($this -> code);

		return $this -> code;
	}
173888
public function getLastLines(int $numberOfLines = self::DEFAULT_NUMBER_OF_LINES): array
    {
        $lines = [];
        if (null === $this->file) {
            return $lines;
        }

        $this->file->seek($this->lineCount);
        $currentKey = $this->file->key();
        while ($currentKey >= 0) {
            $line = $this->getDefaultParser()->parse($this->file->current());
            if ($line) {
                $lines[] = $line;
            }

            if (--$currentKey >= 0) {
                $this->file->seek($currentKey);
            }

            if (\count($lines) >= $numberOfLines) {
                break;
            }
        }

        return $lines;
    }
901245
public function getAddedLines()
    {
        return array_values(array_filter(
            $this->lines,
            function (Line $line) {
                return $line->getType() == Line::ADDED;
            }
        ));
    }
1188406
public function textMessages()
    {
        $result = [];
        foreach ($this->entries as $entry) {
            foreach ($entry->messages as $entryMessage) {
                if ($entryMessage->isMessage) {
                    if ($entryMessage->message->isText && !$entryMessage->message->isQuickReply) {
                        $result[] = $entryMessage;
                    }
                }
            }
        }
        return collect($result);
    }
749028
protected function lineByLine():self
	{
		while( ($line= $this->getLine())->hasMore() ){
			$this->lineNumber+= 1;

			if( $this->embedment ){
				$this->embeddingParse($line);
			}else{
				$this->parseLine($line);
			}
		}

		$this->embedment and $this->breakEmbedding();

		$this->closeNodes($this->level);

		$this->isExecuted= true;

		return $this;
	}
1235708
public function parseLocalPushRefs($lines)
    {
        $branches = [];
        $delimiter = ' pushes to ';
        foreach ($lines as $line) {
            $line = trim($line);
            $line = preg_replace('/\s+/', ' ', $line);
            $parts = explode($delimiter, $line);
            if (count($parts) > 1) {
                $value = explode(' ', $parts[1], 2);
                $branches[$parts[0]] = ['pushes_to' => $value[0], 'local_state' => $value[1]];
            }
        }

        return $branches;
    }
449270
public function parse()
    {
        $raw = $this->getRaw();
        $count = count($raw);
        for ($i = 7; $i < $count; $i++) {
            $line = $raw[$i];

            $process = new Process(
                $line[11],
                $line[0],
                floatval($line[8]),
                floatval($line[9])
            );

            $this->processes[] = $process;
        }
    }
874630
protected function parse()
	{
		if (($s = $this->copy_until_char('<'))==='')
		{
			return $this->read_tag();
		}

		// text
		$node = new Node($this);
		++$this->cursor;
		$node->_[self::HDOM_INFO_TEXT] = $s;
		$this->link_nodes($node, false);
		return true;
	}
1239428
public function getAllElements()
    {
        $paymentSlipData = $this->paymentSlipData;
        $formatted = $this->getReferenceNrFormatted();
        $fillZeros = $this->getReferenceNrFillZeros();

        $elements = parent::getAllElements();

        // Place left reference number
        if ($this->getDisplayReferenceNr()) {
            $lines = [
                $paymentSlipData->getCompleteReferenceNumber(
                    $formatted,
                    $fillZeros
                )
            ];
            $elements['referenceNumberLeft'] = [
                'lines' => $lines,
            'attributes' => $this->getReferenceNumberLeftAttr()
            ];

            // Place right reference number
            // Reuse lines from above
            $elements['referenceNumberRight'] = [
                'lines' => $lines,
                'attributes' => $this->getReferenceNumberRightAttr()
            ];
        }

        // Place code line
        if ($this->getDisplayCodeLine()) {
            $lines = [
                $paymentSlipData->getCodeLine($fillZeros)];
            $elements['codeLine'] = [
                'lines' => $lines,
                'attributes' => $this->getCodeLineAttr()
            ];
        }

        return $elements;
    }
1101433
public function readLines()
    {
        if ($this->getFileObject()->isFile()) {
            if ($this->skipEmptyLines) {
                // skip empty lines
                $lines = file($this->getFileObject()->getPathname(), FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
            } else {
                $lines = file($this->getFileObject()->getPathname(), FILE_IGNORE_NEW_LINES);
            }

            if (is_array($lines)) {
                return $lines;
            }
        }
        return array();
    }