Skip to content

Commit

Permalink
feat: add hex numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Aug 31, 2023
1 parent f1d35df commit 6c19574
Show file tree
Hide file tree
Showing 10 changed files with 2,078 additions and 1,654 deletions.
2 changes: 1 addition & 1 deletion common/define-grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function defineGrammar(dialect, separator) {
new RegExp(`[^${separator}\\d\\s"][^${separator} \\n\\r"]+`),
seq('"', repeat(choice(/[^"]/, '""')), '"'),
)),
number: _ => /\d+/,
number: _ => choice(/\d+/, /0[xX][0-9a-fA-F]+/),
float: _ => choice(/\d*\.\d+/, /\d+\.\d*/),
boolean: _ => choice('true', 'false'),
},
Expand Down
13 changes: 11 additions & 2 deletions csv/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,17 @@
}
},
"number": {
"type": "PATTERN",
"value": "\\d+"
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "\\d+"
},
{
"type": "PATTERN",
"value": "0[xX][0-9a-fA-F]+"
}
]
},
"float": {
"type": "CHOICE",
Expand Down
9 changes: 5 additions & 4 deletions csv/src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"named": true,
"fields": {}
},
{
"type": "number",
"named": true,
"fields": {}
},
{
"type": "row",
"named": true,
Expand All @@ -74,10 +79,6 @@
"type": "false",
"named": false
},
{
"type": "number",
"named": true
},
{
"type": "text",
"named": true
Expand Down
Loading

0 comments on commit 6c19574

Please sign in to comment.