feature #3182 Add support for exponential numbers (fabpot)

This PR was merged into the 1.x branch.

Discussion
----------

Add support for exponential numbers

Commits
-------

60921350 Add support for exponential numbers
This commit is contained in:
Fabien Potencier
2019-11-07 22:14:12 +01:00
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
* 1.42.4 (2019-XX-XX)
* n/a
* added supported for exponential numbers
* 1.42.3 (2019-08-24)
+1 -1
View File
@@ -47,7 +47,7 @@ class Lexer implements \Twig_LexerInterface
const STATE_INTERPOLATION = 4;
const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A';
const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A';
const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A';
const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As';
const REGEX_DQ_STRING_DELIM = '/"/A';
const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As';
@@ -0,0 +1,8 @@
--TEST--
Twig manages exponentiel numbers correctly
--TEMPLATE--
{{ 1.99E+3 }}
--DATA--
return []
--EXPECT--
1990