audiality2
audiality2 copied to clipboard
Module quick analysis feature
For the purpose of acquiring information from A2S modules without actually compiling and rendering them in full, we need a way of just parsing them, without generating or running any script code.
A nice and sophisticated way of doing this would be to add a "dry run" mode to the compiler, so it actually parses and compiles everything, but doesn't issue any VM code, and doesn't attempt to render waves or other things that could result in script being executed. This could also be extended to generate syntax highlighting information and the like.
A simpler approach is to just disable all but the top level parser rules, replacing the rest with a skip function that understands nesting, strings, comments and anything else that would break a naïve "find the next closing brace" algorithm.
An even simpler, but much more limited and task specific solution would be to add a directive 'header' or similar, which is normally ignored, but when in "analysis mode" becomes the only block of code that's actually compiled. This would be use like this:
header
{
def title "KRChipUISFX"
def version "1.0.0"
def description "Kobo Redux Chip Sound Theme - UI"
def author "David Olofson"
def copyright "Copyright 2016 David Olofson"
def license "GPL"
def a2sversion "1.9.1"
}
However, this has the downside of not working at all on any modules not using it.