Skip to content

Commit 93451f2

Browse files
committed
Fix string interpolation syntax
1 parent 0ae3daa commit 93451f2

File tree

2 files changed

+54
-100
lines changed

2 files changed

+54
-100
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "vscode-erg",
44
"description": "Erg language support for Visual Studio Code",
55
"publisher": "erg-lang",
6-
"version": "0.1.5",
6+
"version": "0.1.6",
77
"engines": {
88
"vscode": "^1.70.0"
99
},

syntaxes/erg.tmLanguage.json

Lines changed: 53 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"interpolated": {
171171
"patterns": [
172172
{
173-
"begin": "\\{",
173+
"begin": "\\\\\\{",
174174
"beginCaptures": {
175175
"0": {
176176
"name": "punctuation.section.embedded.begin.erg"
@@ -199,7 +199,7 @@
199199
"nest_curly_and_self": {
200200
"patterns": [
201201
{
202-
"begin": "\\{",
202+
"begin": "\\\\\\{",
203203
"captures": {
204204
"0": {
205205
"name": "punctuation.section.scope.erg"
@@ -532,62 +532,11 @@
532532
"name": "string.quoted.triple.double.erg",
533533
"comment": "multi-line string with triple double quotes",
534534
"patterns": [
535-
{
536-
"include": "#string_escaped_char"
537-
}
538-
]
539-
},
540-
{
541-
"begin": "(fmt) *(\"\"\")",
542-
"beginCaptures": {
543-
"1": {
544-
"name": "support.function.builtin.erg"
545-
},
546-
"2": {
547-
"name": "punctuation.definition.string.multiline.begin.erg"
548-
}
549-
},
550-
"end": "\"\"\"",
551-
"endCaptures": {
552-
"0": {
553-
"name": "punctuation.definition.string.multiline.end.erg"
554-
}
555-
},
556-
"name": "string.formatted.quoted.triple.double.erg",
557-
"comment": "formatted multi-line string with triple double quotes",
558-
"patterns": [
559-
{
560-
"include": "#string_escaped_char"
561-
},
562535
{
563536
"include": "#interpolated"
564-
}
565-
]
566-
},
567-
{
568-
"name": "string.formatted.quoted.double.erg",
569-
"begin": "(fmt) *(\")",
570-
"beginCaptures": {
571-
"1": {
572-
"name": "support.function.builtin.erg"
573537
},
574-
"2": {
575-
"name": "punctuation.definition.string.begin.erg"
576-
}
577-
},
578-
"end": "\"",
579-
"endCaptures": {
580-
"0": {
581-
"name": "punctuation.definition.string.end.erg"
582-
}
583-
},
584-
"comment": "String with single pair of double quotes. Regex matches isolated double quote",
585-
"patterns": [
586538
{
587539
"include": "#string_escaped_char"
588-
},
589-
{
590-
"include": "#interpolated"
591540
}
592541
]
593542
},
@@ -607,6 +556,9 @@
607556
},
608557
"comment": "String with single pair of double quotes. Regex matches isolated double quote",
609558
"patterns": [
559+
{
560+
"include": "#interpolated"
561+
},
610562
{
611563
"include": "#string_escaped_char"
612564
}
@@ -645,8 +597,7 @@
645597
}
646598
},
647599
"name": "source.other.raw.erg",
648-
"patterns": [
649-
]
600+
"patterns": []
650601
},
651602
"symbolized-operator": {
652603
"patterns": [
@@ -713,25 +664,25 @@
713664
}
714665
},
715666
"procedural": {
716-
"patterns": [
667+
"patterns": [
717668
{
718669
"name": "support.function.procedural.builtin.erg",
719670
"match": "(dir!|for!|globals!|id!|if!|input!|locals!|open!|match!|print!|while!|with!)"
720671
},
721-
{
722-
"name": "constant.other.procedural.erg",
723-
"match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
724-
"captures": {
725-
"2": {
726-
"name": "entity.name.function.procedural.erg"
727-
},
728-
"3": {
729-
"name": "entity.name.type.procedural.erg"
730-
}
731-
}
732-
}
733-
]
734-
},
672+
{
673+
"name": "constant.other.procedural.erg",
674+
"match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
675+
"captures": {
676+
"2": {
677+
"name": "entity.name.function.procedural.erg"
678+
},
679+
"3": {
680+
"name": "entity.name.type.procedural.erg"
681+
}
682+
}
683+
}
684+
]
685+
},
735686
"type_decl": {
736687
"patterns": [
737688
{
@@ -752,39 +703,42 @@
752703
]
753704
},
754705
"special-variables": {
755-
"match": "(?x)\n \\b (?<!\\.) (?:\n (self) | (cls) | (do)\n )\\b\n",
756-
"captures": {
757-
"1": {
758-
"name": "variable.language.special.self.python"
759-
},
760-
"2": {
761-
"name": "variable.language.special.cls.python"
762-
},
706+
"match": "(?x)\n \\b (?<!\\.) (?:\n (Self) | (self) | (cls) | (do)\n )\\b\n",
707+
"captures": {
708+
"1": {
709+
"name": "variable.language.special.self.type.erg"
710+
},
711+
"2": {
712+
"name": "variable.language.special.self.erg"
713+
},
763714
"3": {
764-
"name": "variable.language.special.do.python"
715+
"name": "variable.language.special.cls.erg"
716+
},
717+
"4": {
718+
"name": "variable.language.special.do.erg"
765719
}
766-
}
767-
},
720+
}
721+
},
768722
"builtin-exceptions": {
769-
"name": "support.type.exception.erg",
770-
"match": "(?x) (?<!\\.) \\b(\n (\n Arithmetic | Assertion | Attribute | Buffer | BlockingIO\n | BrokenPipe | ChildProcess\n | (Connection (Aborted | Refused | Reset)?)\n | EOF | Environment | FileExists | FileNotFound\n | FloatingPoint | IO | Import | Indentation | Index | Interrupted\n | IsADirectory | NotADirectory | Permission | ProcessLookup\n | Timeout\n | Key | Lookup | Memory | Name | NotImplemented | OS | Overflow\n | Reference | Runtime | Recursion | Syntax | System\n | Tab | Type | UnboundLocal | Unicode(Encode|Decode|Translate)?\n | Value | Windows | ZeroDivision | ModuleNotFound\n ) Error\n|\n ((Pending)?Deprecation | Runtime | Syntax | User | Future | Import\n | Unicode | Bytes | Resource\n )? Warning\n|\n SystemExit | Stop(Async)?Iteration\n | KeyboardInterrupt\n | GeneratorExit | (Base)?Exception\n)\\b\n"
771-
},
772-
"builtin-functions": {
773-
"patterns": [
774-
{
775-
"name": "support.function.builtin.erg",
776-
"match": "(?x)\n (?<!\\.) \\b(\n __import__ | abs | all | any | ascii | assert | bin | breakpoint | callable\n | chr | compile | copyright | credits | delattr | dir | discard | divmod\n | enumerate | eval | exec | exit | filter | format | getattr\n | globals | hasattr | hash | help | hex | if | import\n | isinstance | issubclass | iter | len | license | locals | log | map\n | match | max | memoryview | min | next | not | oct | open | ord | pow | pyimport\n | quit | range | reload | repr | reversed | round\n | setattr | sorted | sum | vars | zip | Class | Del | Trait | Inheritable | Inherit | Patch | Structural | Subsume\n )\\b\n"
777-
},
778-
{
779-
"name": "variable.legacy.builtin.erg",
780-
"match": "(?x)\n (?<!\\.) \\b(\n file | reduce | intern | raw_input | unicode | cmp | basestring\n | execfile | long | xrange\n )\\b\n"
781-
}
782-
]
783-
},
723+
"name": "support.type.exception.erg",
724+
"match": "(?x) (?<!\\.) \\b(\n (\n Arithmetic | Assertion | Attribute | Buffer | BlockingIO\n | BrokenPipe | ChildProcess\n | (Connection (Aborted | Refused | Reset)?)\n | EOF | Environment | FileExists | FileNotFound\n | FloatingPoint | IO | Import | Indentation | Index | Interrupted\n | IsADirectory | NotADirectory | Permission | ProcessLookup\n | Timeout\n | Key | Lookup | Memory | Name | NotImplemented | OS | Overflow\n | Reference | Runtime | Recursion | Syntax | System\n | Tab | Type | UnboundLocal | Unicode(Encode|Decode|Translate)?\n | Value | Windows | ZeroDivision | ModuleNotFound\n ) Error\n|\n ((Pending)?Deprecation | Runtime | Syntax | User | Future | Import\n | Unicode | Bytes | Resource\n )? Warning\n|\n SystemExit | Stop(Async)?Iteration\n | KeyboardInterrupt\n | GeneratorExit | (Base)?Exception\n)\\b\n"
725+
},
726+
"builtin-functions": {
727+
"patterns": [
728+
{
729+
"name": "support.function.builtin.erg",
730+
"match": "(?x)\n (?<!\\.) \\b(\n __import__ | abs | all | any | ascii | assert | bin | breakpoint | callable\n | chr | compile | copyright | credits | delattr | dir | discard | divmod\n | enumerate | eval | exec | exit | filter | format | getattr\n | globals | hasattr | hash | help | hex | if | import\n | isinstance | issubclass | iter | len | license | locals | log | map\n | match | max | memoryview | min | next | not | oct | open | ord | pow | pyimport\n | quit | range | reload | repr | reversed | round\n | setattr | sorted | sum | vars | zip | Class | Del | Trait | Inheritable | Inherit | Patch | Structural | Subsume\n )\\b\n"
731+
},
732+
{
733+
"name": "variable.legacy.builtin.erg",
734+
"match": "(?x)\n (?<!\\.) \\b(\n file | reduce | intern | raw_input | unicode | cmp | basestring\n | execfile | long | xrange\n )\\b\n"
735+
}
736+
]
737+
},
784738
"builtin-types": {
785-
"name": "support.type.erg",
786-
"match": "(?x)\n (?<!\\.) \\b(\n Array | Bool | ByteArray | Bytes | ClassType | ClassMethod | Complex | Dict\n | Float | FrozenSet | Int | Nat | Never | NoneType | Object | Property | Ratio\n | Set | Slice | StaticMethod | Str | Tuple | TraitType | Type\n\n (?# Although 'super' is not a type, it's related to types,\n and is special enough to be highlighted differently from\n other built-ins)\n | super\n )\\b\n"
787-
}
739+
"name": "support.type.erg",
740+
"match": "(?x)\n (?<!\\.) \\b(\n Array | Bool | ByteArray | Bytes | ClassType | ClassMethod | Complex | Dict\n | Float | FrozenSet | Int | Nat | Never | NoneType | Object | Property | Ratio\n | Set | Slice | StaticMethod | Str | Tuple | TraitType | Type\n\n (?# Although 'super' is not a type, it's related to types,\n and is special enough to be highlighted differently from\n other built-ins)\n | super\n )\\b\n"
741+
}
788742
},
789743
"scopeName": "source.erg"
790744
}

0 commit comments

Comments
 (0)