Skip to content

parsing indented pragma, unexpected identifier #1129

@mar2345

Description

@mar2345

Hello,
like to share an example which shows a problem parsing pragmas with translate_off, translate_on

entity pragma_test is
end pragma_test;

architecture dummy of pragma_test is  -- OK
begin
  synerror: assert false
-- pragma translate_off
     or true
-- pragma translate_on
     report "dummy model found during synthesis" severity failure;

end architecture dummy;


architecture dummy2 of pragma_test is  -- generates parsing error
begin
  synerror: assert false
    -- pragma translate_off             
     or true
    -- pragma translate_on
     report "dummy model found during synthesis" severity failure;

end architecture dummy2;

$nvc -a pragma_test.vhd
** Error: unexpected identifier while parsing PSL or concurrent assertion statement, expecting one of **, union,
          report, severity or ;
    > pragma_test.vhd:19em
    |
 19 |     -- pragma translate_off
    |        ^^^^^^ this token was unexpected

the indented --pragma line generates the error

$nvc -v
nvc 1.15-devel (1.14.0.r143.gf57580b0) (Using LLVM 10.0.0)
Copyright (C) 2011-2024  Nick Gasson
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and
you are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.

A fix would be very much appreciated
Thanks !!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions