Skip to content

Commit f878894

Browse files
committed
Allow trailing semicolons for interface lists for VHDL >= 2019
1 parent 45e7ea7 commit f878894

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

vhdl_lang/src/syntax/interface_declaration.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::ast::*;
1717
use crate::data::*;
1818
use vhdl_lang::data::error_codes::ErrorCode;
1919
use vhdl_lang::syntax::parser::ParsingContext;
20+
use vhdl_lang::VHDLStandard::VHDL2019;
2021

2122
pub(crate) fn parse_optional_mode(
2223
ctx: &mut ParsingContext<'_>,
@@ -304,8 +305,8 @@ fn parse_semicolon_separator(ctx: &mut ParsingContext<'_>) -> ParseResult<()> {
304305
peek_token!(
305306
ctx.stream, token,
306307
SemiColon => {
307-
ctx.stream.skip();
308-
if ctx.stream.next_kind_is(RightPar) {
308+
ctx.stream.skip();
309+
if ctx.stream.next_kind_is(RightPar) && ctx.standard < VHDL2019 {
309310
return Err(Diagnostic::syntax_error(&token.pos,
310311
format!("Last interface element may not end with {}",
311312
kinds_str(&[SemiColon]))));
@@ -777,6 +778,23 @@ bar : natural)",
777778
"Last interface element may not end with ';'"
778779
)]
779780
);
781+
782+
let code = Code::with_standard(
783+
"\
784+
(constant foo : std_logic;
785+
bar : natural;
786+
)",
787+
VHDL2019,
788+
);
789+
let result = code.parse_ok_no_diagnostics(parse_generic_interface_list);
790+
791+
assert_eq!(
792+
result,
793+
vec![
794+
code.s1("constant foo : std_logic").generic(),
795+
code.s1("bar : natural").generic()
796+
]
797+
);
780798
}
781799

782800
#[test]

0 commit comments

Comments
 (0)