Skip to content

Commit

Permalink
AQL: Allow unclosed multi-line comments (PrismJS#2058)
Browse files Browse the repository at this point in the history
AQL does not require multi-line comments to be closed. ArangoDB simply treats everything until the end of the query string as a comment in that case. This PR adjusts Prism to highlight such comments correctly.
  • Loading branch information
Simran-B authored and RunDevelopment committed Sep 18, 2019
1 parent 899574e commit f3c6ba5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/prism-aql.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Prism.languages.aql = {
'comment': /\/\/.*|\/\*[\s\S]*?\*\//,
'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
'property': {
pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,
lookbehind: true,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-aql.min.js

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

5 changes: 4 additions & 1 deletion tests/languages/aql/comment_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
multi
line
*/
/* unclosed multi-line comments are allowed
RETURN 1

----------------------------------------------------

[
["comment", "// single line"],
["comment", "/*\r\n multi\r\n line\r\n */"]
["comment", "/*\r\n multi\r\n line\r\n */"],
["comment", "/* unclosed multi-line comments are allowed\r\nRETURN 1"]
]

----------------------------------------------------
Expand Down

0 comments on commit f3c6ba5

Please sign in to comment.