Code Duplication    Length = 3-5 lines in 2 locations

src/Yacc/Parser.php 1 location

@@ 372-374 (lines=3) @@
369
        while ($token->getType() === Token::NAME || $token->getType() === Token::STRING) {
370
            $p = $this->context->internSymbol($token->getValue(), true);
371
372
            if ($p->name[0] === "'") {
373
                $p->value = Utils::characterValue(\mb_substr($p->name, 1, -1));
374
            }
375
376
            if ($type) {
377
                $p->type = $type;

src/Grammar/Context.php 1 location

@@ 373-377 (lines=5) @@
370
            return $p;
371
        }
372
        if ($isTerm || $s[0] === "'") {
373
            if ($s[0] === "'") {
374
                $p->value = Utils::characterValue(\mb_substr($s, 1, -1));
375
            } else {
376
                $p->value = -1;
377
            }
378
            $p->terminal = Symbol::TERMINAL;
379
        } else {
380
            $p->value = null;