From 3b6e7c192312923d8029c0fb527a4c0c3fd4dd04 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 27 Feb 2014 00:07:15 -0500 Subject: [PATCH] md basic --- Preferences/MD Basic Folding.tmPreferences | 19 ++ Syntaxes/MD-BASIC.tmLanguage | 322 +++++++++++++++++++++ 2 files changed, 341 insertions(+) create mode 100644 Preferences/MD Basic Folding.tmPreferences create mode 100644 Syntaxes/MD-BASIC.tmLanguage diff --git a/Preferences/MD Basic Folding.tmPreferences b/Preferences/MD Basic Folding.tmPreferences new file mode 100644 index 0000000..79a089e --- /dev/null +++ b/Preferences/MD Basic Folding.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + MD-Basic Folding + scope + source.md-basic + settings + + foldingStartMarker + ^\s*(?i:REPEAT|WHILE|IF|DO)(\s+|$) + foldingStopMarker + ^\s*(?i:UNTIL|WEND|ENDIF|LOOP)(\s+|$) + + uuid + 9A3F2220-B7B4-42D4-9892-D629D373E206 + + diff --git a/Syntaxes/MD-BASIC.tmLanguage b/Syntaxes/MD-BASIC.tmLanguage new file mode 100644 index 0000000..c9029c3 --- /dev/null +++ b/Syntaxes/MD-BASIC.tmLanguage @@ -0,0 +1,322 @@ + + + + + fileTypes + + name + MD-BASIC + patterns + + + match + ^[%A-Za-z_][A-Za-z0-9_]*(?=:) + name + entity.name.function + + + captures + + 0 + + name + keyword.function + + 1 + + name + entity.name.function + + 2 + + name + variable.parameter + + + match + \b(?i:def\s+fn)\s+([A-Za-z_][A-Za-z0-9_]*)\s*[(]\s*([A-Za-z_][A-Za-z0-9_]*)\s*[)] + name + meta.def.fn + + + match + (\$[0-9a-fA-F]+)\b + name + constant.numeric.hex.md-basic + + + match + \d+|\d*\.\d*([eE][+-]?\d+)? + name + constant.numeric + + + begin + ' + end + \n + name + comment.line.md-basic + + + begin + \b(?i:rem)(?![%$])\b + end + \n + name + comment.line + + + begin + ` + end + ` + name + string.quoted.raw + + + begin + " + end + " + name + string.quoted.double.md-basic + patterns + + + match + \^[A-Za-z^] + name + 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 + name + keyword.control + + + match + \b((?i)do|else|endif|loop|repeat|until|wend|while)(?![%$])\b + name + keyword.control.md-basic + + + match + \b(?i:shload|load|recall|save|store)(?![%$])\b + name + invalid.deprecated + + + match + \b(?i:clear|cont|del|list|new|run)(?![%$])\b + name + keyword.control.immediate + + + match + \b(?i:dim|let)(?![%$])\b + name + keyword.variable + + + match + \b(?i:poke|call|himem|lomem|notrace|trace)(?![%$])\b + name + keyword.utility + + + comment + tab/spc requires ( lookahead? + match + \b(?i:in|input|get|read|data|restore|pr|print|text|home|htab|vtab|inverse|normal|flash|speed|tab|spc)(?![%$])\b + name + keyword.io + + + match + \? + name + keyword.io.short + + + match + \b(?i:def|fn)(?![%$])\b + name + keyword.function + + + match + \b(?i:abs|sgn|int|sqr|sin|cos|tan|atn|exp|log|rnd)(?![%$])\b + name + support.function.arithmetic + + + match + \b(?i:len|val|asc)(?![%$])\b + name + support.function.string + + + match + \b(?i:left|mid|right|str|chr)\$ + name + support.function.string.dollar + + + match + \b(?i:at|gr|color|plot|hlin|vlin|hgr2|hgr|hcolor|hplot|draw|xdraw|scale|rot)(?![%$])\b + name + keyword.graphics + + + match + \b(?i:peek|usr|fre)(?![%$])\b + name + support.function.utility + + + match + \b(?i:scrn)(?![%$])\b + name + support.function.graphics + + + match + \b(?i:pdl|pos)(?![%$])\b + name + support.function.io + + + match + \b(?i:and|or|not)(?![%$])\b + name + keyword.operator.logical + + + match + \b(?i:true|false|__mdbasic__)(?![%$])\b + name + constant.language.md-basic + + + begin + ^\s*#\s*(include)\s+ + captures + + 1 + + name + keyword.control.import.include.md-basic + + + end + (?=(?://|/\*))|$ + name + meta.preprocessor.md-basic.include + patterns + + + match + (?>\\\s*\n) + name + punctuation.separator.continuation.md-basic + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.md-basic + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.md-basic + + + name + string.quoted.double.include.md-basic + + + begin + < + beginCaptures + + 0 + + name + punctuation.definition.string.begin.md-basic + + + end + > + endCaptures + + 0 + + name + punctuation.definition.string.end.md-basic + + + name + string.quoted.other.lt-gt.include.md-basic + + + + + captures + + 1 + + name + keyword.control.import.define.md-basic + + 2 + + name + entity.name.function.preprocessor.md-basic + + + match + ^\s*#\s*(define)\s*([A-Za-z_][A-Za-z_0-9]*) + name + meta.preprocessor.macro.md-basic + + + match + ^\s*#\s*(?i:declare|define|else|endif|error|if|ifdef|ifndef|include|pragma|print|reserve)\b + name + meta.preprocessor + + + match + &\s*([A-Za-z_][A-Za-z0-9_]*) + name + support.function.ampersand + + + comment + uses non-greedy *? so keywords get a first shot + match + [A-Za-z_][A-Za-z0-9_]*[$%]? + name + variable + + + scopeName + source.md-basic + uuid + DD349F4E-DE95-41D3-945C-209066679265 + +