{ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "4690 BASIC", "patterns": [ { "name": "string.quoted.double", "begin": "\"", "end": "\"", "patterns": [ { "match": ".", "name": "string.quoted.double" } ] }, { "name": "string.regexp", "match": "\\b[\\w\\.]+:" }, { "include": "#comments" }, { "include": "#function-decl" }, { "include": "#function-end" }, { "include": "#subroutine-decl" }, { "include": "#subroutine-end" }, { "include": "#integer-decl" }, { "include": "#string-decl" }, { "include": "#real-decl" }, { "include": "#math-function" }, { "include": "#string-function" }, { "include": "#variable-assignment" }, { "include": "#if-statement" }, { "include": "#if-statement-end" }, { "include": "#for-statement" }, { "include": "#arithmetic-operator" }, { "include": "#relational-operator" }, { "include": "#logical-operator" }, { "include": "#line-continuation" }, { "include": "#keywords" }, { "include": "#strings" }, { "include": "#stmt-w-parameters" }, { "include": "#access-stmt" }, { "include": "#dim-stmt" }, { "include": "#compiler-directives" }, { "include": "#on-error" }, { "include": "#open-close" }, { "include": "#number-literal" }, { "include": "#identifier" } ], "repository": { "line-continuation": { "name": "meta.line.continuation", "match": "\\\\(.*)\\n", "captures": { "1": { "name": "comment" } } }, "comments": { "patterns": [ { "name": "comment.line", "match": "!.*|REM.*|REMARK.*" } ] }, "function-decl": { "name": "meta.function", "begin": "(?i)\\b(FUNCTION|DEF)\\s+((\\?|[a-zA-Z])([a-zA-Z0-9#.]*)[\\$#%]?)", "beginCaptures": { "1": { "name": "storage.type.function" }, "2": { "name": "entity.name.function" } }, "patterns": [ { "include": "#parameter-list" }, { "include": "#fun-sub-modifier" }, { "include": "#line-continuation" }, { "include": "#comments" } ], "end": "(?|<|=>|>|=)|\\b(LT|LE|GT|GE|EQ|NE)\\b" }, "logical-operator": { "name": "keyword.operator.logical", "match": "\\b(NOT|AND|OR|XOR)\\b" }, "string-operator": { "name": "keyword.operator", "match": "[+]" }, "string-function": { "begin": "(?i)\\b(ASC|LEN|PACK\\$|TRANSLATE\\$|UCASE\\$|UNPACK\\$|VAL|MID\\$|LEFT\\$|RIGHT\\$|MATCH)\\b", "beginCaptures": { "1": { "name": "support.function.string" }, "0": { "name": "meta.function-call.begin" } }, "end": "\\(", "endCaptures": { "0": { "name": "punctuation.parameters.start" } } }, "string-expression": { "name": "meta.expression.string", "patterns": [ { "include": "#strings" }, { "include": "#string-operator" }, { "include": "#identifier" }, { "name": "\\s+", "match": "text.whitespace" } ] }, "logical-expression": { "name": "meta.expression.logical", "patterns": [ { "include": "#strings" }, { "include": "#logical-operator" }, { "include": "#identifier" }, { "include": "#number-literal" }, { "name": "variable.name", "match": "(\\?|[a-zA-Z])([a-zA-Z0-9#.]*)%?" }, { "name": "\\s+", "match": "text.whitespace" } ] }, "relational-expression": { "name": "meta.expression.relational", "patterns": [ { "include": "#strings" }, { "include": "#relational-operator" }, { "include": "#identifier" }, { "include": "#number-literal" }, { "name": "variable.name", "match": "(\\?|[a-zA-Z])([a-zA-Z0-9#.]*)%?" }, { "name": "\\s+", "match": "text.whitespace" } ] }, "general-expression": { "name": "meta.expression", "patterns": [ { "include": "#logical-expression" }, { "include": "#relational-expression" }, { "include": "#numeric-expression" }, { "include": "#string-expression" } ] }, "keywords": { "patterns": [ { "name": "keyword.control", "match": "(?i)\\b(GOSUB|RETURN|GOTO|WHILE|WEND|NEXT|ON|ERROR|STOP|RANDOMIZE|CHAIN|COMMON|CALL|EXIT SUB|FORM)\\b[^%\\$\\.]" }, { "name": "support.function", "match": "(?i)\\b(NULL|TRUE|FALSE|READ|WRITE|KEY)\\b[^%\\$\\.]" } ] }, "strings": { "name": "string.quoted.double.4690basic", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.4690basic", "match": "\\\\." } ] }, "single-stmts": { "name": "support.function", "match": "(COMMAND$|CONCHAR%|CONSOLE|DATE$)" }, "stmt-w-parameters": { "begin": "(?i)\\b(ASSIGNKEY|CHDIR|COMMON|CLEARS|DATA|DELETE|DELREC|GOSUB|GOTO|INPUT( LINE)?|MKDIR|NEXT|POINT|POKE|PUT|PUTLONG|READ MATRIX|RESUME|RMDIR|USE|WAIT)\\b", "beginCaptures": { "0": { "name": "keyword.other" } }, "patterns": [ { "include": "#io-session" }, { "include": "#string-expression" }, { "include": "#numeric-expression" }, { "include": "#identifier" }, { "name": "punctuation.separator.parameter", "match": "," }, { "name": "punctuation.separator.option", "match": ";" }, { "match": "\\s+", "name": "text.whitespace" } ], "end": "$" }, "open-close": { "name": "support.function", "match": "(?i)OPEN|CLOSE|KEYED|RECL|AS" }, "access-stmt": { "match": "(ACCESS)\\s+((NOREAD|NOWRITE|NODEL)(\\s*,\\s*(NOREAD|NOWRITE|NODEL)){0,2})", "captures": { "1": { "name": "support.function" }, "2": { "name": "constant.language" } } }, "dim-stmt": { "begin": "(?i)DIM\\s+", "beginCaptures": { "0": { "name": "support.function" } }, "patterns": [ { "include": "#identifier" }, { "include": "#dim-subscript" }, { "include": "#line-continuation" }, { "include": "#comments" } ], "end": "\\)|$" }, "dim-subscript": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.function-call.begin" } }, "patterns": [ { "name": "constant.numeric", "match": "\\d" }, { "include": "#identifier" }, { "name": "punctuation.separator.parameter", "match": "," }, { "name": "text.whitespace", "match": "\\s+" } ], "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parameters.end" } } }, "compiler-directives": { "name": "keyword.other", "match": "(%)(INCLUDE|include|DEBUG|debug|ENVIRON|environ|NOLIST|nolist|LIST|list|EJECT|eject|PAGE|page)\\s+([^!\\r\\n]*)", "captures": { "1": { "name": "keyword.operator" }, "2": { "name": "keyword.other" }, "3": { "name": "constant.numeric" } } }, "if-statement": { "name": "meta.if", "begin": "(?i)\\b(IF)", "beginCaptures": { "0": { "name": "keyword.control" } }, "patterns": [ { "include": "#math-function" }, { "include": "#string-function" }, { "include": "#number-literal" }, { "include": "#number-literal" }, { "include": "#arithmetic-operator" }, { "include": "#relational-operator" }, { "include": "#logical-operator" }, { "include": "#keywords" }, { "include": "#strings" }, { "name": "keyword.control", "match": "(?i)THEN" }, { "name": "keyword.control", "match": "(?i)ELSE" }, { "name": "keyword.control", "match": "(?i)(BEGIN)" }, { "include": "#line-continuation" }, { "include": "#comments" }, { "match": "\\s+", "name": "text.whitespace" } ], "end": "(?