@@ -114,8 +114,6 @@ purescriptGrammar =
114114 include : ' #data_ctor'
115115 ,
116116 include : ' #infix_op'
117- ,
118- include : ' #double_colon_inlined_signature'
119117 ,
120118 include : ' #constants_numeric_decimal'
121119 ,
@@ -133,10 +131,12 @@ purescriptGrammar =
133131 include : ' #markup_newline'
134132 ,
135133 include : ' #double_colon_parens'
134+ ,
135+ include : ' #double_colon_inlined'
136136 ,
137137 include : ' #double_colon_orphan'
138138 ,
139- include : ' #comments'
139+ include : ' #comments'
140140 ,
141141 name : ' keyword.other.arrow'
142142 match : / \< -| -\> /
@@ -535,42 +535,45 @@ purescriptGrammar =
535535 0 : name : ' punctuation.definition.string.end'
536536 ]
537537
538- # double_colon_parens:
539- # patterns: [
540- # # Note recursive regex matching nested parens
541- # match: [
542- # '\\(',
543- # '(?<paren>(?:[^()]|\\(\\g<paren>\\))*)',
544- # '(::|∷)',
545- # '(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)',
546- # '\\)'
547- # ].join('')
548- # captures:
549- # 1: patterns: [
550- # include: '$self'
551- # ]
552- # 2: name: 'keyword.other.double-colon'
553- # 3: {name: 'meta.type-signature', patterns: [include: '#type_signature']}
554- # ]
555-
556- double_colon_inlined_signature :
538+ # for inline signatures with parens
539+ double_colon_parens :
557540 patterns : [
558- patterns : [
559- match : ' (SomeType)\s *({doubleColon})(.*)'
560- captures :
561- 1 : name : ' meta.type-signature'
562- 2 : name : ' keyword.other.double-colon'
563- 3 : {name : ' meta.type-signature' , patterns : [include : ' #type_signature' ]}
541+ # Note recursive regex matching nested parens
542+ match : [
543+ ' \\ (' ,
544+ ' (?<paren>(?:[^()]|\\ (\\ g<paren>\\ ))*)' ,
545+ ' (::|∷)' ,
546+ ' (?<paren2>(?:[^()]|\\ (\\ g<paren2>\\ ))*)' ,
547+ ' \\ )'
548+ ].join (' ' )
549+ captures :
550+ 1 : patterns : [
551+ include : ' $self'
552+ ]
553+ 2 : name : ' keyword.other.double-colon'
554+ 3 : {name : ' meta.type-signature' , patterns : [include : ' #type_signature' ]}
555+ ]
564556
565- ]
566- ,
557+ # for inline signatures without parens
558+ double_colon_inlined :
559+ patterns : [
560+ # signatures in ide tooptips (starts from new line)
561+ # patterns: [
562+ # match: '^({classNameOne})(?: +)({doubleColon})(.*)'
563+ # captures:
564+ # 1: {name: 'meta.type-signature', patterns: [include: '#type_signature']}
565+ # 2: name: 'keyword.other.double-colon'
566+ # 3: {name: 'meta.type-signature', patterns: [include: '#type_signature']}
567+ # ]
568+ # ,
567569 patterns : [
568- match : ' ({doubleColon})(.*)(<- )'
570+ match : ' ({doubleColon})(.*)(?=<-|" )'
569571 captures :
570572 1 : name : ' keyword.other.double-colon'
571- 2 : {name : ' meta.type-signature' , patterns : [ include : ' #type_signature ' ]}
572- 3 : name : ' keyword.other.double-colon '
573+ 2 : {name : ' meta.type-signature' , patterns : [
574+ include : ' #type_signature '
573575
576+ ]}
574577 ]
575578 ,
576579 patterns : [
@@ -587,61 +590,13 @@ purescriptGrammar =
587590
588591 ]
589592 ]
590-
591- _double_colon_inlined_signature :
592- patterns : [
593- # Note recursive regex matching nested parens
594- # match: '\\((?<paren>(?:[^()]|\\(\\g<paren>\\))*)(::|∷)(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)\\)'
595- match : [
596- # '\\(',
597- # '(?<paren>(?:[^()]|\\(\\g<paren>\\))*)',
598- ' (::|∷)' ,
599- # '(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)',
600- ' (.*)' ,
601- # '\\)'
602- ].join (' ' )
603- captures :
604- # 1: patterns: [
605- # include: '$self'
606- # ]
607- 1 : name : ' keyword.other.double-colon'
608- 2 : {name : ' meta.type-signature' , patterns : [include : ' #type_signature' ]}
609- ]
610-
611- double_colon_parens :
612- patterns : [
613- # Note recursive regex matching nested parens
614- # Here we will only match parens with :: inside
615- match : [
616- ' \\ (' ,
617- # '(?<paren>(?:[^()]|\\(\\g<paren>\\))*)',
618- ' (?<paren>(?:[^()]*(::|∷)[^()]*|\\ (\\ g<paren>\\ )*))' ,
619- # '(::|∷)',
620- # '(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)',
621- ' \\ )'
622- ].join (' ' )
623- # match: [
624- # '\\((?<paren>(?:[^()]|\\(\\g<paren>\\))*)',
625- # '(::|∷)',
626- # '(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)',
627- # '\\)'
628- # ].join('')
629- captures :
630- 1 : patterns : [
631- # include: "#string_double_quoted"
632- # ,
633- # include: '#double_colon_inlined_signature'
634- # ,
635- include : ' $self'
636- ]
637- ]
638-
639593 double_colon_orphan :
640594 patterns : [
641595 begin : ///
642- ^
643596 ( \s * )
644597 (?: ( :: | ∷ ) )
598+ ( \s * )
599+ $
645600 ///
646601 beginCaptures :
647602 2 : name : ' keyword.other.double-colon'
@@ -653,6 +608,23 @@ purescriptGrammar =
653608 include : ' #type_signature'
654609 ]
655610 ]
611+ # double_colon_orphan:
612+ # patterns: [
613+ # begin: ///
614+ # ^
615+ # ( \s* )
616+ # (?: ( :: | ∷ ) )
617+ # ///
618+ # beginCaptures:
619+ # 2: name: 'keyword.other.double-colon'
620+ # end: ///
621+ # ^
622+ # (?! \1 {indentChar}* | {indentChar}* $ )
623+ # ///
624+ # patterns: [
625+ # include: '#type_signature'
626+ # ]
627+ # ]
656628
657629 markup_newline :
658630 patterns : [
@@ -793,14 +765,21 @@ purescriptGrammar =
793765 because there doesn't seem to be a correct way to distinguish row type declaration
794766 from another types put in brackets.
795767 ###
796- begin : / \( (?= \s * ({functionNameOne}| "{functionNameOne}"| "{classNameOne}")\s * (::| ∷))/
797- end : / \) /
768+ # begin: /\((?= \s*({functionNameOne}|"{functionNameOne}"|"{classNameOne}")\s*(::|∷))/
769+ # end: / \)/
770+ begin : / \( (?=\s * ({functionNameOne}| "{functionNameOne}"| "{classNameOne}")\s * (::| ∷))/
771+ end : / (?=^ \S )/
772+
798773 # applyEndPatternsLast: true
799774 patterns : [
800- # name: 'punctuation.separator.comma.purescript'
801- # match: ','
802- # ,
803- include : ' #record_field_declaration'
775+ name : ' punctuation.separator.comma.purescript'
776+ match : ' ,'
777+ ,
778+ include : ' #comments'
779+ ,
780+ include : ' #record_field_declaration'
781+ ,
782+ include : ' #type_signature'
804783 ]
805784 ]
806785
@@ -821,16 +800,19 @@ purescriptGrammar =
821800 match : ' ,'
822801 ,
823802 include : ' #comments'
803+
824804 ,
825805 include : ' #record_field_declaration'
806+ ,
807+ include : ' #type_signature'
826808 ]
827809 ]
828810
829811 record_field_declaration :
830812 name : ' meta.record-field.type-declaration'
831813 begin : / {recordFieldDeclaration}/
832814 # we use end pattern of " )" with space (as as row type ending)
833- end : / (?={recordFieldDeclaration}| }| \) )/
815+ end : / (?={recordFieldDeclaration}| }| \) | {indentBlockEnd} )/
834816 # applyEndPatternsLast: true
835817 contentName : ' meta.type-signature'
836818 beginCaptures :
@@ -845,16 +827,13 @@ purescriptGrammar =
845827 ]
846828 2 : name : ' keyword.other.double-colon'
847829 patterns : [
848- # # row type pipe
849- # match: /\|(?=\s*{functionNameOne})/
850- # captures:
851- # 0: name: 'punctuation.separator.pipe'
852- # ,
853830 include : ' #record_types'
854831 # ,
855832 # include: '#row_types'
856833 ,
857834 include : ' #type_signature'
835+ # ,
836+ # include: '#record_field_declaration'
858837 ,
859838 include : ' #comments'
860839 ]
@@ -878,8 +857,8 @@ purescriptGrammar =
878857 patterns : [
879858 include : " #record_types"
880859 ,
881- include : ' #row_types'
882- ,
860+ # include: '#row_types'
861+ # ,
883862 name : ' meta.class-constraints'
884863 match : concat / \( / ,
885864 list (' classConstraints' ,/ {classConstraint}/ ,/ ,/ ),
0 commit comments