Skip to content

Commit

Permalink
fix: comments should not consume 2028+2029, and neither should identi…
Browse files Browse the repository at this point in the history
…fiers
  • Loading branch information
amaanq committed May 19, 2024
1 parent e88537c commit b0473cb
Show file tree
Hide file tree
Showing 4 changed files with 69,983 additions and 121,607 deletions.
10 changes: 5 additions & 5 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ module.exports = grammar({
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890
comment: _ => choice(
token(choice(
seq('//', /.*/),
seq('//', /[^\r\n\u2028\u2029]*/),
seq(
'/*',
/[^*]*\*+([^/*][^*]*\*+)*/,
Expand Down Expand Up @@ -1087,17 +1087,17 @@ module.exports = grammar({

identifier: _ => {
// eslint-disable-next-line max-len
const alpha = /[^\x00-\x1F\s\p{Zs}0-9:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
const alpha = /[^\x00-\x1F\s\p{Zs}0-9:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B\u2028\u2029]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
// eslint-disable-next-line max-len
const alphanumeric = /[^\x00-\x1F\s\p{Zs}:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
const alphanumeric = /[^\x00-\x1F\s\p{Zs}:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B\u2028\u2029]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
return token(seq(alpha, repeat(alphanumeric)));
},

private_property_identifier: _ => {
// eslint-disable-next-line max-len
const alpha = /[^\x00-\x1F\s\p{Zs}0-9:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
const alpha = /[^\x00-\x1F\s\p{Zs}0-9:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B\u2028\u2029]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
// eslint-disable-next-line max-len
const alphanumeric = /[^\x00-\x1F\s\p{Zs}:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
const alphanumeric = /[^\x00-\x1F\s\p{Zs}:;`"'@#.,|^&<=>+\-*/\\%?!~()\[\]{}\uFEFF\u2060\u200B\u2028\u2029]|\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]+\}/;
return token(seq('#', alpha, repeat(alphanumeric)));
},

Expand Down
10 changes: 5 additions & 5 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b0473cb

Please sign in to comment.