@@ -31,6 +31,24 @@ exports.setThemeImpl = function(monacoInstance) {
3131 }
3232}
3333
34+exports.registerLanguageImpl = function(monacoInstance) {
35+ return function(languageId) {
36+ return function() {
37+ monacoInstance.languages.register({ id: languageId})
38+ }
39+ }
40+}
41+
42+exports.setMonarchTokensProviderImpl = function(monacoInstance) {
43+ return function(name) {
44+ return function(monarchLanguage) {
45+ return function() {
46+ return monacoInstance.languages.setMonarchTokensProvider(name, monarchLanguage);
47+ }
48+ }
49+ }
50+}
51+
3452exports.nightOwlTheme = {
3553 "base": "vs-dark",
3654 "inherit": true,
@@ -708,3 +726,167 @@ exports.nightOwlTheme = {
708726 }
709727}
710728
729+exports.purescriptSyntax = {
730+ "displayName": "Purescript",
731+ "name": "purescrript",
732+ "mimeTypes": ["text/purescript"],
733+ "fileExtensions": ["purs"],
734+
735+ "editorOptions": { "tabSize": 2, "insertSpaces": true },
736+
737+ "lineComment": "--",
738+ "blockCommentStart": "{-",
739+ "blockCommentEnd": "-}",
740+
741+ "keywords": [
742+ "case", "class", "data", "derive", "do", "else",
743+ "if", "import", "in", "infix", "infixl", "infixr", "instance",
744+ "let", "module", "newtype", "of", "then", "type", "where",
745+ "->", "|", "=>", "::", "\\", "=", "|", "foreign", "forall", "∷"
746+ ],
747+
748+ "extraKeywords": [
749+ ],
750+
751+ "typeKeywords": [
752+ ],
753+
754+ "dataStart": [
755+ "^data"
756+ ],
757+
758+ "typeStart": [
759+ "class","instance","type", "derive"
760+ ],
761+
762+
763+ "escapes" : "\\\\(?:[nrt\\\\\"'\\?]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{6})",
764+ "symbols0": "[\\$%&\\*\\+@!\\/\\\\\\^~=\\.:\\-\\?]",
765+ "symbols" : "(?:@symbols0|[\\|<>])+",
766+ "idchars" : "(?:[\\w'])*",
767+
768+ "tokenizer": {
769+ "root": [
770+
771+ ["((?:[A-Z]@idchars\\.)+)([a-z]@idchars)", ["identifier.namespace","identifier"]],
772+ ["((?:[A-Z]@idchars\\.)+)([A-Z]@idchars)", ["identifier.namespace","constructor"]],
773+
774+ ["[a-z]@idchars(?!\\.)",
775+ { "cases":{ "@dataStart": { "token": "keyword", "next" : "@type_data" },
776+ "@typeStart": { "token": "keyword", "next" : "@type_type" },
777+ "@keywords": "keyword",
778+ "@extraKeywords": "keyword",
779+ "@default" : "identifier" }
780+ }
781+ ],
782+
783+ ["[A-Z]@idchars", "type.identifier" ],
784+
785+ ["_@idchars", "identifier.wildcard"],
786+
787+
788+ ["([a-z]@idchars\\.)+", "identifier.namespace" ],
789+
790+
791+ { "include": "@whitespace" },
792+
793+ ["[{}()\\[\\]]", "@brackets"],
794+ ["[,`]", "delimiter"],
795+
796+
797+ ["::(?!@symbols0)", "type.operator", "@type_line"],
798+ ["@symbols", { "cases": { "@keywords": "keyword.operator",
799+ "@extraKeywords": "keyword.operator",
800+ "@default": "operator" }}
801+ ],
802+
803+
804+ ["[0-9]+\\.[0-9]+([eE][\\-+]?[0-9]+)?", "number.float"],
805+ ["0[xX][0-9a-fA-F]+", "number.hex"],
806+ ["[0-9]+", "number"],
807+
808+
809+ ["\"([^\"\\\\]|\\\\.)*$", "string.invalid" ],
810+ ["\"", { "token": "string.quote", "bracket": "@open", "next": "@string" } ],
811+
812+
813+ ["'[^\\\\']'", "string"],
814+ ["(')(@escapes)(')", ["string","string.escape","string"]],
815+ ["'", "string.invalid"],
816+
817+
818+ ["^[ ]*#.*", "namespace"]
819+ ],
820+
821+ "whitespace": [
822+ ["[ \\r\\n]+", ""],
823+ ["{-", "comment", "@comment" ],
824+ ["--.*$", "comment"]
825+ ],
826+
827+ "comment": [
828+ ["[^\\{\\-]+", "comment" ],
829+ ["{-", "comment", "@push" ],
830+ ["-}", "comment", "@pop" ],
831+ ["[\\{\\-]", "comment"]
832+ ],
833+
834+ "string": [
835+ ["[^\\\\\"]+", "string"],
836+ ["@escapes", "string.escape"],
837+ ["\\\\.", "string.escape.invalid"],
838+ ["\"", { "token": "string.quote", "bracket": "@close", "next": "@pop" } ]
839+ ],
840+
841+ "type_type": [
842+ [ "\\=", "keyword"],
843+ ["^\\s*(?!\\-\\-|\\{\\-)[^\\s]", { "token": "@rematch", "next": "@pop" } ],
844+ { "include": "@type" }
845+ ],
846+
847+ "type_data": [
848+ [ "([=|])(\\s*)([A-Z]@idchars)", ["keyword.operator","","constructor"]],
849+ ["^\\s*$", { "token": "", "next": "@pop" } ],
850+ { "include": "@type" }
851+ ],
852+
853+ "type_line": [
854+ ["^\\s*(?!\\-\\-|\\{\\-)[_a-z]", { "token": "@rematch", "next": "@pop" } ],
855+ ["[^=]*=", { "token": "@rematch", "next": "@pop" } ],
856+ { "include": "@type" }
857+ ],
858+
859+ "type": [
860+ [ "[(\\[]", { "token": "@brackets.type" }, "@type_nested"],
861+ { "include": "@type_content" }
862+ ],
863+
864+ "type_nested": [
865+ ["[)\\]]", { "token": "@brackets.type" }, "@pop" ],
866+ ["[(\\[]", { "token": "@brackets.type" }, "@push"],
867+ [",", "delimiter.type"],
868+ { "include": "@type_content" }
869+ ],
870+
871+ "type_content": [
872+ { "include": "@whitespace" },
873+
874+
875+ ["[a-z]\\d*\\b", "type.identifier.typevar"],
876+ ["_@idchars", "type.identifier.typevar"],
877+
878+ ["((?:[A-Z]@idchars\\.)*)([A-Z]@idchars)",
879+ ["type.identifier.namespace","type.identifier"]
880+ ],
881+ ["((?:[A-Z]@idchars\\.)*)([a-z]@idchars)",
882+ { "cases": { "@typeKeywords": ["type.identifier.namespace","type.keyword"],
883+ "@keywords": { "token": "@rematch", "next": "@pop" },
884+ "@default": ["type.identifier.namespace","type.identifier"]
885+ }}
886+ ],
887+
888+ ["::|->|[\\.:|]", "type.operator"],
889+ ["[\\s\\S]","@rematch","@pop"]
890+ ]
891+ }
892+ }