Add support for exponential numbers

This commit is contained in:
Fabien Potencier
2019-10-22 17:32:36 +02:00
parent 2024406e8e
commit 6092135057
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