-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ParsedTokenStream class and use it for expansion
- Loading branch information
1 parent
58556cc
commit f0d1407
Showing
7 changed files
with
104 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Yay; | ||
|
||
class ParsedTokenStream extends TokenStream { | ||
protected | ||
$ast | ||
; | ||
|
||
function setAst(Ast $ast) { | ||
$this->ast = $ast; | ||
} | ||
|
||
function getAst() { | ||
return $this->ast; | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--TEST-- | ||
Provides an AST to a custom expander | ||
--FILE-- | ||
<?php | ||
|
||
$(macro) { | ||
$( | ||
chain( | ||
chain( | ||
buffer("foo") | ||
) as inner | ||
) as outer | ||
) | ||
} >> { | ||
$$(\Yay\tests\fixtures\expanders\wrap_ast_expander( | ||
$$(\Yay\tests\fixtures\expanders\upper_ast_expander( | ||
$$(\Yay\tests\fixtures\expanders\reverse_ast_expander( | ||
$(outer) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
marcioAlmada
Owner
|
||
)) | ||
)) | ||
)) | ||
} | ||
|
||
foo | ||
|
||
?> | ||
--EXPECTF-- | ||
<?php | ||
|
||
[OOF] | ||
|
||
?> |
What the expander should receive if we pass just
$(outer[inner])
here?