From 85e9eac4ac9081194f338f33fd2b46d284a7372b Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 21 May 2018 16:12:11 -0700 Subject: [PATCH] Improve IFQL syntax highlighting --- ui/src/shared/constants/codeMirrorModes.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/src/shared/constants/codeMirrorModes.ts b/ui/src/shared/constants/codeMirrorModes.ts index 8f7127892..e3761d690 100644 --- a/ui/src/shared/constants/codeMirrorModes.ts +++ b/ui/src/shared/constants/codeMirrorModes.ts @@ -10,13 +10,21 @@ export const modeIFQL = { regex: /\w+(?=[(])/, token: 'function', }, + { + regex: /[\w\d]+(?=\s[=]\s)/, + token: 'variable', + }, { regex: /[=][>]/, token: 'arrow-function', }, + { + regex: /\w+(?=[)]\s[=][>])(?![(])/, + token: 'function-arg', + }, { regex: /AND|OR|[=][=]|[!][=]|[<][=]|[>][=]/, - token: 'logic-operator', + token: 'operator', }, { regex: /\w+[:]/, @@ -25,11 +33,11 @@ export const modeIFQL = { // The regex matches the token, the token property contains the type { regex: /"(?:[^\\]|\\.)*?(?:"|$)/, - token: 'string.double', + token: 'string-double', }, { regex: /'(?:[^\\]|\\.)*?(?:'|$)/, - token: 'string.single', + token: 'string-single', }, { regex: /(function)(\s+)([a-z$][\w$]*)/,