Skip to content

Commit 9e4f2dc

Browse files
authored
fix(ts/js) use identifier to match potential keywords (#2519)
- (parser) Adds `keywords.$pattern` key to grammar definitions - `lexemes` is now deprecated in favor of `keywords.$pattern` key - enh(typescript) use identifier to match potential keywords, preventing false positives - enh(javascript) use identifier to match potential keywords, preventing false positives
1 parent 33d3afe commit 9e4f2dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+181
-129
lines changed

CHANGES.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Parser Engine:
44

5+
- (parser) Adds `keywords.$pattern` key to grammar definitions (#2519) [Josh Goebel][]
56
- (parser) Adds SHEBANG utility mode [Josh Goebel][]
67
- (enh) Added `on:begin` callback for modes (#2261) [Josh Goebel][]
78
- (enh) Added `on:end` callback for modes (#2261) [Josh Goebel][]
@@ -10,10 +11,12 @@ Parser Engine:
1011

1112
Deprecations:
1213

13-
- (deprecation) `endSameAsBegin` is now deprecated. (#2261) [Josh Goebel][]
14+
- `lexemes` is now deprecated in favor of `keywords.$pattern` key (#2519) [Josh Goebel][]
15+
- `endSameAsBegin` is now deprecated. (#2261) [Josh Goebel][]
1416

1517
Language Improvements:
16-
18+
- enh(typescript) use identifier to match potential keywords, preventing false positivites (#2519) [Josh Goebel][]
19+
- enh(javascript) use identifier to match potential keywords, preventing false positivites (#2519) [Josh Goebel][]
1720
- [enh] Add `OPTIMIZE:` and `HACK:` to the labels highlighted inside comments [Josh Goebel][]
1821
- enh(typescript/javascript/coffeescript/livescript) derive ECMAscript keywords from a common foudation (#2518) [Josh Goebel][]
1922
- enh(typescript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Josh Goebel][]
@@ -30,7 +33,7 @@ Language Improvements:
3033
[Vania Kucher]: https://github.com/qWici
3134

3235

33-
## Version 10.0.2 (pending)
36+
## Version 10.0.2
3437

3538
Brower build:
3639

docs/language-guide.rst

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,19 @@ and most interesting parsing happens inside tags.
6464
Keywords
6565
--------
6666

67-
In the simple case language keywords are defined in a string, separated by space:
67+
In the simple case language keywords can be defined with a string, separated by space:
6868

6969
::
7070

7171
{
7272
keywords: 'else for if while'
7373
}
7474

75-
Some languages have different kinds of "keywords" that might not be called as such by the language spec
76-
but are very close to them from the point of view of a syntax highlighter. These are all sorts of "literals", "built-ins", "symbols" and such.
77-
To define such keyword groups the attribute ``keywords`` becomes an object each property of which defines its own group of keywords:
75+
Some languages have different kinds of "keywords" that might not be called as
76+
such by the language spec but are very close to them from the point of view of a
77+
syntax highlighter. These are all sorts of "literals", "built-ins", "symbols"
78+
and such. To define such keyword groups the attribute ``keywords`` becomes an
79+
object each property of which defines its own group of keywords:
7880

7981
::
8082

@@ -85,19 +87,25 @@ To define such keyword groups the attribute ``keywords`` becomes an object each
8587
}
8688
}
8789

88-
The group name becomes then a class name in a generated markup enabling different styling for different kinds of keywords.
90+
The group name becomes the class name in the generated markup enabling different
91+
themeing for different kinds of keywords.
8992

90-
To detect keywords highlight.js breaks the processed chunk of code into separate words — a process called lexing.
91-
The "word" here is defined by the regexp ``[a-zA-Z][a-zA-Z0-9_]*`` that works for keywords in most languages.
92-
Different lexing rules can be defined by the ``lexemes`` attribute:
93+
To detect keywords highlight.js breaks the processed chunk of code into separate
94+
words — a process called lexing. By default "words" are matched with the regexp
95+
``\w+``, and that works well for many languages. Different lexing rules can be
96+
defined by the magic ``$pattern`` attribute:
9397

9498
::
9599

96100
{
97-
lexemes: '-[a-z]+',
98-
keywords: '-import -export'
101+
keywords: {
102+
$pattern: /-[a-z]+/, // allow keywords to begin with dash
103+
keyword: '-import -export'
104+
}
99105
}
100106

107+
Note: The older ``lexemes`` setting has been deprecated in favor of using
108+
``keywords.$pattern``. They are functionally identical.
101109

102110
Sub-modes
103111
---------

docs/mode-reference.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,19 @@ and ``endSameAsBegin: true``.
241241

242242
.. _lexemes:
243243

244-
lexemes
245-
^^^^^^^
244+
lexemes (now keywords.$pattern)
245+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
246246

247247
**type**: regexp
248248

249-
A regular expression that extracts individual lexemes from language text to find :ref:`keywords <keywords>` among them.
250-
Default value is ``hljs.IDENT_RE`` which works for most languages.
249+
A regular expression that extracts individual "words" from the code to compare
250+
against :ref:`keywords <keywords>`. The default value is ``\w+`` which works for
251+
many languages.
251252

253+
Note: It's now recommmended that you use ``keywords.$pattern`` instead of
254+
``lexemes``, as this makes it easier to keep your keyword pattern associated
255+
with your keywords themselves, particularly if your keyword configuration is a
256+
constant that you repeat multiple times within different modes of your grammar.
252257

253258
.. _keywords:
254259

@@ -259,8 +264,8 @@ keywords
259264

260265
Keyword definition comes in two forms:
261266

262-
* ``'for while if else weird_voodoo|10 ... '`` -- a string of space-separated keywords with an optional relevance over a pipe
263-
* ``{'keyword': ' ... ', 'literal': ' ... '}`` -- an object whose keys are names of different kinds of keywords and values are keyword definition strings in the first form
267+
* ``'for while if|0 else weird_voodoo|10 ... '`` -- a string of space-separated keywords with an optional relevance over a pipe
268+
* ``{keyword: ' ... ', literal: ' ... ', $pattern: /\w+/ }`` -- an object that describes multiple sets of keywords and the pattern used to find them
264269

265270
For detailed explanation see :doc:`Language definition guide </language-guide>`.
266271

src/highlight.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ const HLJS = function(hljs) {
131131
}
132132

133133
let last_index = 0;
134-
top.lexemesRe.lastIndex = 0;
135-
let match = top.lexemesRe.exec(mode_buffer);
134+
top.keywordPatternRe.lastIndex = 0;
135+
let match = top.keywordPatternRe.exec(mode_buffer);
136136
let buf = "";
137137

138138
while (match) {
@@ -148,8 +148,8 @@ const HLJS = function(hljs) {
148148
} else {
149149
buf += match[0];
150150
}
151-
last_index = top.lexemesRe.lastIndex;
152-
match = top.lexemesRe.exec(mode_buffer);
151+
last_index = top.keywordPatternRe.lastIndex;
152+
match = top.keywordPatternRe.exec(mode_buffer);
153153
}
154154
buf += mode_buffer.substr(last_index);
155155
emitter.addText(buf);

src/languages/1c.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Description: built-in language 1C:Enterprise (v7, v8)
55
Category: enterprise
66
*/
77

8-
export default function(hljs){
8+
export default function(hljs) {
99

1010
// общий паттерн для определения идентификаторов
1111
var UNDERSCORE_IDENT_RE = '[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]+';
@@ -446,9 +446,12 @@ export default function(hljs){
446446
// meta : инструкции препроцессора, директивы компиляции
447447
var META = {
448448
className: 'meta',
449-
lexemes: UNDERSCORE_IDENT_RE,
449+
450450
begin: '#|&', end: '$',
451-
keywords: {'meta-keyword': KEYWORD + METAKEYWORD},
451+
keywords: {
452+
$pattern: UNDERSCORE_IDENT_RE,
453+
'meta-keyword': KEYWORD + METAKEYWORD
454+
},
452455
contains: [
453456
COMMENTS
454457
]
@@ -463,7 +466,6 @@ export default function(hljs){
463466
// function : объявление процедур и функций
464467
var FUNCTION = {
465468
className: 'function',
466-
lexemes: UNDERSCORE_IDENT_RE,
467469
variants: [
468470
{begin: 'процедура|функция', end: '\\)', keywords: 'процедура функция'},
469471
{begin: 'конецпроцедуры|конецфункции', keywords: 'конецпроцедуры конецфункции'}
@@ -474,9 +476,9 @@ export default function(hljs){
474476
contains: [
475477
{
476478
className: 'params',
477-
lexemes: UNDERSCORE_IDENT_RE,
478479
begin: UNDERSCORE_IDENT_RE, end: ',', excludeEnd: true, endsWithParent: true,
479480
keywords: {
481+
$pattern: UNDERSCORE_IDENT_RE,
480482
keyword: 'знач',
481483
literal: LITERAL
482484
},
@@ -496,8 +498,8 @@ export default function(hljs){
496498
return {
497499
name: '1C:Enterprise',
498500
case_insensitive: true,
499-
lexemes: UNDERSCORE_IDENT_RE,
500501
keywords: {
502+
$pattern: UNDERSCORE_IDENT_RE,
501503
keyword: KEYWORD,
502504
built_in: BUILTIN,
503505
class: CLASS,

src/languages/armasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export default function(hljs) {
2121
name: 'ARM Assembly',
2222
case_insensitive: true,
2323
aliases: ['arm'],
24-
lexemes: '\\.?' + hljs.IDENT_RE,
2524
keywords: {
25+
$pattern: '\\.?' + hljs.IDENT_RE,
2626
meta:
2727
//GNU preprocs
2828
'.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg '+

src/languages/avrasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export default function(hljs) {
99
return {
1010
name: 'AVR Assembly',
1111
case_insensitive: true,
12-
lexemes: '\\.?' + hljs.IDENT_RE,
1312
keywords: {
13+
$pattern: '\\.?' + hljs.IDENT_RE,
1414
keyword:
1515
/* mnemonic */
1616
'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs ' +

src/languages/bash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ export default function(hljs) {
8181
return {
8282
name: 'Bash',
8383
aliases: ['sh', 'zsh'],
84-
lexemes: /\b-?[a-z\._]+\b/,
8584
keywords: {
85+
$pattern: /\b-?[a-z\._]+\b/,
8686
keyword:
8787
'if then else elif fi for while in do done case esac function',
8888
literal:

src/languages/basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default function(hljs) {
1111
case_insensitive: true,
1212
illegal: '^\.',
1313
// Support explicitly typed variables that end with $%! or #.
14-
lexemes: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
1514
keywords: {
15+
$pattern: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
1616
keyword:
1717
'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +
1818
'CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ ' +

src/languages/clojure.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ Category: lisp
77
*/
88

99
export default function(hljs) {
10+
var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
11+
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
1012
var globals = 'def defonce defprotocol defstruct defmulti defmethod defn- defn defmacro deftype defrecord';
1113
var keywords = {
14+
$pattern: SYMBOL_RE,
1215
'builtin-name':
1316
// Clojure keywords
1417
globals + ' ' +
@@ -41,8 +44,6 @@ export default function(hljs) {
4144
'lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize'
4245
};
4346

44-
var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
45-
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
4647
var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
4748

4849
var SYMBOL = {
@@ -86,7 +87,6 @@ export default function(hljs) {
8687
};
8788
var NAME = {
8889
keywords: keywords,
89-
lexemes: SYMBOL_RE,
9090
className: 'name', begin: SYMBOL_RE,
9191
starts: BODY
9292
};

src/languages/crystal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default function(hljs) {
1111
var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?';
1212
var CRYSTAL_PATH_RE = '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?';
1313
var CRYSTAL_KEYWORDS = {
14+
$pattern: CRYSTAL_IDENT_RE,
1415
keyword:
1516
'abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if ' +
1617
'include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? ' +
@@ -187,7 +188,6 @@ export default function(hljs) {
187188
return {
188189
name: 'Crystal',
189190
aliases: ['cr'],
190-
lexemes: CRYSTAL_IDENT_RE,
191191
keywords: CRYSTAL_KEYWORDS,
192192
contains: CRYSTAL_DEFAULT_CONTAINS
193193
};

src/languages/csp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default function(hljs) {
1111
return {
1212
name: 'CSP',
1313
case_insensitive: false,
14-
lexemes: '[a-zA-Z][a-zA-Z0-9_-]*',
1514
keywords: {
15+
$pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
1616
keyword: 'base-uri child-src connect-src default-src font-src form-action ' +
1717
'frame-ancestors frame-src img-src media-src object-src plugin-types ' +
1818
'report-uri sandbox script-src style-src',

src/languages/d.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default function(hljs) {
3030
* @type {Object}
3131
*/
3232
var D_KEYWORDS = {
33+
$pattern: hljs.UNDERSCORE_IDENT_RE,
3334
keyword:
3435
'abstract alias align asm assert auto body break byte case cast catch class ' +
3536
'const continue debug default delete deprecated do else enum export extern final ' +
@@ -245,7 +246,6 @@ export default function(hljs) {
245246

246247
return {
247248
name: 'D',
248-
lexemes: hljs.UNDERSCORE_IDENT_RE,
249249
keywords: D_KEYWORDS,
250250
contains: [
251251
hljs.C_LINE_COMMENT_MODE,

src/languages/elixir.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ Website: https://elixir-lang.org
99
export default function(hljs) {
1010
var ELIXIR_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_.]*(\\!|\\?)?';
1111
var ELIXIR_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?';
12-
var ELIXIR_KEYWORDS =
13-
'and false then defined module in return redo retry end for true self when ' +
12+
var ELIXIR_KEYWORDS = {
13+
$pattern: ELIXIR_IDENT_RE,
14+
keyword: 'and false then defined module in return redo retry end for true self when ' +
1415
'next until do begin unless nil break not case cond alias while ensure or ' +
15-
'include use alias fn quote require import with|0';
16+
'include use alias fn quote require import with|0'
17+
};
1618
var SUBST = {
1719
className: 'subst',
1820
begin: '#\\{', end: '}',
19-
lexemes: ELIXIR_IDENT_RE,
2021
keywords: ELIXIR_KEYWORDS
2122
};
2223
var NUMBER = {
@@ -174,7 +175,6 @@ export default function(hljs) {
174175

175176
return {
176177
name: 'Elixir',
177-
lexemes: ELIXIR_IDENT_RE,
178178
keywords: ELIXIR_KEYWORDS,
179179
contains: ELIXIR_DEFAULT_CONTAINS
180180
};

src/languages/erlang.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,12 @@ export default function(hljs) {
136136
relevance: 0,
137137
excludeEnd: true,
138138
returnBegin: true,
139-
lexemes: '-' + hljs.IDENT_RE,
140-
keywords:
141-
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
139+
keywords: {
140+
$pattern: '-' + hljs.IDENT_RE,
141+
keyword: '-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
142142
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
143-
'-behavior -spec',
143+
'-behavior -spec'
144+
},
144145
contains: [PARAMS]
145146
},
146147
NUMBER,

src/languages/excel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default function(hljs) {
1010
name: 'Excel formulae',
1111
aliases: ['xlsx', 'xls'],
1212
case_insensitive: true,
13-
lexemes: /[a-zA-Z][\w\.]*/,
1413
// built-in functions imported from https://web.archive.org/web/20160513042710/https://support.office.com/en-us/article/Excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
1514
keywords: {
15+
$pattern: /[a-zA-Z][\w\.]*/,
1616
built_in: 'ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST'
1717
},
1818
contains: [

src/languages/gams.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
export default function (hljs) {
1212
var KEYWORDS = {
13-
'keyword':
13+
keyword:
1414
'abort acronym acronyms alias all and assign binary card diag display ' +
1515
'else eq file files for free ge gt if integer le loop lt maximizing ' +
1616
'minimizing model models ne negative no not option options or ord ' +
1717
'positive prod put putpage puttl repeat sameas semicont semiint smax ' +
1818
'smin solve sos1 sos2 sum system table then until using while xor yes',
19-
'literal': 'eps inf na',
20-
'built-in':
19+
literal: 'eps inf na',
20+
built_in:
2121
'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy ' +
2222
'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact ' +
2323
'floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max ' +

0 commit comments

Comments
 (0)