Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parser: macros are parsed in two phases [Closes nette/nette#711]
- Loading branch information
Showing
4 changed files
with
100 additions
and
59 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,29 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Latte\Parser errors. | ||
*/ | ||
|
||
use Tester\Assert, | ||
Latte\Parser; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
Assert::exception(function() { | ||
$parser = new Parser; | ||
$parser->parse("\xA0\xA0"); | ||
}, 'InvalidArgumentException', 'Template is not valid UTF-8 stream.'); | ||
|
||
|
||
Assert::exception(function() { | ||
$parser = new Parser; | ||
$parser->parse("{var \n'abc}"); | ||
}, 'Latte\CompileException', 'Malformed macro on line 1.'); | ||
|
||
|
||
Assert::exception(function() { | ||
$parser = new Parser; | ||
$parser->parse("\n{* \n'abc}"); | ||
}, 'Latte\CompileException', 'Malformed macro on line 2.'); |
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 was deleted.
Oops, something went wrong.
e5d01a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break. Maybe even major BC break. And also compiling
$latte->compile('{')
is broken.e5d01a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand it may make certain things easier for PhpStorm's Latte plugin.
e5d01a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
e5d01a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