Simplified kernancompiler module and added extra features #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've made some changes to the
kernancompilermodule and associated kernan features.Firstly I reduced boilerplate and duplicate code, this required me to change
ParseNodeMetato actually provide aGraceObjectand not a .NET Dictionary.Secondly I added two extra methods to the
kernancompilermodule:parse(n, c), this is likeparse(c), but it tells kernan that the code came from the module calledn, this will make parse errors more usefull (by telling the user which file has said error).readGraceModule(m)this returns the contents of the grace module identifier bym, this performs roughly the same logic as kernan internally does forimport "m" as foo; except that it won't treat resource files and.dllfiles specially. Thus you can say have:And
readGraceModule("foo")will return the contents of the.gracefile, whereas animport "foo"will actually try and load the.dllfile; the intention is that the.gracefile will contain meta-data (like method specifications) for the.dllfile.In order to not duplicate code, I have modified kernan's import logic slightly to expose a
TryReadModuleFilemethod that tries to read a module file, and instead of actually loading it (like the previoustryLoadModuleFilemethod did), it now just returns the contents of the module file as a string.In order to minimise the number of changes made by this pull request, I have not used my cool
Callback.cslibrary, but I still think it's a good idea.