Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes enum check to pass regex tests, more syntax tests
- Loading branch information
Showing
2 changed files
with
136 additions
and
121 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 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 |
---|---|---|
@@ -1,200 +1,214 @@ | ||
/// SYNTAX TEST "Packages/Swift-for-f-ing-sublime/Swift.sublime-syntax" | ||
// SYNTAX TEST "Packages/Swift-for-f-ing-sublime/Swift.sublime-syntax" | ||
|
||
// comment | ||
/// ^ comment.line | ||
/// <- punctuation.definition.comment | ||
// ^ comment.line | ||
// <- punctuation.definition.comment | ||
|
||
// MARK: testing! | ||
/// ^ comment.line | ||
/// ^ punctuation.definition.comment | ||
/// ^ meta.toc-list | ||
// ^ comment.line | ||
// ^ punctuation.definition.comment | ||
// ^ meta.toc-list | ||
|
||
|
||
/* comment */ | ||
/// ^comment.block | ||
// ^comment.block | ||
/* 000 */ | ||
/// ^comment.block | ||
/// ^ comment - constant | ||
// ^comment.block | ||
// ^ comment - constant | ||
000 /* "string" */ | ||
/// <- -comment | ||
/// ^comment.block | ||
/// ^-string | ||
// <- -comment | ||
// ^comment.block | ||
// ^-string | ||
|
||
true | ||
/// <- constant.language | ||
/// <- constant.language.true | ||
// <- constant.language | ||
// <- constant.language.true | ||
false | ||
/// <- constant.language | ||
/// <- constant.language.false | ||
// <- constant.language | ||
// <- constant.language.false | ||
nil | ||
/// <- constant.language | ||
/// <- constant.language.nil | ||
// <- constant.language | ||
// <- constant.language.nil | ||
|
||
1.1 100.001 | ||
/// <- constant.numeric | ||
/// <- constant.numeric.float | ||
/// ^ constant.numeric | ||
/// ^ source.swift | ||
// <- constant.numeric | ||
// <- constant.numeric.float | ||
// ^ constant.numeric | ||
// ^ source.swift | ||
100 | ||
/// <- constant.numeric | ||
/// <- constant.numeric.decimal | ||
// <- constant.numeric | ||
// <- constant.numeric.decimal | ||
1_000_000 | ||
/// ^ constant.numeric.decimal | ||
// ^ constant.numeric.decimal | ||
0xDEADBEEF | ||
/// <- constant.numeric.hexadecimal | ||
/// ^ constant.numeric.hexadecimal | ||
// <- constant.numeric.hexadecimal | ||
// ^ constant.numeric.hexadecimal | ||
0xGGGGG | ||
/// ^ -constant.numeric.hexadecimal | ||
// ^ -constant.numeric.hexadecimal | ||
0o12345670 | ||
/// <- constant.numeric.octal | ||
/// ^ constant.numeric.octal | ||
// <- constant.numeric.octal | ||
// ^ constant.numeric.octal | ||
0o8888 | ||
/// ^ -constant.numeric.octal | ||
// ^ -constant.numeric.octal | ||
0b01010110101 | ||
/// <- constant.numeric.binary | ||
/// ^ constant.numeric.binary | ||
// <- constant.numeric.binary | ||
// ^ constant.numeric.binary | ||
0b22222 | ||
/// ^ -constant.numeric.binary | ||
// ^ -constant.numeric.binary | ||
|
||
if { /**/ } | ||
/// <- keyword.control | ||
// <- keyword.control | ||
where { /**/ } | ||
/// <- keyword.control | ||
// <- keyword.control | ||
|
||
#if FOO | ||
/// <- punctuation.definition.preprocessor | ||
// <- punctuation.definition.preprocessor | ||
#endif | ||
/// ^ meta.preprocessor.c | ||
// ^ meta.preprocessor.c | ||
|
||
if a || b | ||
/// <- keyword | ||
/// ^ keyword.operator | ||
// <- keyword | ||
// ^ keyword.operator | ||
|
||
public func foo | ||
/// <- storage.modifier | ||
/// ^ storage.type | ||
/// ^ storage.type.function | ||
/// ^ variable | ||
/// ^ entity.name.function | ||
// <- storage.modifier | ||
// ^ storage.type | ||
// ^ storage.type.function | ||
// ^ variable | ||
// ^ entity.name.function | ||
|
||
self | ||
/// <- keyword.variable | ||
// <- keyword.variable | ||
super | ||
/// <- keyword.variable | ||
// <- keyword.variable | ||
|
||
Color | ||
/// <- support.class | ||
// <- support.class | ||
UIColor | ||
/// <- support.class | ||
// <- support.class | ||
|
||
enum Foo { case Value } | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ entity.name.type | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ entity.name.type | ||
enum Foo : String { case Value } | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ entity.name.type | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ entity.name.type | ||
// ^ support.class | ||
|
||
enum Foo : String { | ||
case Value | ||
/// ^ keyword.control | ||
// ^ keyword.control | ||
} | ||
|
||
if foo {} | ||
/// <- keyword.control | ||
// <- keyword.control | ||
else {} | ||
/// <- keyword.control | ||
// <- keyword.control | ||
for {} | ||
/// <- keyword.control | ||
// <- keyword.control | ||
while true {} | ||
/// <- keyword.control | ||
/// ^ constant | ||
// <- keyword.control | ||
// ^ constant | ||
switch foo { case .Bar: } | ||
/// <- keyword.control | ||
/// ^ keyword.control | ||
// <- keyword.control | ||
// ^ keyword.control | ||
break | ||
/// <- keyword.control | ||
// <- keyword.control | ||
return | ||
/// <- keyword.control | ||
// <- keyword.control | ||
case 0..0 | ||
/// <- keyword.control | ||
/// ^ constant.numeric | ||
/// ^ keyword.operator | ||
/// ^ constant.numeric | ||
// <- keyword.control | ||
// ^ constant.numeric | ||
// ^ keyword.operator | ||
// ^ constant.numeric | ||
continue | ||
/// <- keyword.control | ||
// <- keyword.control | ||
default | ||
/// <- keyword.control | ||
// <- keyword.control | ||
|
||
enum Foo | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
enum Foo : Bar {} | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ support.class | ||
struct Foo | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
struct Foo : Bar | ||
/// ^ invalid | ||
/// ^ invalid | ||
// ^ invalid | ||
// ^ invalid | ||
class Foo | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
class Foo : Bar {} | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ support.class | ||
protocol Foo | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
protocol Foo : Bar {} | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ support.class | ||
extension Foo | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
extension Foo : Bar | ||
/// <- keyword.entity | ||
/// ^ support.class | ||
/// ^ keyword.operator | ||
/// ^ support.class | ||
// <- keyword.entity | ||
// ^ support.class | ||
// ^ keyword.operator | ||
// ^ support.class | ||
|
||
func foo() | ||
/// ^ variable.function | ||
// ^ variable.function | ||
class func foo() | ||
/// <- meta.function | ||
/// <- storage.type.function | ||
/// ^ storage.type.function | ||
// <- meta.function | ||
// <- storage.type.function | ||
// ^ storage.type.function | ||
|
||
func foo() { foo } | ||
/// ^ variable.function | ||
/// ^ meta.function | ||
// ^ variable.function | ||
// ^ meta.function | ||
|
||
|
||
func foo(a, b: String) { foo } | ||
/// ^ variable.function | ||
/// ^ meta.function | ||
/// ^ variable.parameter | ||
// ^ variable.function | ||
// ^ meta.function | ||
// ^ variable.parameter | ||
|
||
"foo" | ||
/// <- string | ||
/// <- string.quoted | ||
// <- string | ||
// <- string.quoted | ||
|
||
"foo\"" foo | ||
/// <- string | ||
/// ^ constant.character.escape | ||
/// ^ constant.character.escape | ||
/// ^ string | ||
/// ^ -string | ||
// <- string | ||
// ^ constant.character.escape | ||
// ^ constant.character.escape | ||
// ^ string | ||
// ^ -string | ||
|
||
"foo \(bar + (foo * bar))" | ||
/// <- string | ||
/// ^ punctuation.section | ||
/// ^ punctuation.section | ||
/// ^ -string | ||
/// ^ -punctuation.section | ||
// <- string | ||
// ^ punctuation.section | ||
// ^ punctuation.section | ||
// ^ -string | ||
// ^ -punctuation.section | ||
|
||
a = (.Foo(.bahr)) | ||
// ^ constant.language.enum | ||
// ^ constant.language.enum | ||
|
||
.Foo+.Bar | ||
// <- constant.language.enum | ||
// ^ -constant.language.enum | ||
// ^ constant.language.enum | ||
|
||
a.Foo + a.bar() | ||
// <- -constant.language.enum | ||
//^ -constant.language.enum | ||
// ^ -constant.language.enum |