Update Swift.g4 for swift 4.1

This commit is contained in:
kenji21
2018-04-03 10:22:42 +02:00
parent ea07ab1359
commit 19f5110dc1
3 changed files with 14 additions and 1 deletions

View File

@ -894,11 +894,14 @@ platformCondition
: 'os' '(' operatingSystem ')'
| 'arch' '(' architecture ')'
| 'swift' '(' '>=' swiftVersion ')'
| 'canImport' '(' moduleName ')'
| 'targetEnvironment' '(' 'simulator' ')'
;
operatingSystem: 'OSX' | 'iOS' | 'watchOS' | 'tvOS' ;
architecture: 'i386' | 'x86_64' | 'arm' | 'arm64' ;
swiftVersion: FloatingPointLiteral ;
moduleName: IdentifierCharacters ;
lineControlStatement: '#sourceLocation' '(' 'file' ':' fileName ',' 'line' ':' lineNumber ')'
| '#sourceLocation' '(' ')' ;

View File

@ -30,7 +30,7 @@ public class SwiftTokenizerTest extends AbstractTokenizerTest {
@Test
public void tokenizeTest() throws IOException {
this.expectedTokenCount = 4217;
this.expectedTokenCount = 4239;
super.tokenizeTest();
}
}

View File

@ -1003,3 +1003,13 @@ class MyClass {
let myClass = MyClass()
//myClass.delegate = View() // error: cannot assign value of type 'View' to type '(View & MyProtocol)?'
myClass.delegate = ViewSubclass()
// 4.1 conditional
#if canImport(SomeModule)
let someModuleImportedVersion = SomeModule.version
#endif
#if targetEnvironment(simulator)
print("code only compiled for simulator")
#endif