Passed
Pull Request — master (#900)
by Michael
02:50
created

InnerParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 54
ccs 28
cts 28
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 52 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright 2016 Johannes M. Schmitt <[email protected]>
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
namespace JMS\Serializer\Type;
22
23
/**
24
 * @internal
25
 * @generated Use regenerate-parser.php to refresh this class.
26
 */
27
final class InnerParser extends \Hoa\Compiler\Llk\Parser
28
{
29 427
    public function __construct()
30
    {
31 427
        parent::__construct(
32
            [
33 427
                'default' => [
34
                    'skip' => '\s+',
35
                    'parenthesis_' => '<',
36
                    '_parenthesis' => '>',
37
                    'comma' => ',',
38
                    'name' => '(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\)*[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*',
39
                    'quote_:quoted_string' => '"',
40
                    'apostrophe_:apostrophed_string' => '\'',
41
                ],
42
                'quoted_string' => [
43
                    'quoted_string' => '(?:[^"]|"")+',
44
                    '_quote:default' => '"',
45
                ],
46
                'apostrophed_string' => [
47
                    'apostrophed_string' => '(?:[^\']|\'\')+',
48
                    '_apostrophe:default' => '\'',
49
                ],
50
            ],
51
            [
52 427
                'type' => new \Hoa\Compiler\Llk\Rule\Choice('type', ['simple_type', 'compound_type'], null),
53 427
                1 => new \Hoa\Compiler\Llk\Rule\Token(1, 'name', null, -1, true),
54 427
                2 => new \Hoa\Compiler\Llk\Rule\Concatenation(2, [1], '#simple_type'),
55 427
                3 => new \Hoa\Compiler\Llk\Rule\Token(3, 'quote_', null, -1, false),
56 427
                4 => new \Hoa\Compiler\Llk\Rule\Token(4, 'quoted_string', null, -1, true),
57 427
                5 => new \Hoa\Compiler\Llk\Rule\Token(5, '_quote', null, -1, false),
58 427
                6 => new \Hoa\Compiler\Llk\Rule\Concatenation(6, [3, 4, 5], '#simple_type'),
59 427
                7 => new \Hoa\Compiler\Llk\Rule\Token(7, 'apostrophe_', null, -1, false),
60 427
                8 => new \Hoa\Compiler\Llk\Rule\Token(8, 'apostrophed_string', null, -1, true),
61 427
                9 => new \Hoa\Compiler\Llk\Rule\Token(9, '_apostrophe', null, -1, false),
62 427
                10 => new \Hoa\Compiler\Llk\Rule\Concatenation(10, [7, 8, 9], '#simple_type'),
63 427
                'simple_type' => new \Hoa\Compiler\Llk\Rule\Choice('simple_type', [2, 6, 10], null),
64 427
                12 => new \Hoa\Compiler\Llk\Rule\Token(12, 'name', null, -1, true),
65 427
                13 => new \Hoa\Compiler\Llk\Rule\Token(13, 'parenthesis_', null, -1, false),
66 427
                14 => new \Hoa\Compiler\Llk\Rule\Token(14, 'comma', null, -1, false),
67 427
                15 => new \Hoa\Compiler\Llk\Rule\Concatenation(15, [14, 'type'], '#compound_type'),
68 427
                16 => new \Hoa\Compiler\Llk\Rule\Repetition(16, 0, -1, 15, null),
69 427
                17 => new \Hoa\Compiler\Llk\Rule\Token(17, '_parenthesis', null, -1, false),
70 427
                'compound_type' => new \Hoa\Compiler\Llk\Rule\Concatenation('compound_type', [12, 13, 'type', 16, 17], null),
71
            ],
72
            [
73 427
            ]
74
        );
75
76 427
        $this->getRule('type')->setPPRepresentation(' simple_type() | compound_type()');
77 427
        $this->getRule('simple_type')->setDefaultId('#simple_type');
78 427
        $this->getRule('simple_type')->setPPRepresentation(' <name> | ::quote_:: <quoted_string> ::_quote:: | ::apostrophe_:: <apostrophed_string> ::_apostrophe::');
79 427
        $this->getRule('compound_type')->setDefaultId('#compound_type');
80 427
        $this->getRule('compound_type')->setPPRepresentation(' <name> ::parenthesis_:: type() ( ::comma:: type() )* ::_parenthesis::');
81 427
    }
82
}
83