Skip to content

Commit

Permalink
added to test
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatychev committed Aug 5, 2024
1 parent a8cd4ac commit e5e53a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ module.exports = grammar({
special_variable: $ => seq('$', $.identifier),
_variable_name: $ => choice($.identifier, $.special_variable),

string: _ => token(seq('"', repeat(choice(/[^"]/, '\\"')), '"')),
string: _ => token(seq('"', repeat(choice(/[^"]/, '\\"', "\\\\")), '"')),
number: $ => choice($.decimal, $.float),
decimal: _ => token(/-?\d+/),
float: _ => token(/-?(\d+(\.\d+)?|\.\d+)(e-?\d+)?/),
Expand Down
4 changes: 4 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,10 @@
{
"type": "STRING",
"value": "\\\""
},
{
"type": "STRING",
"value": "\\\\"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/corpus/literals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
All Literals
================================================================================
num = -4.3;
escape = "\\";
name = "Karl";
esc = "\\";
boolean = true;
list = [1, 2, each [3, 4], [5, 6]];
trailing_comma_list = [[1, 2,],];
Expand Down

0 comments on commit e5e53a8

Please sign in to comment.