mirror of
https://github.com/danog/phpdoc-parser.git
synced 2024-11-30 04:29:20 +01:00
Lexer: do not use \h as it depends on locale
This commit is contained in:
parent
46fef4d36b
commit
02f909f134
@ -129,7 +129,7 @@ class Lexer
|
||||
self::TOKEN_OPEN_PHPDOC => '/\\*\\*(?=\\s)',
|
||||
self::TOKEN_CLOSE_PHPDOC => '\\*/',
|
||||
self::TOKEN_PHPDOC_TAG => '@[a-z-]++',
|
||||
self::TOKEN_PHPDOC_EOL => '\\r?+\\n\\h*+(?:\\*(?!/)\\h*+)?',
|
||||
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]++',
|
||||
@ -140,7 +140,7 @@ class Lexer
|
||||
self::TOKEN_THIS_VARIABLE => '\\$this\\b',
|
||||
self::TOKEN_VARIABLE => '\\$[a-z_\\x7F-\\xFF][0-9a-z_\\x7F-\\xFF]*+',
|
||||
|
||||
self::TOKEN_HORIZONTAL_WS => '\\h++',
|
||||
self::TOKEN_HORIZONTAL_WS => '[\\x09\\x20]++',
|
||||
|
||||
// anything but TOKEN_CLOSE_PHPDOC or TOKEN_HORIZONTAL_WS or TOKEN_EOL
|
||||
self::TOKEN_OTHER => '(?:(?!\\*/)[^\\s])++',
|
||||
|
@ -299,6 +299,12 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
new IdentifierTypeNode('array'),
|
||||
Lexer::TOKEN_OPEN_SQUARE_BRACKET,
|
||||
],
|
||||
[
|
||||
"?\t\xA009", // edge-case with \h
|
||||
new NullableTypeNode(
|
||||
new IdentifierTypeNode("\xA009")
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user