aboutsummaryrefslogtreecommitdiffstats
path: root/container-search-gui/src/main/resources/gui/editarea/edit_area/reg_syntax/yql.js
blob: 545927a833a9ab0e842cd3bbdef7548335e6040b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
*/
function getSources(bool){
		var options = [];
		if (window.CONFIG.hasOwnProperty("model_sources")){
			var sources = window.CONFIG.model_sources;
			for (i in sources){
				option = [sources[i]];
				options.push(option);
			}
			if (bool == true){options.push(["*"])}
		}
		return options;
}

editAreaLoader.load_syntax["yql"] = {
	'DISPLAY_NAME' : 'YQL'
	,'QUOTEMARKS' : {1: "'", 2: '"', 3: '`'}
	,'KEYWORD_CASE_SENSITIVE' : false
	,'OPERATOR_CASE_SENSITIVE' : false
	,'KEYWORDS' : {
		'statements' : [
			'SELECT', 'FROM','SOURCES', 'CONTAINS',
		 	'NOT', 'ORDER',
			'BY', 'WHERE'
		]
		,'reserved' : [
			'null'

		]
		,'functions' : [
   'DESC', 'ASC', 'ALL', 'GROUP', 'RANGE', 'EACH', 'OUTPUT', 'SUM', 'LIMIT', 'OFFSET', 'TIMEOUT'
		]
	}
	,'OPERATORS' :[
     'COUNT','AND','and','OR','or','BETWEEN','between','&&','&','|','^','/','<=>','=','>=','>','<<','>>','<=','<','-','%','!=','<>','!','||','+','~','*'
	]
	,'DELIMITERS' :[
		'(', ')', '[', ']', '{', '}'
	]
	,'REGEXPS' : {
		// highlight all variables (@...)
		'variables' : {
			'search' : '()(\\@\\w+)()'
			,'class' : 'variables'
			,'modifiers' : 'g'
			,'execute' : 'before' // before or after
		}
	}
	,'STYLES' : {
		'COMMENTS': 'color: #AAAAAA;'
		,'QUOTESMARKS': 'color: #879EFA;'
		,'KEYWORDS' : {
			'reserved' : 'color: #48BDDF;'
			,'functions' : 'color: #0040FD;'
			,'statements' : 'color: #60CA00;'
			}
		,'OPERATORS' : 'color: #FF00FF;'
		,'DELIMITERS' : 'color: #d1421b;'
		,'REGEXPS' : {
			'variables' : 'color: #E0BD54;'
		}
	},
	'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": false
			,"MAX_TEXT_LENGTH": 50		// the maximum length of the text being analyzed before the cursor position
			,"KEYWORDS": {
				'': [	// the prefix of these 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)
						 */
						 ['SELECT','SELECT'],
						 ['FROM','FROM'],
 						 ['SOURCES','SOURCES'],
						 ['CONTAINS','CONTAINS'],
						 ['NOT','NOT'], ['ORDER','ORDER'], ['BY','BY'],['WHERE','WHERE'],
						 ['DESC','DESC'],['ASC','ASC'],['ALL','ALL'], ['GROUP','GROUP'],
						 ['RANGE','RANGE'],['EACH','EACH'],['OUTPUT','OUTPUT'],
						 ['SUM','SUM'],['LIMIT','LIMIT'],['OFFSET','OFFSET'],
						 ['TIMEOUT','TIMEOUT']
					 ]
			}
		},
		"sources": {	// 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": false
			,"MAX_TEXT_LENGTH": 50		// the maximum length of the text being analyzed before the cursor position
			,"KEYWORDS": {
					'SOURCES' : getSources(true) ,
					',' : getSources(false)
			}
		}

	}
};