-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement symbol assignment (NL!Core 11.1 feature port) #6
Implement symbol assignment (NL!Core 11.1 feature port) #6
Conversation
This reverts commit 3fdcbf9.
Stan you always make quality code, so it's not like I don't trust this, buuuuut |
Assignment to known constant (could have been implemented even without changing the label system) Event:
ROM (Hex):
Assignment to unknown (when parsing) constant (requires "saving" the expression for later computation) Event:
ROM (Hex):
Assignment to "complex" math expression (and usage in Event:
ROM (Hex):
Event:
ROM (Hex):
Note: NL!EA 11.1 would end up writing 4, as Circular symbol dependency Event:
stderr:
(I also tested with other various combinations of 1 to 3 symbols that depend on themselves; Including some with math involved and stuff) Uncomputable symbol Event:
stderr:
This one probably could have better diagnosis, as we know the symbol exists; All we don't is its computed value. Note: uncomputable symbols won't be reported unless observed: just writing Out of scope symbol Event:
stderr:
Same remark as for previous one. All done with the following commandline:
And with the raws that come with the current 11.1.3 release.
|
Okay, so I'll need to take a look at how the symbols are stored (should be akin to labels? but distinct since they can be expressions) and double check cycle dependency detection. Do you think it'd be worth rewriting FE7/8 definitions as symbols instead of defines at some point? |
I don't know... Them being #undef-able sounds like something useful. Them being symbols would also mean that they are going to be output as such when/if we implement |
I'm not happy with this as is so I'll close until I feel like working on this again. |
I'd be interested in implementing a simplified version of this. Rather than having any complex symbol resolution (lazy evaluation), just make it eager.
This should be sufficient for most uses (and anything more complex can use #define). |
Thanks to ColorzCore's internal improvements, this implementation of the feature shouldn't freak out when assigning symbols to expressions invoking
CURRENTOFFSET
while not being immediately computable (because ofCURRENTOFFSET
now being substituted at parse-time (?)).Another improvement over the 11.1 impl is that circular dependencies are detected and diagnosed. For example, the following:
Will print this error:
Some files seem to have been detected as having completely been rewritten... is this caused by a difference in encoding?
Hopefully I didn't taint your code of my incompetence too much.(but do tell me if I did)