diff --git a/Preferences/Default.sublime-keymap b/Preferences/Default.sublime-keymap new file mode 100644 index 0000000..f8db2de --- /dev/null +++ b/Preferences/Default.sublime-keymap @@ -0,0 +1,6 @@ +[ + // Disable auto-pair for ' + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'"}, "context": + [{ "key": "selector", "operator": "equal", "operand": "source.md-basic" }] + }, +] \ No newline at end of file diff --git a/Syntaxes/Apple III Business BASIC.sublime-syntax b/Syntaxes/Apple III Business BASIC.sublime-syntax new file mode 100644 index 0000000..e103a2e --- /dev/null +++ b/Syntaxes/Apple III Business BASIC.sublime-syntax @@ -0,0 +1,85 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Apple III Business BASIC +file_extensions: [] +scope: source.business-basic +contexts: + main: + - match: ^\s*\d+ + scope: entity.name.function + - match: '\b(?i:DEF\s+FN)\s*([A-Za-z_][A-Za-z0-9_]*)\b' + scope: meta.def.fn + captures: + 0: keyword.function + 1: entity.name.function + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: \b(?i:REM)\b.*$ + comment: "may end at : ?" + scope: comment.line + - match: '(\d+\.\d*|\.\d+|\d+)([eE][+-]?\d+)?' + scope: constant.numeric + - match: '\b(?i:FN)\s*([A-Za-z][A-Za-z0-9.]*)\s*(?=\()' + scope: meta.fn + captures: + 0: keyword.function + 1: variable.function + - match: '\b(?i:PERFORM)\s+([A-Za-z][A-Za-z0-9.]*)(?=\()' + scope: meta.perform + captures: + 0: keyword.external + 1: support.function + - match: '\b(?i:EXFN%?)(\.)([A-Za-z][A-Za-z0-9.]*)(?=\()' + scope: meta.exfn + captures: + 0: keyword.external + 2: support.function + - match: '\b(?i:INVOKE|PERFORM|EXFN)(?![$%&])\b' + scope: keyword.external + - match: \b(?i:EXFN)% + scope: keyword.external + - match: '(?i:ON|OFF)\s+(?i:EOF)#' + comment: '# screws up \b' + scope: keyword.control + - match: '\b(?i:ON|OFF)\s+(?i:ERR|KBD)(?![$%&])\b' + scope: keyword.control + - match: '\b(?i:FOR|NEXT|STEP|TO|POP|RETURN|ELSE|IF|GOTO|GOSUB|THEN|ON|OFF|RESUME|TRACE|NOTRACE)(?![$%&])\b' + scope: keyword.control + - match: '\b(?i:DATA|GET|INPUT|READ|RESTORE)(?![$%&])\b' + scope: keyword.input + - match: '\b(?i:CLOSE|INPUT|OPEN|OUTPUT|PRINT|READ|WRITE)#' + scope: keyword.file + - match: '\b(?i:CAT|CATALOG|CLOSE|CREATE|DELETE|EXEC|LOCK|RENAME|UNLOCK)(?![$%&])\b' + scope: keyword.file + - match: '\b(?i:AS)\s(?i:EXTENSION|INPUT|OUTPUT)(?![$%&])\b' + scope: keyword.file.as + - match: \b(?i:REC|TYP)(?=\() + scope: support.function.file + - match: '\b(?i:DEL|HOME|INVERSE|LIST|NORMAL|PRINT|\?|WINDOW|IMAGE|USING)(?![$%&])\b' + scope: keyword.screen + - match: \b(?i:SPC|TAB)(?=\() + scope: support.function.screen + - match: '\b(?i:DIM|LET|SWAP)(?![$%&])\b' + scope: keyword.variable + - match: '\b(?i:CHAIN|CLEAR|CONT|END|LOAD|NEW|RUN|SAVE|STOP)(?![$%&])\b' + scope: keyword.utility + - match: '\b(?i:CONV)[$%&]?(?=\()' + scope: support.function.conversion + - match: \b(?i:ASC|CHR\$|HEX\$|INSTR|LEFT\$|LEN|MID\$|RIGHT\$|STR\$|SUB\$|TEN|VAL)(?=\() + scope: support.function.string + - match: \b(?i:ABS|EXP|INT|LOG|RND|SGN|SQR|ATN|COS|SIN|TAN|SCALE)(?=\() + scope: support.function.arithmetic + - match: \b(?i:DIV|MOD)\b + scope: keyword.operator.mathematical + - match: '\b(?i:AND|OR|NOT)(?![$%&])\b' + scope: keyword.operator.logical + - match: '\b(?i:EOF|ERR|ERRLIN|FRE|HPOS|INDENT|KBD|OUTREC|VPOS)(?![$%&])\b' + scope: support.variable + - match: \b(?i:PREFIX)\$ + scope: support.variable.dollar + - match: "[A-Za-z][A-Za-z0-9.]*[$%&]?" + scope: variable diff --git a/Syntaxes/Applesoft.sublime-syntax b/Syntaxes/Applesoft.sublime-syntax new file mode 100644 index 0000000..a763e5f --- /dev/null +++ b/Syntaxes/Applesoft.sublime-syntax @@ -0,0 +1,59 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Applesoft +comment: due to the parsing, order can be important (eg, notrace before not and trace) +file_extensions: + - applesoft +scope: source.applesoft +contexts: + main: + - match: ^\d+ + scope: entity.name.function + - match: '(?i:def\s*fn)\s*([A-Za-z_][A-Za-z0-9_]*)\s*[(]\s*([A-Za-z_][A-Za-z0-9_]*)\s*[)]' + scope: meta.def.fn + captures: + 0: keyword.function + 1: entity.name.function + 2: variable.parameter + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: (?i:shload|load|recall|save|store) + scope: invalid.deprecated + - match: (?i:rem).*$ + scope: comment.line + - match: '\d+|\d*\.\d*([eE][+-]?\d+)?' + scope: constant.numeric + - match: (?i:goto|onerr|on|if|then|for|to|step|next|gosub|return|pop|resume|stop|del|end|wait) + scope: keyword.control + - match: (?i:clear|cont|del|list|new|run) + scope: keyword.control.immediate + - match: (?i:dim|let) + scope: keyword.variable + - match: (?i:poke|call|himem:|lomem:|notrace|trace) + scope: keyword.utility + - match: (?i:in#|input|get|read|data|restore|pr#|print|\?|text|home|htab|vtab|inverse|normal|flash|speed=|tab|spc) + comment: tab/spc requires ( lookahead? + scope: keyword.io + - match: (?i:def|fn) + scope: keyword.function + - match: (?i:abs|sgn|int|sqr|sin|cos|tan|atn|exp|log|rnd) + scope: support.function.arithmetic + - match: (?i:len|left\$|mid\$|right\$|str\$|val|chr\$|asc) + scope: support.function.string + - match: (?i:at|gr|color=|plot|hlin|vlin|hgr2|hgr|hcolor=|hplot|draw|xdraw|scale=|rot=) + scope: keyword.graphics + - match: (?i:peek|usr|fre) + scope: support.function.utility + - match: (?i:scrn) + scope: support.function.graphics + - match: (?i:pdl|pos) + scope: support.function.io + - match: (?i:and|or|not) + scope: keyword.operator.logical + - match: '[A-Za-z][A-Za-z0-9]*?\s*[$%]?' + comment: uses non-greedy *? so keywords get a first shot + scope: variable diff --git a/Syntaxes/GSoft.sublime-syntax b/Syntaxes/GSoft.sublime-syntax new file mode 100644 index 0000000..91ea724 --- /dev/null +++ b/Syntaxes/GSoft.sublime-syntax @@ -0,0 +1,82 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: GSoft +file_extensions: + - src +scope: source.gsoft +contexts: + main: + - match: ^\s*\d+ + scope: entity.name.function + - match: '\b(?i:FUNCTION|SUB)\s*([A-Za-z_][A-Za-z0-9_]*)\b' + scope: meta.function.definition + captures: + 0: keyword.control + 1: entity.name.function + - match: '\b(?i:CALL)\s+([A-Za-z_][A-Za-z0-9_]*)' + scope: meta.function.call + captures: + 0: keyword.control + 1: support.function + - match: '\b(?i:DEF\s+FN)\s*([A-Za-z_][A-Za-z0-9_]*)\b' + scope: meta.def.fn + captures: + 0: keyword.function + 1: entity.name.function + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: '!.*$|\b(?i:rem)\b.*$' + scope: comment.line + - match: '(\d+\.\d*|\.\d+|\d+)([eE][+-]?\d+)?' + scope: constant.numeric + - match: '\$[A-Fa-f0-9]+' + scope: constant.numeric.hex + - match: '\b(?i:TYPE|END\s+TYPE|BYTE|INTEGER|LONG|SINGLE|DOUBLE|STRING|CONST|POINTER)(?![~%&!#$?])\b' + scope: storage.type.basic + - match: '\b(?i:DEF|FN|FUNCTION|SUB|LOADLIBRARY|UNLOADLIBRARY|TOOL|GSOS|LIBRARY)(?![~%&!#$?])\b' + scope: keyword.function + - match: \b(?i:DATA|READ|RESTORE)\b + scope: storage.data + - match: '\b(?i:CALL|CASE|CONT|DO|ELSE|END|ERROR|FOR|GOSUB|GOTO|IF|LOOP|NEXT|ONERR|ON|POP|RESUME|RETURN|SELECT|STEP|THEN|TO|UNTIL|WAIT|WEND|WHILE)(?![~%&!#$?])\b' + scope: keyword.control + - match: '\b(?i:BREAK|STOP)(?![~%&!#$?])\b' + scope: keyword.control.debug + - match: '\b(?i:ERL|ERR)(?![~%&!#$?])\b' + scope: support.variables.error + - match: '\b(?i:AS|DIM|LET)(?![~%&!#$?])\b' + scope: keyword.variable + - match: '\b(?i:\?|CSRLIN|HOME|HTAB|INPUT|INVERSE|LINE|NORMAL|MOUSETEXT|PRINT|SPEED|USING|VTAB)(?![~%&!#$?])\b' + scope: keyword.io + - match: '\b(?i:SPC|TAB|POS)(?![~%&!#$?])\b' + scope: support.function.io + - match: '\b(?i:CLOSE|OPEN|OUTPUT|INPUT|APPEND|RANDOM|BINARY|TCP|GET|PUT|SEEK|CHDIR|MKDIR|NAME|RMDIR|KILL)(?![~%&!#$?])\b' + comment: negative lookahead for type indicators. + scope: keyword.io.disk + - match: '\b(?i:EOF|LOC|LOF)(?![~%&!#$?])\b' + scope: support.function.io.disk + - match: \b(?i:DIR)\$ + scope: support.function.io.disk + - match: \b(?i:CURDIR)\$ + scope: support.variables.io.disk + - match: '\b(?i:ABS|ATN|CDBL|CINT|CLNG|COS|CSNG|EXP|INT|LOG|RND|SGN|SIN|SQR|TAN)(?![~%&!#$?])\b' + scope: support.function.arithmetic + - match: '\b(?i:ASC|FRE|LEN|VAL)(?![~%&!#$?])\b' + scope: support.function.string + - match: \b(?i:CHR|LEFT|MID|RIGHT|STR)\$ + scope: support.function.string + - match: '\b(?i:AT|HCOLOR|HGR|HPLOT|TEXT)(?![~%&!#$?])\b' + scope: keyword.graphics + - match: '\b(?i:ALLOCATE|DISPOSE|SETMEM|SIZEOF|PEEK|POKE|CLEAR)(?![~%&!#$?])\b' + scope: support.function.memory + - match: '\b(?i:NIL|VERSION)(?![~%&!#$?])\b' + scope: support.variable.memory + - match: '\b(?i:TOOLERROR)(?![~%&!#$?])\b' + scope: support.variables.toolbox + - match: '\b(?i:AND|OR|NOT)(?![~%&!#$?])\b' + scope: keyword.operator.logical + - match: '\b[A-Za-z_][A-Za-z0-9_]*[~%&!#$?]?' + scope: variable diff --git a/Syntaxes/Integer BASIC.sublime-syntax b/Syntaxes/Integer BASIC.sublime-syntax new file mode 100644 index 0000000..5f01e68 --- /dev/null +++ b/Syntaxes/Integer BASIC.sublime-syntax @@ -0,0 +1,52 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Integer BASIC +file_extensions: [] +scope: source.integer-basic +contexts: + main: + - match: ^\d+ + scope: entity.name.function.line-number + - match: \b(?i:rem).*$ + scope: comment.line + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: '\b(?i:goto|if|then|for|to|step|next|gosub|return|pop|stop|con|end)(?![$])\b' + scope: keyword.control + - match: '\b(?i:list)(?![$])\b' + scope: keyword.control.immediate + - match: '\b(?i:poke|call|trace|notrace|dsp|nodsp)(?![$])\b' + scope: keyword.utility + - match: '\b(?i:himem|lomem):' + scope: keyword.utility.colon + - match: \b(?i:peek)(?=\() + scope: support.function.utility + - match: '\b(?i:gr|color|plot|hlin|vlin|at)(?![$])\b' + scope: keyword.graphics + - match: \b(?i:scrn)(?=\() + scope: support.function.graphics + - match: '\b(?i:tab|text|vtab|print|input)(?![$])\b' + scope: keyword.io + - match: '\b(?i:in|pr)#' + scope: keyword.io.hash + - match: \b(?i:pdl)(?=\() + scope: support.function.io + - match: '\b(?i:and|or|not)(?![$])\b' + scope: keyword.operator.logical + - match: '\b(?i:mod)(?![$])\b' + scope: keyword.operator.arithmetic + - match: '\b(?i:dim|let)(?![$])\b' + scope: keyword.variable + - match: \b(?i:abs|sgn|rnd)(?=\() + scope: support.function.arithmetic + - match: \b(?i:len|asc)(?=\() + scope: support.function.string + - match: '\b[A-Za-z][A-Za-z0-9]*[$]?' + comment: uses non-greedy *? so keywords get a first shot + scope: variable + - match: \d+ + scope: constant.numeric diff --git a/Syntaxes/MD-BASIC.sublime-syntax b/Syntaxes/MD-BASIC.sublime-syntax new file mode 100644 index 0000000..2b87e71 --- /dev/null +++ b/Syntaxes/MD-BASIC.sublime-syntax @@ -0,0 +1,128 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: MD-BASIC +file_extensions: + - b +scope: source.md-basic + +variables: + ident: '[A-Za-z_][A-Za-z0-9_]*' + +contexts: + main: + - match: "^[%A-Za-z_][A-Za-z0-9_]*(?=:)" + scope: entity.name.function + + - match: '\b(?i:def\s+fn)\s+({{ident}})\s*[(]\s*({{ident}})\s*[)]' + scope: meta.def.fn + captures: + 0: keyword.function + 1: entity.name.function + 2: variable.parameter + + - match: '(\$[0-9a-fA-F]+)\b' + scope: constant.numeric.hex.md-basic + - match: '\d+|\d*\.\d*([eE][+-]?\d+)?' + scope: constant.numeric + - match: "'" + push: + - meta_scope: comment.line.md-basic + - match: \n + pop: true + - match: '\b(?i:rem)(?![%$])\b' + push: + - meta_scope: comment.line + - match: \n + pop: true + - match: "`" + push: + - meta_scope: string.quoted.raw + - match: "`" + pop: true + - match: '"' + push: + - meta_scope: string.quoted.double.md-basic + - match: '"' + pop: true + - match: '\^.' + scope: constant.character.escape.md-basic + - match: '\b(?i:goto|onerr|on|if|then|for|to|step|next|gosub|return|pop|resume|stop|del|end|wait)(?![%$])\b' + scope: keyword.control + - match: '\b((?i)do|else|endif|loop|repeat|until|wend|while)(?![%$])\b' + scope: keyword.control.md-basic + - match: '\b(?i:shload|load|recall|save|store)(?![%$])\b' + scope: invalid.deprecated + - match: '\b(?i:clear|cont|del|list|new|run)(?![%$])\b' + scope: keyword.control.immediate + - match: '\b(?i:dim|let)(?![%$])\b' + scope: keyword.variable + - match: '\b(?i:poke|call|himem|lomem|notrace|trace)(?![%$])\b' + scope: keyword.utility + - match: '\b(?i:in|input|get|read|data|restore|pr|print|text|home|htab|vtab|inverse|normal|flash|speed|tab|spc)(?![%$])\b' + comment: tab/spc requires ( lookahead? + scope: keyword.io + - match: \? + scope: keyword.io.short + - match: '\b(?i:def|fn)(?![%$])\b' + scope: keyword.function + - match: '\b(?i:abs|sgn|int|sqr|sin|cos|tan|atn|exp|log|rnd)(?![%$])\b' + scope: support.function.arithmetic + - match: '\b(?i:len|val|asc)(?![%$])\b' + scope: support.function.string + - match: \b(?i:left|mid|right|str|chr)\$ + scope: support.function.string.dollar + - match: '\b(?i:at|gr|color|plot|hlin|vlin|hgr2|hgr|hcolor|hplot|draw|xdraw|scale|rot)(?![%$])\b' + scope: keyword.graphics + - match: '\b(?i:peek|usr|fre)(?![%$])\b' + scope: support.function.utility + - match: '\b(?i:scrn)(?![%$])\b' + scope: support.function.graphics + - match: '\b(?i:pdl|pos)(?![%$])\b' + scope: support.function.io + - match: '\b(?i:and|or|not)(?![%$])\b' + scope: keyword.operator.logical + - match: '\b(?i:true|false|__mdbasic__)(?![%$])\b' + scope: constant.language.md-basic + - match: ^\s*#\s*(include)\s+ + captures: + 1: keyword.control.import.include.md-basic + push: + - meta_scope: meta.preprocessor.md-basic.include + - match: (?=(?://|/\*))|$ + captures: + 1: keyword.control.import.include.md-basic + pop: true + - match: (?>\\\s*\n) + scope: punctuation.separator.continuation.md-basic + - match: '"' + captures: + 0: punctuation.definition.string.begin.md-basic + push: + - meta_scope: string.quoted.double.include.md-basic + - match: '"' + captures: + 0: punctuation.definition.string.end.md-basic + pop: true + - match: < + captures: + 0: punctuation.definition.string.begin.md-basic + push: + - meta_scope: string.quoted.other.lt-gt.include.md-basic + - match: ">" + captures: + 0: punctuation.definition.string.end.md-basic + pop: true + - match: '^\s*#\s*(define)\s*([A-Za-z_][A-Za-z_0-9]*)' + scope: meta.preprocessor.macro.md-basic + captures: + 1: keyword.control.import.define.md-basic + 2: entity.name.function.preprocessor.md-basic + - match: ^\s*#\s*(?i:declare|define|else|endif|error|if|ifdef|ifndef|include|pragma|print|reserve)\b + scope: meta.preprocessor + - match: '&\s*([A-Za-z_][A-Za-z0-9_]*)' + scope: support.function.ampersand + - match: "[A-Za-z_][A-Za-z0-9_]*[$%]?" + comment: uses non-greedy *? so keywords get a first shot + scope: variable + diff --git a/Syntaxes/MPW Integer Basic.sublime-syntax b/Syntaxes/MPW Integer Basic.sublime-syntax new file mode 100644 index 0000000..e1ee3c8 --- /dev/null +++ b/Syntaxes/MPW Integer Basic.sublime-syntax @@ -0,0 +1,53 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: MPW Integer BASIC +comment: orca/integer basic with support for "named_lines" +file_extensions: + - bas +scope: source.integer-basic.mpw +contexts: + main: + - match: '^\s*"([A-Za-z0-9_~]+)"' + scope: meta.function.definition + captures: + 0: string.quoted.double + 1: entity.name.function + - match: ^\s*\d+ + scope: entity.name.function + - match: '\b(?i:call)\s+([A-Za-z0-9_~]+)' + scope: meta.function.call + captures: + 0: keyword.control + 1: support.function + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: \b(?i:rem)\b.*$ + scope: comment.line + - match: \d+ + scope: constant.numeric + - match: \b(?i:CALL|END|FOR|GOSUB|GOTO|IF|NEXT|POP|RETURN|STEP|THEN|TO)\b + scope: keyword.control + - match: \b(?i:DIM|LET)\b + scope: keyword.variable + - match: \b(?i:INPUT|PRINT|TAB|TEXT|TEXT80|VTAB)\b + scope: keyword.io + - match: \b(?i:ABS|RND|SGN)\b + scope: support.function.arithmetic + - match: \b(?i:ASC|LEN)\b + scope: support.function.string + - match: \b(?i:AT|COLOR|GR|HGR|HLIN|PLOT|VLIN)\b + scope: keyword.graphics + - match: \b(?i:SCRN)\b + scope: support.function.graphics + - match: \b(?i:PDL)\b + scope: support.function.io + - match: \b(?i:AND|OR|NOT)\b + scope: keyword.operator.logical + - match: \b(?i:MOD)\b + scope: keyword.operator.mathematical + - match: '[A-Za-z][A-Za-z0-9]*\$?' + scope: variable diff --git a/Syntaxes/ORCA Integer Basic.sublime-syntax b/Syntaxes/ORCA Integer Basic.sublime-syntax new file mode 100644 index 0000000..4408fe3 --- /dev/null +++ b/Syntaxes/ORCA Integer Basic.sublime-syntax @@ -0,0 +1,47 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: ORCA/Integer BASIC +file_extensions: + - bas +scope: source.integer-basic.orca +contexts: + main: + - match: ^\s*\d+ + scope: entity.name.function + - match: '\b(?i:call)\s+([A-Za-z0-9_~]+)' + scope: meta.function.call + captures: + 0: keyword.control + 1: support.function + - match: '"' + push: + - meta_scope: string.quoted.double + - match: '"' + pop: true + - match: \b(?i:rem)\b.*$ + scope: comment.line + - match: \d+ + scope: constant.numeric + - match: \b(?i:CALL|END|FOR|GOSUB|GOTO|IF|NEXT|POP|RETURN|STEP|THEN|TO)\b + scope: keyword.control + - match: \b(?i:DIM|LET)\b + scope: keyword.variable + - match: \b(?i:INPUT|PRINT|TAB|TEXT|TEXT80|VTAB)\b + scope: keyword.io + - match: \b(?i:ABS|RND|SGN)\b + scope: support.function.arithmetic + - match: \b(?i:ASC|LEN)\b + scope: support.function.string + - match: \b(?i:AT|COLOR|GR|HGR|HLIN|PLOT|VLIN)\b + scope: keyword.graphics + - match: \b(?i:SCRN)\b + scope: support.function.graphics + - match: \b(?i:PDL)\b + scope: support.function.io + - match: \b(?i:AND|OR|NOT)\b + scope: keyword.operator.logical + - match: \b(?i:MOD)\b + scope: keyword.operator.mathematical + - match: '[A-Za-z][A-Za-z0-9]*\$?' + scope: variable