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 array indexing in VAR_CONFIG blocks #1308

Closed
volsa opened this issue Sep 12, 2024 · 2 comments
Closed

Support array indexing in VAR_CONFIG blocks #1308

volsa opened this issue Sep 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@volsa
Copy link
Member

volsa commented Sep 12, 2024

Describe the bug
Indexing any array variable within a VAR_CONFIG block currently reports a parsing error, e.g.

VAR_CONFIG
    main.foo[1].bar AT %IX1.0 : BOOL;
END_VAR

will report

error[E006]: Missing expected Token AT
  ┌─ target/demo.st:2:12
  │
2 │     foo.bar[1] AT %IX1.0 : BOOL;
  │            ^ Missing expected Token AT

error[E006]: Missing expected Token hardware access
  ┌─ target/demo.st:2:12
  │
2 │     foo.bar[1] AT %IX1.0 : BOOL;
  │            ^ Missing expected Token hardware access

error[E007]: Unexpected token: expected KeywordSemicolon but found '[1] AT %IX1.0 : BOOL'
  ┌─ target/demo.st:2:12
  │
2 │     foo.bar[1] AT %IX1.0 : BOOL;
  │            ^^^^^^^^^^^^^^^^^^^^ Unexpected token: expected KeywordSemicolon but found '[1] AT %IX1.0 : BOOL'
@volsa volsa added the bug Something isn't working label Sep 12, 2024
@mhasel
Copy link
Member

mhasel commented Sep 23, 2024

In a similar vein, declaring a custom string type, e.g.

VAR_CONFIG
    main.foo.bar AT %IX1.0 : STRING[100];
END_VAR

currently leads to a panic in index::visitor::visit_global_var_block, src/index/visitor.rs:313:50 due to the custom string type not having a name. Not yet sure if this is also a parser issue (might be in the pre-processor), if not I'll open a separate issue once I've investigated further.

@mhasel
Copy link
Member

mhasel commented Oct 8, 2024

Since parsing arrays is no longer an issue, I'm closing this issue. Custom string type panic tracked in #1331

@mhasel mhasel closed this as completed Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants