diff --git a/.vscode/launch.json b/.vscode/launch.json index e49111b..587a6ed 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,4 +25,4 @@ "preLaunchTask": "npm" } ] -} \ No newline at end of file +} diff --git a/syntaxes/haskell.tmLanguage b/syntaxes/haskell.tmLanguage index 76c18ef..e80383a 100644 --- a/syntaxes/haskell.tmLanguage +++ b/syntaxes/haskell.tmLanguage @@ -35,13 +35,13 @@ match - \(\) + \(\s*\) name constant.language.unit.haskell match - \[\] + \[\s*\] name constant.language.empty-list.haskell @@ -112,12 +112,16 @@ patterns + include + #type_signature + + + + + match + (?x) + \b(data|newtype) + \s+ + ([\p{Lu}\p{Lt}][\w\p{Nd}_']*) + ((?:\s+[\p{Ll}][\w\p{Nd}_']*)*) + \s+ + (where|=|$) + + captures + + 1 + + name + keyword.other.haskell + + 2 + + name + storage.type.haskell + + 3 + + patterns + + + match + '*[\p{Ll}][\w\p{Nd}_']* + name + variable.other.generic-type.haskell + + + + 4 + + name + keyword.other.haskell + + + + + match + (?x) + \b(type) + \s+ + ([\p{Lu}\p{Lt}][\w\p{Nd}_']*) + ((?:\s+[\p{Ll}][\w\p{Nd}_']*)*) + (?: + \s+ + (=) + (.*) + )?\s*$ + + captures + + 1 + + name + keyword.other.haskell + + 2 + + name + storage.type.haskell + + 3 + + patterns + + + match + '*[\p{Ll}][\w\p{Nd}_']* + name + variable.other.generic-type.haskell + + + + 4 + + name + keyword.other.haskell + + 5 + + patterns + + + include + #type_signature + + + + + begin \b(instance)\b @@ -225,13 +324,11 @@ (?x)\b ( deriving | where - | data - | type([\t ]+(family|role))? + | type([\t ]+(family|role)) | case | of | let - | in - | newtype + | inĀ§ | default )\b @@ -463,12 +560,12 @@ end (?=^(\1)?[^\s]) - + match \b[\p{Lu}\p{Lt}][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}']* @@ -479,16 +576,39 @@ include #comments - + include #infix_op + + begin + (::) + beginCaptures + + 1 + + name + keyword.other.double-colon.haskell + + + end + \)|$ + patterns + + + include + #type_signature + + + name + meta.type-declaration.haskell + comment In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*. @@ -503,6 +623,36 @@ name punctuation.separator.comma.haskell + + repository @@ -661,6 +811,19 @@ patterns + + begin + \( + end + \) + patterns + + + include + #type_signature + + + captures @@ -701,12 +864,12 @@ name keyword.other.big-arrow.haskell - + match \b[\p{Ll}_][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}']* @@ -721,7 +884,7 @@ match - \(\) + \(\s*\) name support.constant.unit.haskell @@ -731,6 +894,7 @@ + scopeName source.haskell