bass icon indicating copy to clipboard operation
bass copied to clipboard

[request] support for fixed length arrays

Open antis81 opened this issue 3 years ago • 0 comments

Defining static arrays is an issue using the !rept. meta when the array label is local. Example:

a_scope:  <-- Trying to define local "a_scope.arr[idx]" labels (actually this is a "__macro_<id>" label in my case)
  .arr:  ; <-- should have indexed .arr[<i>] labels
  !rept 5 { 
    ; note: scope is now "__rept_<id>"
    .arr[i]: !byte 0  ; results in "__rept_<id>.my_arr[<i>]" label -> practically invisible
  }

A solution to this could be a new !array meta command:

a_scope:
  !array .arr, 5  ; defines "a_scope.arr"
  {
    .arr[i]: !byte 0  ; defines "a_scope.arr[<i>]
  }

… or (probably better) we could allow explicit definition of sub labels:

a_scope:
  !rept 5 {
    a_scope.arr[i]: !byte 0  ; currently a syntax error
  }

antis81 avatar May 17 '21 09:05 antis81