Skip to content

Commit 10a1d2a

Browse files
committed
update grammars
1 parent 84f1d0d commit 10a1d2a

17 files changed

Lines changed: 1489 additions & 403 deletions

File tree

extensions/fsharp/syntaxes/fsharp.tmLanguage.json

Lines changed: 112 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/ionide/ionide-fsgrammar/commit/67c9f45ebbbd5a12d89ffad1661caf8452f1d552",
7+
"version": "https://github.com/ionide/ionide-fsgrammar/commit/eb210da2bfea65a7dff46d22c97a0e9e410a9469",
88
"name": "fsharp",
99
"scopeName": "source.fsharp",
1010
"patterns": [
@@ -64,7 +64,7 @@
6464
"generic_declaration": {
6565
"patterns": [
6666
{
67-
"match": "([^<>,])",
67+
"match": "([^<>,*()-])",
6868
"captures": {
6969
"1": {
7070
"name": "entity.name.type.fsharp"
@@ -86,13 +86,16 @@
8686
},
8787
"patterns": [
8888
{
89-
"match": "([^<>,])",
89+
"match": "([^<>,*()-])",
9090
"captures": {
9191
"1": {
9292
"name": "entity.name.type.fsharp"
9393
}
9494
}
9595
},
96+
{
97+
"include": "#tuple_signature"
98+
},
9699
{
97100
"include": "#generic_declaration"
98101
}
@@ -151,6 +154,48 @@
151154
}
152155
]
153156
},
157+
"tuple_signature": {
158+
"patterns": [
159+
{
160+
"match": "(([?[:alpha:]0-9'`^._ ]+))+",
161+
"captures": {
162+
"1": {
163+
"name": "entity.name.type.fsharp"
164+
}
165+
}
166+
},
167+
{
168+
"begin": "(\\()",
169+
"end": "(\\))",
170+
"beginCaptures": {
171+
"1": {
172+
"name": "keyword.symbol.fsharp"
173+
}
174+
},
175+
"endCaptures": {
176+
"1": {
177+
"name": "keyword.symbol.fsharp"
178+
}
179+
},
180+
"patterns": [
181+
{
182+
"match": "(([?[:alpha:]0-9'`^._ ]+))+",
183+
"captures": {
184+
"1": {
185+
"name": "entity.name.type.fsharp"
186+
}
187+
}
188+
},
189+
{
190+
"include": "#tuple_signature"
191+
}
192+
]
193+
},
194+
{
195+
"include": "#keywords"
196+
}
197+
]
198+
},
154199
"anonymous_functions": {
155200
"patterns": [
156201
{
@@ -351,7 +396,7 @@
351396
{
352397
"name": "binding.fsharp",
353398
"begin": "\\b(val mutable|val|let mutable|let inline|let|member val|member|static member|override|let!)(\\s+rec|mutable)?(\\s+\\[\\<.*\\>\\])?\\s*(private|internal|public)?\\s+(\\[[^-=]*\\]|[_[:alpha:]]([_[:alpha:]0-9,\\._]+)*|``[_[:alpha:]]([_[:alpha:]0-9,\\._`\\s]+|(?<=,)\\s)*)?",
354-
"end": "\\s*(with\\b|=|\\n+=)",
399+
"end": "\\s*(with\\b|=|\\n+=|(?<=\\=))",
355400
"beginCaptures": {
356401
"1": {
357402
"name": "keyword.fsharp"
@@ -379,21 +424,35 @@
379424
"include": "#comments"
380425
},
381426
{
382-
"match": "(:)\\s*(\\()?\\s*(([?[:alpha:]0-9'`^._ ]+))*",
383-
"captures": {
427+
"include": "#attributes"
428+
},
429+
{
430+
"begin": "(:)\\s*(\\()",
431+
"beginCaptures": {
384432
"1": {
385433
"name": "keyword.symbol.fsharp"
386434
},
387435
"2": {
388436
"name": "keyword.symbol.fsharp"
437+
}
438+
},
439+
"end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]+))+)",
440+
"endCaptures": {
441+
"1": {
442+
"name": "keyword.symbol.fsharp"
389443
},
390-
"3": {
444+
"2": {
391445
"name": "entity.name.type.fsharp"
392446
}
393-
}
447+
},
448+
"patterns": [
449+
{
450+
"include": "#tuple_signature"
451+
}
452+
]
394453
},
395454
{
396-
"match": "(\\*\\s*\\()\\s*(([?[:alpha:]0-9'`^._ ]+))*",
455+
"match": "(:)\\s*([?[:alpha:]0-9'`^._ ]+)*",
397456
"captures": {
398457
"1": {
399458
"name": "keyword.symbol.fsharp"
@@ -417,6 +476,31 @@
417476
}
418477
}
419478
},
479+
{
480+
"begin": "(\\*)\\s*(\\()",
481+
"beginCaptures": {
482+
"1": {
483+
"name": "keyword.symbol.fsharp"
484+
},
485+
"2": {
486+
"name": "keyword.symbol.fsharp"
487+
}
488+
},
489+
"end": "(\\)\\s*(([?[:alpha:]0-9'`^._ ]+))+)",
490+
"endCaptures": {
491+
"1": {
492+
"name": "keyword.symbol.fsharp"
493+
},
494+
"2": {
495+
"name": "entity.name.type.fsharp"
496+
}
497+
},
498+
"patterns": [
499+
{
500+
"include": "#tuple_signature"
501+
}
502+
]
503+
},
420504
{
421505
"match": "(\\*)(\\s*([?[:alpha:]0-9'`^._ ]+))*",
422506
"captures": {
@@ -429,7 +513,7 @@
429513
}
430514
},
431515
{
432-
"begin": "(<)",
516+
"begin": "(<(?![[:space:]]*\\)))",
433517
"end": "(>)",
434518
"beginCaptures": {
435519
"1": {
@@ -717,7 +801,7 @@
717801
"patterns": [
718802
{
719803
"name": "entity.name.type.format.specifier.fsharp",
720-
"match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o)|(s|b|O)|(\\+?A)))",
804+
"match": "(%0?-?(\\d+)?((a|t)|(\\.\\d+)?(f|F|e|E|g|G|M)|(b|c|s|d|i|x|X|o|u)|(s|b|O)|(\\+?A)))",
721805
"captures": {
722806
"1": {
723807
"name": "keyword.format.specifier.fsharp"
@@ -734,7 +818,7 @@
734818
},
735819
{
736820
"name": "variable.parameter.fsharp",
737-
"match": "[[:alpha:]0-9'`<>^._ ]\\w*"
821+
"match": "``[[:alpha:]0-9'`^:,._ ]+``|[[:alpha:]0-9'`<>^._ ]\\w*"
738822
}
739823
]
740824
},
@@ -774,7 +858,7 @@
774858
]
775859
},
776860
{
777-
"match": "\\s*(->)\\s*([[:alpha:]0-9'`^._ ]+)",
861+
"match": "\\s*(->)\\s*(?!with|get|set\\b)\\b([\\w0-9'`^._]+)",
778862
"captures": {
779863
"1": {
780864
"name": "keyword.symbol.fsharp"
@@ -888,7 +972,7 @@
888972
"patterns": [
889973
{
890974
"name": "record.fsharp",
891-
"begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)",
975+
"begin": "\\b(type)[\\s]+(private|internal|public)?\\s*",
892976
"end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))",
893977
"beginCaptures": {
894978
"1": {
@@ -899,12 +983,6 @@
899983
},
900984
"3": {
901985
"name": "support.function.attribute.fsharp"
902-
},
903-
"4": {
904-
"name": "entity.name.type.fsharp"
905-
},
906-
"5": {
907-
"name": "keyword.symbol.fsharp"
908986
}
909987
},
910988
"endCaptures": {
@@ -931,6 +1009,20 @@
9311009
{
9321010
"include": "#comments"
9331011
},
1012+
{
1013+
"include": "#attributes"
1014+
},
1015+
{
1016+
"match": "([[:alpha:]0-9'`^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)(<)",
1017+
"captures": {
1018+
"1": {
1019+
"name": "entity.name.type.fsharp"
1020+
},
1021+
"2": {
1022+
"name": "keyword.symbol.fsharp"
1023+
}
1024+
}
1025+
},
9341026
{
9351027
"match": "\\s*(>)\\s*(private|internal|public)?",
9361028
"captures": {
@@ -957,56 +1049,6 @@
9571049
"include": "#keywords"
9581050
}
9591051
]
960-
},
961-
{
962-
"name": "record.fsharp",
963-
"begin": "\\b(type)[\\s]+(private|internal|public)?(\\s*\\[\\<.*\\>\\])?[\\s]*([[:alpha:]0-9'`^:,._]+<(.*)>|[[:alpha:]0-9'^:,._]+|``[[:alpha:]0-9'`^:,._ ]+``)[\\s]?(private|internal|public)?[\\s]*",
964-
"end": "\\s*((with)|((as)\\s*([[:alpha:]0-9']+))|(=)|[\\n=]|(\\(\\)))",
965-
"beginCaptures": {
966-
"1": {
967-
"name": "keyword.fsharp"
968-
},
969-
"2": {
970-
"name": "keyword.fsharp"
971-
},
972-
"3": {
973-
"name": "support.function.attribute.fsharp"
974-
},
975-
"4": {
976-
"name": "entity.name.type.fsharp"
977-
},
978-
"6": {
979-
"name": "keyword.fsharp"
980-
}
981-
},
982-
"endCaptures": {
983-
"2": {
984-
"name": "keyword.fsharp"
985-
},
986-
"3": {
987-
"name": "keyword.fsharp"
988-
},
989-
"4": {
990-
"name": "keyword.fsharp"
991-
},
992-
"5": {
993-
"name": "variable.parameter.fsharp"
994-
},
995-
"6": {
996-
"name": "keyword.symbol.fsharp"
997-
},
998-
"7": {
999-
"name": "constant.language.unit.fsharp"
1000-
}
1001-
},
1002-
"patterns": [
1003-
{
1004-
"include": "#comments"
1005-
},
1006-
{
1007-
"include": "#member_declaration"
1008-
}
1009-
]
10101052
}
10111053
]
10121054
},

0 commit comments

Comments
 (0)