I feel bad about that project and I should probably remove the extension from vscode marketplace it since I know of its current limitations.
I did start a total grammar rewrite for inform6 in antlr4 some time during last year where I didn’t skip the code block sections and made the grammar pretty much complete (except for the preprocessing directives) but I did nevertheless run into issues with the preprocessor anyway. It’s a pain since the design decision to put the preprocessor inside the language itself instead of having it run before independently of the parser makes writing a utility like that somewhat of a Chtulhu nightmare to get completely correct. I guess I could probably complete it if someone where to write or tweak an existing c-preprocessor to work with inform6 or add an option to the compiler to output the preprocessed code.
(I did also experiment with the output of gameinfo.dbg as an alternative but the disadvantages there is that the compiler only outputs that info to a file, not stdout and you can’t track object procedures. Otherwise it has a lot of information about the code structure and with line and character data from original source code)
Either way I think you are completely right about a making handmade parser instead of a grammar.
Best option in my opinion would be to use AST from within the compiler and have it output to stdout with a compiler option.
You know, I was not aware of this! I must have read it in the spec, but it never stuck in my head.
It is not true in Glulx. This is an uncomfortable behavior difference between the platforms. Oh well.
Of course, if you put a 0 as a placeholder for say a before routine
You sure you’re not thinking of -1 (NULL)? Hm, maybe they do the same thing.
…I just realized that even though the compiler doesn’t define NULL as -1, it does distinguish -1 as a special value in the obj.prop() veneer routine. Oh, what a headache.
CA__Pr (the veneer routine responsible for performing obj.prop()) solves this on line 314 in veneer.c ( default: return x-->m;) by returning the property value as is when the value isn’t a routine or string. Additionally, If it finds the value -1, it returns false.