mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-10 09:26:29 +00:00
Add support for exponential numbers
This commit is contained in:
@@ -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
@@ -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
|
||||
Reference in New Issue
Block a user