'_' isn't an integer and octal, hex, and binary values are

pull/204/head
Jonathan Arnett 2021-12-29 14:57:06 +07:00
parent 12ab1ee0f9
commit 58ae4730ee
4 changed files with 12727 additions and 10872 deletions

@ -571,7 +571,12 @@ module.exports = grammar({
/* Literals */
string: ($) => /\"(?:\\[efnrt\"\\]|[^\"])*\"/,
float: ($) => /-?[0-9_]+\.[0-9_]+/,
integer: ($) => /-?[0-9_]+/,
integer: ($) =>
seq(optional("-"), choice($._hex, $._decimal, $._octal, $._binary)),
_hex: ($) => /0[xX][0-9a-fA-F_]+/,
_decimal: ($) => /[0-9][0-9_]*/,
_octal: ($) => /0[oO][0-7_]+/,
_binary: ($) => /0[bB][0-1_]+/,
_bit_string_segment_option_unit: ($) =>
seq("unit", "(", alias($.integer, $.bit_string_segment_option_unit), ")"),
_bit_string_segment_option_literal: ($) =>

@ -3957,8 +3957,58 @@
"value": "-?[0-9_]+\\.[0-9_]+"
},
"integer": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "-"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_hex"
},
{
"type": "SYMBOL",
"name": "_decimal"
},
{
"type": "SYMBOL",
"name": "_octal"
},
{
"type": "SYMBOL",
"name": "_binary"
}
]
}
]
},
"_hex": {
"type": "PATTERN",
"value": "0[xX][0-9a-fA-F_]+"
},
"_decimal": {
"type": "PATTERN",
"value": "[0-9][0-9_]*"
},
"_octal": {
"type": "PATTERN",
"value": "0[oO][0-7_]+"
},
"_binary": {
"type": "PATTERN",
"value": "-?[0-9_]+"
"value": "0[bB][0-1_]+"
},
"_bit_string_segment_option_unit": {
"type": "SEQ",

@ -477,6 +477,11 @@
]
}
},
{
"type": "bit_string_segment_option_unit",
"named": true,
"fields": {}
},
{
"type": "bit_string_segment_options",
"named": true,
@ -1599,6 +1604,11 @@
]
}
},
{
"type": "integer",
"named": true,
"fields": {}
},
{
"type": "list",
"named": true,
@ -2995,10 +3005,6 @@
"type": "bit_string_segment_option_signed",
"named": true
},
{
"type": "bit_string_segment_option_unit",
"named": true
},
{
"type": "bit_string_segment_option_unsigned",
"named": true
@ -3063,10 +3069,6 @@
"type": "import",
"named": false
},
{
"type": "integer",
"named": true
},
{
"type": "javascript",
"named": false

File diff suppressed because it is too large Load Diff