private function buildFixedAndInlines(array $fixedMap, array $inlines): array
    {
        $overlapped = array_intersect($fixedMap, $inlines);
        if ($overlapped) {
            throw new \InvalidArgumentException(
                "Duplicating fixed tokens and inline tokens strings: "
                . join(', ', array_map('json_encode', $overlapped))
            );
        }

        // $fixedMap all keys are valid names, so + with integer keys will not loss anything
        $all = $fixedMap + array_values($inlines);

        // sort in reverse order to let more long items match first
        // so /'$$' | '$'/ will find ['$$', '$'] in '$$$' and not ['$', '$', '$']
        arsort($all, SORT_STRING);

        $re_map = [];

        $alias_name = 'a';
        foreach ($all as $name => $text) {
            // inline?
            if (is_int($name)) {
                $name = '_' . $alias_name;
                // string increment
                $alias_name++;

                $this->aliased[$name] = $text;
                $this->aliasOf[$text] = $name;
            }
            $re_map[$name] = $this->textToRegExp($text);
        }

        return $re_map;
    }
private function buildFixedAndInlines(array $fixedMap, array $inlines): array
    {
        $overlapped = array_intersect($fixedMap, $inlines);
        if ($overlapped) {
            throw new \InvalidArgumentException(
                "Duplicating fixed tokens and inline tokens strings: "
                . join(', ', array_map('json_encode', $overlapped))
            );
        }

        // $fixedMap all keys are valid names, so + with integer keys will not loss anything
        $all = $fixedMap + array_values($inlines);

        // sort in reverse order to let more long items match first
        // so /'$$' | '$'/ will find ['$$', '$'] in '$$$' and not ['$', '$', '$']
        arsort($all, SORT_STRING);

        $re_map = [];

        $alias_name = 'a';
        foreach ($all as $name => $text) {
            // inline?
            if (is_int($name)) {
                $name = '_' . $alias_name;
                // string increment
                $alias_name++;

                $this->aliased[$name] = $text;
                $this->aliasOf[$text] = $name;
            }
            $re_map[$name] = $this->textToRegExp($text);
        }

        return $re_map;
    }
private function buildFixedAndInlines ( array $ fixedMap , array $ inlines ) : array { $ overlapped = array_intersect ( $ fixedMap , $ inlines ) ; if ( $ overlapped ) { throw new \ InvalidArgumentException ( "Duplicating fixed tokens and inline tokens strings: " . join ( ', ' , array_map ( 'json_encode' , $ overlapped ) ) ) ; } // $fixedMap all keys are valid names, so + with integer keys will not loss anything $ all = $ fixedMap + array_values ( $ inlines ) ; // sort in reverse order to let more long items match first // so /'$$' | '$'/ will find ['$$', '$'] in '$$$' and not ['$', '$', '$'] arsort ( $ all , SORT_STRING ) ; $ re_map = [ ] ; $ alias_name = 'a' ; foreach ( $ all as $ name => $ text ) { // inline? if ( is_int ( $ name ) ) { $ name = '_' . $ alias_name ; // string increment $ alias_name ++ ; $ this -> aliased [ $ name ] = $ text ; $ this -> aliasOf [ $ text ] = $ name ; } $ re_map [ $ name ] = $ this -> textToRegExp ( $ text ) ; } return $ re_map ; }
Build inline tokens into regexp map

**Note** about side effect of changing properties in addition to returned map.

Inline tokens all are aliased with generated names. Returned regexps map has that
generated named in keys. Aliases map is stored in `$aliased` property. As of all inline
tokens are hidden, `$hiddens` map will be updated too with generated names.
@param string[] $fixedMap Fixed tokens map
@param string[] $inlines List of inline token texts.
@return string[] Returns regexps map with generated names in keys. Also properties `$aliased`
and `$hiddens` will be updated.
Build inline tokens into regexp map