diff --git a/syntaxes/csharp.json b/syntaxes/csharp.json index acf9f8488..4126156b0 100644 --- a/syntaxes/csharp.json +++ b/syntaxes/csharp.json @@ -74,11 +74,11 @@ "field-declaration": { "patterns": [ { - "begin": "(?=(?:(?:(?:private|public|volatile|internal|protected|static|readonly|const)\\s*)*)(?:[\\w\\s,<>\\[\\]]+?)(?:[\\w]+)\\s*(?:;|=|=>))", + "begin": "(?=(?:(?:(?:private|public|volatile|internal|protected|static|readonly|const|event)\\s*)*)(?:[\\w\\s,<>\\[\\]]+?)(?:[\\w]+)\\s*(?:;|=|=>))", "end": "(?=;)", "patterns": [ { - "match": "^\\s*((?:(?:private|public|volatile|internal|protected|static|readonly|const)\\s*)*)\\s*(.+?)\\s*([\\w]+)\\s*(?=;|=)", + "match": "^\\s*((?:(?:private|public|volatile|internal|protected|static|readonly|const|event)\\s*)*)\\s*(.+?)\\s*([\\w]+)\\s*(?=;|=)", "captures": { "1" : { "patterns": [ @@ -101,7 +101,7 @@ }, { "begin": "(?==>?)", - "end": "(?=;)", + "end": "(?=;|$)", "patterns": [ { "include": "#code" @@ -115,7 +115,7 @@ "variable": { "patterns": [ { - "match": "\\b(var)\\s+(.*?)(?=(=|;))", + "match": "^\\s*\\b(var)\\s+(.*?)(?=(=|;))", "captures": { "1": { "name": "keyword.other.var.cs" @@ -123,7 +123,7 @@ } }, { - "match": "\\b(?!var|return|yield|throw)([\\w<>*?\\[\\]]+)\\s+([\\w]+)\\s*(?=(=(?!=)|;))", + "match": "^\\s*\\b(?!var|return|yield|throw)([\\w<>*?\\[\\]]+)\\s+([\\w]+)\\s*(?=(=(?!=)|;))", "captures": { "1": { "name": "storage.type.variable.cs" @@ -167,7 +167,7 @@ "type": { "patterns": [ { - "match": "(\\w+\\s*<(?:[\\w\\s,\\.`\\[\\]\\*]+|\\g<1>)+>(?:\\s*\\[\\s*\\])?)", + "match": "([\\w\\.]+\\s*<(?:[\\w\\s,\\.`\\[\\]\\*]+|\\g<1>)+>(?:\\s*\\[\\s*\\])?)", "comment": "generic type", "captures": { "1": { @@ -176,7 +176,7 @@ } }, { - "match": "\\b([a-zA-Z]+[\\w]*\\b(?:\\s*\\[\\s*\\])?\\*?)", + "match": "\\b([a-zA-Z]+[\\w\\.]*\\b(?:\\s*\\[\\s*\\])?\\*?)", "comment": "non-generic type", "captures": { "1": { @@ -218,7 +218,7 @@ } ] }, - "class": { + "type-declaration": { "begin": "(?=\\w?[\\w\\s]*[^@]?(?:class|struct|interface|enum)\\s+\\w+)", "end": "}", "endCaptures": { @@ -288,12 +288,21 @@ }, "type-body": { "patterns": [ + { + "include": "type-declaration" + }, { "include": "#field-declaration" }, + { + "include": "#property-declaration" + }, { "include": "#method" }, + { + "include": "#storage-modifiers" + }, { "include": "#code" } @@ -308,7 +317,7 @@ "include": "#comments" }, { - "include": "#class" + "include": "#type-declaration" }, { "include": "#variable" @@ -375,15 +384,109 @@ } ] }, - "constants": { + "string-interpolated": { "patterns": [ { - "match": "\\b(true|false|null|this|base)\\b", - "name": "constant.language.cs" + "begin": "\\$\"", + "end": "\"|$", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "begin": "([^{}]+?)(?={|\"|$)", + "end": "(?={|\"|$)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.cs" + } + } + }, + { + "begin": "{", + "end": "}", + "name": "meta.interpolated.expression.cs", + "patterns":[ + { + "include":"#code" + } + ] + }, + { + "begin": "([^{}]+?)(?={|\"|$)", + "end": "(?={|\"|$)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.cs" + } + } + } + ] + } + ] + }, + "string-interpolated-verbatim": { + "patterns": [ + { + "begin": "\\$@\"", + "end": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cs" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cs" + } + }, + "patterns": [ + { + "begin": "([^{}]+?)(?={|\"|$)", + "end": "(?={|\"|$)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.literal.cs" + } + } + }, + { + "begin": "{", + "end": "}", + "name": "meta.interpolated.expression.cs", + "patterns":[ + { + "include":"#code" + } + ] + }, + { + "begin": "([^{}]+?)(?={|\"|$)", + "end": "(?={|\"|$)", + "beginCaptures": { + "1": { + "name": "string.quoted.double.literal.cs" + } + } + } + ] + } + ] + }, + "string": { + "patterns":[ + { + "include": "#string-interpolated-verbatim" }, { - "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b", - "name": "constant.numeric.cs" + "include": "#string-interpolated" }, { "captures": { @@ -438,6 +541,21 @@ } ] }, + "constants": { + "patterns": [ + { + "match": "\\b(true|false|null|this|base)\\b", + "name": "constant.language.cs" + }, + { + "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b", + "name": "constant.numeric.cs" + }, + { + "include": "#string" + } + ] + }, "keywords": { "patterns": [ { @@ -458,23 +576,64 @@ } ] }, - "method": { + "attribute": { + "begin": "\\[", + "end": "\\]", + "name": "meta.method.annotation.cs", "patterns": [ { - "begin": "\\[", - "end": "\\]", - "name": "meta.method.annotation.cs", - "patterns": [ - { - "include": "#constants" + "include": "#constants" + }, + { + "include": "#preprocessor" + }, + { + "include": "#builtinTypes" + } + ] + }, + "property-declaration": { + "begin": "^\\s*(?!.*\\b(?:class|interface|struct)\\b)((?:\\w+\\s+)*?)(?!(?:private|public|internal|protected|static|new|virtual|override))(\\w.+?)\\s+(\\w+)\\s*(?={|$)", + "end": "}|;|$", + "beginCaptures": { + "1" : { + "patterns": [ + { + "include": "#storage-modifiers" + } + ] }, - { - "include": "#preprocessor" + "2" : { + "patterns": [ + { + "include": "#type" + } + ] }, + "3": { + "name": "entity.name.function.cs" + } + }, + "name": "meta.property.cs", + "patterns": [ + { + "include": "#block" + }, + { + "begin": "=", + "end": "(?=;)", + "patterns":[ { - "include": "#builtinTypes" + "include": "#code" } ] + } + ] + }, + "method": { + "patterns": [ + { + "include": "attribute" }, { "begin": "(?=\\bnew\\s+)(?=[\\w<].*\\s+)(?=[^=]+\\()", @@ -573,106 +732,6 @@ ] } ] - }, - { - "begin": "(?!new)(?=[\\w<].*\\s+)(?=[^\\(]+=>)", - "end": ";", - "endCaptures": { - "0": { - "name": "punctuation.section.property.end.cs" - } - }, - "name": "meta.property.cs", - "patterns": [ - { - "include": "#storage-modifiers" - }, - { - "begin": "(?=([\\w.]+)\\s*=>)", - "captures": { - "1": { - "name": "entity.name.function.cs" - } - }, - "end": "(?==>)", - "name": "meta.method.identifier.cs" - }, - { - "begin": "(?=\\w.*\\s+[\\w.]+\\s*=>)", - "end": "(?=[\\w.]+\\s*=>)", - "name": "meta.method.return-type.cs", - "patterns": [ - { - "include": "#builtinTypes" - } - ] - }, - { - "begin": "=>", - "beginCaptures": { - "0": { - "name": "punctuation.section.property.begin.cs" - } - }, - "end": "(?=;)", - "name": "meta.method.body.cs", - "patterns": [ - { - "include": "#code" - } - ] - } - ] - }, - { - "begin": "(?!new)(?=[\\w<].*\\s+)(?=[^=\\(]+\\{)", - "end": "}", - "endCaptures": { - "0": { - "name": "punctuation.section.property.end.cs" - } - }, - "name": "meta.property.cs", - "patterns": [ - { - "include": "#storage-modifiers" - }, - { - "begin": "([\\w.]+)\\s*(?={)", - "captures": { - "1": { - "name": "entity.name.function.cs" - } - }, - "end": "(?={)", - "name": "meta.method.identifier.cs" - }, - { - "begin": "(?=\\w.*\\s+[\\w.]+\\s*\\{)", - "end": "(?=[\\w.]+\\s*\\{)", - "name": "meta.method.return-type.cs", - "patterns": [ - { - "include": "#builtinTypes" - } - ] - }, - { - "begin": "{", - "beginCaptures": { - "0": { - "name": "punctuation.section.property.begin.cs" - } - }, - "end": "(?=})", - "name": "meta.method.body.cs", - "patterns": [ - { - "include": "#code" - } - ] - } - ] } ] }, diff --git a/test/syntaxes/class.tests.ts b/test/syntaxes/class.tests.ts index c3b49a69f..cd95f9dd9 100644 --- a/test/syntaxes/class.tests.ts +++ b/test/syntaxes/class.tests.ts @@ -92,7 +92,7 @@ const input = ` namespace TestNamespace { class PublicClass : IInterface, IInterfaceTwo { } - class PublicClass : IInterface, IInterfaceTwo { } + class PublicClass : Root.IInterface, Something.IInterfaceTwo { } class PublicClass : Dictionary>, IMap> { } }`; let tokens: Token[] = TokenizerUtil.tokenize(input); @@ -104,8 +104,8 @@ namespace TestNamespace tokens.should.contain(Tokens.ClassKeyword("class", 5, 5)); tokens.should.contain(Tokens.ClassIdentifier("PublicClass", 5, 11)); - tokens.should.contain(Tokens.Type("IInterface", 5, 28)); - tokens.should.contain(Tokens.Type("IInterfaceTwo", 5, 43)); + tokens.should.contain(Tokens.Type("Root.IInterface", 5, 28)); + tokens.should.contain(Tokens.Type("Something.IInterfaceTwo", 5, 63)); tokens.should.contain(Tokens.Type("Dictionary>", 6, 28)); tokens.should.contain(Tokens.Type("IMap>", 6, 71)); @@ -141,7 +141,28 @@ namespace TestNamespace }); + it("nested class", function() { +const input = ` +namespace TestNamespace +{ + class Klass + { + public class Nested + { + + } + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.ClassKeyword("class", 4, 5)); + tokens.should.contain(Tokens.ClassIdentifier("Klass", 4, 11)); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 6, 9)); + tokens.should.contain(Tokens.ClassKeyword("class", 6, 16)); + tokens.should.contain(Tokens.ClassIdentifier("Nested", 6, 22)); + }); }); }); diff --git a/test/syntaxes/event.tests.ts b/test/syntaxes/event.tests.ts new file mode 100644 index 000000000..38a849fb9 --- /dev/null +++ b/test/syntaxes/event.tests.ts @@ -0,0 +1,45 @@ +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Event", function() { + it("declaration", function() { + +const input = ` +public class Tester +{ + public event Type Event; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); + tokens.should.contain(Tokens.Type("Type", 4, 18)); + tokens.should.contain(Tokens.EventIdentifier("Event", 4, 23)); + }); + + it("generic", function () { + + const input = ` +public class Tester +{ + public event EventHandler, Dictionary> Event; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.StorageModifierKeyword("event", 4, 12)); + tokens.should.contain(Tokens.Type("EventHandler, Dictionary>", 4, 18)); + tokens.should.contain(Tokens.EventIdentifier("Event", 4, 58)); + }); + }); +}); + + diff --git a/test/syntaxes/field.tests.ts b/test/syntaxes/field.tests.ts index abad029e1..dee1b2bd7 100644 --- a/test/syntaxes/field.tests.ts +++ b/test/syntaxes/field.tests.ts @@ -50,7 +50,8 @@ const input = ` public class Tester { private static readonly List _field; - readonly string _field; + readonly string _field2; + string _field3; }`; let tokens: Token[] = TokenizerUtil.tokenize(input); @@ -60,6 +61,10 @@ public class Tester tokens.should.contain(Tokens.StorageModifierKeyword("readonly", 4, 20)); tokens.should.contain(Tokens.Type("List", 4, 29)); tokens.should.contain(Tokens.FieldIdentifier("_field", 4, 34)); + + tokens.should.contain(Tokens.FieldIdentifier("_field2", 5, 21)); + + tokens.should.contain(Tokens.FieldIdentifier("_field3", 6, 12)); }); it("types", function() { @@ -94,7 +99,7 @@ public class Tester tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); tokens.should.contain(Tokens.Type("string", 4, 13)); tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); - tokens.should.contain(Tokens.StringQuoted("hello", 4, 29)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 29)); tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); tokens.should.contain(Tokens.Type("bool", 5, 13)); @@ -116,7 +121,7 @@ public class Tester tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 5)); tokens.should.contain(Tokens.Type("string", 4, 13)); tokens.should.contain(Tokens.FieldIdentifier("field", 4, 20)); - tokens.should.contain(Tokens.StringQuoted("hello", 4, 30)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 30)); tokens.should.contain(Tokens.StorageModifierKeyword("const", 5, 5)); tokens.should.contain(Tokens.Type("bool", 5, 13)); diff --git a/test/syntaxes/property.tests.ts b/test/syntaxes/property.tests.ts new file mode 100644 index 000000000..a7ad89745 --- /dev/null +++ b/test/syntaxes/property.tests.ts @@ -0,0 +1,133 @@ +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("Property", function() { + it("declaration", function() { + +const input = ` +class Tester +{ + public IBooom Property + { + get { return null; } + set { something = value; } + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 6, 9)); + tokens.should.contain(Tokens.Keyword("set", 7, 9)); + }); + + it("declaration single line", function() { + +const input = ` +class Tester +{ + public IBooom Property { get { return null; } private set { something = value; } } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 4, 30)); + tokens.should.contain(Tokens.StorageModifierKeyword("private", 4, 51)); + tokens.should.contain(Tokens.Keyword("set", 4, 59)); + }); + + + it("declaration without modifiers", function() { + +const input = ` +class Tester +{ + IBooom Property {get; set;} +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.Type("IBooom", 4, 5)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 12)); + }); + + it("auto-property single line", function() { + +const input = ` +class Tester +{ + public IBooom Property { get; set; } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 4, 30)); + tokens.should.contain(Tokens.Keyword("set", 4, 35)); + }); + + it("auto-property", function() { + +const input = ` +class Tester +{ + public IBooom Property + { + get; + set; + } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("IBooom", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 19)); + tokens.should.contain(Tokens.Keyword("get", 6, 9)); + tokens.should.contain(Tokens.Keyword("set", 7, 9)); + }); + + it("generic auto-property", function() { + +const input = ` +class Tester +{ + public Dictionary[]> Property { get; set; } +}`; + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); + tokens.should.contain(Tokens.Keyword("get", 4, 53)); + tokens.should.contain(Tokens.Keyword("set", 4, 58)); + }); + + it("auto-property initializer", function() { + +const input = ` +class Tester +{ + public Dictionary[]> Property { get; } = new Dictionary[]>(); +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StorageModifierKeyword("public", 4, 5)); + tokens.should.contain(Tokens.Type("Dictionary[]>", 4, 12)); + tokens.should.contain(Tokens.PropertyIdentifier("Property", 4, 42)); + tokens.should.contain(Tokens.Keyword("get", 4, 53)); + tokens.should.contain(Tokens.StorageModifierKeyword("new", 4, 62)); + }); + }); +}); + + diff --git a/test/syntaxes/string.tests.ts b/test/syntaxes/string.tests.ts new file mode 100644 index 000000000..fe58bb6f7 --- /dev/null +++ b/test/syntaxes/string.tests.ts @@ -0,0 +1,123 @@ +import { should } from 'chai'; +import { Tokens, Token } from './utils/tokenizer'; +import { TokenizerUtil } from'./utils/tokenizerUtil'; + +describe("Grammar", function() { + before(function() { + should(); + }); + + describe("String interpolated", function() { + it("non-verbatim", function() { + +const input = ` +public class Tester +{ + string test = $"hello {one} world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello ", 4, 21)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 28)); + tokens.should.contain(Tokens.StringDoubleQuoted(" world ", 4, 32)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 40)); + tokens.should.contain(Tokens.StringDoubleQuoted("!", 4, 44)); + tokens.should.contain(Tokens.StringEnd('"', 4, 45)); + }); + + + it("non-verbatim without expressions single-line", function() { + +const input = ` +public class Tester +{ + string test = $"hello world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello world!", 4, 21)); + tokens.should.contain(Tokens.StringEnd('"', 4, 33)); + }); + + it("non-verbatim multi-line", function() { + +const input = ` +public class Tester +{ + string test = $"hello +world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuoted("hello", 4, 21)); + tokens.should.not.contain(Tokens.StringDoubleQuoted("world!", 5, 1)); + tokens.should.not.contain(Tokens.StringEnd('"', 5, 7)); + }); + + + it("verbatim single-line", function() { + +const input = ` +public class Tester +{ + string test = $@"hello {one} world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 4, 33)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 4, 41)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 4, 45)); + tokens.should.contain(Tokens.StringEnd('"', 4, 46)); + }); + + + it("verbatim multi-line", function() { + +const input = ` +public class Tester +{ + string test = $@"hello {one} + world {two}!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello ", 4, 22)); + tokens.should.contain(Tokens.StringInterpolatedExpression("one", 4, 29)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world ", 5, 1)); + tokens.should.contain(Tokens.StringInterpolatedExpression("two", 5, 12)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("!", 5, 16)); + tokens.should.contain(Tokens.StringEnd('"', 5, 17)); + }); + + it("verbatim multi-line without expressions", function() { + +const input = ` +public class Tester +{ + string test = $@"hello + world!"; +}`; + + let tokens: Token[] = TokenizerUtil.tokenize(input); + + tokens.should.contain(Tokens.StringStart('$@"', 4, 19)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim("hello", 4, 22)); + tokens.should.contain(Tokens.StringDoubleQuotedVerbatim(" world!", 5, 1)); + tokens.should.contain(Tokens.StringEnd('"', 5, 11)); + }); + }); +}); + + diff --git a/test/syntaxes/utils/tokenizer.ts b/test/syntaxes/utils/tokenizer.ts index e70b840e2..e49d2e3bf 100644 --- a/test/syntaxes/utils/tokenizer.ts +++ b/test/syntaxes/utils/tokenizer.ts @@ -82,9 +82,27 @@ export namespace Tokens { export const FieldIdentifier = (text: string, line?: number, column?: number) => createToken(text, "entity.name.variable.cs", line, column); - export const StringQuoted = (text: string, line?: number, column?: number) => + export const StringDoubleQuoted = (text: string, line?: number, column?: number) => createToken(text, "string.quoted.double.cs", line, column); + export const StringDoubleQuotedVerbatim = (text: string, line?: number, column?: number) => + createToken(text, "string.quoted.double.literal.cs", line, column); + + export const EventIdentifier = (text: string, line?: number, column?: number) => + createToken(text, "entity.name.variable.cs", line, column); + export const LanguageConstant = (text: string, line?: number, column?: number) => createToken(text, "constant.language.cs", line, column); + + export const PropertyIdentifier = (text: string, line?: number, column?: number) => + createToken(text, "entity.name.function.cs", line, column); + + export const StringInterpolatedExpression = (text: string, line?: number, column?: number) => + createToken(text, "meta.interpolated.expression.cs", line, column); + + export const StringStart = (text: string, line?: number, column?: number) => + createToken(text, "punctuation.definition.string.begin.cs", line, column); + + export const StringEnd = (text: string, line?: number, column?: number) => + createToken(text, "punctuation.definition.string.end.cs", line, column); }