summaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-07-16 10:24:08 +0100
committerliamfallon <liam.fallon@est.tech>2020-07-17 14:46:26 +0100
commit2de08a64e959788f288d82cd4410fee9424a11bc (patch)
tree93d90b4de43e6e52c7059e842cf8c5ba4d10ecca /gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js
parentee41415476b6ea1775a2f689eecb8713abf81f0c (diff)
Move apex policy editor to policy-gui
This review moves the code for the apex policy editor from the apex repo to the GUI repo. The docker part of the build will be moved in the next review because it is intertwined with the other two legacy apex GUIs and needs to be disentangled. Subsequent reviews on the apex repo will remove this code from there. Issue-ID: POLICY-2621 Change-Id: Ib9a43f463b839201656208a48ab48869a19f963a Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js')
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js94
1 files changed, 94 insertions, 0 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js
new file mode 100644
index 0000000..556566b
--- /dev/null
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/edit_area/reg_syntax/js.js
@@ -0,0 +1,94 @@
+editAreaLoader.load_syntax["js"] = {
+ 'DISPLAY_NAME' : 'Javascript'
+ ,'COMMENT_SINGLE' : {1 : '//'}
+ ,'COMMENT_MULTI' : {'/*' : '*/'}
+ ,'QUOTEMARKS' : {1: "'", 2: '"'}
+ ,'KEYWORD_CASE_SENSITIVE' : false
+ ,'KEYWORDS' : {
+ 'statements' : [
+ 'as', 'break', 'case', 'catch', 'continue', 'decodeURI', 'delete', 'do',
+ 'else', 'encodeURI', 'eval', 'finally', 'for', 'if', 'in', 'is', 'item',
+ 'instanceof', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'void',
+ 'while', 'write', 'with'
+ ]
+ ,'keywords' : [
+ 'class', 'const', 'default', 'debugger', 'export', 'extends', 'false',
+ 'function', 'import', 'namespace', 'new', 'null', 'package', 'private',
+ 'protected', 'public', 'super', 'true', 'use', 'var', 'window', 'document',
+ // the list below must be sorted and checked (if it is a keywords or a function and if it is not present twice
+ 'Link ', 'outerHeight ', 'Anchor', 'FileUpload',
+ 'location', 'outerWidth', 'Select', 'Area', 'find', 'Location', 'Packages', 'self',
+ 'arguments', 'locationbar', 'pageXoffset', 'Form',
+ 'Math', 'pageYoffset', 'setTimeout', 'assign', 'Frame', 'menubar', 'parent', 'status',
+ 'blur', 'frames', 'MimeType', 'parseFloat', 'statusbar', 'Boolean', 'Function', 'moveBy',
+ 'parseInt', 'stop', 'Button', 'getClass', 'moveTo', 'Password', 'String', 'callee', 'Hidden',
+ 'name', 'personalbar', 'Submit', 'caller', 'history', 'NaN', 'Plugin', 'sun', 'captureEvents',
+ 'History', 'navigate', 'print', 'taint', 'Checkbox', 'home', 'navigator', 'prompt', 'Text',
+ 'Image', 'Navigator', 'prototype', 'Textarea', 'clearTimeout', 'Infinity',
+ 'netscape', 'Radio', 'toolbar', 'close', 'innerHeight', 'Number', 'ref', 'top', 'closed',
+ 'innerWidth', 'Object', 'RegExp', 'toString', 'confirm', 'isFinite', 'onBlur', 'releaseEvents',
+ 'unescape', 'constructor', 'isNan', 'onError', 'Reset', 'untaint', 'Date', 'java', 'onFocus',
+ 'resizeBy', 'unwatch', 'defaultStatus', 'JavaArray', 'onLoad', 'resizeTo', 'valueOf', 'document',
+ 'JavaClass', 'onUnload', 'routeEvent', 'watch', 'Document', 'JavaObject', 'open', 'scroll', 'window',
+ 'Element', 'JavaPackage', 'opener', 'scrollbars', 'Window', 'escape', 'length', 'Option', 'scrollBy'
+ ]
+ ,'functions' : [
+ // common functions for Window object
+ 'alert', 'Array', 'back', 'blur', 'clearInterval', 'close', 'confirm', 'eval ', 'focus', 'forward', 'home',
+ 'name', 'navigate', 'onblur', 'onerror', 'onfocus', 'onload', 'onmove',
+ 'onresize', 'onunload', 'open', 'print', 'prompt', 'scroll', 'scrollTo', 'setInterval', 'status',
+ 'stop'
+ ]
+ }
+ ,'OPERATORS' :[
+ '+', '-', '/', '*', '=', '<', '>', '%', '!'
+ ]
+ ,'DELIMITERS' :[
+ '(', ')', '[', ']', '{', '}'
+ ]
+ ,'STYLES' : {
+ 'COMMENTS': 'color: #AAAAAA;'
+ ,'QUOTESMARKS': 'color: #6381F8;'
+ ,'KEYWORDS' : {
+ 'statements' : 'color: #60CA00;'
+ ,'keywords' : 'color: #48BDDF;'
+ ,'functions' : 'color: #2B60FF;'
+ }
+ ,'OPERATORS' : 'color: #FF00FF;'
+ ,'DELIMITERS' : 'color: #0038E1;'
+
+ }
+ ,'AUTO_COMPLETION' : {
+ "default": { // the name of this definition group. It's posisble to have different rules inside the same definition file
+ "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
+ ,"possible_words_letters": "[a-zA-Z0-9_]+"
+ ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$"
+ ,"prefix_separator": "\\."
+ }
+ ,"CASE_SENSITIVE": true
+ ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position
+ ,"KEYWORDS": {
+ '': [ // the prefix of thoses items
+ /**
+ * 0 : the keyword the user is typing
+ * 1 : (optionnal) the string inserted in code ("{@}" being the new position of the cursor, "§" beeing the equivalent to the value the typed string indicated if the previous )
+ * If empty the keyword will be displayed
+ * 2 : (optionnal) the text that appear in the suggestion box (if empty, the string to insert will be displayed)
+ */
+ ['Array', '§()', '']
+ ,['alert', '§({@})', 'alert(String message)']
+ ,['document']
+ ,['window']
+ ]
+ ,'window' : [
+ ['location']
+ ,['document']
+ ,['scrollTo', 'scrollTo({@})', 'scrollTo(Int x,Int y)']
+ ]
+ ,'location' : [
+ ['href']
+ ]
+ }
+ }
+ }
+};