Completed
Pull Request — 1.x (#286)
by Alexander
02:43
created

PointcutLexer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 2
Metric Value
wmc 1
c 5
b 0
f 2
lcom 0
cbo 1
dl 0
loc 60
ccs 32
cts 32
cp 1
rs 10

1 Method

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