From d219055bc845253eff2b27d30a23b11b97b7ee9d Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 19 Nov 2017 21:26:59 +0100 Subject: Update --- syntax/purescript.vim | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'syntax/purescript.vim') diff --git a/syntax/purescript.vim b/syntax/purescript.vim index 39ad579f..50e35395 100644 --- a/syntax/purescript.vim +++ b/syntax/purescript.vim @@ -21,13 +21,13 @@ syn keyword purescriptBoolean true false syn match purescriptDelimiter "[,;|.()[\]{}]" " Constructor -syn match purescriptConstructor "\<[A-Z]\w*\>" +syn match purescriptConstructor "\%(\" syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained \ containedin=purescriptData,purescriptNewtype \ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment " Type -syn match purescriptType "\<[A-Z]\w*\>" contained +syn match purescriptType "\%(\" contained \ containedin=purescriptTypeAlias \ nextgroup=purescriptType,purescriptTypeVar skipwhite syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained @@ -36,9 +36,20 @@ syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^ \ contains=purescriptConstructor,purescriptDelimiter " Function -syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained -syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend -syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`" +syn match purescriptFunction "\%(\" contained +" syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained +syn match purescriptFunction "(\%(\" containedin=purescriptClassDecl contained + \ nextgroup=purescriptClassName + \ skipnl +syn match purescriptClassName "\<[A-Z]\w*\>" containedin=purescriptClassDecl contained " Module syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl @@ -46,8 +57,8 @@ syn match purescriptModuleKeyword "\" syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>" \ contains=purescriptModuleKeyword,purescriptModuleName \ nextgroup=purescriptModuleParams skipwhite skipnl skipempty -syn region purescriptModuleParams start="(" end=")" fold contained keepend - \ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment +syn region purescriptModuleParams start="(" skip="([^)]\{-})" end=")" fold contained keepend + \ contains=purescriptClassDecl,purescriptClass,purescriptClassName,purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment \ nextgroup=purescriptImportParams skipwhite " Import @@ -86,8 +97,9 @@ syn match purescriptForall "∀" syn keyword purescriptConditional if then else syn keyword purescriptStatement do case of in syn keyword purescriptLet let +" syn keyword purescriptClass class syn keyword purescriptWhere where -syn match purescriptStructure "\<\(data\|newtype\|type\|class\|kind\)\>" +syn match purescriptStructure "\<\(data\|newtype\|type\|kind\)\>" \ nextgroup=purescriptType skipwhite syn keyword purescriptStructure derive syn keyword purescriptStructure instance @@ -101,7 +113,7 @@ syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type " Operators syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)" -syn match purescriptOperatorType "\(::\|∷\)" +syn match purescriptOperatorType "\%(\.*\)\@40\|<-\|[\\→←]\)" syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained @@ -176,6 +188,8 @@ highlight def link purescriptLineComment purescriptComment highlight def link purescriptBlockComment purescriptComment " purescript general highlights +highlight def link purescriptClass purescriptKeyword +highlight def link purescriptClassName Type highlight def link purescriptStructure purescriptKeyword highlight def link purescriptKeyword Keyword highlight def link purescriptStatement Statement -- cgit v1.2.3