CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
arcade.js429 linesDownload Raw Back to languages
1/*2 Language: ArcGIS Arcade3 Category: scripting4 Website: https://developers.arcgis.com/arcade/5 Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python6*/7 8/** @type LanguageFn */9function arcade(hljs) {10  const regex = hljs.regex;11  const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';12  const KEYWORDS = {13    keyword: [14      "break",15      "case",16      "catch",17      "continue",18      "debugger",19      "do",20      "else",21      "export",22      "for",23      "function",24      "if",25      "import",26      "in",27      "new",28      "of",29      "return",30      "switch",31      "try",32      "var",33      "void",34      "while"35    ],36    literal: [37      "BackSlash",38      "DoubleQuote",39      "ForwardSlash",40      "Infinity",41      "NaN",42      "NewLine",43      "PI",44      "SingleQuote",45      "Tab",46      "TextFormatting",47      "false",48      "null",49      "true",50      "undefined"51    ],52    built_in: [53      "Abs",54      "Acos",55      "All",56      "Angle",57      "Any",58      "Area",59      "AreaGeodetic",60      "Array",61      "Asin",62      "Atan",63      "Atan2",64      "Attachments",65      "Average",66      "Back",67      "Bearing",68      "Boolean",69      "Buffer",70      "BufferGeodetic",71      "Ceil",72      "Centroid",73      "ChangeTimeZone",74      "Clip",75      "Concatenate",76      "Console",77      "Constrain",78      "Contains",79      "ConvertDirection",80      "ConvexHull",81      "Cos",82      "Count",83      "Crosses",84      "Cut",85      "Date|0",86      "DateAdd",87      "DateDiff",88      "DateOnly",89      "Day",90      "Decode",91      "DefaultValue",92      "Densify",93      "DensifyGeodetic",94      "Dictionary",95      "Difference",96      "Disjoint",97      "Distance",98      "DistanceGeodetic",99      "DistanceToCoordinate",100      "Distinct",101      "Domain",102      "DomainCode",103      "DomainName",104      "EnvelopeIntersects",105      "Equals",106      "Erase",107      "Exp",108      "Expects",109      "Extent",110      "Feature",111      "FeatureInFilter",112      "FeatureSet",113      "FeatureSetByAssociation",114      "FeatureSetById",115      "FeatureSetByName",116      "FeatureSetByPortalItem",117      "FeatureSetByRelationshipClass",118      "FeatureSetByRelationshipName",119      "Filter",120      "FilterBySubtypeCode",121      "Find",122      "First|0",123      "Floor",124      "FromCharCode",125      "FromCodePoint",126      "FromJSON",127      "Front",128      "GdbVersion",129      "Generalize",130      "Geometry",131      "GetEnvironment",132      "GetFeatureSet",133      "GetFeatureSetInfo",134      "GetUser",135      "GroupBy",136      "Guid",137      "HasKey",138      "HasValue",139      "Hash",140      "Hour",141      "IIf",142      "ISOMonth",143      "ISOWeek",144      "ISOWeekday",145      "ISOYear",146      "Includes",147      "IndexOf",148      "Insert",149      "Intersection",150      "Intersects",151      "IsEmpty",152      "IsNan",153      "IsSelfIntersecting",154      "IsSimple",155      "KnowledgeGraphByPortalItem",156      "Left|0",157      "Length",158      "Length3D",159      "LengthGeodetic",160      "Log",161      "Lower",162      "Map",163      "Max",164      "Mean",165      "MeasureToCoordinate",166      "Mid",167      "Millisecond",168      "Min",169      "Minute",170      "Month",171      "MultiPartToSinglePart",172      "Multipoint",173      "NearestCoordinate",174      "NearestVertex",175      "NextSequenceValue",176      "None",177      "Now",178      "Number",179      "Offset",180      "OrderBy",181      "Overlaps",182      "Point",183      "PointToCoordinate",184      "Polygon",185      "Polyline",186      "Pop",187      "Portal",188      "Pow",189      "Proper",190      "Push",191      "QueryGraph",192      "Random",193      "Reduce",194      "Relate",195      "Replace",196      "Resize",197      "Reverse",198      "Right|0",199      "RingIsClockwise",200      "Rotate",201      "Round",202      "Schema",203      "Second",204      "SetGeometry",205      "Simplify",206      "Sin",207      "Slice",208      "Sort",209      "Splice",210      "Split",211      "Sqrt",212      "StandardizeFilename",213      "StandardizeGuid",214      "Stdev",215      "SubtypeCode",216      "SubtypeName",217      "Subtypes",218      "Sum",219      "SymmetricDifference",220      "Tan",221      "Text",222      "Time",223      "TimeZone",224      "TimeZoneOffset",225      "Timestamp",226      "ToCharCode",227      "ToCodePoint",228      "ToHex",229      "ToLocal",230      "ToUTC",231      "Today",232      "Top|0",233      "Touches",234      "TrackAccelerationAt",235      "TrackAccelerationWindow",236      "TrackCurrentAcceleration",237      "TrackCurrentDistance",238      "TrackCurrentSpeed",239      "TrackCurrentTime",240      "TrackDistanceAt",241      "TrackDistanceWindow",242      "TrackDuration",243      "TrackFieldWindow",244      "TrackGeometryWindow",245      "TrackIndex",246      "TrackSpeedAt",247      "TrackSpeedWindow",248      "TrackStartTime",249      "TrackWindow",250      "Trim",251      "TypeOf",252      "Union",253      "Upper",254      "UrlEncode",255      "Variance",256      "Week",257      "Weekday",258      "When|0",259      "Within",260      "Year|0",261    ]262  };263  const PROFILE_VARS = [264    "aggregatedFeatures",265    "analytic",266    "config",267    "datapoint",268    "datastore",269    "editcontext",270    "feature",271    "featureSet",272    "feedfeature",273    "fencefeature",274    "fencenotificationtype",275    "graph",276    "join",277    "layer",278    "locationupdate",279    "map",280    "measure",281    "measure",282    "originalFeature",283    "record",284    "reference",285    "rowindex",286    "sourcedatastore",287    "sourcefeature",288    "sourcelayer",289    "target",290    "targetdatastore",291    "targetfeature",292    "targetlayer",293    "userInput",294    "value",295    "variables",296    "view"297  ];298  const SYMBOL = {299    className: 'symbol',300    begin: '\\$' + regex.either(...PROFILE_VARS)301  };302  const NUMBER = {303    className: 'number',304    variants: [305      { begin: '\\b(0[bB][01]+)' },306      { begin: '\\b(0[oO][0-7]+)' },307      { begin: hljs.C_NUMBER_RE }308    ],309    relevance: 0310  };311  const SUBST = {312    className: 'subst',313    begin: '\\$\\{',314    end: '\\}',315    keywords: KEYWORDS,316    contains: [] // defined later317  };318  const TEMPLATE_STRING = {319    className: 'string',320    begin: '`',321    end: '`',322    contains: [323      hljs.BACKSLASH_ESCAPE,324      SUBST325    ]326  };327  SUBST.contains = [328    hljs.APOS_STRING_MODE,329    hljs.QUOTE_STRING_MODE,330    TEMPLATE_STRING,331    NUMBER,332    hljs.REGEXP_MODE333  ];334  const PARAMS_CONTAINS = SUBST.contains.concat([335    hljs.C_BLOCK_COMMENT_MODE,336    hljs.C_LINE_COMMENT_MODE337  ]);338 339  return {340    name: 'ArcGIS Arcade',341    case_insensitive: true,342    keywords: KEYWORDS,343    contains: [344      hljs.APOS_STRING_MODE,345      hljs.QUOTE_STRING_MODE,346      TEMPLATE_STRING,347      hljs.C_LINE_COMMENT_MODE,348      hljs.C_BLOCK_COMMENT_MODE,349      SYMBOL,350      NUMBER,351      { // object attr container352        begin: /[{,]\s*/,353        relevance: 0,354        contains: [355          {356            begin: IDENT_RE + '\\s*:',357            returnBegin: true,358            relevance: 0,359            contains: [360              {361                className: 'attr',362                begin: IDENT_RE,363                relevance: 0364              }365            ]366          }367        ]368      },369      { // "value" container370        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(return)\\b)\\s*',371        keywords: 'return',372        contains: [373          hljs.C_LINE_COMMENT_MODE,374          hljs.C_BLOCK_COMMENT_MODE,375          hljs.REGEXP_MODE,376          {377            className: 'function',378            begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>',379            returnBegin: true,380            end: '\\s*=>',381            contains: [382              {383                className: 'params',384                variants: [385                  { begin: IDENT_RE },386                  { begin: /\(\s*\)/ },387                  {388                    begin: /\(/,389                    end: /\)/,390                    excludeBegin: true,391                    excludeEnd: true,392                    keywords: KEYWORDS,393                    contains: PARAMS_CONTAINS394                  }395                ]396              }397            ]398          }399        ],400        relevance: 0401      },402      {403        beginKeywords: 'function',404        end: /\{/,405        excludeEnd: true,406        contains: [407          hljs.inherit(hljs.TITLE_MODE, {408            className: "title.function",409            begin: IDENT_RE410          }),411          {412            className: 'params',413            begin: /\(/,414            end: /\)/,415            excludeBegin: true,416            excludeEnd: true,417            contains: PARAMS_CONTAINS418          }419        ],420        illegal: /\[|%/421      },422      { begin: /\$[(.]/ }423    ],424    illegal: /#(?!!)/425  };426}427 428export { arcade as default };429 
basant307/AI_Governance_Project · CoolFace