Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Go: add raw string literal syntax #10

Merged
merged 1 commit into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export var language = <ILanguage> {
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string' ],
[/`/, "string", "@rawstring"],

// characters
[/'[^\\']'/, 'string'],
Expand Down Expand Up @@ -162,5 +163,10 @@ export var language = <ILanguage> {
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop' ]
],

rawstring: [
[/[^\`]/, "string"],
[/`/, "string", "@pop"]
],
},
};
6 changes: 6 additions & 0 deletions test/go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,5 +1163,11 @@ testTokenization('go', [
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.go' }
]}],

[{
line: '`Hello world() ""`',
tokens: [
{ startIndex: 0, type: 'string.go' }
]}]
]);