Parses one line of Fusion

@param string $fusionLine One line of Fusion code
@return void
@throws Fusion\Exception
422439
protected function parseFusionLine($fusionLine)
    {
        $fusionLine = trim($fusionLine);

        if ($this->currentBlockCommentState === true) {
            $this->parseComment($fusionLine);
        } else {
            if ($fusionLine === '') {
                return;
            } elseif (preg_match(self::SCAN_PATTERN_COMMENT, $fusionLine)) {
                $this->parseComment($fusionLine);
            } elseif (preg_match(self::SCAN_PATTERN_OPENINGCONFINEMENT, $fusionLine)) {
                $this->parseConfinementBlock($fusionLine, true);
            } elseif (preg_match(self::SCAN_PATTERN_CLOSINGCONFINEMENT, $fusionLine)) {
                $this->parseConfinementBlock($fusionLine, false);
            } elseif (preg_match(self::SCAN_PATTERN_DECLARATION, $fusionLine)) {
                $this->parseDeclaration($fusionLine);
            } elseif (preg_match(self::SCAN_PATTERN_OBJECTDEFINITION, $fusionLine)) {
                $this->parseObjectDefinition($fusionLine);
            } else {
                throw new Fusion\Exception('Syntax error in line ' . $this->currentLineNumber . '. (' . $fusionLine . ')', 1180547966);
            }
        }
    }
549934
private function parseLine($line)
    {
        if (!$line) {
            return array();
        }

        $line = trim($line);

        if (!$line) {
            return array();
        }

        $array = array();
        $group = $this->nodeContainsGroup($line);

        if ($group) {
            $this->addGroup($line, $group);
            $line = $this->stripGroup ($line, $group);
        }
        if ($this->startsMappedSequence($line)) {
            return $this->returnMappedSequence($line);
        }
        if ($this->startsMappedValue($line)) {
            return $this->returnMappedValue($line);
        }
        if ($this->isArrayElement($line)) {
            return $this->returnArrayElement($line);
        }
        if ($this->isPlainArray($line)) {
            return $this->returnPlainArray($line);
        }

        return $this->returnKeyValuePair($line);
    }
1015017
protected function parseComment($fusionLine)
    {
        if (preg_match(self::SPLIT_PATTERN_COMMENTTYPE, $fusionLine, $matches, PREG_OFFSET_CAPTURE) === 1) {
            switch ($matches[1][0]) {
                case '/*':
                    $this->currentBlockCommentState = true;
                    break;
                case '*/':
                    if ($this->currentBlockCommentState !== true) {
                        throw new Fusion\Exception('Unexpected closing block comment without matching opening block comment.', 1180615119);
                    }
                    $this->currentBlockCommentState = false;
                    $this->parseFusionLine(substr($fusionLine, ($matches[1][1] + 2)));
                    break;
                case '#':
                case '//':
                default:
                    break;
            }
        } elseif ($this->currentBlockCommentState === false) {
            throw new Fusion\Exception('No comment type matched although the comment scan regex matched the Fusion line (' . $fusionLine . ').', 1180614895);
        }
    }
872134
protected function handle($fusionPath, \Exception $exception, $referenceCode)
    {
        $logMessage = $this->throwableStorage->logThrowable($exception);
        $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
        if (isset($referenceCode)) {
            return sprintf(
                '<!-- Exception while rendering %s: %s (%s) -->',
                $this->formatScriptPath($fusionPath, ''),
                htmlspecialchars($exception->getMessage()),
                $referenceCode
            );
        } else {
            return sprintf(
                '<!-- Exception while rendering %s: %s -->',
                $this->formatScriptPath($fusionPath, ''),
                htmlspecialchars($exception->getMessage())
            );
        }
    }
540807
private function parse($line)
    {
        $uriParser = new UriParser($line);
        $line = $uriParser->encode();
        if ($uriParser->validateIP() ||
            !$uriParser->validateHost() ||
            (
                parse_url($line, PHP_URL_SCHEME) !== null &&
                !$uriParser->validateScheme()
            )
        ) {
            return false;
        }
        $parts = $this->getParts($line);
        return $parts['scheme'] . $parts['host'] . $parts['port'];
    }
710201
public function render($fusionPath)
    {
        try {
            $output = $this->evaluateInternal($fusionPath, self::BEHAVIOR_EXCEPTION);
            if ($this->debugMode) {
                $output = sprintf('%1$s<!-- Beginning to render TS path "%2$s" (Context: %3$s) -->%4$s%1$s<!-- End to render TS path "%2$s" (Context: %3$s) -->',
                    chr(10),
                    $fusionPath,
                    implode(', ', array_keys($this->getCurrentContext())),
                    $output
                );
            }
        } catch (SecurityException $securityException) {
            throw $securityException;
        } catch (\Exception $exception) {
            $output = $this->handleRenderingException($fusionPath, $exception);
        }

        return $output;
    }
612109
protected function processContinuedLineInSameState($line)
    {
        switch ($this->state) {
            case 'msgctxt':
            case 'msgid':
            case 'msgid_plural':
                if (is_string($this->currentEntry[$this->state])) {
                    // Convert it to array
                    $this->currentEntry[$this->state] = array($this->currentEntry[$this->state]);
                }
                $this->currentEntry[$this->state][] = $line;
                break;
            case 'msgstr':
                $this->currentEntry['msgstr'][] = trim($line, '"');
                break;
            default:
                throw new \Exception('Parse error!');
        }
    }
