Fix parsing numeric literals with underscore in decimal part
The regexp adapted from Emacs' ada-mode was wrong, and also not accept "E+..."
This commit is contained in:
parent
6903869a00
commit
c61d74d03a
|
|
@ -124,7 +124,7 @@ module.exports = grammar({
|
|||
character_literal: $ => token(/'.'/),
|
||||
numeric_literal: $ => token(
|
||||
choice(
|
||||
/[0-9][0-9_]*(\.[0-9]+)?([eE][0-9_-]+)?/,
|
||||
/[0-9][0-9_]*(\.[0-9_]+)?([eE][+-]?[0-9_]+)?/,
|
||||
/[0-9]+#[0-9a-fA-F._-]+#/
|
||||
)
|
||||
),
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[0-9][0-9_]*(\\.[0-9]+)?([eE][0-9_-]+)?"
|
||||
"value": "[0-9][0-9_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
|
|
|
|||
3650
src/parser.c
3650
src/parser.c
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,7 @@ String literals
|
|||
|
||||
A : String := "12'34";
|
||||
|
||||
--------
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
|
|
@ -21,7 +21,7 @@ String literals with quotes
|
|||
|
||||
A : String := "12""23";
|
||||
|
||||
--------
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
|
|
@ -32,3 +32,19 @@ A : String := "12""23";
|
|||
(term
|
||||
(string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Numeric literals with underscore
|
||||
================================================================================
|
||||
|
||||
A : Integer := 12_14.12_122E+11_2;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user