From 817dc3e325328b5a51bd1caa6ba2bc736fb08ebd Mon Sep 17 00:00:00 2001 From: David Gileadi Date: Tue, 4 Oct 2016 16:54:44 -0700 Subject: [PATCH] Initial import --- README.md | 3 + language-configuration.json | 20 ++++++ package.json | 26 ++++++++ syntaxes/mumps.tmLanguage | 123 ++++++++++++++++++++++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 README.md create mode 100644 language-configuration.json create mode 100644 package.json create mode 100644 syntaxes/mumps.tmLanguage diff --git a/README.md b/README.md new file mode 100644 index 0000000..3fc7559 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# MUMPS README + +This is a simple [conversion](https://code.visualstudio.com/docs/customization/colorizer#_adding-a-new-language) of the [M/MUMPS/Caché language syntax for TextMate](https://github.com/ksherlock/MUMPS.tmbundle). \ No newline at end of file diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..ce7a278 --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,20 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": ";" + }, + // symbols used as brackets + "brackets": [ + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["(", ")"], + ["\"", "\""] + ], + // symbols that that can be used to surround a selection + "surroundingPairs": [ + ["(", ")"], + ["\"", "\""] + ] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..bbd3c05 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "mumps", + "displayName": "M/MUMPS/Caché language syntax highlighting", + "description": "M/MUMPS/Caché language syntax highlighting for Visual Studio Code. Converted from the MUMPS TextMate Bundle.", + "version": "0.0.1", + "publisher": "dgileadi", + "engines": { + "vscode": "^1.5.0" + }, + "categories": [ + "Languages" + ], + "contributes": { + "languages": [{ + "id": "mumps", + "aliases": ["MUMPS", "mumps"], + "extensions": [".int",".m",".zwr"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "mumps", + "scopeName": "source.mumps", + "path": "./syntaxes/mumps.tmLanguage" + }] + } +} \ No newline at end of file diff --git a/syntaxes/mumps.tmLanguage b/syntaxes/mumps.tmLanguage new file mode 100644 index 0000000..a6ce5ce --- /dev/null +++ b/syntaxes/mumps.tmLanguage @@ -0,0 +1,123 @@ + + + + + fileTypes + + int + m + zwr + + name + MUMPS + patterns + + + match + ^[%A-Za-z][A-Za-z0-9]* + name + entity.name.function + + + comment + uses positive look behind (leading space) and positive look ahead (space, :, or $) + match + (?<=\s)(?i:[BCDEFGHIJKLMNOQRSUVWX])(?=(:|\s|$)) + name + keyword.mumps.short + + + match + (?<=\s)(?i:BREAK|CLOSE|DO|ELSE|FOR|GOTO|HALT|HANG|IF|JOB|KILL|LOCK|MERGE|NEW|OPEN|QUIT|READ|SET|USE|VIEW|WRITE|XECUTE)(?=(:|\s|$)) + name + keyword.mumps + + + match + (?<=\s)(?i:CATCH|CONTINUE|ELSEIF|TCOMMIT|THROW|TROLLBACK|TRY|TSTART|WHILE)(?=(:|\s|$)) + name + keyword.mumps.cache + + + begin + " + end + " + name + string.quoted.double + + + match + ;.* + name + comment.line.mumps + + + match + \b([0-9]+)\b + name + constant.numeric + + + match + [-+*<>=_?!@#&*,():|\\'\[\]] + name + keyword.operator + + + comment + uses negative look behind (don't match $$) and positive look ahead (match "(" ) + match + (?<!\$)\$(?i:ASCII|A|CHAR|C|DATA|D|EXTRACT|E|FIND|F|FNUMBER|FN|GET|G|JUSTIFY|J|LENGTH|L|NAME|NA|NEXT|N|ORDER|O|PIECE|P|QLENGTH|QL|QSUBSCRIPT|QS|QUERY|Q|RANDOM|R|REVERSE|RE|SELECT|S|STACK|ST|TEXT|T|TRANSLATE|TR|VIEW|V)(?=\() + name + support.function.mumps + + + match + (?<!\$)\$(?i:ZABS|ZARCCOS|ZARCSIN|ZARCTAN|ZCOS|ZCOT|ZCSC|ZDATE|ZD|ZDATEH|ZDH|ZDATETIME|ZDT|ZDATETIMEH|ZDTH|ZEXP|ZHEX|ZH|ZLN|ZLOG|ZPOWER|ZSEC|ZSIN|ZSQR|ZTAN|ZTIME|ZT|ZTIMEH|ZTH|ZUTIL|ZU|ZF|ZPREVIOUS|ZP)(?=\() + name + support.function.z + + + match + (?<!\$)\$(?i:BIT|BITCOUNT|BITFIND|BITLOGIC|CASE|CLASSMETHOD|CLASSNAME|DECIMAL|DOUBLE|FACTOR|INCREMENT|I|INUMBER|ISOBJECT|ISVALIDDOUBLE|ISVALIDNUM|LIST|LI|LISTBUILD|LB|LISTDATA|LD|LISTFIND|LF|LISTFROMSTRING|LFS|LISTGET|LG|LISTLENGTH|LL|LISTNEXT|LISTSAME|LS|LISTTOSTRING|LTS|LISTVALID|LV|LOCATE|MATCH|METHOD|NCONVERT|NC|NORMALIZE|NOW|NUMBER|NUM|PARAMETER|PREFETCHOFF|PREFETCHON|PROPERTY|REPLACE|SCONVERT|SC|SORTBEGIN|SORTEND|WASCII|WA|WCHAR|WC|WEXTRACT|WE|WFIND|WF|WISWIDE|WLENGTH|WL|WREVERSE|WRE|XECUTE)(?=\() + name + support.function.cache + + + comment + uses negative look behind (don't match $$) and negative look ahead (don't match "(" ) + match + (?<!\$)\$(?i:DEVICE|ECODE|EC|ESTACK|ES|ETRAP|ET|HALT|HOROLOG|H|IO|I|JOB|J|KEY|K|NAMESPACE|PRINCIPAL|P|QUIT|Q|ROLES|STACK|ST|STORAGE|S|SYSTEM|TEST|T|THIS|TLEVEL|TL|USERNAME|X|Y)\b + name + variable.language.special + + + match + (?<!\$)\$[Zz](?i:A|B|CHILD|C|EOF|ERROR|E|HOROLOG|H|IO|I|JOB|J|MODE|M|NAME|N|NSPACE|ORDER|O|PARENT|P|PI|POS|REFERENCE|R|STORAGE|S|TIMESTAMP|TS|TIMEZONE|TZ|TRAP|T|VERSION|V)\b + name + variable.language.special.z + + + comment + $$func or $$func^routine + match + \$\$([%A-Za-z][A-Za-z0-9]*)(\^[%A-Za-z][A-Za-z0-9]*)? + name + support.function.user + + + comment + $$^routine + match + \$\$\^([%A-Za-z][A-Za-z0-9]*) + name + support.function.user + + + scopeName + source.mumps + uuid + 7D587692-5638-4FF8-8A38-68A8D6CB82C0 + +