forked from alecthomas/chroma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refinement of the C# lexer (alecthomas#563)
- Loading branch information
Showing
17 changed files
with
197 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
#nullable enable | ||
|
||
public struct Student | ||
{ | ||
public string FirstName; | ||
public string? MiddleName; | ||
public string LastName; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[ | ||
{"type":"Keyword","value":"using"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameNamespace","value":"System"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"CommentPreproc","value":"#nullable enable"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"struct"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameClass","value":"Student"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"FirstName"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string?"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"MiddleName"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"LastName"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"}"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public record Person(string FirstName, string LastName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"record"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameClass","value":"Person"}, | ||
{"type":"Punctuation","value":"("}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"FirstName"}, | ||
{"type":"Punctuation","value":","}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"LastName"}, | ||
{"type":"Punctuation","value":");"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public record Person | ||
{ | ||
public string FirstName { get; init; } = default!; | ||
public string LastName { get; init; } = default!; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[ | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"record"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameClass","value":"Person"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"FirstName"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"get"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"init"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"default"}, | ||
{"type":"Punctuation","value":"!;"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"KeywordType","value":"string"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"LastName"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"get"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"init"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"="}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"default"}, | ||
{"type":"Punctuation","value":"!;"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"};"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
Hello World | ||
*/ | ||
|
||
/*** | ||
* Hello Developer | ||
***/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{"type":"CommentMultiline","value":"/*\n Hello World\n*/"}, | ||
{"type":"Text","value":"\n\n"}, | ||
{"type":"CommentMultiline","value":"/***\n* Hello Developer\n***/"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// TODO: Maybe later | ||
// TODO: Implement more features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{"type":"CommentSingle","value":"// TODO: Maybe later"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"CommentSingle","value":"// TODO: Implement more features"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <summary> | ||
/// Class <c>Point</c> models a point in a two-dimensional plane. | ||
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{"type":"CommentSpecial","value":"/// \u003csummary\u003e"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"CommentSpecial","value":"/// Class \u003cc\u003ePoint\u003c/c\u003e models a point in a two-dimensional plane."}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"CommentSpecial","value":"/// \u003c/summary\u003e"} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public interface IOrder | ||
{ | ||
DateTime Purchased { get; } | ||
decimal Cost { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[ | ||
{"type":"Keyword","value":"public"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"interface"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"NameClass","value":"IOrder"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"Name","value":"DateTime"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Purchased"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"get"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"Text","value":"\n "}, | ||
{"type":"KeywordType","value":"decimal"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Name","value":"Cost"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"{"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Keyword","value":"get"}, | ||
{"type":"Punctuation","value":";"}, | ||
{"type":"Text","value":" "}, | ||
{"type":"Punctuation","value":"}"}, | ||
{"type":"Text","value":"\n"}, | ||
{"type":"Punctuation","value":"}"} | ||
] |