@@ -114,8 +114,6 @@ purescriptGrammar =
114
114
include : ' #data_ctor'
115
115
,
116
116
include : ' #infix_op'
117
- ,
118
- include : ' #double_colon_inlined_signature'
119
117
,
120
118
include : ' #constants_numeric_decimal'
121
119
,
@@ -133,10 +131,12 @@ purescriptGrammar =
133
131
include : ' #markup_newline'
134
132
,
135
133
include : ' #double_colon_parens'
134
+ ,
135
+ include : ' #double_colon_inlined'
136
136
,
137
137
include : ' #double_colon_orphan'
138
138
,
139
- include : ' #comments'
139
+ include : ' #comments'
140
140
,
141
141
name : ' keyword.other.arrow'
142
142
match : / \< -| -\> /
@@ -535,42 +535,45 @@ purescriptGrammar =
535
535
0 : name : ' punctuation.definition.string.end'
536
536
]
537
537
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 :
557
540
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
+ ]
564
556
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
+ # ,
567
569
patterns : [
568
- match : ' ({doubleColon})(.*)(<- )'
570
+ match : ' ({doubleColon})(.*)(?=<-|" )'
569
571
captures :
570
572
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 '
573
575
576
+ ]}
574
577
]
575
578
,
576
579
patterns : [
@@ -587,61 +590,13 @@ purescriptGrammar =
587
590
588
591
]
589
592
]
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
-
639
593
double_colon_orphan :
640
594
patterns : [
641
595
begin : ///
642
- ^
643
596
( \s * )
644
597
(?: ( :: | ∷ ) )
598
+ ( \s * )
599
+ $
645
600
///
646
601
beginCaptures :
647
602
2 : name : ' keyword.other.double-colon'
@@ -653,6 +608,23 @@ purescriptGrammar =
653
608
include : ' #type_signature'
654
609
]
655
610
]
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
+ # ]
656
628
657
629
markup_newline :
658
630
patterns : [
@@ -793,14 +765,21 @@ purescriptGrammar =
793
765
because there doesn't seem to be a correct way to distinguish row type declaration
794
766
from another types put in brackets.
795
767
###
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
+
798
773
# applyEndPatternsLast: true
799
774
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'
804
783
]
805
784
]
806
785
@@ -821,16 +800,19 @@ purescriptGrammar =
821
800
match : ' ,'
822
801
,
823
802
include : ' #comments'
803
+
824
804
,
825
805
include : ' #record_field_declaration'
806
+ ,
807
+ include : ' #type_signature'
826
808
]
827
809
]
828
810
829
811
record_field_declaration :
830
812
name : ' meta.record-field.type-declaration'
831
813
begin : / {recordFieldDeclaration}/
832
814
# we use end pattern of " )" with space (as as row type ending)
833
- end : / (?={recordFieldDeclaration}| }| \) )/
815
+ end : / (?={recordFieldDeclaration}| }| \) | {indentBlockEnd} )/
834
816
# applyEndPatternsLast: true
835
817
contentName : ' meta.type-signature'
836
818
beginCaptures :
@@ -845,16 +827,13 @@ purescriptGrammar =
845
827
]
846
828
2 : name : ' keyword.other.double-colon'
847
829
patterns : [
848
- # # row type pipe
849
- # match: /\|(?=\s*{functionNameOne})/
850
- # captures:
851
- # 0: name: 'punctuation.separator.pipe'
852
- # ,
853
830
include : ' #record_types'
854
831
# ,
855
832
# include: '#row_types'
856
833
,
857
834
include : ' #type_signature'
835
+ # ,
836
+ # include: '#record_field_declaration'
858
837
,
859
838
include : ' #comments'
860
839
]
@@ -878,8 +857,8 @@ purescriptGrammar =
878
857
patterns : [
879
858
include : " #record_types"
880
859
,
881
- include : ' #row_types'
882
- ,
860
+ # include: '#row_types'
861
+ # ,
883
862
name : ' meta.class-constraints'
884
863
match : concat / \( / ,
885
864
list (' classConstraints' ,/ {classConstraint}/ ,/ ,/ ),
0 commit comments