Skip to content

Commit 189c98a

Browse files
authored
Merge pull request #100 from HenningHolmDE/pure_function_syntax
Add explicit "pure" to the syntax parser
2 parents c6de2ac + 56ff9fa commit 189c98a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

vhdl_lang/src/syntax/declarative_part.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ pub fn is_declarative_part(stream: &mut TokenStream, begin_is_end: bool) -> Pars
5050
fn check_declarative_part(token: &Token, may_end: bool, may_begin: bool) -> ParseResult<()> {
5151
match token.kind {
5252
Use | Type | Subtype | Shared | Constant | Signal | Variable | File | Component
53-
| Attribute | Alias | Impure | Function | Procedure | Package | For => Ok(()),
53+
| Attribute | Alias | Impure | Pure | Function | Procedure | Package | For => Ok(()),
5454
Begin if may_begin => Ok(()),
5555
End if may_end => Ok(()),
5656
_ => {
5757
let decl_kinds = [
5858
Use, Type, Subtype, Shared, Constant, Signal, Variable, File, Component, Attribute,
59-
Alias, Impure, Function, Procedure, Package, For,
59+
Alias, Impure, Pure, Function, Procedure, Package, For,
6060
];
6161

6262
Err(token.kinds_error(&decl_kinds))
@@ -83,23 +83,23 @@ pub fn parse_declarative_part_leave_end_token(
8383

8484
fn is_recover_token(kind: Kind) -> bool {
8585
match kind {
86-
Type | Subtype | Component | Impure | Function | Procedure | Package | For | File
87-
| Shared | Constant | Signal | Variable | Attribute | Use | Alias => true,
86+
Type | Subtype | Component | Impure | Pure | Function | Procedure | Package | For
87+
| File | Shared | Constant | Signal | Variable | Attribute | Use | Alias => true,
8888
_ => false,
8989
}
9090
};
9191

9292
while let Some(token) = stream.peek()? {
9393
match token.kind {
9494
Begin | End => break,
95-
Type | Subtype | Component | Impure | Function | Procedure | Package | For => {
95+
Type | Subtype | Component | Impure | Pure | Function | Procedure | Package | For => {
9696
let decl = match token.kind {
9797
Type | Subtype => {
9898
parse_type_declaration(stream, diagnostics).map(Declaration::Type)?
9999
}
100100
Component => parse_component_declaration(stream, diagnostics)
101101
.map(Declaration::Component)?,
102-
Impure | Function | Procedure => parse_subprogram(stream, diagnostics)?,
102+
Impure | Pure | Function | Procedure => parse_subprogram(stream, diagnostics)?,
103103
Package => parse_package_instantiation(stream).map(Declaration::Package)?,
104104
For => {
105105
parse_configuration_specification(stream).map(Declaration::Configuration)?
@@ -145,8 +145,8 @@ pub fn parse_declarative_part_leave_end_token(
145145

146146
_ => {
147147
diagnostics.push(token.kinds_error(&[
148-
Type, Subtype, Component, Impure, Function, Procedure, Package, For, File,
149-
Shared, Constant, Signal, Variable, Attribute, Use, Alias,
148+
Type, Subtype, Component, Impure, Pure, Function, Procedure, Package, For,
149+
File, Shared, Constant, Signal, Variable, Attribute, Use, Alias,
150150
]));
151151
stream.skip_until(is_recover_token)?;
152152
continue;
@@ -232,7 +232,7 @@ constant x: natural := 5;
232232
msgs,
233233
vec![Diagnostic::error(
234234
code.s1("var").pos(),
235-
"Expected 'type', 'subtype', 'component', 'impure', \
235+
"Expected 'type', 'subtype', 'component', 'impure', 'pure', \
236236
'function', 'procedure', 'package', 'for', 'file', \
237237
'shared', 'constant', 'signal', 'variable', 'attribute', \
238238
'use' or 'alias'"

vhdl_lang/src/syntax/interface_declaration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn parse_interface_declaration(
227227
let ident = stream.expect_ident()?;
228228
Ok(vec![InterfaceDeclaration::Type(ident)])
229229
},
230-
Function | Procedure | Impure => {
230+
Function | Procedure | Impure | Pure => {
231231
let decl = parse_subprogram_declaration_no_semi(stream, diagnostics)?;
232232
let default = parse_subprogram_default(stream)?;
233233

0 commit comments

Comments
 (0)