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: { keyword: 'define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline' },
|
120 | contains: [
|
121 | {
|
122 | begin: /\\\n/,
|
123 | relevance: 0
|
124 | },
|
125 | {
|
126 | beginKeywords: 'include',
|
127 | end: '$',
|
128 | keywords: { keyword: 'include' },
|
129 | contains: [
|
130 | {
|
131 | className: 'string',
|
132 | begin: '"',
|
133 | end: '"',
|
134 | illegal: '\\n'
|
135 | }
|
136 | ]
|
137 | },
|
138 | hljs.C_LINE_COMMENT_MODE,
|
139 | hljs.C_BLOCK_COMMENT_MODE,
|
140 | AT_COMMENT_MODE
|
141 | ]
|
142 | };
|
143 |
|
144 | const STRUCT_TYPE =
|
145 | {
|
146 | begin: /\bstruct\s+/,
|
147 | end: /\s/,
|
148 | keywords: "struct",
|
149 | contains: [
|
150 | {
|
151 | className: "type",
|
152 | begin: hljs.UNDERSCORE_IDENT_RE,
|
153 | relevance: 0
|
154 | }
|
155 | ]
|
156 | };
|
157 |
|
158 |
|
159 | const PARSE_PARAMS = [
|
160 | {
|
161 | className: 'params',
|
162 | begin: /\(/,
|
163 | end: /\)/,
|
164 | excludeBegin: true,
|
165 | excludeEnd: true,
|
166 | endsWithParent: true,
|
167 | relevance: 0,
|
168 | contains: [
|
169 | {
|
170 | className: 'literal',
|
171 | begin: /\.\.\./
|
172 | },
|
173 | hljs.C_NUMBER_MODE,
|
174 | hljs.C_BLOCK_COMMENT_MODE,
|
175 | AT_COMMENT_MODE,
|
176 | STRUCT_TYPE
|
177 | ]
|
178 | }
|
179 | ];
|
180 |
|
181 | const FUNCTION_DEF =
|
182 | {
|
183 | className: "title",
|
184 | begin: hljs.UNDERSCORE_IDENT_RE,
|
185 | relevance: 0
|
186 | };
|
187 |
|
188 | const DEFINITION = function(beginKeywords, end, inherits) {
|
189 | const mode = hljs.inherit(
|
190 | {
|
191 | className: "function",
|
192 | beginKeywords: beginKeywords,
|
193 | end: end,
|
194 | excludeEnd: true,
|
195 | contains: [].concat(PARSE_PARAMS)
|
196 | },
|
197 | inherits || {}
|
198 | );
|
199 | mode.contains.push(FUNCTION_DEF);
|
200 | mode.contains.push(hljs.C_NUMBER_MODE);
|
201 | mode.contains.push(hljs.C_BLOCK_COMMENT_MODE);
|
202 | mode.contains.push(AT_COMMENT_MODE);
|
203 | return mode;
|
204 | };
|
205 |
|
206 | const BUILT_IN_REF =
|
207 | {
|
208 | className: 'built_in',
|
209 | begin: '\\b(' + KEYWORDS.built_in.split(' ').join('|') + ')\\b'
|
210 | };
|
211 |
|
212 | const STRING_REF =
|
213 | {
|
214 | className: 'string',
|
215 | begin: '"',
|
216 | end: '"',
|
217 | contains: [ hljs.BACKSLASH_ESCAPE ],
|
218 | relevance: 0
|
219 | };
|
220 |
|
221 | const FUNCTION_REF =
|
222 | {
|
223 |
|
224 | begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
|
225 | returnBegin: true,
|
226 | keywords: KEYWORDS,
|
227 | relevance: 0,
|
228 | contains: [
|
229 | { beginKeywords: KEYWORDS.keyword },
|
230 | BUILT_IN_REF,
|
231 | {
|
232 | className: 'built_in',
|
233 | begin: hljs.UNDERSCORE_IDENT_RE,
|
234 | relevance: 0
|
235 | }
|
236 | ]
|
237 | };
|
238 |
|
239 | const FUNCTION_REF_PARAMS =
|
240 | {
|
241 |
|
242 | begin: /\(/,
|
243 | end: /\)/,
|
244 | relevance: 0,
|
245 | keywords: {
|
246 | built_in: KEYWORDS.built_in,
|
247 | literal: KEYWORDS.literal
|
248 | },
|
249 | contains: [
|
250 | hljs.C_NUMBER_MODE,
|
251 | hljs.C_BLOCK_COMMENT_MODE,
|
252 | AT_COMMENT_MODE,
|
253 | BUILT_IN_REF,
|
254 | FUNCTION_REF,
|
255 | STRING_REF,
|
256 | 'self'
|
257 | ]
|
258 | };
|
259 |
|
260 | FUNCTION_REF.contains.push(FUNCTION_REF_PARAMS);
|
261 |
|
262 | return {
|
263 | name: 'GAUSS',
|
264 | aliases: [ 'gss' ],
|
265 | case_insensitive: true,
|
266 | keywords: KEYWORDS,
|
267 | illegal: /(\{[%#]|[%#]\}| <- )/,
|
268 | contains: [
|
269 | hljs.C_NUMBER_MODE,
|
270 | hljs.C_LINE_COMMENT_MODE,
|
271 | hljs.C_BLOCK_COMMENT_MODE,
|
272 | AT_COMMENT_MODE,
|
273 | STRING_REF,
|
274 | PREPROCESSOR,
|
275 | {
|
276 | className: 'keyword',
|
277 | begin: /\bexternal (matrix|string|array|sparse matrix|struct|proc|keyword|fn)/
|
278 | },
|
279 | DEFINITION('proc keyword', ';'),
|
280 | DEFINITION('fn', '='),
|
281 | {
|
282 | beginKeywords: 'for threadfor',
|
283 | end: /;/,
|
284 |
|
285 | relevance: 0,
|
286 | contains: [
|
287 | hljs.C_BLOCK_COMMENT_MODE,
|
288 | AT_COMMENT_MODE,
|
289 | FUNCTION_REF_PARAMS
|
290 | ]
|
291 | },
|
292 | {
|
293 |
|
294 | variants: [
|
295 | { begin: hljs.UNDERSCORE_IDENT_RE + '\\.' + hljs.UNDERSCORE_IDENT_RE },
|
296 | { begin: hljs.UNDERSCORE_IDENT_RE + '\\s*=' }
|
297 | ],
|
298 | relevance: 0
|
299 | },
|
300 | FUNCTION_REF,
|
301 | STRUCT_TYPE
|
302 | ]
|
303 | };
|
304 | }
|
305 |
|
306 | module.exports = gauss;
|