-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support underscores in number literals
- Loading branch information
Showing
6 changed files
with
52 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# 3.17.0 (2024-XX-XX) | ||
|
||
* n/a | ||
* Support underscores in number literals | ||
|
||
# 3.16.0 (2024-11-29) | ||
|
||
|
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,24 @@ | ||
--TEST-- | ||
Twig compile numbers literals with underscores correctly | ||
--TEMPLATE-- | ||
{{ 0_0 is same as 0 ? 'ok' : 'ko' }} | ||
{{ 1_23 is same as 123 ? 'ok' : 'ko' }} | ||
{{ 12_3 is same as 123 ? 'ok' : 'ko' }} | ||
{{ 1_2_3 is same as 123 ? 'ok' : 'ko' }} | ||
{{ -1_2 is same as -12 ? 'ok' : 'ko' }} | ||
{{ 1_2.3_4 is same as 12.34 ? 'ok' : 'ko' }} | ||
{{ -1_2.3_4 is same as -12.34 ? 'ok' : 'ko' }} | ||
{{ 1.2_3e-4 is same as 1.23e-4 ? 'ok' : 'ko' }} | ||
{{ -1.2_3e+4 is same as -1.23e+4 ? 'ok' : 'ko' }} | ||
--DATA-- | ||
return [] | ||
--EXPECT-- | ||
ok | ||
ok | ||
ok | ||
ok | ||
ok | ||
ok | ||
ok | ||
ok | ||
ok |
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,8 @@ | ||
--TEST-- | ||
Twig does not allow to use 2 underscored between digits in numbers | ||
--TEMPLATE-- | ||
{{ 1__2 }} | ||
--DATA-- | ||
return [] | ||
--EXCEPTION-- | ||
Twig\Error\SyntaxError: Unexpected token "name" of value "__2" ("end of print statement" expected) in "index.twig" at line 2. |