Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 6668102

Browse files
Fixed backquoted string literals in Go
1 parent 5a5f900 commit 6668102

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/lang-go.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ PR['registerLangHandler'](
4747
// Whitespace is made up of spaces, tabs and newline characters.
4848
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
4949
// Not escaped as a string. See note on minimalism above.
50-
[PR['PR_PLAIN'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$))/, null, '"\'']
50+
[PR['PR_PLAIN'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$)|`[^`]*(?:`|$))/, null, '"\'']
5151
],
5252
[
5353
// Block comments are delimited by /* and */.
5454
// Single-line comments begin with // and extend to the end of a line.
5555
[PR['PR_COMMENT'], /^(?:\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/],
56-
[PR['PR_PLAIN'], /^(?:[^\/\"\']|\/(?![\/\*]))+/i]
56+
[PR['PR_PLAIN'], /^(?:[^\/\"\'`]|\/(?![\/\*]))+/i]
5757
]),
5858
['go']);

tests/prettify_test.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ <h1>Go mode</h1>
12981298
}
12991299

13001300
/* " */ &quot;foo /* " /*/ */
1301+
/* ` */ `foo /* ` /*/ */
13011302
</pre>
13021303

13031304
Test IE by copy/pasting content here.
@@ -2905,7 +2906,8 @@ <h1>Go mode</h1>
29052906
' fmt.Printf("Hello, world; or \u039a\u03b1\u03bb\u03b7\u03bc\u03ad\u03c1\u03b1 \u03ba\u03cc\u03c3\u03bc\u03b5; or \u3053\u3093\u306b\u3061\u306f \u4e16\u754c\\n") `END`COM// Semicolon inserted here`END`PLN\n' +
29062907
'}\n' +
29072908
'\n' +
2908-
'`END`COM/* " *\/`END`PLN "foo /* " `END`COM/*\/ *\/`END'
2909+
'`END`COM/* " *\/`END`PLN "foo /* " `END`COM/*\/ *\/`END`PLN\n' +
2910+
'`END`COM/* ` *\/`END`PLN `foo /* ` `END`COM/*\/ *\/`END'
29092911
};
29102912
</script>
29112913

0 commit comments

Comments
 (0)