monkey function

Mode monkey(
  1. Highlight hljs
)

Highlight.js language definition for monkey.

Implementation

Mode monkey(Highlight hljs) {
  return Mode(
    name: r'Monkey',
    caseInsensitive: true,
    keywords: {
      r'keyword': [
        r'public',
        r'private',
        r'property',
        r'continue',
        r'exit',
        r'extern',
        r'new',
        r'try',
        r'catch',
        r'eachin',
        r'not',
        r'abstract',
        r'final',
        r'select',
        r'case',
        r'default',
        r'const',
        r'local',
        r'global',
        r'field',
        r'end',
        r'if',
        r'then',
        r'else',
        r'elseif',
        r'endif',
        r'while',
        r'wend',
        r'repeat',
        r'until',
        r'forever',
        r'for',
        r'to',
        r'step',
        r'next',
        r'return',
        r'module',
        r'inline',
        r'throw',
        r'import',
        r'and',
        r'or',
        r'shl',
        r'shr',
        r'mod',
      ],
      r'built_in': [
        r'DebugLog',
        r'DebugStop',
        r'Error',
        r'Print',
        r'ACos',
        r'ACosr',
        r'ASin',
        r'ASinr',
        r'ATan',
        r'ATan2',
        r'ATan2r',
        r'ATanr',
        r'Abs',
        r'Abs',
        r'Ceil',
        r'Clamp',
        r'Clamp',
        r'Cos',
        r'Cosr',
        r'Exp',
        r'Floor',
        r'Log',
        r'Max',
        r'Max',
        r'Min',
        r'Min',
        r'Pow',
        r'Sgn',
        r'Sgn',
        r'Sin',
        r'Sinr',
        r'Sqrt',
        r'Tan',
        r'Tanr',
        r'Seed',
        r'PI',
        r'HALFPI',
        r'TWOPI',
      ],
      r'literal': [r'true', r'false', r'null'],
    },
    illegal: r'\/\*',
    contains: [
      Mode(
        scope: r'comment',
        begin: r'#rem',
        end: r'#end',
        contains: [
          Mode(
            scope: r'doctag',
            begin: r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
            end: r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
            excludeBegin: true,
            relevance: 0,
          ),
          Mode(
            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}",
          ),
        ],
      ),
      Mode(
        scope: r'comment',
        begin: r"'",
        end: r'$',
        contains: [
          Mode(
            scope: r'doctag',
            begin: r'[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
            end: r'(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
            excludeBegin: true,
            relevance: 0,
          ),
          Mode(
            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}",
          ),
        ],
        relevance: 0,
      ),
      Mode(
        variants: [
          Mode(match: [r'(function|method)', r'\s+', r'[a-zA-Z_]\w*']),
        ],
        scope: {1: r'keyword', 3: r'title.function'},
      ),
      Mode(
        variants: [
          Mode(
            match: [
              r'(class|interface|extends|implements)',
              r'\s+',
              r'[a-zA-Z_]\w*',
            ],
          ),
        ],
        scope: {1: r'keyword', 3: r'title.class'},
      ),
      Mode(scope: r'variable.language', begin: r'\b(self|super)\b'),
      Mode(
        scope: r'meta',
        begin: r'\s*#',
        end: r'$',
        keywords: {r'keyword': r'if else elseif endif end then'},
      ),
      Mode(match: [r'^\s*', r'strict\b'], scope: {2: r'meta'}),
      Mode(
        beginKeywords: r'alias',
        end: r'=',
        contains: [Mode(scope: r'title', begin: r'[a-zA-Z_]\w*', relevance: 0)],
      ),
      Mode(
        scope: r'string',
        begin: r'"',
        end: r'"',
        illegal: r'\n',
        contains: [Mode(begin: r'\\[\s\S]', relevance: 0)],
      ),
      Mode(
        scope: r'number',
        relevance: 0,
        variants: [
          Mode(begin: r'[$][a-fA-F0-9]+'),
          Mode(scope: r'number', begin: r'\b\d+(\.\d+)?', relevance: 0),
        ],
      ),
    ],
  );
}