@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @param Readable $input |
88 | - * @return \Traversable|TokenInterface[] |
|
88 | + * @return \Generator |
|
89 | 89 | */ |
90 | 90 | protected function exec(Readable $input): \Traversable |
91 | 91 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | - * @return iterable|TokenDefinition[] |
|
162 | + * @return \Generator |
|
163 | 163 | */ |
164 | 164 | public function getTokenDefinitions(): iterable |
165 | 165 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->map[$this->id] = $name; |
74 | 74 | $this->tokens[$this->id] = $pcre; |
75 | 75 | } catch (LexerException $e) { |
76 | - $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token ' . $name, $e->getMessage()); |
|
76 | + $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token '.$name, $e->getMessage()); |
|
77 | 77 | |
78 | 78 | throw new BadLexemeException($message); |
79 | 79 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($this->tokens as $id => $pcre) { |
167 | 167 | $name = $this->map[$id]; |
168 | 168 | |
169 | - yield new TokenDefinition($name, $pcre, ! \in_array($name, $this->skipped, true)); |
|
169 | + yield new TokenDefinition($name, $pcre, !\in_array($name, $this->skipped, true)); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ]); |
49 | 49 | throw new \InvalidArgumentException($error); |
50 | 50 | |
51 | - case ! self::isLookahead($flags) && \class_exists(\Parle\Lexer::class, false): |
|
51 | + case !self::isLookahead($flags) && \class_exists(\Parle\Lexer::class, false): |
|
52 | 52 | return new ParleLexer($tokens, $skip); |
53 | 53 | |
54 | 54 | default: |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private static function isLookahead(int $flags): bool |
64 | 64 | { |
65 | - return (bool)($flags & self::LOOKAHEAD); |
|
65 | + return (bool) ($flags & self::LOOKAHEAD); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private static function isMultistate(int $flags): bool |
73 | 73 | { |
74 | - return (bool)($flags & self::MULTISTATE); |
|
74 | + return (bool) ($flags & self::MULTISTATE); |
|
75 | 75 | } |
76 | 76 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | public function getTokenDefinitions(): iterable |
56 | 56 | { |
57 | 57 | foreach ($this->tokens as $name => $pcre) { |
58 | - $keep = ! \in_array($name, $this->skipped, true); |
|
58 | + $keep = !\in_array($name, $this->skipped, true); |
|
59 | 59 | $state = $this->getTokenState($name); |
60 | 60 | $next = $this->getNextState($name); |
61 | 61 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function lex(Readable $input): \Traversable |
38 | 38 | { |
39 | 39 | foreach ($this->exec($input) as $token) { |
40 | - if (! \in_array($token->getName(), $this->skipped, true)) { |
|
40 | + if (!\in_array($token->getName(), $this->skipped, true)) { |
|
41 | 41 | yield $token; |
42 | 42 | } |
43 | 43 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function getTokenDefinitions(): iterable |
79 | 79 | { |
80 | 80 | foreach ($this->tokens as $name => $pcre) { |
81 | - yield new TokenDefinition($name, $pcre, ! \in_array($name, $this->skipped, true)); |
|
81 | + yield new TokenDefinition($name, $pcre, !\in_array($name, $this->skipped, true)); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |