Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brand new TextMate grammar for providing C# syntax highlighting #1115

Merged
merged 138 commits into from
Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
cae9cfe
Start new C# grammar with comments, type names, and using directives
DustinCampbell Dec 26, 2016
6c65c7e
Add extern aliases
DustinCampbell Dec 26, 2016
df59ed0
Add basic attribute support
DustinCampbell Dec 26, 2016
3f5b10b
String literals
DustinCampbell Dec 26, 2016
1887e71
Add attribute named arguments
DustinCampbell Dec 26, 2016
c5831f6
Add namespace declarations
DustinCampbell Dec 26, 2016
8a242d4
Refine using directives a bit
DustinCampbell Dec 26, 2016
839b76d
Add class declarations
DustinCampbell Dec 27, 2016
6b258ee
Add interface declarations
DustinCampbell Dec 27, 2016
30bcf56
Refactor test infrastructure a bit and improve test performance by 2X
DustinCampbell Dec 27, 2016
6a23de3
Split type-declaration into class-declaration and interface-declaration
DustinCampbell Dec 27, 2016
973adf2
Add struct declarations
DustinCampbell Dec 27, 2016
cbc65f9
Add enum declarations
DustinCampbell Dec 27, 2016
2af4bf2
Add delegate declarations
DustinCampbell Dec 27, 2016
d0ecb1a
Add field declarations
DustinCampbell Dec 27, 2016
c9e65f5
Add property declarations
DustinCampbell Dec 27, 2016
7a4d60b
Allow muliple declarators in field declarations
DustinCampbell Dec 27, 2016
b18805c
Add event declarations
DustinCampbell Dec 27, 2016
28008bc
Refine field declarations
DustinCampbell Dec 27, 2016
47e7a22
Refine property declarations
DustinCampbell Dec 27, 2016
e6c0532
Add indexer declarations
DustinCampbell Dec 27, 2016
e406840
Add interpolated strings
DustinCampbell Dec 28, 2016
b5c61eb
Refactor tests a bit
DustinCampbell Dec 28, 2016
2c2a8cb
A bit more refactoring of tests
DustinCampbell Dec 28, 2016
fc096de
Add a few more numeric literal tests
DustinCampbell Dec 28, 2016
81ba982
Refine interpolated strings and escaped braces
DustinCampbell Dec 28, 2016
7a2b7fc
Update TODO list for declarations
DustinCampbell Dec 28, 2016
f6e7212
Refine type name regular expressions a bit more
DustinCampbell Dec 28, 2016
ed44f41
Add method declarations
DustinCampbell Dec 28, 2016
04f8754
Add return statement and a handful of operators
DustinCampbell Dec 28, 2016
02bb1e9
Add a way to tokenize specific bits of code in tests
DustinCampbell Dec 28, 2016
541464f
Update a couple tests
DustinCampbell Dec 28, 2016
98a1240
Stop testing token line/column
DustinCampbell Dec 28, 2016
57bf1bf
Test only the parts that matter
DustinCampbell Dec 28, 2016
20aa1f5
Rename csharp2.json to csharp-new.json
DustinCampbell Dec 28, 2016
9f90808
Further test clean up
DustinCampbell Dec 28, 2016
5588e5b
Add while and do..while loops
DustinCampbell Dec 28, 2016
ffe5396
Rename file
DustinCampbell Dec 28, 2016
6710e7e
Shorten names for a few oft-used tokens
DustinCampbell Dec 28, 2016
90bd717
Add tuple types
DustinCampbell Dec 31, 2016
30dd20c
Add support for alias-qualified names
DustinCampbell Jan 3, 2017
c293861
Add support for constructors
DustinCampbell Jan 3, 2017
3ebbb0c
Add support for destructors
DustinCampbell Jan 3, 2017
2c9ee01
Add support for operator declarations
DustinCampbell Jan 3, 2017
b782dce
Add support for conversion operators
DustinCampbell Jan 3, 2017
b81b894
Add support for verbatim string literals
DustinCampbell Jan 3, 2017
9105b28
Add support for explicitly-implemented interface methods
DustinCampbell Jan 4, 2017
673044d
Add support for explicitly-implemented interface indexers
DustinCampbell Jan 4, 2017
8814cf6
Add support for explicitly-implemented interface properties and events
DustinCampbell Jan 4, 2017
1ad05ee
Add support for interface members
DustinCampbell Jan 4, 2017
1b1c450
Move to YAML to make it easier to define grammar
DustinCampbell Jan 5, 2017
757b65b
Share match for 'base types'
DustinCampbell Jan 6, 2017
da284d3
Rename build.ts -> buildSyntax.ts and update npm commands
DustinCampbell Jan 6, 2017
dc293b5
Add support for constructor initializers
DustinCampbell Jan 6, 2017
ca07e82
Add support for labeled statements
DustinCampbell Jan 6, 2017
9fbf444
Add support for local variable declarations
DustinCampbell Jan 6, 2017
db74360
Add support for local constant declarations
DustinCampbell Jan 6, 2017
1999df6
Add support for if/else statements
DustinCampbell Jan 6, 2017
f6818cf
Add switch and goto statements
DustinCampbell Jan 6, 2017
8a1c309
Factor our return statements
DustinCampbell Jan 6, 2017
e1ff4d6
Factor out do and while statements
DustinCampbell Jan 6, 2017
20a0c8d
Add support for for statements
DustinCampbell Jan 6, 2017
58d7636
Add foreach statements
DustinCampbell Jan 6, 2017
586fd96
Add support for try statements with finally and catch clauses
DustinCampbell Jan 6, 2017
61c7d88
Remove syntaxes/csharp.tmLanguage since we build it
DustinCampbell Jan 6, 2017
d6cf67b
Add support for checked/unchecked statements and expressions
DustinCampbell Jan 6, 2017
ef31f10
Add support for lock statements
DustinCampbell Jan 6, 2017
4c489c3
Add support for using statements
DustinCampbell Jan 6, 2017
6ec599a
Add support for break, continue, throw and yield statements
DustinCampbell Jan 6, 2017
99b8dca
Factor out if and else statements
DustinCampbell Jan 6, 2017
6d8b187
Move TODO list into YAML file
DustinCampbell Jan 7, 2017
6408bca
Add support for invocation expressions
DustinCampbell Jan 7, 2017
df9ced1
Add support for element access expressions
DustinCampbell Jan 7, 2017
5573dc5
Add support for cast expressions
DustinCampbell Jan 7, 2017
2534ff3
Fix typo
DustinCampbell Jan 7, 2017
60271d1
Add regression test for issue #802
DustinCampbell Jan 7, 2017
7be2f67
Add regression tests for issue #816
DustinCampbell Jan 7, 2017
74ee310
Add regression test for issue #830
DustinCampbell Jan 7, 2017
487eb62
Fix #829 and add regression test
DustinCampbell Jan 7, 2017
d161564
Fix #861 and add regression test
DustinCampbell Jan 7, 2017
1ab9c08
Fix #1078 and add regression tests
DustinCampbell Jan 7, 2017
813b83e
Fix #1084 and add regression test
DustinCampbell Jan 7, 2017
b09b97e
Add regression test for #1084
DustinCampbell Jan 7, 2017
1b53e8d
Add regression test for issue #1097
DustinCampbell Jan 7, 2017
c49b733
Add regression test for issue #1108
DustinCampbell Jan 7, 2017
8eee866
Allow comments in more places
DustinCampbell Jan 7, 2017
75c7168
Add array creation expressions
DustinCampbell Jan 7, 2017
544d983
Add override and virtual modifiers
DustinCampbell Jan 7, 2017
c1c575d
Fix cast expressions
DustinCampbell Jan 7, 2017
e20b131
Add support for initializers and several more fixes
DustinCampbell Jan 7, 2017
553efe4
Add regression test for issue #1096
DustinCampbell Jan 7, 2017
4b17d8f
Revamp invocation, element access and member access expressions and a…
DustinCampbell Jan 7, 2017
212e5b7
Add support for preprocessor
DustinCampbell Jan 7, 2017
ff5455a
Add regression test for issue #731
DustinCampbell Jan 7, 2017
b4f1ab2
Add regression test for issue #225
DustinCampbell Jan 7, 2017
43cfbe9
Improve display of type declaration names with type parameters and al…
DustinCampbell Jan 7, 2017
6255ad9
Display built-in types as keywords
DustinCampbell Jan 7, 2017
80745b9
Big revamp of type name matching and support added for nullable type …
DustinCampbell Jan 8, 2017
3dca527
Add support for var in local variable declarations and foreach statem…
DustinCampbell Jan 9, 2017
b4e05bf
Add support for query expressions
DustinCampbell Jan 9, 2017
7475dd2
Add regression test for issue #1106 and fix enough to make it pass
DustinCampbell Jan 9, 2017
b337d17
Fix array suffixes for jagged arrays and multi-dimensional arrays wit…
DustinCampbell Jan 9, 2017
f4e7989
Fix several bugs
DustinCampbell Jan 9, 2017
2f93a87
Ensure preprocessor works in enum member lists
DustinCampbell Jan 9, 2017
3435be2
Refine queries a bit so that clauses are only matched inside a query
DustinCampbell Jan 9, 2017
5728dfe
Add unsafe storage modifier
DustinCampbell Jan 9, 2017
1a06b43
Add tests for lambda expression support
DustinCampbell Jan 9, 2017
c0ca262
Allow constructor initializers to have line break between : and this/…
DustinCampbell Jan 9, 2017
0496580
Add support for default expressions
DustinCampbell Jan 9, 2017
5861d0d
Consolidate statement tests
DustinCampbell Jan 9, 2017
616d6c7
Consolidate expression and literal tests
DustinCampbell Jan 9, 2017
e01afdb
Clean up several token types
DustinCampbell Jan 9, 2017
ae019da
Add support for anonymous methods
DustinCampbell Jan 10, 2017
78dae22
Add support for null coalescing operator
DustinCampbell Jan 10, 2017
a125c41
Add support for conditional operator
DustinCampbell Jan 10, 2017
9fdc7c9
Allow attributes on property and event accessors
DustinCampbell Jan 10, 2017
446395f
Choose different keyword name for 'operator' since 'keyword.other.ope…
DustinCampbell Jan 10, 2017
ac01c0a
Add support for XML doc comments by leveraging 'text.xml'
DustinCampbell Jan 10, 2017
39db070
Add regression test for issue #316
DustinCampbell Jan 10, 2017
e467be7
Handle XML doc comments rather than delegating to text.xml (so we can…
DustinCampbell Jan 10, 2017
6cda9f5
Add regression tests for issue #1091
DustinCampbell Jan 10, 2017
75a1c99
Switch to new grammar
DustinCampbell Jan 10, 2017
166995a
Add top-level methods and statements and fix issue with implicit lamb…
DustinCampbell Jan 10, 2017
3e3148b
Tweak tuple type rule slightly
DustinCampbell Jan 10, 2017
2024390
Add support for compound operators and 'this' keyword on extension me…
DustinCampbell Jan 10, 2017
057a854
Add support for nameof expressions
DustinCampbell Jan 10, 2017
8ebfdf8
Add support for null-conditional operator
DustinCampbell Jan 10, 2017
e214cdf
Tweak to anonymous object creation expressions
DustinCampbell Jan 10, 2017
2f3f41e
Add regression test for issue #268
DustinCampbell Jan 10, 2017
0b2b402
Add support for await expressions
DustinCampbell Jan 10, 2017
161ddf2
Tweak query expressions slightly
DustinCampbell Jan 10, 2017
28ff2cf
Add support for is and as casts
DustinCampbell Jan 10, 2017
3873cc6
Delete old grammar
DustinCampbell Jan 10, 2017
93b3b54
Remove third-party notice for old grammar
DustinCampbell Jan 10, 2017
8e868b6
Clean up syntax.md
DustinCampbell Jan 11, 2017
b0d0041
Add plist output to source control
DustinCampbell Jan 11, 2017
eed1bbe
Revert unintended changes in package.json
DustinCampbell Jan 11, 2017
47fb5c5
Remove 'meta.type.parameters.cs' name which causes tuple element name…
DustinCampbell Jan 11, 2017
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
40 changes: 0 additions & 40 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ expressly granted, whether by implication, estoppel or otherwise.
3. run-in-terminal version 0.0.2 (https://github.com/microsoft/run-in-terminal)
4. semver version 5.1.0 (https://github.com/npm/node-semver)
5. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped)
6. language-csharp version 0.11.0 (https://github.com/atom/language-csharp)

%% omnisharp-roslyn NOTICES AND INFORMATION BEGINS HERE
============================================================
Expand Down Expand Up @@ -123,42 +122,3 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
============================================================
END OF DefinitelyTyped NOTICES AND INFORMATION

%% language-csharp NOTICES AND INFORMATION BEGIN HERE
=========================================
Copyright (c) 2014 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This package was derived from a TextMate bundle located at
https://github.com/wintermi/csharp-tmbundle by Matthew Winter @wintermi and
Adam Lickel @lickel and distributed under the following license, located in
`README.markdown`:

This bundle is dual-licensed under MIT and GPL licenses.

- http://www.opensource.org/licenses/mit-license.php
- http://www.gnu.org/licenses/gpl.html

Use it, change it, fork it, sell it. Do what you will, but please leave the
author attribution.
=========================================
END OF language-csharp NOTICES AND INFORMATION
23 changes: 23 additions & 0 deletions buildSyntax.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as fs from 'fs';
import * as path from 'path';
import * as yaml from 'js-yaml';
import * as plist from 'plist';

function writePlistFile(grammar: any, fileName: string) {
const text = plist.build(grammar);
fs.writeFileSync(fileName, text, "utf8");
}

function readYaml(fileName: string) {
const text = fs.readFileSync(fileName, "utf8");
return yaml.safeLoad(text);
}

function buildGrammar() {
const tsGrammar = readYaml("syntaxes/csharp.tmLanguage.yml");

// Write csharp.tmLanguage
writePlistFile(tsGrammar, "syntaxes/csharp.tmLanguage");
}

buildGrammar();
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"main": "./out/src/main",
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -p ./ && gulp tslint",
"compile": "tsc -p ./ && gulp tslint && node ./out/buildSyntax.js",
"watch": "tsc -watch -p ./",
"test": "node ./node_modules/vscode/bin/test",
"test": "node ./node_modules/vscode/bin/test && mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
"build-syntax": "node ./out/buildSyntax.js",
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
"postinstall": "node ./node_modules/vscode/bin/install"
},
Expand All @@ -46,6 +47,7 @@
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/fs-extra": "0.0.35",
"@types/js-yaml": "^3.5.29",
"@types/mkdirp": "^0.3.29",
"@types/mocha": "^2.2.32",
"@types/node": "^6.0.40",
Expand All @@ -56,7 +58,9 @@
"gulp": "^3.9.1",
"gulp-mocha": "^2.1.3",
"gulp-tslint": "^4.3.0",
"js-yaml": "^3.7.0",
"mocha": "^2.3.3",
"plist": "^2.0.1",
"tslint": "^3.15.1",
"tslint-microsoft-contrib": "^2.0.12",
"typescript": "^2.0.3",
Expand Down Expand Up @@ -390,7 +394,7 @@
{
"language": "csharp",
"scopeName": "source.cs",
"path": "./syntaxes/csharp.json"
"path": "./syntaxes/csharp.tmLanguage"
}
],
"jsonValidation": [
Expand Down Expand Up @@ -1144,4 +1148,4 @@
}
]
}
}
}
Loading