Skip to content

Commit 7492b2a

Browse files
committed
drop support for complement type
1 parent d23d1c9 commit 7492b2a

File tree

4 files changed

+5
-47
lines changed

4 files changed

+5
-47
lines changed

doc/grammer.ebnf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
Type
22
::= Atomic (Union | Intersection)?
3-
| Complement
43

54
Union
65
::= ('|' Atomic)+
76

87
Intersection
98
::= ('&' Atomic)+
109

11-
Complement
12-
::= '~' Atomic
13-
1410
Atomic
1511
::= Identifier (Generic | Array)?
1612
| '(' Type ')' Array?

doc/grammer.peg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
Type
22
= Atomic (Union / Intersection)?
3-
/ Complement
43

54
Union
65
= ('|' Atomic)+
76

87
Intersection
98
= ('&' Atomic)+
109

11-
Complement
12-
= '~' Atomic
13-
1410
Atomic
1511
= Identifier (Generic / Array)?
1612
/ '(' Type ')' Array?

src/Ast/ComplementNode.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Parser.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,13 @@ private function tearDown(): void
6767

6868
private function parseType(): Ast\Node
6969
{
70-
if ($this->tokenType === Lexer::TOKEN_COMPLEMENT) {
71-
$type = $this->parseComplement();
70+
$type = $this->parseAtomic();
7271

73-
} else {
74-
$type = $this->parseAtomic();
75-
76-
if ($this->tokenType === Lexer::TOKEN_UNION) {
77-
$type = $this->parseUnion($type);
72+
if ($this->tokenType === Lexer::TOKEN_UNION) {
73+
$type = $this->parseUnion($type);
7874

79-
} elseif ($this->tokenType === Lexer::TOKEN_INTERSECTION) {
80-
$type = $this->parseIntersection($type);
81-
}
75+
} elseif ($this->tokenType === Lexer::TOKEN_INTERSECTION) {
76+
$type = $this->parseIntersection($type);
8277
}
8378

8479
return $type;
@@ -140,13 +135,6 @@ private function parseIntersection(Ast\Node $type): Ast\Node
140135
}
141136

142137

143-
private function parseComplement(): Ast\Node
144-
{
145-
$this->consume(Lexer::TOKEN_COMPLEMENT);
146-
return new Ast\ComplementNode($this->parseAtomic());
147-
}
148-
149-
150138
private function parseGeneric(Ast\SimpleNode $baseType): Ast\Node
151139
{
152140
$this->consume(Lexer::TOKEN_OPEN_ANGLE_BRACKET);

0 commit comments

Comments
 (0)