devsoc-unsw / structs.sh

An educational data structures and algorithms platform.
https://structs.sh
MIT License
27 stars 7 forks source link

Stack arrays #651

Closed yellowsubmarine1447 closed 2 months ago

yellowsubmarine1447 commented 3 months ago

Heap arrays are displayed, now we want to modify get_stack_data to handle stack arrays.

There's a bug in the function where ptype's output is checked to not end with [] in order for the variable to be a struct, but it should be checked to not end with [\d+] (from testing there seems to always be a number inserted, even if omitted in source code -> in which case array size is implied because it actually has to be initialised if the number is omitted).

Then, we can just check for ending with [\d+]. When we (hopefully) only use AST's to parse variables, this string parsing won't be necessary.