diff --git a/clean.js b/clean.js index b402e9cd3db285bcd73232605dd7e3dcadc69deb..bc302b06b062cbcac888e627aa0eef300ab77739 100644 --- a/clean.js +++ b/clean.js @@ -209,6 +209,7 @@ var highlightRules = { [/([^\s;]+)/, ['modulename'], 'pop'] ], funcargs: [ + [/(::)/, ['punctuation'], 'type'], [/(=:)/, ['punctuation']], [/((?::=)?=)/, ['punctuation'], 'jump:rhs'], [/(\[\|)/, ['punctuation']], /* overloaded list */ @@ -253,6 +254,8 @@ var highlightRules = { [/(\(\))/, ['type']], [/(\()(->)(\))/, ['punctuation', 'type', 'punctuation']], [/(\|)/, ['punctuation'], 'context'], + [/(\()/, ['punctuation'], 'type'], + [/(\))/, ['punctuation'], 'pop'], [/([^\s\w])/, ['punctuation']] ], typeOfPattern: [ diff --git a/package.json b/package.json index c07977e010baf79cd290043d00c2e5a4b8a5bd95..e4d571c3e568bb44e460521a354d983d6bd9cc35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clean-highlighter", - "version": "0.1.13", + "version": "0.1.14", "description": "Clean language highlighter", "keywords": ["clean","highlighter"], "main": "clean.js", diff --git a/tests/dynamic-pattern-match b/tests/dynamic-pattern-match new file mode 100644 index 0000000000000000000000000000000000000000..7f21952eea3271fdb44b29311d24202a478e17bd --- /dev/null +++ b/tests/dynamic-pattern-match @@ -0,0 +1,72 @@ +----- +unpack :: Dynamic -> Maybe a +unpack (x :: a^) = Just x +unpack (f :: A.a: Int -> Maybe a) = Just (f 37) +unpack _ = Nothing +----- +funcname unpack +whitespace +punctuation :: +whitespace +type Dynamic +whitespace +punctuation -> +whitespace +type Maybe +whitespace +typevar a +whitespace \n +funcname unpack +whitespace +punctuation ( +argument x +whitespace +punctuation :: +whitespace +typevar a +punctuation ^) +whitespace +punctuation = +whitespace +constructor Just +whitespace +argumentinrhs x +whitespace \n +funcname unpack +whitespace +punctuation ( +argument f +whitespace +punctuation :: +whitespace +existential A +punctuation . +typevar a +punctuation : +whitespace +type Int +whitespace +punctuation -> +whitespace +type Maybe +whitespace +typevar a +punctuation ) +whitespace +punctuation = +whitespace +constructor Just +whitespace +punctuation ( +argumentinrhs f +whitespace +literal literal-int literal-int-dec 37 +punctuation ) +whitespace \n +funcname unpack +whitespace +argument _ +whitespace +punctuation = +whitespace +constructor Nothing