1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | function gauss(hljs) {
|
9 | const KEYWORDS = {
|
10 | keyword: 'bool break call callexe checkinterrupt clear clearg closeall cls comlog compile ' +
|
11 | 'continue create debug declare delete disable dlibrary dllcall do dos ed edit else ' +
|
12 | 'elseif enable end endfor endif endp endo errorlog errorlogat expr external fn ' +
|
13 | 'for format goto gosub graph if keyword let lib library line load loadarray loadexe ' +
|
14 | 'loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow ' +
|
15 | 'matrix msym ndpclex new open output outwidth plot plotsym pop prcsn print ' +
|
16 | 'printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen ' +
|
17 | 'scroll setarray show sparse stop string struct system trace trap threadfor ' +
|
18 | 'threadendfor threadbegin threadjoin threadstat threadend until use while winprint ' +
|
19 | 'ne ge le gt lt and xor or not eq eqv',
|
20 | built_in: 'abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol ' +
|
21 | 'AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks ' +
|
22 | 'AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults ' +
|
23 | 'annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness ' +
|
24 | 'annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd ' +
|
25 | 'astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar ' +
|
26 | 'base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 ' +
|
27 | 'cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv ' +
|
28 | 'cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn ' +
|
29 | 'cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi ' +
|
30 | 'cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir ' +
|
31 | 'ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated ' +
|
32 | 'complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs ' +
|
33 | 'cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos ' +
|
34 | 'datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd ' +
|
35 | 'dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName ' +
|
36 | 'dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy ' +
|
37 | 'dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen ' +
|
38 | 'dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA ' +
|
39 | 'dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField ' +
|
40 | 'dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition ' +
|
41 | 'dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows ' +
|
42 | 'dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly ' +
|
43 | 'dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy ' +
|
44 | 'dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl ' +
|
45 | 'dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt ' +
|
46 | 'dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday ' +
|
47 | 'dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays ' +
|
48 | 'endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error ' +
|
49 | 'etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut ' +
|
50 | 'EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol ' +
|
51 | 'EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq ' +
|
52 | 'feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt ' +
|
53 | 'floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC ' +
|
54 | 'gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders ' +
|
55 | 'gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse ' +
|
56 | 'gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray ' +
|
57 | 'getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders ' +
|
58 | 'getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT ' +
|
59 | 'gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm ' +
|
60 | 'hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 ' +
|
61 | 'indicesf indicesfn indnv indsav integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 ' +
|
62 | 'inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf ' +
|
63 | 'isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv ' +
|
64 | 'lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn ' +
|
65 | 'lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind ' +
|
66 | 'loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars ' +
|
67 | 'makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli ' +
|
68 | 'mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave ' +
|
69 | 'movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate ' +
|
70 | 'olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto ' +
|
71 | 'pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox ' +
|
72 | 'plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea ' +
|
73 | 'plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout ' +
|
74 | 'plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill ' +
|
75 | 'plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol ' +
|
76 | 'plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange ' +
|
77 | 'plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel ' +
|
78 | 'plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot ' +
|
79 | 'pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames ' +
|
80 | 'pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector ' +
|
81 | 'pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate ' +
|
82 | 'qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr ' +
|
83 | 'real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn ' +
|
84 | 'rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel ' +
|
85 | 'rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn ' +
|
86 | 'rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh ' +
|
87 | 'rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind ' +
|
88 | 'scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa ' +
|
89 | 'setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind ' +
|
90 | 'sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL ' +
|
91 | 'spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense ' +
|
92 | 'spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet ' +
|
93 | 'sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt ' +
|
94 | 'strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr ' +
|
95 | 'surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname ' +
|
96 | 'time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk ' +
|
97 | 'trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt ' +
|
98 | 'utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs ' +
|
99 | 'vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window ' +
|
100 | 'writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM ' +
|
101 | 'xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics cdfEmpirical dot h5create h5open h5read h5readAttribute ' +
|
102 | 'h5write h5writeAttribute ldl plotAddErrorBar plotAddSurface plotCDFEmpirical plotSetColormap plotSetContourLabels ' +
|
103 | 'plotSetLegendFont plotSetTextInterpreter plotSetXTicCount plotSetYTicCount plotSetZLevels powerm strjoin sylvester ' +
|
104 | 'strtrim',
|
105 | literal: 'DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS ' +
|
106 | 'DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 ' +
|
107 | 'DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS ' +
|
108 | 'DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES ' +
|
109 | 'DB_TRANSACTIONS DB_UNICODE DB_VIEWS __STDIN __STDOUT __STDERR __FILE_DIR'
|
110 | };
|
111 |
|
112 | const AT_COMMENT_MODE = hljs.COMMENT('@', '@');
|
113 |
|
114 | const PREPROCESSOR =
|
115 | {
|
116 | className: 'meta',
|
117 | begin: '#',
|
118 | end: '$',
|
119 | keywords: {
|
120 | keyword: 'define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline'
|
121 | },
|
122 | contains: [
|
123 | {
|
124 | begin: /\\\n/,
|
125 | relevance: 0
|
126 | },
|
127 | {
|
128 | beginKeywords: 'include',
|
129 | end: '$',
|
130 | keywords: {
|
131 | keyword: 'include'
|
132 | },
|
133 | contains: [
|
134 | {
|
135 | className: 'string',
|
136 | begin: '"',
|
137 | end: '"',
|
138 | illegal: '\\n'
|
139 | }
|
140 | ]
|
141 | },
|
142 | hljs.C_LINE_COMMENT_MODE,
|
143 | hljs.C_BLOCK_COMMENT_MODE,
|
144 | AT_COMMENT_MODE
|
145 | ]
|
146 | };
|
147 |
|
148 | const STRUCT_TYPE =
|
149 | {
|
150 | begin: /\bstruct\s+/,
|
151 | end: /\s/,
|
152 | keywords: "struct",
|
153 | contains: [
|
154 | {
|
155 | className: "type",
|
156 | begin: hljs.UNDERSCORE_IDENT_RE,
|
157 | relevance: 0
|
158 | }
|
159 | ]
|
160 | };
|
161 |
|
162 |
|
163 | const PARSE_PARAMS = [
|
164 | {
|
165 | className: 'params',
|
166 | begin: /\(/,
|
167 | end: /\)/,
|
168 | excludeBegin: true,
|
169 | excludeEnd: true,
|
170 | endsWithParent: true,
|
171 | relevance: 0,
|
172 | contains: [
|
173 | {
|
174 | className: 'literal',
|
175 | begin: /\.\.\./
|
176 | },
|
177 | hljs.C_NUMBER_MODE,
|
178 | hljs.C_BLOCK_COMMENT_MODE,
|
179 | AT_COMMENT_MODE,
|
180 | STRUCT_TYPE
|
181 | ]
|
182 | }
|
183 | ];
|
184 |
|
185 | const FUNCTION_DEF =
|
186 | {
|
187 | className: "title",
|
188 | begin: hljs.UNDERSCORE_IDENT_RE,
|
189 | relevance: 0
|
190 | };
|
191 |
|
192 | const DEFINITION = function(beginKeywords, end, inherits) {
|
193 | const mode = hljs.inherit(
|
194 | {
|
195 | className: "function",
|
196 | beginKeywords: beginKeywords,
|
197 | end: end,
|
198 | excludeEnd: true,
|
199 | contains: [].concat(PARSE_PARAMS)
|
200 | },
|
201 | inherits || {}
|
202 | );
|
203 | mode.contains.push(FUNCTION_DEF);
|
204 | mode.contains.push(hljs.C_NUMBER_MODE);
|
205 | mode.contains.push(hljs.C_BLOCK_COMMENT_MODE);
|
206 | mode.contains.push(AT_COMMENT_MODE);
|
207 | return mode;
|
208 | };
|
209 |
|
210 | const BUILT_IN_REF =
|
211 | {
|
212 | className: 'built_in',
|
213 | begin: '\\b(' + KEYWORDS.built_in.split(' ').join('|') + ')\\b'
|
214 | };
|
215 |
|
216 | const STRING_REF =
|
217 | {
|
218 | className: 'string',
|
219 | begin: '"',
|
220 | end: '"',
|
221 | contains: [hljs.BACKSLASH_ESCAPE],
|
222 | relevance: 0
|
223 | };
|
224 |
|
225 | const FUNCTION_REF =
|
226 | {
|
227 |
|
228 | begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
|
229 | returnBegin: true,
|
230 | keywords: KEYWORDS,
|
231 | relevance: 0,
|
232 | contains: [
|
233 | {
|
234 | beginKeywords: KEYWORDS.keyword
|
235 | },
|
236 | BUILT_IN_REF,
|
237 | {
|
238 | className: 'built_in',
|
239 | begin: hljs.UNDERSCORE_IDENT_RE,
|
240 | relevance: 0
|
241 | }
|
242 | ]
|
243 | };
|
244 |
|
245 | const FUNCTION_REF_PARAMS =
|
246 | {
|
247 |
|
248 | begin: /\(/,
|
249 | end: /\)/,
|
250 | relevance: 0,
|
251 | keywords: {
|
252 | built_in: KEYWORDS.built_in,
|
253 | literal: KEYWORDS.literal
|
254 | },
|
255 | contains: [
|
256 | hljs.C_NUMBER_MODE,
|
257 | hljs.C_BLOCK_COMMENT_MODE,
|
258 | AT_COMMENT_MODE,
|
259 | BUILT_IN_REF,
|
260 | FUNCTION_REF,
|
261 | STRING_REF,
|
262 | 'self'
|
263 | ]
|
264 | };
|
265 |
|
266 | FUNCTION_REF.contains.push(FUNCTION_REF_PARAMS);
|
267 |
|
268 | return {
|
269 | name: 'GAUSS',
|
270 | aliases: ['gss'],
|
271 | case_insensitive: true,
|
272 | keywords: KEYWORDS,
|
273 | illegal: /(\{[%#]|[%#]\}| <- )/,
|
274 | contains: [
|
275 | hljs.C_NUMBER_MODE,
|
276 | hljs.C_LINE_COMMENT_MODE,
|
277 | hljs.C_BLOCK_COMMENT_MODE,
|
278 | AT_COMMENT_MODE,
|
279 | STRING_REF,
|
280 | PREPROCESSOR,
|
281 | {
|
282 | className: 'keyword',
|
283 | begin: /\bexternal (matrix|string|array|sparse matrix|struct|proc|keyword|fn)/
|
284 | },
|
285 | DEFINITION('proc keyword', ';'),
|
286 | DEFINITION('fn', '='),
|
287 | {
|
288 | beginKeywords: 'for threadfor',
|
289 | end: /;/,
|
290 |
|
291 | relevance: 0,
|
292 | contains: [
|
293 | hljs.C_BLOCK_COMMENT_MODE,
|
294 | AT_COMMENT_MODE,
|
295 | FUNCTION_REF_PARAMS
|
296 | ]
|
297 | },
|
298 | {
|
299 |
|
300 | variants: [
|
301 | {
|
302 | begin: hljs.UNDERSCORE_IDENT_RE + '\\.' + hljs.UNDERSCORE_IDENT_RE
|
303 | },
|
304 | {
|
305 | begin: hljs.UNDERSCORE_IDENT_RE + '\\s*='
|
306 | }
|
307 | ],
|
308 | relevance: 0
|
309 | },
|
310 | FUNCTION_REF,
|
311 | STRUCT_TYPE
|
312 | ]
|
313 | };
|
314 | }
|
315 |
|
316 | export { gauss as default };
|