Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions grammars/csharp.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1055,14 +1055,14 @@
<key>begin</key>
<string>(?=\benum\b)</string>
<key>end</key>
<string>(?&lt;=\})</string>
<string>(?&lt;=\})|(?=;)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?=enum)</string>
<key>end</key>
<string>(?=\{)</string>
<string>(?=\{)|(?=;)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -1190,7 +1190,7 @@
<key>begin</key>
<string>(?=\binterface\b)</string>
<key>end</key>
<string>(?&lt;=\})</string>
<string>(?&lt;=\})|(?=;)</string>
<key>patterns</key>
<array>
<dict>
Expand All @@ -1212,7 +1212,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=\{)</string>
<string>(?=\{)|(?=;)</string>
<key>patterns</key>
<array>
<dict>
Expand Down
8 changes: 4 additions & 4 deletions grammars/csharp.tmLanguage.cson
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,11 @@ repository:
]
"enum-declaration":
begin: "(?=\\benum\\b)"
end: "(?<=\\})"
end: "(?<=\\})|(?=;)"
patterns: [
{
begin: "(?=enum)"
end: "(?=\\{)"
end: "(?=\\{)|(?=;)"
patterns: [
{
include: "#comment"
Expand Down Expand Up @@ -758,7 +758,7 @@ repository:
]
"interface-declaration":
begin: "(?=\\binterface\\b)"
end: "(?<=\\})"
end: "(?<=\\})|(?=;)"
patterns: [
{
begin: '''
Expand All @@ -771,7 +771,7 @@ repository:
name: "storage.type.interface.cs"
"2":
name: "entity.name.type.interface.cs"
end: "(?=\\{)"
end: "(?=\\{)|(?=;)"
patterns: [
{
include: "#comment"
Expand Down
8 changes: 4 additions & 4 deletions src/csharp.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ repository:

enum-declaration:
begin: (?=\benum\b)
end: (?<=\})
end: (?<=\})|(?=;)
patterns:
- begin: (?=enum)
end: (?=\{)
end: (?=\{)|(?=;)
patterns:
- include: '#comment'
- match: (enum)\s+(@?[_[:alpha:]][_[:alnum:]]*)
Expand Down Expand Up @@ -375,7 +375,7 @@ repository:

interface-declaration:
begin: (?=\binterface\b)
end: (?<=\})
end: (?<=\})|(?=;)
patterns:
- begin: |-
(?x)
Expand All @@ -384,7 +384,7 @@ repository:
beginCaptures:
'1': { name: storage.type.interface.cs }
'2': { name: entity.name.type.interface.cs }
end: (?=\{)
end: (?=\{)|(?=;)
patterns:
- include: '#comment'
- include: '#type-parameter-list'
Expand Down
11 changes: 11 additions & 0 deletions test/enum.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ describe("Enums", () => {
Token.Punctuation.CloseBrace]);
});

it("enum with no body", async () => {

const input = `enum E;`;
const tokens = await tokenize(input);

tokens.should.deep.equal([
Token.Keyword.Definition.Enum,
Token.Identifier.EnumName("E"),
Token.Punctuation.Semicolon]);
});

it("enum with base type", async () => {

const input = `enum E : byte { }`;
Expand Down
11 changes: 11 additions & 0 deletions test/interface.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ describe("Interfaces", () => {
Token.Punctuation.CloseBrace]);
});

it("interface with no body", async () => {

const input = `interface IFoo;`;
const tokens = await tokenize(input);

tokens.should.deep.equal([
Token.Keyword.Definition.Interface,
Token.Identifier.InterfaceName("IFoo"),
Token.Punctuation.Semicolon]);
});

it("interface inheritance", async () => {

const input = `
Expand Down