Skip to content

Commit d5edacb

Browse files
committed
[vhdl_syntax] update PackagePathname, RelativePathname and PartialPathname
This is both for special list syntax preparation as well as for correctness reasons
1 parent 4442955 commit d5edacb

17 files changed

Lines changed: 293 additions & 107 deletions

vhdl_syntax/src/parser/productions/names.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,11 @@ impl Parser {
193193
},
194194
Circ, Identifier => {
195195
self.start_node(RelativePathname);
196-
while self.opt_token(Circ) {
196+
while self.next_is(Circ) {
197+
self.start_node(UpLevel);
198+
self.skip(); // Circ
197199
self.expect_token(Dot);
200+
self.end_node();
198201
}
199202
self.partial_pathname();
200203
});
@@ -203,21 +206,21 @@ impl Parser {
203206

204207
fn partial_pathname(&mut self) {
205208
// LRM §8.7
206-
// partial_pathname ::= { identifier [ `(` expression `)` ] `.` } identifier ;
209+
// partial_pathname ::= { pathname_element `.` } object_simple_name ;
207210
self.start_node(PartialPathname);
211+
self.separated_list(Parser::pathname_element, Dot);
212+
self.end_node();
213+
}
214+
215+
fn pathname_element(&mut self) {
216+
self.start_node(PathnameElement);
208217
self.identifier();
209-
loop {
210-
if self.next_is(LeftPar) {
211-
self.start_node(ParenthesizedExpressionOrAggregate);
212-
self.expect_token(LeftPar);
213-
self.expression();
214-
self.expect_token(RightPar);
215-
self.end_node();
216-
self.expect_token(Dot);
217-
} else if !self.opt_token(Dot) {
218-
break;
219-
}
220-
self.identifier();
218+
if self.next_is(LeftPar) {
219+
self.start_node(ParenthesizedExpression);
220+
self.expect_token(LeftPar);
221+
self.expression();
222+
self.expect_token(RightPar);
223+
self.end_node();
221224
}
222225
self.end_node();
223226
}

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__concurrent_statement__tests__concurrent_signal_assignment_external_name.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ ConcurrentSimpleSignalAssignment
1010
Keyword(Signal)
1111
RelativePathname
1212
PartialPathname
13-
Identifier 'dut'
13+
PathnameElement
14+
Identifier 'dut'
1415
Dot
15-
Identifier 'foo'
16+
PathnameElement
17+
Identifier 'foo'
1618
Colon
1719
SubtypeIndication
1820
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__expression__tests__external_name.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ NameExpression
99
Keyword(Signal)
1010
RelativePathname
1111
PartialPathname
12-
Identifier 'dut'
12+
PathnameElement
13+
Identifier 'dut'
1314
Dot
14-
Identifier 'foo'
15+
PathnameElement
16+
Identifier 'foo'
1517
Colon
1618
SubtypeIndication
1719
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_absolute.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ Name
99
AbsolutePathname
1010
Dot
1111
PartialPathname
12-
Identifier 'dut'
12+
PathnameElement
13+
Identifier 'dut'
1314
Dot
14-
Identifier 'gen'
15+
PathnameElement
16+
Identifier 'gen'
1517
Colon
1618
SubtypeIndication
1719
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_explicit_relative.snap

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ Name
77
LtLt
88
Keyword(Signal)
99
RelativePathname
10-
Circ
11-
Dot
10+
UpLevel
11+
Circ
12+
Dot
1213
PartialPathname
13-
Identifier 'dut'
14+
PathnameElement
15+
Identifier 'dut'
1416
Dot
15-
Identifier 'gen'
17+
PathnameElement
18+
Identifier 'gen'
1619
Colon
1720
SubtypeIndication
1821
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_explicit_relative_multiple_levels.snap

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ Name
77
LtLt
88
Keyword(Signal)
99
RelativePathname
10-
Circ
11-
Dot
12-
Circ
13-
Dot
14-
Circ
15-
Dot
10+
UpLevel
11+
Circ
12+
Dot
13+
UpLevel
14+
Circ
15+
Dot
16+
UpLevel
17+
Circ
18+
Dot
1619
PartialPathname
17-
Identifier 'dut'
20+
PathnameElement
21+
Identifier 'dut'
1822
Dot
19-
Identifier 'gen'
23+
PathnameElement
24+
Identifier 'gen'
2025
Colon
2126
SubtypeIndication
2227
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_implicit_relative.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Name
88
Keyword(Signal)
99
RelativePathname
1010
PartialPathname
11-
Identifier 'dut'
11+
PathnameElement
12+
Identifier 'dut'
1213
Dot
13-
Identifier 'foo'
14+
PathnameElement
15+
Identifier 'foo'
1416
Colon
1517
SubtypeIndication
1618
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_object_classes-2.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Name
88
Keyword(Signal)
99
RelativePathname
1010
PartialPathname
11-
Identifier 'dut'
11+
PathnameElement
12+
Identifier 'dut'
1213
Dot
13-
Identifier 'foo'
14+
PathnameElement
15+
Identifier 'foo'
1416
Colon
1517
SubtypeIndication
1618
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_object_classes-3.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Name
88
Keyword(Variable)
99
RelativePathname
1010
PartialPathname
11-
Identifier 'dut'
11+
PathnameElement
12+
Identifier 'dut'
1213
Dot
13-
Identifier 'foo'
14+
PathnameElement
15+
Identifier 'foo'
1416
Colon
1517
SubtypeIndication
1618
Name

vhdl_syntax/src/parser/productions/snapshots/vhdl_syntax__parser__productions__names__tests__external_name_object_classes.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Name
88
Keyword(Constant)
99
RelativePathname
1010
PartialPathname
11-
Identifier 'dut'
11+
PathnameElement
12+
Identifier 'dut'
1213
Dot
13-
Identifier 'foo'
14+
PathnameElement
15+
Identifier 'foo'
1416
Colon
1517
SubtypeIndication
1618
Name

0 commit comments

Comments
 (0)