diff --git a/components/prism-aql.js b/components/prism-aql.js index 2de15228c3..4a338eb63b 100644 --- a/components/prism-aql.js +++ b/components/prism-aql.js @@ -15,7 +15,7 @@ Prism.languages.aql = { pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i, lookbehind: true }, - /\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, + /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i, // pseudo keywords get a lookbehind to avoid false positives { pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i, @@ -35,7 +35,11 @@ Prism.languages.aql = { pattern: /\.\./, alias: 'operator' }, - 'number': /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i, + 'number': [ + /\b0b[01]+/i, + /\b0x[0-9a-f]+/i, + /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i + ], 'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/, 'punctuation': /::|[?.:,;()[\]{}]/ }; diff --git a/components/prism-aql.min.js b/components/prism-aql.min.js index 5fa9a63cd0..596c72b89e 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_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|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:[/\b0b[01]+/i,/\b0x[0-9a-f]+/i,/(?:\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/keyword_feature.test b/tests/languages/aql/keyword_feature.test index 204d45785e..d095cb4ae9 100644 --- a/tests/languages/aql/keyword_feature.test +++ b/tests/languages/aql/keyword_feature.test @@ -16,6 +16,7 @@ IN INBOUND INSERT INTO +K_PATHS K_SHORTEST_PATHS LET LIKE @@ -32,6 +33,7 @@ SHORTEST_PATH SORT UPDATE UPSERT +WINDOW WITH KEEP @@ -69,6 +71,7 @@ OPTIONS ["keyword", "INBOUND"], ["keyword", "INSERT"], ["keyword", "INTO"], + ["keyword", "K_PATHS"], ["keyword", "K_SHORTEST_PATHS"], ["keyword", "LET"], ["keyword", "LIKE"], @@ -85,6 +88,7 @@ OPTIONS ["keyword", "SORT"], ["keyword", "UPDATE"], ["keyword", "UPSERT"], + ["keyword", "WINDOW"], ["keyword", "WITH"], ["keyword", "KEEP"], diff --git a/tests/languages/aql/number_feature.test b/tests/languages/aql/number_feature.test index b4720e08ad..4fd7800bf8 100644 --- a/tests/languages/aql/number_feature.test +++ b/tests/languages/aql/number_feature.test @@ -6,6 +6,8 @@ .5 4.87e103 4.87E103 +0b10101110 +0xabcdef02 ---------------------------------------------------- @@ -17,7 +19,9 @@ ["number", "0.5"], ["number", ".5"], ["number", "4.87e103"], - ["number", "4.87E103"] + ["number", "4.87E103"], + ["number", "0b10101110"], + ["number", "0xabcdef02"] ] ----------------------------------------------------