Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement numeric literal separators
- Loading branch information
1 parent
aa9433e
commit a1ec76e
Showing
10 changed files
with
188 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Valid use of numeric literal separator | ||
--FILE-- | ||
<?php | ||
var_dump(299_792_458 === 299792458); | ||
var_dump(135_00 === 13500); | ||
var_dump(96_485.332_12 === 96485.33212); | ||
var_dump(6.674_083e-11 === 6.674083e-11); | ||
var_dump(0xCAFE_F00D === 0xCAFEF00D); | ||
var_dump(0b0101_1111 === 0b01011111); | ||
var_dump(024_044_120 === 024044120); | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) |
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,7 @@ | ||
--TEST-- | ||
Invalid use: trailing underscore | ||
--FILE-- | ||
<?php | ||
100_; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected '_' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: adjacent underscores | ||
--FILE-- | ||
<?php | ||
10__0; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected '__0' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore left of period | ||
--FILE-- | ||
<?php | ||
100_.0; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected '_' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore right of period | ||
--FILE-- | ||
<?php | ||
100._0; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected '_0' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore next to 0x | ||
--FILE-- | ||
<?php | ||
0x_0123; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected 'x_0123' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore next to 0b | ||
--FILE-- | ||
<?php | ||
0b_0101; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected 'b_0101' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore left of e | ||
--FILE-- | ||
<?php | ||
1_e2; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected '_e2' (T_STRING) in %s on line %d |
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,7 @@ | ||
--TEST-- | ||
Invalid use: underscore right of e | ||
--FILE-- | ||
<?php | ||
1e_2; | ||
--EXPECTF-- | ||
Parse error: syntax error, unexpected 'e_2' (T_STRING) in %s on line %d |
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