Verified Commit 88ff4d98 authored by Camil Staps's avatar Camil Staps 🚀

Add support for qualified imports

parent 1861ae1e
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
font-weight: bold; font-weight: bold;
} }
.funcname.funcname-onlyused, .modulename.modulename-onlyused, .argument { .funcname.funcname-onlyused, .argument {
color: #6e94ad; color: #6e94ad;
font-weight: normal; font-weight: normal;
} }
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
color: #444; color: #444;
} }
.qualified {
color: #444;
font-weight: normal;
}
.field { .field {
color: #41b1b5; color: #41b1b5;
} }
......
...@@ -144,6 +144,7 @@ function highlightClean(func, callback, start) { ...@@ -144,6 +144,7 @@ function highlightClean(func, callback, start) {
_prepend: [ _prepend: [
[/(\s*)(\/\/.*)/, ['whitespace', 'comment']], [/(\s*)(\/\/.*)/, ['whitespace', 'comment']],
[/(\s*)(\/\*)/, ['whitespace', 'comment'], 'comment'], [/(\s*)(\/\*)/, ['whitespace', 'comment'], 'comment'],
[/(')([\w`]+)('\.)/, ['punctuation', 'qualified', 'punctuation']],
], ],
_append: [ _append: [
[/(\n[^\n\S]*)/, function(matches, states) { [/(\n[^\n\S]*)/, function(matches, states) {
...@@ -344,7 +345,8 @@ function highlightClean(func, callback, start) { ...@@ -344,7 +345,8 @@ function highlightClean(func, callback, start) {
[/\b(True|False)\b/, [/\b(True|False)\b/,
['literal literal-bool']], ['literal literal-bool']],
[/(")/, ['literal literal-string'], 'string'], [/(")/, ['literal literal-string'], 'string'],
[/(\[)(\s*)(')/, ['punctuation', 'whitespace', 'literal literal-char'], 'charlist'], [/(\[)(\s*)(')(?=.*'\])/,
['punctuation', 'whitespace', 'literal literal-char'], 'charlist'],
[/([A-Z][\w`]*)/,['constructor']], [/([A-Z][\w`]*)/,['constructor']],
[/\b(_)\b/, ['argument argument-wildcard']], [/\b(_)\b/, ['argument argument-wildcard']],
[/([\w`]+)/, ['funcname funcname-onlyused']], [/([\w`]+)/, ['funcname funcname-onlyused']],
...@@ -371,7 +373,8 @@ function highlightClean(func, callback, start) { ...@@ -371,7 +373,8 @@ function highlightClean(func, callback, start) {
[/\b(True|False)\b/, [/\b(True|False)\b/,
['literal literal-bool']], ['literal literal-bool']],
[/(")/, ['literal literal-string'], 'string'], [/(")/, ['literal literal-string'], 'string'],
[/(\[)(\s*)(')/, ['punctuation', 'whitespace', 'literal literal-char'], 'charlist'], [/(\[)(\s*)(')(?=.*'\])/,
['punctuation', 'whitespace', 'literal literal-char'], 'charlist'],
[/(\(.+\)\s+infix.*)/, [/(\(.+\)\s+infix.*)/,
['__type__']], ['__type__']],
[/([\w`]+\s*::.*)/, [/([\w`]+\s*::.*)/,
...@@ -558,7 +561,7 @@ function highlightClean(func, callback, start) { ...@@ -558,7 +561,7 @@ function highlightClean(func, callback, start) {
], ],
importAs: [ importAs: [
[/(,)/, ['punctuation'], 'pop'], [/(,)/, ['punctuation'], 'pop'],
[/([^,\s]+)/, ['modulename modulename-onlyused']] [/([^,\s]+)/, ['modulename qualified']]
], ],
importFrom: [ importFrom: [
[/([^,\s]+)(\s+)(import)/, ['modulename', 'whitespace', 'keyword'], 'importSelections'] [/([^,\s]+)(\s+)(import)/, ['modulename', 'whitespace', 'keyword'], 'importSelections']
......
-----
instance 'T'.toTypeContext ['syntax'.TypeContext]
where
toTypeContext context
= ['T'.Instance gds.glob_object.ds_ident.id_name (map 'T'.toType tc_types)
\\ {tc_class=(TCClass gds),tc_types} <- context] ++
['T'.Derivation gtc_generic.glob_object.ds_ident.id_name ('T'.toType t)
\\ {tc_class=(TCGeneric {gtc_generic}),tc_types=[t]} <- context]
-----
keyword instance
whitespace
punctuation '
qualified T
punctuation '.
classname toTypeContext
whitespace
punctuation ['
qualified syntax
punctuation '.
type TypeContext
punctuation ]
whitespace \n
keyword where
whitespace \n
funcname toTypeContext
whitespace
argument context
whitespace \n
punctuation =
whitespace
punctuation ['
qualified T
punctuation '.
constructor Instance
whitespace
funcname funcname-onlyused gds
punctuation .
funcname funcname-onlyused glob_object
punctuation .
funcname funcname-onlyused ds_ident
punctuation .
funcname funcname-onlyused id_name
whitespace
punctuation (
funcname funcname-onlyused map
whitespace
punctuation '
qualified T
punctuation '.
funcname funcname-onlyused toType
whitespace
funcname funcname-onlyused tc_types
punctuation )
whitespace \n
punctuation \\
whitespace
punctuation {
funcname funcname-onlyused tc_class
punctuation =(
constructor TCClass
whitespace
funcname funcname-onlyused gds
punctuation ),
funcname funcname-onlyused tc_types
punctuation }
whitespace
punctuation <-
whitespace
argumentinrhs context
punctuation ]
whitespace
punctuation ++
whitespace \n
punctuation ['
qualified T
punctuation '.
constructor Derivation
whitespace
funcname funcname-onlyused gtc_generic
punctuation .
funcname funcname-onlyused glob_object
punctuation .
funcname funcname-onlyused ds_ident
punctuation .
funcname funcname-onlyused id_name
whitespace
punctuation ('
qualified T
punctuation '.
funcname funcname-onlyused toType
whitespace
funcname funcname-onlyused t
punctuation )
whitespace \n
punctuation \\
whitespace
punctuation {
funcname funcname-onlyused tc_class
punctuation =(
constructor TCGeneric
whitespace
punctuation {
funcname funcname-onlyused gtc_generic
punctuation }),
funcname funcname-onlyused tc_types
punctuation =[
funcname funcname-onlyused t
punctuation ]}
whitespace
punctuation <-
whitespace
argumentinrhs context
punctuation ]
-----
pdType :: !'syntax'.ParsedDefinition -> Maybe 'T'.Type
-----
funcname pdType
whitespace
punctuation ::
whitespace
punctuation !'
qualified syntax
punctuation '.
type ParsedDefinition
whitespace
punctuation ->
whitespace
type Maybe
whitespace
punctuation '
qualified T
punctuation '.
type Type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment