Skip to content

Commit c88890c

Browse files
committed
chore(arcade) eslint --fix, explode keywords
1 parent e828d69 commit c88890c

File tree

1 file changed

+185
-57
lines changed

1 file changed

+185
-57
lines changed

src/languages/arcade.js

Lines changed: 185 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,156 @@
1010
export default function(hljs) {
1111
const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';
1212
const KEYWORDS = {
13-
keyword:
14-
'if for while var new function do return void else break',
15-
literal:
16-
'BackSlash DoubleQuote false ForwardSlash Infinity NaN NewLine null PI SingleQuote Tab TextFormatting true undefined',
17-
built_in:
18-
'Abs Acos Angle Attachments Area AreaGeodetic Asin Atan Atan2 Average Bearing Boolean Buffer BufferGeodetic ' +
19-
'Ceil Centroid Clip Console Constrain Contains Cos Count Crosses Cut Date DateAdd ' +
20-
'DateDiff Day Decode DefaultValue Dictionary Difference Disjoint Distance DistanceGeodetic Distinct ' +
21-
'DomainCode DomainName Equals Exp Extent Feature FeatureSet FeatureSetByAssociation FeatureSetById FeatureSetByPortalItem ' +
22-
'FeatureSetByRelationshipName FeatureSetByTitle FeatureSetByUrl Filter First Floor Geometry GroupBy Guid HasKey Hour IIf IndexOf ' +
23-
'Intersection Intersects IsEmpty IsNan IsSelfIntersecting Length LengthGeodetic Log Max Mean Millisecond Min Minute Month ' +
24-
'MultiPartToSinglePart Multipoint NextSequenceValue Now Number OrderBy Overlaps Point Polygon ' +
25-
'Polyline Portal Pow Random Relate Reverse RingIsClockWise Round Second SetGeometry Sin Sort Sqrt Stdev Sum ' +
26-
'SymmetricDifference Tan Text Timestamp Today ToLocal Top Touches ToUTC TrackCurrentTime ' +
27-
'TrackGeometryWindow TrackIndex TrackStartTime TrackWindow TypeOf Union UrlEncode Variance ' +
28-
'Weekday When Within Year '
13+
keyword: [
14+
"if",
15+
"for",
16+
"while",
17+
"var",
18+
"new",
19+
"function",
20+
"do",
21+
"return",
22+
"void",
23+
"else",
24+
"break"
25+
],
26+
literal: [
27+
"BackSlash",
28+
"DoubleQuote",
29+
"false",
30+
"ForwardSlash",
31+
"Infinity",
32+
"NaN",
33+
"NewLine",
34+
"null",
35+
"PI",
36+
"SingleQuote",
37+
"Tab",
38+
"TextFormatting",
39+
"true",
40+
"undefined"
41+
],
42+
built_in: [
43+
"Abs",
44+
"Acos",
45+
"Angle",
46+
"Attachments",
47+
"Area",
48+
"AreaGeodetic",
49+
"Asin",
50+
"Atan",
51+
"Atan2",
52+
"Average",
53+
"Bearing",
54+
"Boolean",
55+
"Buffer",
56+
"BufferGeodetic",
57+
"Ceil",
58+
"Centroid",
59+
"Clip",
60+
"Console",
61+
"Constrain",
62+
"Contains",
63+
"Cos",
64+
"Count",
65+
"Crosses",
66+
"Cut",
67+
"Date",
68+
"DateAdd",
69+
"DateDiff",
70+
"Day",
71+
"Decode",
72+
"DefaultValue",
73+
"Dictionary",
74+
"Difference",
75+
"Disjoint",
76+
"Distance",
77+
"DistanceGeodetic",
78+
"Distinct",
79+
"DomainCode",
80+
"DomainName",
81+
"Equals",
82+
"Exp",
83+
"Extent",
84+
"Feature",
85+
"FeatureSet",
86+
"FeatureSetByAssociation",
87+
"FeatureSetById",
88+
"FeatureSetByPortalItem",
89+
"FeatureSetByRelationshipName",
90+
"FeatureSetByTitle",
91+
"FeatureSetByUrl",
92+
"Filter",
93+
"First",
94+
"Floor",
95+
"Geometry",
96+
"GroupBy",
97+
"Guid",
98+
"HasKey",
99+
"Hour",
100+
"IIf",
101+
"IndexOf",
102+
"Intersection",
103+
"Intersects",
104+
"IsEmpty",
105+
"IsNan",
106+
"IsSelfIntersecting",
107+
"Length",
108+
"LengthGeodetic",
109+
"Log",
110+
"Max",
111+
"Mean",
112+
"Millisecond",
113+
"Min",
114+
"Minute",
115+
"Month",
116+
"MultiPartToSinglePart",
117+
"Multipoint",
118+
"NextSequenceValue",
119+
"Now",
120+
"Number",
121+
"OrderBy",
122+
"Overlaps",
123+
"Point",
124+
"Polygon",
125+
"Polyline",
126+
"Portal",
127+
"Pow",
128+
"Random",
129+
"Relate",
130+
"Reverse",
131+
"RingIsClockWise",
132+
"Round",
133+
"Second",
134+
"SetGeometry",
135+
"Sin",
136+
"Sort",
137+
"Sqrt",
138+
"Stdev",
139+
"Sum",
140+
"SymmetricDifference",
141+
"Tan",
142+
"Text",
143+
"Timestamp",
144+
"Today",
145+
"ToLocal",
146+
"Top",
147+
"Touches",
148+
"ToUTC",
149+
"TrackCurrentTime",
150+
"TrackGeometryWindow",
151+
"TrackIndex",
152+
"TrackStartTime",
153+
"TrackWindow",
154+
"TypeOf",
155+
"Union",
156+
"UrlEncode",
157+
"Variance",
158+
"Weekday",
159+
"When",
160+
"Within",
161+
"Year"
162+
]
29163
};
30164
const SYMBOL = {
31165
className: 'symbol',
@@ -34,15 +168,9 @@ export default function(hljs) {
34168
const NUMBER = {
35169
className: 'number',
36170
variants: [
37-
{
38-
begin: '\\b(0[bB][01]+)'
39-
},
40-
{
41-
begin: '\\b(0[oO][0-7]+)'
42-
},
43-
{
44-
begin: hljs.C_NUMBER_RE
45-
}
171+
{ begin: '\\b(0[bB][01]+)' },
172+
{ begin: '\\b(0[oO][0-7]+)' },
173+
{ begin: hljs.C_NUMBER_RE }
46174
],
47175
relevance: 0
48176
};
@@ -88,16 +216,20 @@ export default function(hljs) {
88216
{ // object attr container
89217
begin: /[{,]\s*/,
90218
relevance: 0,
91-
contains: [{
92-
begin: IDENT_RE + '\\s*:',
93-
returnBegin: true,
94-
relevance: 0,
95-
contains: [{
96-
className: 'attr',
97-
begin: IDENT_RE,
98-
relevance: 0
99-
}]
100-
}]
219+
contains: [
220+
{
221+
begin: IDENT_RE + '\\s*:',
222+
returnBegin: true,
223+
relevance: 0,
224+
contains: [
225+
{
226+
className: 'attr',
227+
begin: IDENT_RE,
228+
relevance: 0
229+
}
230+
]
231+
}
232+
]
101233
},
102234
{ // "value" container
103235
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(return)\\b)\\s*',
@@ -111,25 +243,23 @@ export default function(hljs) {
111243
begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>',
112244
returnBegin: true,
113245
end: '\\s*=>',
114-
contains: [{
115-
className: 'params',
116-
variants: [
117-
{
118-
begin: IDENT_RE
119-
},
120-
{
121-
begin: /\(\s*\)/
122-
},
123-
{
124-
begin: /\(/,
125-
end: /\)/,
126-
excludeBegin: true,
127-
excludeEnd: true,
128-
keywords: KEYWORDS,
129-
contains: PARAMS_CONTAINS
130-
}
131-
]
132-
}]
246+
contains: [
247+
{
248+
className: 'params',
249+
variants: [
250+
{ begin: IDENT_RE },
251+
{ begin: /\(\s*\)/ },
252+
{
253+
begin: /\(/,
254+
end: /\)/,
255+
excludeBegin: true,
256+
excludeEnd: true,
257+
keywords: KEYWORDS,
258+
contains: PARAMS_CONTAINS
259+
}
260+
]
261+
}
262+
]
133263
}
134264
],
135265
relevance: 0
@@ -154,9 +284,7 @@ export default function(hljs) {
154284
],
155285
illegal: /\[|%/
156286
},
157-
{
158-
begin: /\$[(.]/
159-
}
287+
{ begin: /\$[(.]/ }
160288
],
161289
illegal: /#(?!!)/
162290
};

0 commit comments

Comments
 (0)