Verified Commit e67b737d authored by Camil Staps's avatar Camil Staps 🚀

Fix #6 (state after derive; add highlighting for of keyword in derives)

parent d8e1576c
......@@ -261,6 +261,7 @@ function highlightClean(func, callback, start) {
type: [
[/(\n)/, ['whitespace'], 'pop'],
[/(where)/, ['keyword'], 'pop'],
[/(of)/, ['keyword'], 'typeOfPattern'],
[/([a-z][\w`]*)/, ['typevar']],
[/(A)(\.)/, ['existential', 'punctuation'], 'quantifiedVariables'],
[/([A-Z_]\w*)/, ['type']],
......@@ -268,6 +269,19 @@ function highlightClean(func, callback, start) {
[/(\|)/, ['punctuation'], 'context'],
[/([^\s\w])/, ['punctuation']]
],
typeOfPattern: [
[/([a-z]\w*)/, ['argument']],
[/([A-Z]\w*)/, ['constructor']],
[/([{([])/, ['punctuation'], 'typeOfPattern'],
[/([})\]])/, ['punctuation'], 'pop'],
[/([=:]+)/, ['punctuation']],
[/(,)/, function (matches, states) {
if (states[states.length-2] == 'typeOfPattern')
return [['punctuation']];
else
return [['punctuation'], 'pop'];
}]
],
quantifiedVariables: [
[/(\*)/, ['punctuation']],
[/(:)/, ['punctuation'], 'pop'],
......@@ -410,7 +424,7 @@ function highlightClean(func, callback, start) {
[/([^\s,]+)/, ['typevar']]
],
derive: [
[/(\S+)/, ['generic'], 'type'],
[/(\S+)/, ['generic'], 'jump:type'],
],
abc: [
[/(\.)/, ['abc-directive'], 'abcDirective'],
......
-----
derive ggen Int, Bool, Real, Char, String
derive ggen UNIT, PAIR, EITHER, CONS of gcd=:{a,b,c}, OBJECT of gtd, FIELD of d, RECORD of grd
derive ggen (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
-----
keyword derive
whitespace
generic ggen
whitespace
type Int
punctuation ,
whitespace
type Bool
punctuation ,
whitespace
type Real
punctuation ,
whitespace
type Char
punctuation ,
whitespace
type String
whitespace \n
keyword derive
whitespace
generic ggen
whitespace
type UNIT
punctuation ,
whitespace
type PAIR
punctuation ,
whitespace
type EITHER
punctuation ,
whitespace
type CONS
whitespace
keyword of
whitespace
argument gcd
punctuation =:{
argument a
punctuation ,
argument b
punctuation ,
argument c
punctuation },
whitespace
type OBJECT
whitespace
keyword of
whitespace
argument gtd
punctuation ,
whitespace
type FIELD
whitespace
keyword of
whitespace
argument d
punctuation ,
whitespace
type RECORD
whitespace
keyword of
whitespace
argument grd
whitespace \n
keyword derive
whitespace
generic ggen
whitespace
punctuation (,),
whitespace
punctuation (,,),
whitespace
punctuation (,,,),
whitespace
punctuation (,,,,),
whitespace
punctuation (,,,,,),
whitespace
punctuation (,,,,,,),
whitespace
punctuation (,,,,,,,)
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