|
4 | 4 | // |
5 | 5 | // Copyright (c) 2018, Olof Kraigher olof.kraigher@gmail.com |
6 | 6 |
|
| 7 | +use super::alias_declaration::parse_alias_declaration; |
7 | 8 | use super::common::ParseResult; |
| 9 | +use super::component_declaration::parse_component_declaration; |
8 | 10 | use super::concurrent_statement::parse_labeled_concurrent_statement; |
9 | 11 | use super::context::{parse_library_clause, parse_use_clause}; |
10 | 12 | use super::declarative_part::parse_declarative_part_leave_end_token; |
11 | | -use super::design_unit::parse_design_file; |
| 13 | +use super::design_unit::{parse_design_file, parse_entity_declaration}; |
12 | 14 | use super::expression::{parse_aggregate, parse_choices, parse_expression}; |
13 | 15 | use super::interface_declaration::{parse_generic, parse_parameter, parse_port}; |
14 | 16 | use super::names::{parse_association_list, parse_designator, parse_name, parse_selected_name}; |
| 17 | +use super::object_declaration::{parse_file_declaration, parse_object_declaration}; |
15 | 18 | use super::range::{parse_discrete_range, parse_range}; |
16 | 19 | use super::sequential_statement::parse_sequential_statement; |
17 | 20 | use super::subprogram::{parse_signature, parse_subprogram_declaration_no_semi}; |
18 | 21 | use super::subtype_indication::parse_subtype_indication; |
19 | 22 | use super::tokens::{Comment, Symbols, Token, TokenStream, Tokenizer}; |
| 23 | +use super::type_declaration::parse_type_declaration; |
20 | 24 | use super::waveform::parse_waveform; |
21 | 25 | use crate::ast; |
22 | 26 | use crate::ast::*; |
@@ -334,6 +338,30 @@ impl Code { |
334 | 338 | self.symbols.symtab().insert_utf8(name) |
335 | 339 | } |
336 | 340 |
|
| 341 | + pub fn type_decl(&self) -> TypeDeclaration { |
| 342 | + self.with_stream_no_diagnostics(parse_type_declaration) |
| 343 | + } |
| 344 | + |
| 345 | + pub fn object_decl(&self) -> ObjectDeclaration { |
| 346 | + self.parse_ok(parse_object_declaration).remove(0) |
| 347 | + } |
| 348 | + |
| 349 | + pub fn file_decl(&self) -> FileDeclaration { |
| 350 | + self.parse_ok(parse_file_declaration).remove(0) |
| 351 | + } |
| 352 | + |
| 353 | + pub fn alias_decl(&self) -> AliasDeclaration { |
| 354 | + self.parse_ok(parse_alias_declaration) |
| 355 | + } |
| 356 | + |
| 357 | + pub fn component_decl(&self) -> ComponentDeclaration { |
| 358 | + self.with_stream_no_diagnostics(parse_component_declaration) |
| 359 | + } |
| 360 | + |
| 361 | + pub fn entity_decl(&self) -> EntityDeclaration { |
| 362 | + self.with_stream_no_diagnostics(parse_entity_declaration) |
| 363 | + } |
| 364 | + |
337 | 365 | pub fn subtype_indication(&self) -> SubtypeIndication { |
338 | 366 | self.parse_ok(parse_subtype_indication) |
339 | 367 | } |
|
0 commit comments