1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | function lasso(hljs) {
|
9 | const LASSO_IDENT_RE = '[a-zA-Z_][\\w.]*';
|
10 | const LASSO_ANGLE_RE = '<\\?(lasso(script)?|=)';
|
11 | const LASSO_CLOSE_RE = '\\]|\\?>';
|
12 | const LASSO_KEYWORDS = {
|
13 | $pattern: LASSO_IDENT_RE + '|&[lg]t;',
|
14 | literal:
|
15 | 'true false none minimal full all void and or not ' +
|
16 | 'bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft',
|
17 | built_in:
|
18 | 'array date decimal duration integer map pair string tag xml null ' +
|
19 | 'boolean bytes keyword list locale queue set stack staticarray ' +
|
20 | 'local var variable global data self inherited currentcapture givenblock',
|
21 | keyword:
|
22 | 'cache database_names database_schemanames database_tablenames ' +
|
23 | 'define_tag define_type email_batch encode_set html_comment handle ' +
|
24 | 'handle_error header if inline iterate ljax_target link ' +
|
25 | 'link_currentaction link_currentgroup link_currentrecord link_detail ' +
|
26 | 'link_firstgroup link_firstrecord link_lastgroup link_lastrecord ' +
|
27 | 'link_nextgroup link_nextrecord link_prevgroup link_prevrecord log ' +
|
28 | 'loop namespace_using output_none portal private protect records ' +
|
29 | 'referer referrer repeating resultset rows search_args ' +
|
30 | 'search_arguments select sort_args sort_arguments thread_atomic ' +
|
31 | 'value_list while abort case else fail_if fail_ifnot fail if_empty ' +
|
32 | 'if_false if_null if_true loop_abort loop_continue loop_count params ' +
|
33 | 'params_up return return_value run_children soap_definetag ' +
|
34 | 'soap_lastrequest soap_lastresponse tag_name ascending average by ' +
|
35 | 'define descending do equals frozen group handle_failure import in ' +
|
36 | 'into join let match max min on order parent protected provide public ' +
|
37 | 'require returnhome skip split_thread sum take thread to trait type ' +
|
38 | 'where with yield yieldhome'
|
39 | };
|
40 | const HTML_COMMENT = hljs.COMMENT(
|
41 | '<!--',
|
42 | '-->',
|
43 | {
|
44 | relevance: 0
|
45 | }
|
46 | );
|
47 | const LASSO_NOPROCESS = {
|
48 | className: 'meta',
|
49 | begin: '\\[noprocess\\]',
|
50 | starts: {
|
51 | end: '\\[/noprocess\\]',
|
52 | returnEnd: true,
|
53 | contains: [HTML_COMMENT]
|
54 | }
|
55 | };
|
56 | const LASSO_START = {
|
57 | className: 'meta',
|
58 | begin: '\\[/noprocess|' + LASSO_ANGLE_RE
|
59 | };
|
60 | const LASSO_DATAMEMBER = {
|
61 | className: 'symbol',
|
62 | begin: '\'' + LASSO_IDENT_RE + '\''
|
63 | };
|
64 | const LASSO_CODE = [
|
65 | hljs.C_LINE_COMMENT_MODE,
|
66 | hljs.C_BLOCK_COMMENT_MODE,
|
67 | hljs.inherit(hljs.C_NUMBER_MODE, {
|
68 | begin: hljs.C_NUMBER_RE + '|(-?infinity|NaN)\\b'
|
69 | }),
|
70 | hljs.inherit(hljs.APOS_STRING_MODE, {
|
71 | illegal: null
|
72 | }),
|
73 | hljs.inherit(hljs.QUOTE_STRING_MODE, {
|
74 | illegal: null
|
75 | }),
|
76 | {
|
77 | className: 'string',
|
78 | begin: '`',
|
79 | end: '`'
|
80 | },
|
81 | {
|
82 | variants: [
|
83 | {
|
84 | begin: '[#$]' + LASSO_IDENT_RE
|
85 | },
|
86 | {
|
87 | begin: '#',
|
88 | end: '\\d+',
|
89 | illegal: '\\W'
|
90 | }
|
91 | ]
|
92 | },
|
93 | {
|
94 | className: 'type',
|
95 | begin: '::\\s*',
|
96 | end: LASSO_IDENT_RE,
|
97 | illegal: '\\W'
|
98 | },
|
99 | {
|
100 | className: 'params',
|
101 | variants: [
|
102 | {
|
103 | begin: '-(?!infinity)' + LASSO_IDENT_RE,
|
104 | relevance: 0
|
105 | },
|
106 | {
|
107 | begin: '(\\.\\.\\.)'
|
108 | }
|
109 | ]
|
110 | },
|
111 | {
|
112 | begin: /(->|\.)\s*/,
|
113 | relevance: 0,
|
114 | contains: [LASSO_DATAMEMBER]
|
115 | },
|
116 | {
|
117 | className: 'class',
|
118 | beginKeywords: 'define',
|
119 | returnEnd: true,
|
120 | end: '\\(|=>',
|
121 | contains: [
|
122 | hljs.inherit(hljs.TITLE_MODE, {
|
123 | begin: LASSO_IDENT_RE + '(=(?!>))?|[-+*/%](?!>)'
|
124 | })
|
125 | ]
|
126 | }
|
127 | ];
|
128 | return {
|
129 | name: 'Lasso',
|
130 | aliases: [
|
131 | 'ls',
|
132 | 'lassoscript'
|
133 | ],
|
134 | case_insensitive: true,
|
135 | keywords: LASSO_KEYWORDS,
|
136 | contains: [
|
137 | {
|
138 | className: 'meta',
|
139 | begin: LASSO_CLOSE_RE,
|
140 | relevance: 0,
|
141 | starts: {
|
142 | end: '\\[|' + LASSO_ANGLE_RE,
|
143 | returnEnd: true,
|
144 | relevance: 0,
|
145 | contains: [HTML_COMMENT]
|
146 | }
|
147 | },
|
148 | LASSO_NOPROCESS,
|
149 | LASSO_START,
|
150 | {
|
151 | className: 'meta',
|
152 | begin: '\\[no_square_brackets',
|
153 | starts: {
|
154 | end: '\\[/no_square_brackets\\]',
|
155 | keywords: LASSO_KEYWORDS,
|
156 | contains: [
|
157 | {
|
158 | className: 'meta',
|
159 | begin: LASSO_CLOSE_RE,
|
160 | relevance: 0,
|
161 | starts: {
|
162 | end: '\\[noprocess\\]|' + LASSO_ANGLE_RE,
|
163 | returnEnd: true,
|
164 | contains: [HTML_COMMENT]
|
165 | }
|
166 | },
|
167 | LASSO_NOPROCESS,
|
168 | LASSO_START
|
169 | ].concat(LASSO_CODE)
|
170 | }
|
171 | },
|
172 | {
|
173 | className: 'meta',
|
174 | begin: '\\[',
|
175 | relevance: 0
|
176 | },
|
177 | {
|
178 | className: 'meta',
|
179 | begin: '^#!',
|
180 | end: 'lasso9$',
|
181 | relevance: 10
|
182 | }
|
183 | ].concat(LASSO_CODE)
|
184 | };
|
185 | }
|
186 |
|
187 | export { lasso as default };
|