Skip to content

Commit 7209cf6

Browse files
committed
[r] update grammar
1 parent ad58f84 commit 7209cf6

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

extensions/r/syntaxes/r.tmLanguage.json

Lines changed: 14 additions & 10 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/Ikuyadeu/vscode-R/commit/0ad8c770ea3836b15bc121fff4161a794d3deeaa",
7+
"version": "https://github.com/Ikuyadeu/vscode-R/commit/b3ef459a3999160d97ea28f4754fda810417f99f",
88
"fileTypes": [
99
"R",
1010
"r",
@@ -178,19 +178,23 @@
178178
"name": "keyword.operator.arithmetic.r"
179179
},
180180
{
181-
"match": "(=|<-|<<-|->|->>)",
181+
"match": "==",
182+
"name": "keyword.operator.comarison.r"
183+
},
184+
{
185+
"match": "(:=|<-|<<-|->|->>)",
182186
"name": "keyword.operator.assignment.r"
183187
},
184188
{
185-
"match": "(==|!=|<>|<|>|<=|>=)",
189+
"match": "(!=|<>|<|>|<=|>=|%in%)",
186190
"name": "keyword.operator.comparison.r"
187191
},
188192
{
189193
"match": "(!|&{1,2}|[|]{1,2})",
190194
"name": "keyword.operator.logical.r"
191195
},
192196
{
193-
"match": "(%in%|:=|%between%|%chin%|%like%|%\\+%|%\\+replace%|%:%|%do%|%dopar%|%>%|%<>%|%T>%|%\\$%)",
197+
"match": "(%between%|%chin%|%like%|%\\+%|%\\+replace%|%:%|%do%|%dopar%|%>%|%<>%|%T>%|%\\$%)",
194198
"name": "keyword.operator.other.r"
195199
},
196200
{
@@ -337,7 +341,7 @@
337341
"function-declarations": {
338342
"patterns": [
339343
{
340-
"begin": "^\\s*([a-zA-Z0-9._:]*)\\s*(<<?-|=)\\s*(?=function\\s*\\()",
344+
"begin": "^\\s*([a-zA-Z._][\\w.:]*)\\s*(<<?-|=)\\s*(?=function\\s*\\()",
341345
"beginCaptures": {
342346
"1": {
343347
"name": "entity.name.function.r"
@@ -349,7 +353,7 @@
349353
"name": "keyword.control.r"
350354
}
351355
},
352-
"end": "",
356+
"end": "(?<=\\))",
353357
"name": "meta.function.r",
354358
"patterns": [
355359
{
@@ -384,7 +388,7 @@
384388
"include": "#comments"
385389
},
386390
{
387-
"match": "(?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`)",
391+
"match": "(?:[a-zA-Z._][\\w.]*|`[^`]+`)",
388392
"name": "variable.parameter.r"
389393
},
390394
{
@@ -405,7 +409,7 @@
405409
]
406410
},
407411
"function-calls": {
408-
"begin": "(?:\\b|(?=\\.))((?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`))\\s*(\\()",
412+
"begin": "(?:\\b|(?=\\.))((?:[a-zA-Z._][\\w.]*|`[^`]+`))\\s*(\\()",
409413
"beginCaptures": {
410414
"1": {
411415
"name": "variable.function.r"
@@ -435,7 +439,7 @@
435439
"contentName": "meta.function-call.parameters.r"
436440
},
437441
{
438-
"match": "(?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`)(?=\\s[^=])",
442+
"match": "(?:[a-zA-Z._][\\w.]*|`[^`]+`)(?=\\s[^=])",
439443
"name": "variable.parameter.r"
440444
},
441445
{
@@ -483,7 +487,7 @@
483487
"name": "variable.parameter.r"
484488
}
485489
},
486-
"match": "(@param)\\s*((?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`))"
490+
"match": "(@param)\\s*((?:[a-zA-Z._][\\w.]*|`[^`]+`))"
487491
},
488492
{
489493
"match": "@[a-zA-Z0-9]+",

extensions/r/test/colorize-results/test_r.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
},
354354
{
355355
"c": "function",
356-
"t": "source.r meta.function.r keyword.control.r",
356+
"t": "source.r meta.function.r meta.function.r keyword.control.r",
357357
"r": {
358358
"dark_plus": "keyword.control: #C586C0",
359359
"light_plus": "keyword.control: #AF00DB",
@@ -364,7 +364,7 @@
364364
},
365365
{
366366
"c": "(",
367-
"t": "source.r meta.function.r punctuation.section.parens.begin.r",
367+
"t": "source.r meta.function.r meta.function.r punctuation.section.parens.begin.r",
368368
"r": {
369369
"dark_plus": "default: #D4D4D4",
370370
"light_plus": "default: #000000",
@@ -375,7 +375,7 @@
375375
},
376376
{
377377
"c": "x",
378-
"t": "source.r meta.function.r meta.function.parameters.r variable.parameter.r",
378+
"t": "source.r meta.function.r meta.function.r meta.function.parameters.r variable.parameter.r",
379379
"r": {
380380
"dark_plus": "variable: #9CDCFE",
381381
"light_plus": "variable: #001080",
@@ -386,7 +386,7 @@
386386
},
387387
{
388388
"c": ",",
389-
"t": "source.r meta.function.r meta.function.parameters.r punctuation.separator.parameters.r",
389+
"t": "source.r meta.function.r meta.function.r meta.function.parameters.r punctuation.separator.parameters.r",
390390
"r": {
391391
"dark_plus": "default: #D4D4D4",
392392
"light_plus": "default: #000000",
@@ -397,7 +397,7 @@
397397
},
398398
{
399399
"c": " ",
400-
"t": "source.r meta.function.r meta.function.parameters.r",
400+
"t": "source.r meta.function.r meta.function.r meta.function.parameters.r",
401401
"r": {
402402
"dark_plus": "default: #D4D4D4",
403403
"light_plus": "default: #000000",
@@ -408,7 +408,7 @@
408408
},
409409
{
410410
"c": "y",
411-
"t": "source.r meta.function.r meta.function.parameters.r variable.parameter.r",
411+
"t": "source.r meta.function.r meta.function.r meta.function.parameters.r variable.parameter.r",
412412
"r": {
413413
"dark_plus": "variable: #9CDCFE",
414414
"light_plus": "variable: #001080",
@@ -419,7 +419,7 @@
419419
},
420420
{
421421
"c": ")",
422-
"t": "source.r meta.function.r punctuation.section.parens.end.r",
422+
"t": "source.r meta.function.r meta.function.r punctuation.section.parens.end.r",
423423
"r": {
424424
"dark_plus": "default: #D4D4D4",
425425
"light_plus": "default: #000000",

0 commit comments

Comments
 (0)