Add rudimentary Sublime Text 3 syntax highlighting

Users can install the grammar by adding the files to their
`%AppData%\Roaming\Sublime Text 3\Packages\User` folder.
It's fairly simplistic, but should be a decent start.
This commit is contained in:
Rob Rodi 2015-01-27 19:11:13 -08:00 коммит произвёл Adam Sapek
Родитель 0452c662b0
Коммит 73630c7dc7
3 изменённых файлов: 260 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,88 @@
//# [PackageDev] target_format: plist, ext: tmLanguage
{
"name": "Bond",
"scopeName": "source.bond",
"fileTypes": ["bond"],
"patterns": [
{ "include": "#commonStuff" },
{
"match": "^(namespace)\\s+(.+)$",
"name": "meta.namespace.source.cs",
"captures": {
"1": { "name": "keyword.other.namespace.source.bond" },
"2": { "name": "storage.type.bond" },
}
},
{
"match": "^import\\s+",
"name": "keyword.other.import.source.bond"
},
// ENUM
{
"begin": "(enum)\\s+(.+)$",
"name": "meta.enum.source.bond",
"captures": {
"1": { "name": "keyword.other.enum.source.bond" },
"2": { "name": "storage.type.source.enum.bond" }
},
"patterns": [
{ "include": "#commonStuff" },
{
"match": "^\\s*([^\\s]*)\\s",
"name": "entity.name.type.enum.value.bond",
"captures": {
"1": { "name": "entity.name.bond" }
}
}
],
"end":"\\}"
},
// STRUCT
{
"begin": "(struct)\\s+(.+)",
"name": "meta.struct.source.bond",
"captures": {
"1": { "name": "keyword.other.struct.source.bond" },
"2": { "name": "storage.type.source.struct.bond" }
},
"patterns":[
{
"name": "constant.numeric.bond",
"match":"^\\s*(\\d+)"
},
{ "include": "#commonStuff" }
],
"end": "\\}"
}
],
"repository": {
"commonStuff": {
"patterns": [
{
"match": "u?int(8|16|32|64)|double|bool|wstring|map|set|vector|nullable",
"name": "constant.language.source"
},
{
"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.bond"
},
{
"match": "\\b(true|false|nothing)\\b",
"name": "constant.language.source"
},
{
"match": "//.+",
"name": "comment.line.double-slash.bond"
},
{
"match": "\"[^\"]+\"",
"name": "string.quoted.double.source.cs"
}
]
}
},
"uuid": "d902f5e0-8df4-4bd1-b0e8-e5915501d0cc"
}

Просмотреть файл

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>bond</string>
</array>
<key>name</key>
<string>Bond</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#commonStuff</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.namespace.source.bond</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.bond</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.type.namespace.source.bond</string>
</dict>
</dict>
<key>match</key>
<string>^(namespace)\s+(cpp|csharp) (.+)$</string>
<key>name</key>
<string>meta.namespace.source.cs</string>
</dict>
<dict>
<key>match</key>
<string>^import\s+</string>
<key>name</key>
<string>keyword.other.import.source.bond</string>
</dict>
<dict>
<key>begin</key>
<string>(enum)\s+(.+)$</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.enum.source.bond</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.source.enum.bond</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>meta.enum.source.bond</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#commonStuff</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.bond</string>
</dict>
</dict>
<key>match</key>
<string>^\s*([^\s]*)\s</string>
<key>name</key>
<string>entity.name.type.enum.value.bond</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(struct)\s+(.+)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.struct.source.bond</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.source.struct.bond</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>meta.struct.source.bond</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>^\s*(\d+)</string>
<key>name</key>
<string>constant.numeric.bond</string>
</dict>
<dict>
<key>include</key>
<string>#commonStuff</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
<key>commonStuff</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>u?int(8|16|32|64)|double|bool|wstring|map|set|vector|nullable</string>
<key>name</key>
<string>constant.language.source</string>
</dict>
<dict>
<key>match</key>
<string>\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</string>
<key>name</key>
<string>constant.numeric.bond</string>
</dict>
<dict>
<key>match</key>
<string>\b(true|false|nothing)\b</string>
<key>name</key>
<string>constant.language.source</string>
</dict>
<dict>
<key>match</key>
<string>//.+</string>
<key>name</key>
<string>comment.line.double-slash.bond</string>
</dict>
<dict>
<key>match</key>
<string>"[^"]+"</string>
<key>name</key>
<string>string.quoted.double.source.cs</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.bond</string>
<key>uuid</key>
<string>d902f5e0-8df4-4bd1-b0e8-e5915501d0cc</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,4 @@
#Bond Syntax Highlighting for SublimeText
Install by adding to your user's directory
```%AppData%\Roaming\Sublime Text 3\Packages\User```