[clojure] Add a word boundary to ensure exact matches for `(comment ...)`.

pull/2748/head
Abdussalam Abdurrahman 6 years ago
parent 6f6f1b43f0
commit c77f11b1b0

@ -792,6 +792,30 @@ testTokenization('clojure', [
{startIndex: 0, type: 'comment.clj'}, {startIndex: 0, type: 'comment.clj'},
], ],
}, },
{
line: '(comments foo bar)',
tokens: [
{startIndex: 0, type: 'delimiter.parenthesis.clj'},
{startIndex: 1, type: 'identifier.clj'},
{startIndex: 9, type: 'white.clj'},
{startIndex: 10, type: 'identifier.clj'},
{startIndex: 13, type: 'white.clj'},
{startIndex: 14, type: 'identifier.clj'},
{startIndex: 17, type: 'delimiter.parenthesis.clj'},
]
},
{
line: '(comment6 foo bar)',
tokens: [
{startIndex: 0, type: 'delimiter.parenthesis.clj'},
{startIndex: 1, type: 'identifier.clj'},
{startIndex: 9, type: 'white.clj'},
{startIndex: 10, type: 'identifier.clj'},
{startIndex: 13, type: 'white.clj'},
{startIndex: 14, type: 'identifier.clj'},
{startIndex: 17, type: 'delimiter.parenthesis.clj'},
]
},
{ {
line: '(comment foo', line: '(comment foo',
tokens: [ tokens: [

@ -762,13 +762,13 @@ export const language = <ILanguage>{
whitespace: [ whitespace: [
[/\s+/, 'white'], [/\s+/, 'white'],
[/;.*$/, 'comment'], [/;.*$/, 'comment'],
[/\(comment/, 'comment', '@comment'], [/\(comment\b/, 'comment', '@comment'],
], ],
comment: [ comment: [
[/\(/, 'comment', '@push'], [/\(/, 'comment', '@push'],
[/\)/, 'comment', '@pop'], [/\)/, 'comment', '@pop'],
[/[^)]/, 'comment'], [/[^()]/, 'comment'],
], ],
string: [ string: [

Loading…
Cancel
Save