arcade function

Mode arcade(
  1. Highlight hljs
)

Highlight.js language definition for arcade.

Implementation

Mode arcade(Highlight hljs) {
  final Mode mode0 = Mode();
  final Mode mode1 = Mode();
  final Mode mode2 = Mode();
  final Mode mode3 = Mode();
  final Mode mode4 = Mode();
  final Mode mode5 = Mode();
  final Mode mode6 = Mode();
  final Mode mode7 = Mode();
  final Mode mode8 = Mode();
  final Mode mode9 = Mode();
  final Mode mode10 = Mode();
  final Mode mode11 = Mode();
  final Mode mode12 = Mode();
  final Mode mode13 = Mode();
  final Mode mode14 = Mode();
  final Mode mode15 = Mode();
  final Mode mode16 = Mode();
  mode0.scope = r'string';
  mode0.begin = r"'";
  mode0.end = r"'";
  mode0.illegal = r'\n';
  mode0.contains = [mode1];
  mode1.begin = r'\\[\s\S]';
  mode1.relevance = 0;
  mode2.scope = r'string';
  mode2.begin = r'"';
  mode2.end = r'"';
  mode2.illegal = r'\n';
  mode2.contains = [mode1];
  mode3.scope = r'string';
  mode3.begin = r'`';
  mode3.end = r'`';
  mode3.contains = [mode1, mode4];
  mode4.scope = r'subst';
  mode4.begin = r'\$\{';
  mode4.end = r'\}';
  mode4.keywords = {
    r'keyword': [
      r'break',
      r'case',
      r'catch',
      r'continue',
      r'debugger',
      r'do',
      r'else',
      r'export',
      r'for',
      r'function',
      r'if',
      r'import',
      r'in',
      r'new',
      r'of',
      r'return',
      r'switch',
      r'try',
      r'var',
      r'void',
      r'while',
    ],
    r'literal': [
      r'BackSlash',
      r'DoubleQuote',
      r'ForwardSlash',
      r'Infinity',
      r'NaN',
      r'NewLine',
      r'PI',
      r'SingleQuote',
      r'Tab',
      r'TextFormatting',
      r'false',
      r'null',
      r'true',
      r'undefined',
    ],
    r'built_in': [
      r'Abs',
      r'Acos',
      r'All',
      r'Angle',
      r'Any',
      r'Area',
      r'AreaGeodetic',
      r'Array',
      r'Asin',
      r'Atan',
      r'Atan2',
      r'Attachments',
      r'Average',
      r'Back',
      r'Bearing',
      r'Boolean',
      r'Buffer',
      r'BufferGeodetic',
      r'Ceil',
      r'Centroid',
      r'ChangeTimeZone',
      r'Clip',
      r'Concatenate',
      r'Console',
      r'Constrain',
      r'Contains',
      r'ConvertDirection',
      r'ConvexHull',
      r'Cos',
      r'Count',
      r'Crosses',
      r'Cut',
      r'Date|0',
      r'DateAdd',
      r'DateDiff',
      r'DateOnly',
      r'Day',
      r'Decode',
      r'DefaultValue',
      r'Densify',
      r'DensifyGeodetic',
      r'Dictionary',
      r'Difference',
      r'Disjoint',
      r'Distance',
      r'DistanceGeodetic',
      r'DistanceToCoordinate',
      r'Distinct',
      r'Domain',
      r'DomainCode',
      r'DomainName',
      r'EnvelopeIntersects',
      r'Equals',
      r'Erase',
      r'Exp',
      r'Expects',
      r'Extent',
      r'Feature',
      r'FeatureInFilter',
      r'FeatureSet',
      r'FeatureSetByAssociation',
      r'FeatureSetById',
      r'FeatureSetByName',
      r'FeatureSetByPortalItem',
      r'FeatureSetByRelationshipClass',
      r'FeatureSetByRelationshipName',
      r'Filter',
      r'FilterBySubtypeCode',
      r'Find',
      r'First|0',
      r'Floor',
      r'FromCharCode',
      r'FromCodePoint',
      r'FromJSON',
      r'Front',
      r'GdbVersion',
      r'Generalize',
      r'Geometry',
      r'GetEnvironment',
      r'GetFeatureSet',
      r'GetFeatureSetInfo',
      r'GetUser',
      r'GroupBy',
      r'Guid',
      r'HasKey',
      r'HasValue',
      r'Hash',
      r'Hour',
      r'IIf',
      r'ISOMonth',
      r'ISOWeek',
      r'ISOWeekday',
      r'ISOYear',
      r'Includes',
      r'IndexOf',
      r'Insert',
      r'Intersection',
      r'Intersects',
      r'IsEmpty',
      r'IsNan',
      r'IsSelfIntersecting',
      r'IsSimple',
      r'KnowledgeGraphByPortalItem',
      r'Left|0',
      r'Length',
      r'Length3D',
      r'LengthGeodetic',
      r'Log',
      r'Lower',
      r'Map',
      r'Max',
      r'Mean',
      r'MeasureToCoordinate',
      r'Mid',
      r'Millisecond',
      r'Min',
      r'Minute',
      r'Month',
      r'MultiPartToSinglePart',
      r'Multipoint',
      r'NearestCoordinate',
      r'NearestVertex',
      r'NextSequenceValue',
      r'None',
      r'Now',
      r'Number',
      r'Offset',
      r'OrderBy',
      r'Overlaps',
      r'Point',
      r'PointToCoordinate',
      r'Polygon',
      r'Polyline',
      r'Pop',
      r'Portal',
      r'Pow',
      r'Proper',
      r'Push',
      r'QueryGraph',
      r'Random',
      r'Reduce',
      r'Relate',
      r'Replace',
      r'Resize',
      r'Reverse',
      r'Right|0',
      r'RingIsClockwise',
      r'Rotate',
      r'Round',
      r'Schema',
      r'Second',
      r'SetGeometry',
      r'Simplify',
      r'Sin',
      r'Slice',
      r'Sort',
      r'Splice',
      r'Split',
      r'Sqrt',
      r'StandardizeFilename',
      r'StandardizeGuid',
      r'Stdev',
      r'SubtypeCode',
      r'SubtypeName',
      r'Subtypes',
      r'Sum',
      r'SymmetricDifference',
      r'Tan',
      r'Text',
      r'Time',
      r'TimeZone',
      r'TimeZoneOffset',
      r'Timestamp',
      r'ToCharCode',
      r'ToCodePoint',
      r'ToHex',
      r'ToLocal',
      r'ToUTC',
      r'Today',
      r'Top|0',
      r'Touches',
      r'TrackAccelerationAt',
      r'TrackAccelerationWindow',
      r'TrackCurrentAcceleration',
      r'TrackCurrentDistance',
      r'TrackCurrentSpeed',
      r'TrackCurrentTime',
      r'TrackDistanceAt',
      r'TrackDistanceWindow',
      r'TrackDuration',
      r'TrackFieldWindow',
      r'TrackGeometryWindow',
      r'TrackIndex',
      r'TrackSpeedAt',
      r'TrackSpeedWindow',
      r'TrackStartTime',
      r'TrackWindow',
      r'Trim',
      r'TypeOf',
      r'Union',
      r'Upper',
      r'UrlEncode',
      r'Variance',
      r'Week',
      r'Weekday',
      r'When|0',
      r'Within',
      r'Year|0',
    ],
  };
  mode4.contains = [mode0, mode2, mode3, mode5, mode9];
  mode5.scope = r'number';
  mode5.variants = [mode6, mode7, mode8];
  mode5.relevance = 0;
  mode6.begin = r'\b(0[bB][01]+)';
  mode7.begin = r'\b(0[oO][0-7]+)';
  mode8.begin =
      r'(-?)(\b0[xX][a-fA-F0-9]+|(\b\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)';
  mode9.scope = r'regexp';
  mode9.begin = r'\/(?=[^/\n]*\/)';
  mode9.end = r'\/[gimuy]*';
  mode9.contains = [mode1, mode10];
  mode10.begin = r'\[';
  mode10.end = r'\]';
  mode10.relevance = 0;
  mode10.contains = [mode1];
  mode11.scope = r'comment';
  mode11.begin = r'//';
  mode11.end = r'$';
  mode11.contains = [mode12, mode13];
  mode12.scope = r'doctag';
  mode12.begin = r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)';
  mode12.end = r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):';
  mode12.excludeBegin = true;
  mode12.relevance = 0;
  mode13.begin =
      r"[ ]+((?:I|a|is|so|us|to|at|if|in|it|on|[A-Za-z]+['](d|ve|re|ll|t|s|n)|[A-Za-z]+[-][a-z]+|[A-Za-z][a-z]{2,})[.]?[:]?([.][ ]|[ ])){3}";
  mode14.scope = r'comment';
  mode14.begin = r'/\*';
  mode14.end = r'\*/';
  mode14.contains = [mode15, mode16];
  mode15.scope = r'doctag';
  mode15.begin = r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)';
  mode15.end = r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):';
  mode15.excludeBegin = true;
  mode15.relevance = 0;
  mode16.begin =
      r"[ ]+((?:I|a|is|so|us|to|at|if|in|it|on|[A-Za-z]+['](d|ve|re|ll|t|s|n)|[A-Za-z]+[-][a-z]+|[A-Za-z][a-z]{2,})[.]?[:]?([.][ ]|[ ])){3}";
  return Mode(
    name: r'ArcGIS Arcade',
    caseInsensitive: true,
    keywords: {
      r'keyword': [
        r'break',
        r'case',
        r'catch',
        r'continue',
        r'debugger',
        r'do',
        r'else',
        r'export',
        r'for',
        r'function',
        r'if',
        r'import',
        r'in',
        r'new',
        r'of',
        r'return',
        r'switch',
        r'try',
        r'var',
        r'void',
        r'while',
      ],
      r'literal': [
        r'BackSlash',
        r'DoubleQuote',
        r'ForwardSlash',
        r'Infinity',
        r'NaN',
        r'NewLine',
        r'PI',
        r'SingleQuote',
        r'Tab',
        r'TextFormatting',
        r'false',
        r'null',
        r'true',
        r'undefined',
      ],
      r'built_in': [
        r'Abs',
        r'Acos',
        r'All',
        r'Angle',
        r'Any',
        r'Area',
        r'AreaGeodetic',
        r'Array',
        r'Asin',
        r'Atan',
        r'Atan2',
        r'Attachments',
        r'Average',
        r'Back',
        r'Bearing',
        r'Boolean',
        r'Buffer',
        r'BufferGeodetic',
        r'Ceil',
        r'Centroid',
        r'ChangeTimeZone',
        r'Clip',
        r'Concatenate',
        r'Console',
        r'Constrain',
        r'Contains',
        r'ConvertDirection',
        r'ConvexHull',
        r'Cos',
        r'Count',
        r'Crosses',
        r'Cut',
        r'Date|0',
        r'DateAdd',
        r'DateDiff',
        r'DateOnly',
        r'Day',
        r'Decode',
        r'DefaultValue',
        r'Densify',
        r'DensifyGeodetic',
        r'Dictionary',
        r'Difference',
        r'Disjoint',
        r'Distance',
        r'DistanceGeodetic',
        r'DistanceToCoordinate',
        r'Distinct',
        r'Domain',
        r'DomainCode',
        r'DomainName',
        r'EnvelopeIntersects',
        r'Equals',
        r'Erase',
        r'Exp',
        r'Expects',
        r'Extent',
        r'Feature',
        r'FeatureInFilter',
        r'FeatureSet',
        r'FeatureSetByAssociation',
        r'FeatureSetById',
        r'FeatureSetByName',
        r'FeatureSetByPortalItem',
        r'FeatureSetByRelationshipClass',
        r'FeatureSetByRelationshipName',
        r'Filter',
        r'FilterBySubtypeCode',
        r'Find',
        r'First|0',
        r'Floor',
        r'FromCharCode',
        r'FromCodePoint',
        r'FromJSON',
        r'Front',
        r'GdbVersion',
        r'Generalize',
        r'Geometry',
        r'GetEnvironment',
        r'GetFeatureSet',
        r'GetFeatureSetInfo',
        r'GetUser',
        r'GroupBy',
        r'Guid',
        r'HasKey',
        r'HasValue',
        r'Hash',
        r'Hour',
        r'IIf',
        r'ISOMonth',
        r'ISOWeek',
        r'ISOWeekday',
        r'ISOYear',
        r'Includes',
        r'IndexOf',
        r'Insert',
        r'Intersection',
        r'Intersects',
        r'IsEmpty',
        r'IsNan',
        r'IsSelfIntersecting',
        r'IsSimple',
        r'KnowledgeGraphByPortalItem',
        r'Left|0',
        r'Length',
        r'Length3D',
        r'LengthGeodetic',
        r'Log',
        r'Lower',
        r'Map',
        r'Max',
        r'Mean',
        r'MeasureToCoordinate',
        r'Mid',
        r'Millisecond',
        r'Min',
        r'Minute',
        r'Month',
        r'MultiPartToSinglePart',
        r'Multipoint',
        r'NearestCoordinate',
        r'NearestVertex',
        r'NextSequenceValue',
        r'None',
        r'Now',
        r'Number',
        r'Offset',
        r'OrderBy',
        r'Overlaps',
        r'Point',
        r'PointToCoordinate',
        r'Polygon',
        r'Polyline',
        r'Pop',
        r'Portal',
        r'Pow',
        r'Proper',
        r'Push',
        r'QueryGraph',
        r'Random',
        r'Reduce',
        r'Relate',
        r'Replace',
        r'Resize',
        r'Reverse',
        r'Right|0',
        r'RingIsClockwise',
        r'Rotate',
        r'Round',
        r'Schema',
        r'Second',
        r'SetGeometry',
        r'Simplify',
        r'Sin',
        r'Slice',
        r'Sort',
        r'Splice',
        r'Split',
        r'Sqrt',
        r'StandardizeFilename',
        r'StandardizeGuid',
        r'Stdev',
        r'SubtypeCode',
        r'SubtypeName',
        r'Subtypes',
        r'Sum',
        r'SymmetricDifference',
        r'Tan',
        r'Text',
        r'Time',
        r'TimeZone',
        r'TimeZoneOffset',
        r'Timestamp',
        r'ToCharCode',
        r'ToCodePoint',
        r'ToHex',
        r'ToLocal',
        r'ToUTC',
        r'Today',
        r'Top|0',
        r'Touches',
        r'TrackAccelerationAt',
        r'TrackAccelerationWindow',
        r'TrackCurrentAcceleration',
        r'TrackCurrentDistance',
        r'TrackCurrentSpeed',
        r'TrackCurrentTime',
        r'TrackDistanceAt',
        r'TrackDistanceWindow',
        r'TrackDuration',
        r'TrackFieldWindow',
        r'TrackGeometryWindow',
        r'TrackIndex',
        r'TrackSpeedAt',
        r'TrackSpeedWindow',
        r'TrackStartTime',
        r'TrackWindow',
        r'Trim',
        r'TypeOf',
        r'Union',
        r'Upper',
        r'UrlEncode',
        r'Variance',
        r'Week',
        r'Weekday',
        r'When|0',
        r'Within',
        r'Year|0',
      ],
    },
    contains: [
      mode0,
      mode2,
      mode3,
      mode11,
      mode14,
      Mode(
        scope: r'symbol',
        begin:
            r'\$(?:aggregatedFeatures|analytic|config|datapoint|datastore|editcontext|feature|featureSet|feedfeature|fencefeature|fencenotificationtype|graph|join|layer|locationupdate|map|measure|measure|originalFeature|record|reference|rowindex|sourcedatastore|sourcefeature|sourcelayer|target|targetdatastore|targetfeature|targetlayer|userInput|value|variables|view)',
      ),
      mode5,
      Mode(
        begin: r'[{,]\s*',
        relevance: 0,
        contains: [
          Mode(
            begin: r'[A-Za-z_][0-9A-Za-z_]*\s*:',
            returnBegin: true,
            relevance: 0,
            contains: [
              Mode(
                scope: r'attr',
                begin: r'[A-Za-z_][0-9A-Za-z_]*',
                relevance: 0,
              ),
            ],
          ),
        ],
      ),
      Mode(
        begin:
            r'(!|!=|!==|%|%=|&|&&|&=|\*|\*=|\+|\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\?|\[|\{|\(|\^|\^=|\||\|=|\|\||~|\b(return)\b)\s*',
        keywords: r'return',
        contains: [
          mode11,
          mode14,
          mode9,
          Mode(
            scope: r'function',
            begin: r'(\(.*?\)|[A-Za-z_][0-9A-Za-z_]*)\s*=>',
            returnBegin: true,
            end: r'\s*=>',
            contains: [
              Mode(
                scope: r'params',
                variants: [
                  Mode(begin: r'[A-Za-z_][0-9A-Za-z_]*'),
                  Mode(begin: r'\(\s*\)'),
                  Mode(
                    begin: r'\(',
                    end: r'\)',
                    excludeBegin: true,
                    excludeEnd: true,
                    keywords: {
                      r'keyword': [
                        r'break',
                        r'case',
                        r'catch',
                        r'continue',
                        r'debugger',
                        r'do',
                        r'else',
                        r'export',
                        r'for',
                        r'function',
                        r'if',
                        r'import',
                        r'in',
                        r'new',
                        r'of',
                        r'return',
                        r'switch',
                        r'try',
                        r'var',
                        r'void',
                        r'while',
                      ],
                      r'literal': [
                        r'BackSlash',
                        r'DoubleQuote',
                        r'ForwardSlash',
                        r'Infinity',
                        r'NaN',
                        r'NewLine',
                        r'PI',
                        r'SingleQuote',
                        r'Tab',
                        r'TextFormatting',
                        r'false',
                        r'null',
                        r'true',
                        r'undefined',
                      ],
                      r'built_in': [
                        r'Abs',
                        r'Acos',
                        r'All',
                        r'Angle',
                        r'Any',
                        r'Area',
                        r'AreaGeodetic',
                        r'Array',
                        r'Asin',
                        r'Atan',
                        r'Atan2',
                        r'Attachments',
                        r'Average',
                        r'Back',
                        r'Bearing',
                        r'Boolean',
                        r'Buffer',
                        r'BufferGeodetic',
                        r'Ceil',
                        r'Centroid',
                        r'ChangeTimeZone',
                        r'Clip',
                        r'Concatenate',
                        r'Console',
                        r'Constrain',
                        r'Contains',
                        r'ConvertDirection',
                        r'ConvexHull',
                        r'Cos',
                        r'Count',
                        r'Crosses',
                        r'Cut',
                        r'Date|0',
                        r'DateAdd',
                        r'DateDiff',
                        r'DateOnly',
                        r'Day',
                        r'Decode',
                        r'DefaultValue',
                        r'Densify',
                        r'DensifyGeodetic',
                        r'Dictionary',
                        r'Difference',
                        r'Disjoint',
                        r'Distance',
                        r'DistanceGeodetic',
                        r'DistanceToCoordinate',
                        r'Distinct',
                        r'Domain',
                        r'DomainCode',
                        r'DomainName',
                        r'EnvelopeIntersects',
                        r'Equals',
                        r'Erase',
                        r'Exp',
                        r'Expects',
                        r'Extent',
                        r'Feature',
                        r'FeatureInFilter',
                        r'FeatureSet',
                        r'FeatureSetByAssociation',
                        r'FeatureSetById',
                        r'FeatureSetByName',
                        r'FeatureSetByPortalItem',
                        r'FeatureSetByRelationshipClass',
                        r'FeatureSetByRelationshipName',
                        r'Filter',
                        r'FilterBySubtypeCode',
                        r'Find',
                        r'First|0',
                        r'Floor',
                        r'FromCharCode',
                        r'FromCodePoint',
                        r'FromJSON',
                        r'Front',
                        r'GdbVersion',
                        r'Generalize',
                        r'Geometry',
                        r'GetEnvironment',
                        r'GetFeatureSet',
                        r'GetFeatureSetInfo',
                        r'GetUser',
                        r'GroupBy',
                        r'Guid',
                        r'HasKey',
                        r'HasValue',
                        r'Hash',
                        r'Hour',
                        r'IIf',
                        r'ISOMonth',
                        r'ISOWeek',
                        r'ISOWeekday',
                        r'ISOYear',
                        r'Includes',
                        r'IndexOf',
                        r'Insert',
                        r'Intersection',
                        r'Intersects',
                        r'IsEmpty',
                        r'IsNan',
                        r'IsSelfIntersecting',
                        r'IsSimple',
                        r'KnowledgeGraphByPortalItem',
                        r'Left|0',
                        r'Length',
                        r'Length3D',
                        r'LengthGeodetic',
                        r'Log',
                        r'Lower',
                        r'Map',
                        r'Max',
                        r'Mean',
                        r'MeasureToCoordinate',
                        r'Mid',
                        r'Millisecond',
                        r'Min',
                        r'Minute',
                        r'Month',
                        r'MultiPartToSinglePart',
                        r'Multipoint',
                        r'NearestCoordinate',
                        r'NearestVertex',
                        r'NextSequenceValue',
                        r'None',
                        r'Now',
                        r'Number',
                        r'Offset',
                        r'OrderBy',
                        r'Overlaps',
                        r'Point',
                        r'PointToCoordinate',
                        r'Polygon',
                        r'Polyline',
                        r'Pop',
                        r'Portal',
                        r'Pow',
                        r'Proper',
                        r'Push',
                        r'QueryGraph',
                        r'Random',
                        r'Reduce',
                        r'Relate',
                        r'Replace',
                        r'Resize',
                        r'Reverse',
                        r'Right|0',
                        r'RingIsClockwise',
                        r'Rotate',
                        r'Round',
                        r'Schema',
                        r'Second',
                        r'SetGeometry',
                        r'Simplify',
                        r'Sin',
                        r'Slice',
                        r'Sort',
                        r'Splice',
                        r'Split',
                        r'Sqrt',
                        r'StandardizeFilename',
                        r'StandardizeGuid',
                        r'Stdev',
                        r'SubtypeCode',
                        r'SubtypeName',
                        r'Subtypes',
                        r'Sum',
                        r'SymmetricDifference',
                        r'Tan',
                        r'Text',
                        r'Time',
                        r'TimeZone',
                        r'TimeZoneOffset',
                        r'Timestamp',
                        r'ToCharCode',
                        r'ToCodePoint',
                        r'ToHex',
                        r'ToLocal',
                        r'ToUTC',
                        r'Today',
                        r'Top|0',
                        r'Touches',
                        r'TrackAccelerationAt',
                        r'TrackAccelerationWindow',
                        r'TrackCurrentAcceleration',
                        r'TrackCurrentDistance',
                        r'TrackCurrentSpeed',
                        r'TrackCurrentTime',
                        r'TrackDistanceAt',
                        r'TrackDistanceWindow',
                        r'TrackDuration',
                        r'TrackFieldWindow',
                        r'TrackGeometryWindow',
                        r'TrackIndex',
                        r'TrackSpeedAt',
                        r'TrackSpeedWindow',
                        r'TrackStartTime',
                        r'TrackWindow',
                        r'Trim',
                        r'TypeOf',
                        r'Union',
                        r'Upper',
                        r'UrlEncode',
                        r'Variance',
                        r'Week',
                        r'Weekday',
                        r'When|0',
                        r'Within',
                        r'Year|0',
                      ],
                    },
                    contains: [
                      mode0,
                      mode2,
                      mode3,
                      mode5,
                      mode9,
                      mode14,
                      mode11,
                    ],
                  ),
                ],
              ),
            ],
          ),
        ],
        relevance: 0,
      ),
      Mode(
        beginKeywords: r'function',
        end: r'\{',
        excludeEnd: true,
        contains: [
          Mode(
            scope: r'title.function',
            begin: r'[A-Za-z_][0-9A-Za-z_]*',
            relevance: 0,
          ),
          Mode(
            scope: r'params',
            begin: r'\(',
            end: r'\)',
            excludeBegin: true,
            excludeEnd: true,
            contains: [mode0, mode2, mode3, mode5, mode9, mode14, mode11],
          ),
        ],
        illegal: r'\[|%',
      ),
      Mode(begin: r'\$[(.]'),
    ],
    illegal: r'#(?!!)',
  );
}