tree-sitter-javascript
Advanced tools
Comparing version 0.13.0 to 0.13.1
const PREC = { | ||
COMMENT: 1, // Prefer comments over regexes | ||
STRING: 2, // In a string, prefer string characters over comments | ||
COMMA: -1, | ||
DECLARATION: 1, | ||
COMMENT: 1, | ||
ASSIGN: 0, | ||
@@ -712,2 +714,32 @@ OBJECT: 1, | ||
string: $ => choice( | ||
seq( | ||
'"', | ||
repeat(choice( | ||
token(prec(PREC.STRING, /[^"\\\n]+/)), | ||
$.escape_sequence | ||
)), | ||
'"' | ||
), | ||
seq( | ||
"'", | ||
repeat(choice( | ||
token(prec(PREC.STRING, /[^'\\\n]+/)), | ||
$.escape_sequence | ||
)), | ||
"'" | ||
) | ||
), | ||
escape_sequence: $ => token(seq( | ||
'\\', | ||
choice( | ||
/[^xu0-7]/, | ||
/[0-7]{1,3}/, | ||
/x[0-9a-fA-F]{2}/, | ||
/u[0-9a-fA-F]{4}/, | ||
/u{[0-9a-fA-F]+}/ | ||
) | ||
)), | ||
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890 | ||
@@ -723,7 +755,2 @@ comment: $ => token(prec(PREC.COMMENT, choice( | ||
string: $ => token(choice( | ||
seq('"', repeat(choice(/[^\\"\n]/, /\\(.|\n)/)), '"'), | ||
seq("'", repeat(choice(/[^\\'\n]/, /\\(.|\n)/)), "'") | ||
)), | ||
template_string: $ => seq( | ||
@@ -733,2 +760,3 @@ '`', | ||
$._template_chars, | ||
$.escape_sequence, | ||
$.template_substitution | ||
@@ -747,3 +775,3 @@ )), | ||
'/', | ||
repeat(choice( | ||
repeat1(choice( | ||
seq( | ||
@@ -750,0 +778,0 @@ '[', |
{ | ||
"name": "tree-sitter-javascript", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"description": "Javascript grammar for node-tree-sitter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,7 +0,1 @@ | ||
class Foo { | ||
constructor() { | ||
} | ||
catch() { | ||
} | ||
} | ||
"//ok" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
47838768
5652