-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RakuAST: Implement FIRST phaser as an AST construct
It turns out that there is no need to even dip into QAST in order to implement the `FIRST` phaser, which was particularly tricky because it depended on so-called "extops" that are particularly hard to arrange in pure QAST (`p6setfirstflag` and `p6takefirstflag`, for the curious). It turns out (nine++) that we can simply arrange for this construct at an AST level, by emulating something like: ``` { state $triggered; unless $triggered { # ... the actual content of the FIRST phaser block $triggered = True } }() ``` This feels like a much more natural implementation and it really shows off what a difference RakuAST can already make to code generation.
- Loading branch information
Showing
2 changed files
with
50 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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