// Create your own language definition here
// You can safely look at other samples without losing modifications.
// Modifications are not saved on browser refresh/close though -- copy often!
return {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
ignoreCase: true,
keywords: [
'ACT', 'ONGSAVE', 'DEBUG', 'ONNEWLOC', 'AND', 'OR', 'LOC', 'OBJ',
'NO', 'MIN', 'MAX', 'RAND', 'IIF', 'RGB', 'LEN', 'ISNUM',
'LCASE', 'UCASE', 'INPUT', 'STR', 'VAL', 'ARRSIZE', 'ISPLAY',
'DESC', 'TRIM', 'GETOBJ', 'STRCOMP', 'STRFIND', 'STRPOS',
'MID', 'ARRPOS', 'ARRCOMP', 'INSTR', 'REPLACE', 'FUNC',
'DYNEVAL', 'RND', 'COUNTOBJ', 'MSECSCOUNT', 'QSPVER', 'USER_TEXT',
'USRTXT', 'CURLOC', 'SELOBJ', 'SELACT', 'MAINTXT', 'STATTXT', 'CURACTS',
'ELSE', 'TO', 'STEP', 'ELSEIF', 'END', 'LOCAL', 'SET', 'LET', 'IF',
'FOR', 'ADDOBJ', 'CLA', 'CLOSE', 'CLS', 'CMDCLEAR', 'CMDCLR', 'COPYARR',
'DELACT', 'DELOBJ', 'DYNAMIC', 'EXEC', 'EXIT', 'FREELIB', 'KILLQST', 'GOSUB',
'GS', 'GOTO', 'GT', 'ADDQST', 'INCLIB', 'JUMP', 'KILLALL', 'KILLOBJ',
'KILLVAR', 'MENU', 'CLEAR', 'CLR','NL','PL','P','MSG','OPENGAME','OPENQST',
'PLAY','REFINT', 'SAVEGAME', 'SETTIMER', 'SHOWACTS', 'SHOWINPUT', 'SHOWOBJS',
'SHOWSTAT', 'UNSELECT', 'UNSEL', 'VIEW', 'WAIT', 'XGOTO', 'XGT'
],
typeKeywords: [
'$'
],
operators: [
'=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=',
'&&', '||', '++', '--', '+', '-', '*', '/', '&', '|', '^', '%',
'<<', '>>', '>>>', '+=', '-=', '*=', '/=', '&=', '|=', '^=',
'%=', '<<=', '>>=', '>>>='
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
// C# style strings
escapes: /\\(?:[abfnrtv\\"]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[/[a-z_$][\w$]*/, { cases: { '@typeKeywords': 'keyword',
'@keywords': 'keyword',
'@default': 'identifier' } }],
[/[A-Z][\w\$]*/, 'type.identifier' ], // to show class names nicely
// whitespace
{ include: '@whitespace' },
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'operator',
'@default' : '' } } ],
// numbers
[/\d+/, 'number'],
// delimiter: after number because of .\d floats
[/[;,.]/, 'delimiter'],
// strings
[/'/, { token: 'string.quote', bracket: '@open', next: '@html_block', nextEmbedded: 'text/css'} ],
[/"/, { token: 'string.doublequote', bracket: '@open', next: '@stringdouble' } ],
],
html_block: [
[/[^']+/, ''],
[/'/, { token: 'string.quote', bracket: '@close', next: '@pop', nextEmbedded: '@pop' } ]
],
stringdouble: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ]
],
whitespace: [
[/[ \t\r\n]+/, 'white'],
[/\/\*/, 'comment', '@comment' ],
[/!.*$/, 'comment'],
],
},
};