PointcutLexer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 62
c 0
b 0
f 0
ccs 33
cts 33
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 56 1
1
<?php
2
3
declare(strict_types=1);
4
/*
5
 * Go! AOP framework
6
 *
7
 * @copyright Copyright 2013, Lisachenko Alexander <[email protected]>
8
 *
9
 * This source file is subject to the license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Go\Aop\Pointcut;
14
15
use Dissect\Lexer\SimpleLexer;
16
17
/**
18
 * This class defines a lexer for pointcut expression
19
 */
20
class PointcutLexer extends SimpleLexer
21
{
22
    /**
23
     * Lexer token definitions
24
     */
25 31
    public function __construct()
26
    {
27
        // General tokens
28 31
        $this->token('execution');
29 31
        $this->token('dynamic');
30 31
        $this->token('within');
31 31
        $this->token('access');
32 31
        $this->token('cflowbelow');
33 31
        $this->token('initialization');
34 31
        $this->token('staticinitialization');
35 31
        $this->token('matchInherited');
36
37
        // Parenthesis
38 31
        $this->token('(');
39 31
        $this->token(')');
40
41
        // Member modifiers
42 31
        $this->token('public');
43 31
        $this->token('protected');
44 31
        $this->token('private');
45 31
        $this->token('final');
46
47
        // Access type (dynamic or static)
48 31
        $this->token('->');
49 31
        $this->token('::');
50
51
        // Logic tokens
52 31
        $this->token('!');
53 31
        $this->token('&');
54 31
        $this->token('&&');
55 31
        $this->token('|');
56 31
        $this->token('||');
57
58 31
        $this->token('annotation', '@');
59
60
        // Regex for class name
61 31
        $this->regex('namePart', '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/');
62
63
        // NS separator
64 31
        $this->token('nsSeparator', '\\');
65
66
        // Return-type specifier
67 31
        $this->token(':');
68
69
        // Special wildcard tokens
70 31
        $this->token('+');
71 31
        $this->token('*');
72 31
        $this->token('**');
73
74
        // White spaces
75 31
        $this->regex('WSP', "/^[ \r\n\t]+/");
76
77
        // Comments
78 31
        $this->regex('CMT', '|^//.*|');
79 31
        $this->skip('CMT', 'WSP');
80 31
    }
81
}
82