Skip to content

Commit

Permalink
enh(arcade) - update list of keywords, functions, and profile variabl…
Browse files Browse the repository at this point in the history
…es to match Arcade version 1.29 (#4181)
  • Loading branch information
ekenes authored Dec 4, 2024
1 parent 13a96b0 commit 195659e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CAVEATS / POTENTIALLY BREAKING CHANGES
Core Grammars:

- fix(makefile) - allow strings inside `$()` expressions [aneesh98][]
- enh(arcade) updated to ArcGIS Arcade version 1.29 [Kristian Ekenes][]
- enh(css) add all properties listed on MDN (96 additions including `anchor-name`, `aspect-ratio`, `backdrop-filter`, `container`, `margin-trim`, `place-content`, `scroll-timeline`, ...) [BaliBalo][]
- enh(erlang) OTP 27 triple-quoted strings [nixxquality][]
- enh(erlang) OTP 27 doc attribute [nixxquality][]
Expand Down Expand Up @@ -87,6 +88,7 @@ CONTRIBUTORS
[clsource]: https://github.com/clsource
[Jake Leahy]: https://github.com/ire4ever1190
[Laurel King]: https://github.com/laurelthorburn
[Kristian Ekenes]: https://github.com/ekenes


## Version 11.10.0
Expand Down
13 changes: 12 additions & 1 deletion src/languages/arcade.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
Language: ArcGIS Arcade
Category: scripting
Author: John Foster <[email protected]>
Website: https://developers.arcgis.com/arcade/
Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python
*/
Expand All @@ -26,6 +25,7 @@ export default function(hljs) {
"import",
"in",
"new",
"of",
"return",
"switch",
"try",
Expand Down Expand Up @@ -96,6 +96,7 @@ export default function(hljs) {
"Disjoint",
"Distance",
"DistanceGeodetic",
"DistanceToCoordinate",
"Distinct",
"Domain",
"DomainCode",
Expand All @@ -107,6 +108,7 @@ export default function(hljs) {
"Expects",
"Extent",
"Feature",
"FeatureInFilter",
"FeatureSet",
"FeatureSetByAssociation",
"FeatureSetById",
Expand All @@ -115,6 +117,7 @@ export default function(hljs) {
"FeatureSetByRelationshipClass",
"FeatureSetByRelationshipName",
"Filter",
"FilterBySubtypeCode",
"Find",
"First|0",
"Floor",
Expand Down Expand Up @@ -149,6 +152,7 @@ export default function(hljs) {
"IsNan",
"IsSelfIntersecting",
"IsSimple",
"KnowledgeGraphByPortalItem",
"Left|0",
"Length",
"Length3D",
Expand All @@ -158,6 +162,7 @@ export default function(hljs) {
"Map",
"Max",
"Mean",
"MeasureToCoordinate",
"Mid",
"Millisecond",
"Min",
Expand All @@ -175,13 +180,15 @@ export default function(hljs) {
"OrderBy",
"Overlaps",
"Point",
"PointToCoordinate",
"Polygon",
"Polyline",
"Pop",
"Portal",
"Pow",
"Proper",
"Push",
"QueryGraph",
"Random",
"Reduce",
"Relate",
Expand All @@ -202,6 +209,7 @@ export default function(hljs) {
"Splice",
"Split",
"Sqrt",
"StandardizeFilename",
"StandardizeGuid",
"Stdev",
"SubtypeCode",
Expand Down Expand Up @@ -264,6 +272,7 @@ export default function(hljs) {
"feedfeature",
"fencefeature",
"fencenotificationtype",
"graph",
"join",
"layer",
"locationupdate",
Expand All @@ -281,7 +290,9 @@ export default function(hljs) {
"targetdatastore",
"targetfeature",
"targetlayer",
"userInput",
"value",
"variables",
"view"
];
const SYMBOL = {
Expand Down
11 changes: 10 additions & 1 deletion test/markup/arcade/profile.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@
}
n+=i;
}
<span class="hljs-keyword">return</span> n;

<span class="hljs-keyword">return</span> n;
<span class="hljs-keyword">var</span> a = [<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,<span class="hljs-number">6</span>,<span class="hljs-number">8</span>,<span class="hljs-number">10</span>];
<span class="hljs-keyword">var</span> total = <span class="hljs-number">0</span>;
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> v <span class="hljs-keyword">of</span> a) {
total += v;
}

<span class="hljs-keyword">var</span> result = <span class="hljs-built_in">DistanceToCoordinate</span>(<span class="hljs-symbol">$userInput</span>, <span class="hljs-number">1038</span>);

<span class="hljs-keyword">return</span> result.coordinate.x + total;
11 changes: 10 additions & 1 deletion test/markup/arcade/profile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ for(var i=1; i<100; i++) {
}
n+=i;
}
return n;

return n;
var a = [2,4,6,8,10];
var total = 0;
for (var v of a) {
total += v;
}

var result = DistanceToCoordinate($userInput, 1038);

return result.coordinate.x + total;

0 comments on commit 195659e

Please sign in to comment.