From 717ace021cc09fed82681e935043d9bfa7050189 Mon Sep 17 00:00:00 2001 From: Simran Date: Tue, 15 Oct 2019 16:03:54 +0200 Subject: [PATCH] AQL: Disallow unclosed multiline comments again (#2089) This reverts commit f3c6ba590345b140a2306903a5396e28187466eb. --- components/prism-aql.js | 2 +- components/prism-aql.min.js | 2 +- tests/languages/aql/comment_feature.test | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/components/prism-aql.js b/components/prism-aql.js index 3ee8a02dce..2de15228c3 100644 --- a/components/prism-aql.js +++ b/components/prism-aql.js @@ -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, diff --git a/components/prism-aql.min.js b/components/prism-aql.min.js index c7bd24848e..5fa9a63cd0 100644 --- a/components/prism-aql.min.js +++ b/components/prism-aql.min.js @@ -1 +1 @@ -Prism.languages.aql={comment:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,property:{pattern:/([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,greedy:!0},variable:/@@?\w+/,keyword:[{pattern:/(\bWITH\s+)COUNT(?=\s+INTO\b)/i,lookbehind:!0},/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i,{pattern:/(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,lookbehind:!0},{pattern:/(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,lookbehind:!0},{pattern:/\bOPTIONS(?=\s*{)/i}],function:/(?!\d)\w+(?=\s*\()/,boolean:/(?:true|false)/i,range:{pattern:/\.\./,alias:"operator"},number:/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i,operator:/\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,punctuation:/::|[?.:,;()[\]{}]/}; \ No newline at end of file +Prism.languages.aql={comment:/\/\/.*|\/\*[\s\S]*?\*\//,property:{pattern:/([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,greedy:!0},variable:/@@?\w+/,keyword:[{pattern:/(\bWITH\s+)COUNT(?=\s+INTO\b)/i,lookbehind:!0},/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i,{pattern:/(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,lookbehind:!0},{pattern:/(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,lookbehind:!0},{pattern:/\bOPTIONS(?=\s*{)/i}],function:/(?!\d)\w+(?=\s*\()/,boolean:/(?:true|false)/i,range:{pattern:/\.\./,alias:"operator"},number:/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i,operator:/\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,punctuation:/::|[?.:,;()[\]{}]/}; \ No newline at end of file diff --git a/tests/languages/aql/comment_feature.test b/tests/languages/aql/comment_feature.test index 3de3149229..ea3f62ae31 100644 --- a/tests/languages/aql/comment_feature.test +++ b/tests/languages/aql/comment_feature.test @@ -3,15 +3,12 @@ multi line */ -/* unclosed multi-line comments are allowed -RETURN 1 ---------------------------------------------------- [ ["comment", "// single line"], - ["comment", "/*\r\n multi\r\n line\r\n */"], - ["comment", "/* unclosed multi-line comments are allowed\r\nRETURN 1"] + ["comment", "/*\r\n multi\r\n line\r\n */"] ] ----------------------------------------------------