Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of type mark do not allow slice or index #680

Open
go2sh opened this issue Oct 27, 2018 · 5 comments
Open

Parsing of type mark do not allow slice or index #680

go2sh opened this issue Oct 27, 2018 · 5 comments
Assignees

Comments

@go2sh
Copy link

go2sh commented Oct 27, 2018

Description
The subtype attribute is allowed on any object and can be used as type mark. So the following should be allowed:

constant asd : std_logic_vector(1 downto 0) := "00";
constant asdf : asd(0)'subtype := '1';

Expected behaviour
Compiles with success.

Context

library ieee;
use ieee.std_logic_1164.all;

package a is

function b(ads : integer) return std_logic_vector;

constant asdfg : std_logic_vector(1 downto 0) := "00";
end package;

package body a is
function b(ads : integer) return std_logic_vector is
  variable gg : asdfg(1)'subtype;
begin


return "00";
end function;

end package body;

Version:
GHDL 0.36-dev (v0.35-339-g5a97d9f2)

PS: I'am posting this here just for completeness. This language is very strange sometimes. ;-) I don't expect any fix.

@Paebbels
Copy link
Member

The bug reported in #641 uses a similar syntax to declare new objects.

@go2sh
Copy link
Author

go2sh commented Oct 28, 2018

This one doesn't even get parsed. Same direction but a different problem.

@tgingold
Copy link
Member

I agree this is allowed by vhdl 08.

@tgingold
Copy link
Member

But I also agree this is awful and makes the VHDL grammar more complex; not anymore LALR I would think.

@go2sh
Copy link
Author

go2sh commented Nov 12, 2018

I also came across this, because its hard to parse. I started to create a new tm-grammar and wanted to highlight subtype indications, but with the code above it's quite hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants