The documentation says Branescript allows array indexing in C style manner: foo[0].
However, looking at the formal definition, that seems to be not the case.
Expressions are defined as:
Expr ::= LPAREN Expr RPAREN
| Expr BinOp Expr
| UnaOp Expr
| Array | ArrayIndex | Call | IDENT | Instance | Literal
| Projection
This does contain Array and ArrayIndex, but array is a definition of an array, not the usage of an identifier (variable) that points to / contains an array.
ArrayIndex suffers the same fate as it is prefixed with: Array itself: ArrayIndex ::= Array LBRACKET Expr RBRACKET
Proposed solutions:
We either have to change identifiers such that identifiers can be indexed by default, or we have to change ArrayIndex to be:
ArrayIndex ::= Array LBRACKET Expr RBRACKET | IDENT LBRACKET Expr RBRACKET\
The latter seems better to me in this case. @Lut99 Let me know what you think.
The documentation says Branescript allows array indexing in C style manner:
foo[0].However, looking at the formal definition, that seems to be not the case.
Expressions are defined as:
This does contain
ArrayandArrayIndex, but array is a definition of an array, not the usage of an identifier (variable) that points to / contains an array.ArrayIndex suffers the same fate as it is prefixed with:
Arrayitself:ArrayIndex ::= Array LBRACKET Expr RBRACKETProposed solutions:
We either have to change identifiers such that identifiers can be indexed by default, or we have to change
ArrayIndexto be:ArrayIndex ::= Array LBRACKET Expr RBRACKET | IDENT LBRACKET Expr RBRACKET\The latter seems better to me in this case. @Lut99 Let me know what you think.