1257188
private function parseLines(array $lines)
    {
        $originUnchanged = $this->originStartLine;
        $destUnchanged = $this->destStartLine;

        $deleted = $this->originStartLine;
        $new = $this->destStartLine;
        foreach ($lines as $line) {
            if (preg_match('/^\+(.*)/', $line)) {
                $this->lines[] = new DiffChunkLineAdded($new++, preg_replace('/\+(.*)/', ' $1', $line));
                $destUnchanged++;
            } else if (preg_match('/^-(.*)/', $line)) {
                $this->lines[] = new DiffChunkLineDeleted($deleted++, preg_replace('/-(.*)/', ' $1', $line));
                $originUnchanged++;
            } else if (preg_match('/^ (.*)/', $line) || $line == '') {
                $this->lines[] = new DiffChunkLineUnchanged($originUnchanged++, $destUnchanged++, $line);
                $deleted++;
                $new++;
            } else if (!preg_match('/\\ No newline at end of file/', $line)) {
                throw new \Exception(sprintf('GitElephant was unable to parse the line %s', $line));
            }
        }
    }
1201876
protected function processLine($line)
    {
        if ($line === '') {
            $this->handleBlankLine();
            return;
        }

        $this->justNewEntry = false;

        $data = $this->parseLine($line);

        if ($data['key'][0] === '#') {
            $this->handleComment($data);
            return;
        }

        $this->handleOtherCases($data, $line);
    }
1120010
public function parseLine($line) {
        $line = trim($line, "\r\n");

        if (preg_match('/^([\w-]+):\s+(.+)/', $line, $matches)) {
            $name = strtolower($matches[1]);
            $value = $matches[2];
            $this->currentHeader = $name;

            if (isset($this->headers[$name])) {
                if (!is_array($this->headers[$name])) {
                    $this->headers[$name] = [$this->headers[$name]];
                }
                $this->headers[$name][] = $value;
            }
            else {
                $this->headers[$name] = $value;
            }
        }
        elseif (preg_match('/^\s+(.+)$/', $line, $matches) && $this->currentHeader !== null) {
            if (is_array($this->headers[$this->currentHeader])) {
                $lastKey = sizeof($this->headers[$this->currentHeader]) - 1;
                $this->headers[$this->currentHeader][$lastKey] .= $matches[1];
            }
            else {
                $this->headers[$this->currentHeader] .= $matches[1];
            }
        }

        return $this;
    }
1036389
protected function parseLine(string $line): string
    {
        if (!$this->isHiraganaCodePoints($line)) {
            throw new SyntaxException(_('ピクトセンスで使用可能の文字はひらがな、「ヴ」「ー」のみです。ただし、「ゔ」「ゕ」「ゖ」「𛀁」も使用できません: ') . $line);
        }
        
        if (mb_strlen($line, 'UTF-8') > self::WORD_MAX) {
            throw new SyntaxException(sprintf(_('「%1$s」は%2$d文字を越えています。'), $line, self::WORDS_MAX));
        }

        return str_replace('ヴ', 'ゔ', $line);
    }
1029826
protected function parse_line($line)
    {
        $line = trim($line);
        if (empty($line)) {
            return null;
        }

        $fields = rcube_utils::explode_quoted_string(',', $line);

        // remove quotes if needed
        if (!empty($fields)) {
            foreach ($fields as $idx => $value) {
                if (($len = strlen($value)) > 1 && $value[0] == '"' && $value[$len-1] == '"') {
                    // remove surrounding quotes
                    $value = substr($value, 1, -1);
                    // replace doubled quotes inside the string with single quote
                    $value = str_replace('""', '"', $value);

                    $fields[$idx] = $value;
                }
            }
        }

        return $fields;
    }
210708
private function parse_ftp_rawlist($line) {
		$output = array();

		$split = preg_split('[ ]', $line, 9, PREG_SPLIT_NO_EMPTY);
		if ($split[0] != 'total') {
			$output['isdir'] = ($split[0] {0} === 'd');
			$output['perms'] = $split[0];
			$output['number'] = $split[1];
			$output['owner'] = $split[2];
			$output['group'] = $split[3];
			$output['size'] = $split[4];
			$output['month'] = $split[5];
			$output['day'] = $split[6];
			$output['time/year'] = $split[7];
			$output['name'] = $split[8];
		}
		return !empty($output) ? $output : false;
	}
620968
public function parse($line)
    {
        $elements = [];

        // 1. remove braces
        $line = \str_replace(['{', '}'], '', $line);

        // 2. extract elements
        $elements = $this->extractElements($line);

        // 3. remove quotes
        $iterator = function($element)
        {
            return \str_replace(['\'', '"'], '', $element);
        };

        return \array_map($iterator, $elements);
    }
1226177
private function parseResponseHeaderLine($line) {
        list($key, $value) = explode(':', $line, 2);
        $key = trim(strtolower(str_replace('-', '_', $key)));
        $value = trim($value);
        if (empty($this->headers[$key])) {
            $this->headers[$key] = $value;
        } elseif (is_array($this->headers[$key])) {
            $this->headers[$key][] = $value;
        } else {
            $this->headers[$key] = array($this->headers[$key], $value);
        }
    }
1008296
public static function parseMultiLineComment($line)
    {
        $parsed = preg_replace('-^\s*/\*+-', '', $line);
        $parsed = preg_replace('-\*/-', '', $parsed);
        return rtrim($parsed);
    }
415996
public function handleRenderingException($fusionPath, \Exception $exception)
    {
        if ($exception instanceof RuntimeException) {
            throw $exception;
        } else {
            throw new RuntimeException('Fusion Rendering Exception, see fusionPath and nested Exception for details.', 1401803055, $exception, $fusionPath);
        }
    }