mirror of
https://github.com/danog/phpdoc-parser.git
synced 2025-01-22 13:51:20 +01:00
ConstExprParser: allow integers in bin, oct and hex format
This commit is contained in:
parent
97be1de71b
commit
5ba6bd81e5
@ -132,7 +132,7 @@ class Lexer
|
||||
self::TOKEN_PHPDOC_EOL => '\\r?+\\n[\\x09\\x20]*+(?:\\*(?!/))?',
|
||||
|
||||
self::TOKEN_FLOAT => '(?:-?[0-9]++\\.[0-9]*+(?:e-?[0-9]++)?)|(?:-?[0-9]*+\\.[0-9]++(?:e-?[0-9]++)?)|(?:-?[0-9]++e-?[0-9]++)',
|
||||
self::TOKEN_INTEGER => '-?[0-9]++',
|
||||
self::TOKEN_INTEGER => '-?(?:(?:0b[0-1]++)|(?:0o[0-7]++)|(?:0x[0-9a-f]++)|(?:[0-9]++))',
|
||||
self::TOKEN_SINGLE_QUOTED_STRING => '\'(?:\\\\.|[^\'\\r\\n])*+\'',
|
||||
self::TOKEN_DOUBLE_QUOTED_STRING => '"(?:\\\\.|[^"\\r\\n])*+"',
|
||||
|
||||
|
@ -79,6 +79,26 @@ class ConstExprParserTest extends \PHPUnit\Framework\TestCase
|
||||
'123',
|
||||
new ConstExprIntegerNode('123'),
|
||||
],
|
||||
[
|
||||
'0b0110101',
|
||||
new ConstExprIntegerNode('0b0110101'),
|
||||
],
|
||||
[
|
||||
'0o777',
|
||||
new ConstExprIntegerNode('0o777'),
|
||||
],
|
||||
[
|
||||
'0x7Fb4',
|
||||
new ConstExprIntegerNode('0x7Fb4'),
|
||||
],
|
||||
[
|
||||
'-0O777',
|
||||
new ConstExprIntegerNode('-0O777'),
|
||||
],
|
||||
[
|
||||
'-0X7Fb4',
|
||||
new ConstExprIntegerNode('-0X7Fb4'),
|
||||
],
|
||||
[
|
||||
'123.4',
|
||||
new ConstExprFloatNode('123.4'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user