Verified Commit 7b78759c authored by Camil Staps's avatar Camil Staps 🚀

Highlight generic implementations properly (clean-cloogle/cloogle.org#179)

parent 8cbc9d4a
......@@ -218,7 +218,8 @@ function highlightClean(func, callback, start) {
[/(")/, ['literal literal-string'], 'string'],
[/(\|)/, ['punctuation'], 'guard'],
[/(=)/, ['punctuation'], 'rhs'],
[/([^\(\)\s]+)/, ['funcname'], 'funcargs']
[/([^\(\){\s]+)({\|)/, ['funcname', 'punctuation'], 'genericArgs'],
[/([^\(\){[\s]+)/, ['funcname'], 'funcargs']
],
moduleName: [
[/(\S+)/, ['modulename'], 'pop']
......@@ -226,9 +227,10 @@ function highlightClean(func, callback, start) {
funcargs: [
[/((?::=)?=)/, ['punctuation'], 'jump:rhs'],
[/([:\[\](),{}=]+)/, ['punctuation']],
[/(\|})/, ['punctuation']],
[/(\|)/, ['punctuation'], 'jump:guard'],
[/([A-Z][^:\[\](),{}=\s]+)/, ['constructor']],
[/([^:\[\](),{}=\s]+)/, ['argument']]
[/([^:\[\](),{}=|\s]+)/, ['argument']]
],
startConstructor: [ // alternative entry point in case this is a constructor
[/(\()(.*)(\))(\s*)(infix[lr]?)(\s*)(\d*)(\s*)(::)/,
......@@ -241,16 +243,17 @@ function highlightClean(func, callback, start) {
[/(.*)(::)/, ['field', 'punctuation'], 'type']
],
generic: [
[/(class)(\s)/, ['keyword', 'whitespace'], 'genericClass'],
[/(\S+)/, ['funcname funcname-generic'], 'genericVars']
],
genericClass: [
[/(\S+)/, ['classname classname-generic'], 'genericVars']
[/(\S+)/, ['funcname funcname-generic'], 'jump:genericVars']
],
genericVars: [
[/(::)/, ['punctuation'], 'type'],
[/(::)/, ['punctuation'], 'jump:type'],
[/(\S)/, ['typevar']]
],
genericArgs: [
[/(of)/, ['keyword'], 'jump:funcargs'],
[/([A-Z]\w*)/, ['type']],
[/(\|})/, ['punctuation'], 'jump:funcargs'],
],
type: [
[/(\n)/, ['whitespace'], 'pop'],
[/(where)/, ['keyword'], 'pop'],
......
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