Open
Conversation
Owner
Author
|
A couple more comments.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a work in progress.
Addresses #177.
Still hardcoding various things in here, and definitely not ready to merge this one, but I still wanted to share because I discovered/realized various things.
Do not merge before the following
For one thing, the refactor Refactor: everything is an object #242. It's much easier for that one to land and then we rebase this one, than the other way around.But Refactor: everything is an object #242 will not merge, so that's... fine.Also, @vendethiel's work in More advanced regex features. #239. This solution is going to need to change based on the ways regexes expand and become more powerful. Specifically, see More advanced regex features. #239 (comment).More advanced regex features. #239 has merged now.What I realized
We're going to have to register/store custom statements just the same as we do operators. The logical place to do this is
OpScope. (Which indicates "opscope" is perhaps not the best name for it!) Not a big problem in itself, but I hadn't thought about this before. All the categories that can be declared/extended in 007 will need to end up in an opscope-like thing.(The big one:) The
statement:whoathing is not a macro expansion as such. An expansion is an AST → AST transformation. Butstatement:whoatransforms from textual source directly to AST. Proximally, this means that there's no "unexpanded AST" that the parser can produce for this statement. What could we reasonably put there? A blankQ::Statement? (Then we cannot makeQ::Statementan abstract type.)Also, excitingly, I had to split the utility method
expandin Actions.pm intoexpand(for this use case) andexpand-expr(for all the previous ones). It turns out we've only ever expanded macros into an expression, but in this case we're expanding it into a statementlist. In that case, we are not supposed to do the dance of wrapping things into aQ::Expr::StatementListAdapter.