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

support range for string parameters #131

Open
gjcoram opened this issue Jun 21, 2024 · 2 comments
Open

support range for string parameters #131

gjcoram opened this issue Jun 21, 2024 · 2 comments

Comments

@gjcoram
Copy link

gjcoram commented Jun 21, 2024

error: unexpected token ''{'; expected '(', ''{', system function identifier, identifier, literal,
'~', '!', '+' or '-'
--> /home/gjcoram/modeling/cmc_qa/cmcqa/model_qa/veriloga/vacode/param_example2.va:18:36
|
18 | parameter string type = "NPN" from '{ "NPN", "PNP" };
| ^^ unexpected_token

error: could not compile param_example2.va due to 1 previous errors

@gjcoram
Copy link
Author

gjcoram commented Jun 21, 2024

I also tried the old syntax:
parameter string type = "NPN" from { "NPN", "PNP" };

@gjcoram
Copy link
Author

gjcoram commented Jul 6, 2024

diff --git a/openvaf/parser/src/grammar/items.rs b/openvaf/parser/src/grammar/items.rs
old mode 100644
new mode 100755
index f1e65e5..28152a7
--- a/openvaf/parser/src/grammar/items.rs
+++ b/openvaf/parser/src/grammar/items.rs
@@ -121,7 +121,16 @@ fn constraint(p: &mut Parser) {
m.abandon(p);
return;
}
- range_or_expr(p);
+ if p.eat(T!["'{"]) || p.eat(T!['{']) {
+ // array range (for string parameters)
+ expr(p);
+ while p.eat(T![,]) {
+ expr(p);
+ }
+ p.expect(T!['}']);
+ } else {
+ range_or_expr(p);
+ }
m.complete(p, CONSTRAINT);
}

gjcoram added a commit to gjcoram/OpenVAF that referenced this issue Jul 6, 2024
arpadbuermen pushed a commit to arpadbuermen/OpenVAF that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant