Skip to content

Commit bd19ded

Browse files
author
Marcin Szamotulski
authored
Import syntax (#56)
1 parent 8bbcf0f commit bd19ded

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

syntax/purescript.vim

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ syn keyword purescriptBoolean true false
1818
" Delimiters
1919
syn match purescriptDelimiter "[,;|.()[\]{}]"
2020

21-
" Constructor
22-
syn match purescriptConstructor "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>"
23-
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
24-
\ containedin=purescriptData,purescriptNewtype
25-
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
26-
2721
" Type
28-
syn match purescriptType "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>" contained
22+
syn match purescriptType "\%(\<class\s\+\)\@15<!\<\u\w*\>" contained
2923
\ containedin=purescriptTypeAlias
3024
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
3125
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
3226
\ containedin=purescriptData,purescriptNewtype,purescriptTypeAlias,purescriptFunctionDecl
3327
syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^,.]\)*\>("rs=e-1 matchgroup=purescriptDelimiter end=")" contained extend
3428
\ contains=purescriptConstructor,purescriptDelimiter
3529

30+
" Constructor
31+
syn match purescriptConstructor "\%(\<class\s\+\)\@15<!\<\u\w*\>"
32+
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
33+
\ containedin=purescriptData,purescriptNewtype
34+
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
35+
36+
3637
" Function
3738
syn match purescriptFunction "\%(\<instance\s\+\|\<class\s\+\)\@18<!\<[_a-z]\(\w\|\'\)*\>" contained
3839
" syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
@@ -73,12 +74,13 @@ syn region purescriptImportParams
7374
\ skip="([^)]\{-})"
7475
\ end=")"
7576
\ contained
76-
\ contains=purescriptClass,purescriptClassName,purescriptStructure,purescriptType
77+
\ contains=purescriptClass,purescriptClass,purescriptStructure,purescriptType,purescriptIdentifier
7778
\ nextgroup=purescriptImportAs
7879
\ skipwhite
7980
syn keyword purescriptAsKeyword as contained
8081
syn match purescriptImportAs "\<as\>\_s\+\u\w*"
8182
\ contains=purescriptAsKeyword,purescriptModuleName
83+
\ nextgroup=purescriptModuleName
8284
syn keyword purescriptHidingKeyword hiding contained
8385
syn match purescriptImportHiding "hiding"
8486
\ contained
@@ -165,6 +167,7 @@ syn sync minlines=50
165167
highlight def link purescriptModule Include
166168
highlight def link purescriptImport Include
167169
highlight def link purescriptModuleKeyword purescriptKeyword
170+
highlight def link purescriptImportAs Include
168171
highlight def link purescriptModuleName Include
169172
highlight def link purescriptModuleParams purescriptDelimiter
170173
highlight def link purescriptImportKeyword purescriptKeyword

0 commit comments

Comments
 (0)