Skip to content

Commit d17eee5

Browse files
authored
Merge pull request #60 from wclr/grammar-update-2-fix2
Fix inline signature (triple quotes)
2 parents 874c6b5 + d49f9a9 commit d17eee5

5 files changed

Lines changed: 1003 additions & 104 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.DS_Store
22
npm-debug.log
33
node_modules
4+
output
5+
.psc-ide-port

grammars/purescript.cson

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
{
5858
'include': '#function_type_declaration'
5959
}
60+
{
61+
'include': '#function_type_declaration_arrow_first'
62+
}
6063
{
6164
'include': '#typed_hole'
6265
}
@@ -97,13 +100,13 @@
97100
'include': '#markup_newline'
98101
}
99102
{
100-
'include': '#double_colon_parens'
103+
'include': '#string_double_colon_parens'
101104
}
102105
{
103-
'include': '#double_colon_inlined'
106+
'include': '#double_colon_parens'
104107
}
105108
{
106-
'include': '#double_colon_orphan'
109+
'include': '#double_colon_inlined'
107110
}
108111
{
109112
'include': '#comments'
@@ -155,7 +158,7 @@
155158
'patterns': [
156159
{
157160
'name': 'keyword.operator.function.infix.purescript'
158-
'match': '(`)(?:[\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*(?:\\.[\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*)*\\.)?[\\p{Ll}_][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*(`)'
161+
'match': '(`)(?:[\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*(?:\\.[\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*)*\\.)?[\\p{Ll}_][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*.*(`)'
159162
'captures':
160163
'1':
161164
'name': 'punctuation.definition.entity.purescript'
@@ -238,7 +241,7 @@
238241
'patterns': [
239242
{
240243
'name': 'meta.foreign.data.purescript'
241-
'begin': '^(\\s*)(foreign)\\s+(import)\\s+(data)(?:\\s+([\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*)\\s*((?:::|∷)))?'
244+
'begin': '^(\\s*)(foreign)\\s+(import)\\s+(data)\\s(?:\\s+([\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*)\\s*((?:::|∷)))?'
242245
'end': '^(?!\\1[ \\t]|[ \\t]*$)'
243246
'contentName': 'meta.kind-signature.purescript'
244247
'beginCaptures':
@@ -482,7 +485,7 @@
482485
}
483486
{
484487
'name': 'constant.numeric.purescript'
485-
'match': '\\d+'
488+
'match': ' \\d+ '
486489
}
487490
{
488491
'match': '([\\p{S}\\p{P}&&[^(),;\\[\\]`{}_"\']]+)'
@@ -582,6 +585,25 @@
582585
'name': 'punctuation.definition.string.end.purescript'
583586
}
584587
]
588+
'string_double_colon_parens':
589+
'patterns': [
590+
{
591+
'match': '\\((.*?)("(?:[ -\\[\\]-~]|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))*(::|∷)((?:[ -\\[\\]-~]|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_])))*")'
592+
'captures':
593+
'1':
594+
'patterns': [
595+
{
596+
'include': '$self'
597+
}
598+
]
599+
'2':
600+
'patterns': [
601+
{
602+
'include': '$self'
603+
}
604+
]
605+
}
606+
]
585607
'string_double_quoted':
586608
'patterns': [
587609
{
@@ -634,7 +656,7 @@
634656
'double_colon_parens':
635657
'patterns': [
636658
{
637-
'match': '\\((?<paren>(?:[^()]|\\(\\g<paren>\\))*)(::|∷)(?<paren2>(?:[^()]|\\(\\g<paren2>\\))*)\\)'
659+
'match': '\\((?<paren>(?:[^()]|\\(\\g<paren>\\))*)(::|∷)(?<paren2>(?:[^()}]|\\(\\g<paren2>\\))*)\\)'
638660
'captures':
639661
'1':
640662
'patterns': [
@@ -658,7 +680,7 @@
658680
{
659681
'patterns': [
660682
{
661-
'match': '((?:::|∷))(.*)(?=<-|""")'
683+
'match': '((?:::|∷))(.*?)(?=<-| """)'
662684
'captures':
663685
'1':
664686
'name': 'keyword.other.double-colon.purescript'
@@ -675,17 +697,16 @@
675697
{
676698
'patterns': [
677699
{
678-
'match': '((?:::|∷))(.*)'
679-
'captures':
700+
'begin': '((?:::|∷))'
701+
'end': '(?=^(\\s|\\S))'
702+
'beginCaptures':
680703
'1':
681704
'name': 'keyword.other.double-colon.purescript'
682-
'2':
683-
'name': 'meta.type-signature.purescript'
684-
'patterns': [
685-
{
686-
'include': '#type_signature'
687-
}
688-
]
705+
'patterns': [
706+
{
707+
'include': '#type_signature'
708+
}
709+
]
689710
}
690711
]
691712
}
@@ -857,6 +878,32 @@
857878
]
858879
}
859880
]
881+
'function_type_declaration_arrow_first':
882+
'patterns': [
883+
{
884+
'name': 'meta.function.type-declaration.purescript'
885+
'begin': '^(\\s*)(?:\\s(::|∷)(?!.*<-))'
886+
'end': '^(?!\\1[ \\t]|[ \\t]*$)'
887+
'contentName': 'meta.type-signature.purescript'
888+
'beginCaptures':
889+
'2':
890+
'name': 'keyword.other.double-colon.purescript'
891+
'patterns': [
892+
{
893+
'include': '#double_colon'
894+
}
895+
{
896+
'include': '#type_signature'
897+
}
898+
{
899+
'include': '#record_types'
900+
}
901+
{
902+
'include': '#row_types'
903+
}
904+
]
905+
}
906+
]
860907
'row_types':
861908
'patterns': [
862909
{

0 commit comments

Comments
 (0)