Open Clyybber opened 5 years ago
A bit simplified:
type
Tile[n: static int] = object
a: array[n, int]
Coord = tuple[x, y: int]
Rule[n: static int] = tuple[c: Coord, t: Tile[n]]
Discriminator[n: static int] = seq[Rule[n]]
Tileset[n: static int] = array[n, Discriminator[n]]
#works fine with `tiles: static seq[string]` -> `tiles: seq[string]`
proc parseProb(tiles: static seq[string], tileslen: static int, p: string): Tile[tileslen] =
discard "TODO"
proc parseMap(tiles: static seq[string], tileslen: static int, content: static string): Tileset[tileslen] =
for id, name in tiles:
var pStr: string = ""
discard parseProb(tiles, tileslen, pStr)
when isMainModule:
const parsedTileset = parseMap(@["a", "b", "c"], 3, "abc")
The following snippet errors out with a confusing error.
Example
Current Output
Expected Output
Should compile or spit out a more appropriate error message.
Possible Solution
See the comment in the snippet
Additional Information