@@ -68,37 +68,37 @@ pub fn is_declarative_part(ctx: &mut ParsingContext) -> ParseResult<bool> {
6868 ) )
6969}
7070
71+ pub fn is_recover_token ( kind : Kind ) -> bool {
72+ matches ! (
73+ kind,
74+ Type | Subtype
75+ | Component
76+ | Impure
77+ | Pure
78+ | Function
79+ | Procedure
80+ | Package
81+ | For
82+ | File
83+ | Shared
84+ | Constant
85+ | Signal
86+ | Variable
87+ | Attribute
88+ | View
89+ | Use
90+ | Alias
91+ | Begin
92+ | End
93+ | Disconnect
94+ )
95+ }
96+
7197pub fn parse_declarative_part (
7298 ctx : & mut ParsingContext < ' _ > ,
7399) -> ParseResult < Vec < WithTokenSpan < Declaration > > > {
74100 let mut declarations: Vec < WithTokenSpan < Declaration > > = Vec :: new ( ) ;
75101
76- fn is_recover_token ( kind : Kind ) -> bool {
77- matches ! (
78- kind,
79- Type | Subtype
80- | Component
81- | Impure
82- | Pure
83- | Function
84- | Procedure
85- | Package
86- | For
87- | File
88- | Shared
89- | Constant
90- | Signal
91- | Variable
92- | Attribute
93- | View
94- | Use
95- | Alias
96- | Begin
97- | End
98- | Disconnect
99- )
100- }
101-
102102 while let Some ( token) = ctx. stream . peek ( ) {
103103 let start_token = ctx. stream . get_current_token_id ( ) ;
104104 match token. kind {
@@ -206,10 +206,12 @@ pub fn parse_declarative_part(
206206 VHDL2008 | VHDL1993 => & [
207207 Type , Subtype , Component , Impure , Pure , Function , Procedure , Package , For ,
208208 File , Shared , Constant , Signal , Variable , Attribute , Use , Alias ,
209+ Disconnect ,
209210 ] ,
210211 VHDL2019 => & [
211212 Type , Subtype , Component , Impure , Pure , Function , Procedure , Package , For ,
212213 File , Shared , Constant , Signal , Variable , Attribute , Use , Alias , View ,
214+ Disconnect ,
213215 ] ,
214216 } ;
215217 ctx. diagnostics . push ( token. kinds_error ( expected) ) ;
@@ -305,7 +307,7 @@ constant x: natural := 5;
305307 "Expected 'type', 'subtype', 'component', 'impure', 'pure', \
306308 'function', 'procedure', 'package', 'for', 'file', \
307309 'shared', 'constant', 'signal', 'variable', 'attribute', \
308- 'use' or 'alias '"
310+ 'use', 'alias' or 'disconnect '"
309311 ) ]
310312 ) ;
311313 }
@@ -333,7 +335,7 @@ var not_a_var: broken;
333335 "Expected 'type', 'subtype', 'component', 'impure', 'pure', \
334336 'function', 'procedure', 'package', 'for', 'file', \
335337 'shared', 'constant', 'signal', 'variable', 'attribute', \
336- 'use' or 'alias '",
338+ 'use', 'alias' or 'disconnect '",
337339 ) ] ,
338340 ) ;
339341
@@ -351,20 +353,8 @@ var not_a_var: broken;
351353 "Expected 'type', 'subtype', 'component', 'impure', 'pure', \
352354 'function', 'procedure', 'package', 'for', 'file', \
353355 'shared', 'constant', 'signal', 'variable', 'attribute', \
354- 'use', 'alias' or 'view '",
356+ 'use', 'alias', 'view' or 'disconnect '",
355357 ) ] ,
356358 )
357359 }
358-
359- #[ test]
360- fn parse_declarative_part_with_disconnection ( ) {
361- let code = Code :: new (
362- "\
363- constant foo: real := 5.1;
364- disconnect my_signal : integer after 42 ms;
365- signal bar: std_logic;
366- " ,
367- ) ;
368- code. with_stream_no_diagnostics ( parse_declarative_part) ;
369- }
370360}
0 commit comments