]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/gams.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / gams.js
1 /*! `gams` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: GAMS
7 Author: Stefan Bechert <stefan.bechert@gmx.net>
8 Contributors: Oleg Efimov <efimovov@gmail.com>, Mikko Kouhia <mikko.kouhia@iki.fi>
9 Description: The General Algebraic Modeling System language
10 Website: https://www.gams.com
11 Category: scientific
12 */
13
14 /** @type LanguageFn */
15 function gams(hljs) {
16 const regex = hljs.regex;
17 const KEYWORDS = {
18 keyword:
19 'abort acronym acronyms alias all and assign binary card diag display '
20 + 'else eq file files for free ge gt if integer le loop lt maximizing '
21 + 'minimizing model models ne negative no not option options or ord '
22 + 'positive prod put putpage puttl repeat sameas semicont semiint smax '
23 + 'smin solve sos1 sos2 sum system table then until using while xor yes',
24 literal:
25 'eps inf na',
26 built_in:
27 'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy '
28 + 'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact '
29 + 'floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max '
30 + 'min mod ncpCM ncpF ncpVUpow ncpVUsin normal pi poly power '
31 + 'randBinomial randLinear randTriangle round rPower sigmoid sign '
32 + 'signPower sin sinh slexp sllog10 slrec sqexp sqlog10 sqr sqrec sqrt '
33 + 'tan tanh trunc uniform uniformInt vcPower bool_and bool_eqv bool_imp '
34 + 'bool_not bool_or bool_xor ifThen rel_eq rel_ge rel_gt rel_le rel_lt '
35 + 'rel_ne gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear '
36 + 'jdate jnow jstart jtime errorLevel execError gamsRelease gamsVersion '
37 + 'handleCollect handleDelete handleStatus handleSubmit heapFree '
38 + 'heapLimit heapSize jobHandle jobKill jobStatus jobTerminate '
39 + 'licenseLevel licenseStatus maxExecError sleep timeClose timeComp '
40 + 'timeElapsed timeExec timeStart'
41 };
42 const PARAMS = {
43 className: 'params',
44 begin: /\(/,
45 end: /\)/,
46 excludeBegin: true,
47 excludeEnd: true
48 };
49 const SYMBOLS = {
50 className: 'symbol',
51 variants: [
52 { begin: /=[lgenxc]=/ },
53 { begin: /\$/ }
54 ]
55 };
56 const QSTR = { // One-line quoted comment string
57 className: 'comment',
58 variants: [
59 {
60 begin: '\'',
61 end: '\''
62 },
63 {
64 begin: '"',
65 end: '"'
66 }
67 ],
68 illegal: '\\n',
69 contains: [ hljs.BACKSLASH_ESCAPE ]
70 };
71 const ASSIGNMENT = {
72 begin: '/',
73 end: '/',
74 keywords: KEYWORDS,
75 contains: [
76 QSTR,
77 hljs.C_LINE_COMMENT_MODE,
78 hljs.C_BLOCK_COMMENT_MODE,
79 hljs.QUOTE_STRING_MODE,
80 hljs.APOS_STRING_MODE,
81 hljs.C_NUMBER_MODE
82 ]
83 };
84 const COMMENT_WORD = /[a-z0-9&#*=?@\\><:,()$[\]_.{}!+%^-]+/;
85 const DESCTEXT = { // Parameter/set/variable description text
86 begin: /[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/,
87 excludeBegin: true,
88 end: '$',
89 endsWithParent: true,
90 contains: [
91 QSTR,
92 ASSIGNMENT,
93 {
94 className: 'comment',
95 // one comment word, then possibly more
96 begin: regex.concat(
97 COMMENT_WORD,
98 // [ ] because \s would be too broad (matching newlines)
99 regex.anyNumberOfTimes(regex.concat(/[ ]+/, COMMENT_WORD))
100 ),
101 relevance: 0
102 }
103 ]
104 };
105
106 return {
107 name: 'GAMS',
108 aliases: [ 'gms' ],
109 case_insensitive: true,
110 keywords: KEYWORDS,
111 contains: [
112 hljs.COMMENT(/^\$ontext/, /^\$offtext/),
113 {
114 className: 'meta',
115 begin: '^\\$[a-z0-9]+',
116 end: '$',
117 returnBegin: true,
118 contains: [
119 {
120 className: 'keyword',
121 begin: '^\\$[a-z0-9]+'
122 }
123 ]
124 },
125 hljs.COMMENT('^\\*', '$'),
126 hljs.C_LINE_COMMENT_MODE,
127 hljs.C_BLOCK_COMMENT_MODE,
128 hljs.QUOTE_STRING_MODE,
129 hljs.APOS_STRING_MODE,
130 // Declarations
131 {
132 beginKeywords:
133 'set sets parameter parameters variable variables '
134 + 'scalar scalars equation equations',
135 end: ';',
136 contains: [
137 hljs.COMMENT('^\\*', '$'),
138 hljs.C_LINE_COMMENT_MODE,
139 hljs.C_BLOCK_COMMENT_MODE,
140 hljs.QUOTE_STRING_MODE,
141 hljs.APOS_STRING_MODE,
142 ASSIGNMENT,
143 DESCTEXT
144 ]
145 },
146 { // table environment
147 beginKeywords: 'table',
148 end: ';',
149 returnBegin: true,
150 contains: [
151 { // table header row
152 beginKeywords: 'table',
153 end: '$',
154 contains: [ DESCTEXT ]
155 },
156 hljs.COMMENT('^\\*', '$'),
157 hljs.C_LINE_COMMENT_MODE,
158 hljs.C_BLOCK_COMMENT_MODE,
159 hljs.QUOTE_STRING_MODE,
160 hljs.APOS_STRING_MODE,
161 hljs.C_NUMBER_MODE
162 // Table does not contain DESCTEXT or ASSIGNMENT
163 ]
164 },
165 // Function definitions
166 {
167 className: 'function',
168 begin: /^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,
169 returnBegin: true,
170 contains: [
171 { // Function title
172 className: 'title',
173 begin: /^[a-z0-9_]+/
174 },
175 PARAMS,
176 SYMBOLS
177 ]
178 },
179 hljs.C_NUMBER_MODE,
180 SYMBOLS
181 ]
182 };
183 }
184
185 return gams;
186
187 })();
188 ;
189 export default hljsGrammar;