Merge pull request #2855 from philipturner/main

Update Swift language specification to version 5.5
This commit is contained in:
Alexandru Dima 2022-01-14 09:53:37 +01:00 committed by GitHub
commit bfb6a42e3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 27 deletions

View file

@ -9,12 +9,12 @@ testTokenization('swift', [
// Attributes
[
{
line: '@noescape',
line: '@escaping',
tokens: [
{
startIndex: 0,
type: 'keyword.control.swift'
} /* '@noescape' */
} /* '@escaping' */
]
}
],

View file

@ -38,33 +38,84 @@ export const language = <languages.IMonarchLanguage>{
// TODO(owensd): Support the full range of unicode valid identifiers.
identifier: /[a-zA-Z_][\w$]*/,
// TODO(owensd): Support the @availability macro properly.
attributes: [
'@autoclosure',
'@noescape',
'@noreturn',
'@NSApplicationMain',
'@NSCopying',
'@NSManaged',
'@objc',
'@UIApplicationMain',
'@noreturn',
'@availability',
'@GKInspectable',
'@IBAction',
'@IBDesignable',
'@IBInspectable',
'@IBOutlet'
'@IBOutlet',
'@IBSegueAction',
'@NSApplicationMain',
'@NSCopying',
'@NSManaged',
'@Sendable',
'@UIApplicationMain',
'@autoclosure',
'@actorIndependent',
'@asyncHandler',
'@available',
'@convention',
'@derivative', // Swift for TensorFlow
'@differentiable', // Swift for TensorFlow
'@discardableResult',
'@dynamicCallable',
'@dynamicMemberLookup',
'@escaping',
'@frozen',
'@globalActor',
'@inlinable',
'@inline',
'@main',
'@nonobjc',
'@noreturn',
'@objc',
'@objcMembers',
'@propertyWrapper',
'@requires_stored_property_inits',
'@resultBuilder',
'@testable',
'@unchecked',
'@unknown',
'@usableFromInline',
'@warn_unqualified_access'
],
accessmodifiers: ['public', 'private', 'fileprivate', 'internal'],
accessmodifiers: ['open', 'public', 'internal', 'fileprivate', 'private'],
keywords: [
'__COLUMN__',
'__FILE__',
'__FUNCTION__',
'__LINE__',
'#available',
'#colorLiteral',
'#column',
'#dsohandle',
'#else',
'#elseif',
'#endif',
'#error',
'#file',
'#fileID',
'#fileLiteral',
'#filePath',
'#function',
'#if',
'#imageLiteral',
'#keyPath',
'#line',
'#selector',
'#sourceLocation',
'#warning',
'Any',
'Protocol',
'Self',
'Type',
'actor',
'as',
'as!',
'as?',
'assignment',
'associatedtype',
'associativity',
'async',
'await',
'break',
'case',
'catch',
@ -72,6 +123,7 @@ export const language = <languages.IMonarchLanguage>{
'continue',
'convenience',
'default',
'defer',
'deinit',
'didSet',
'do',
@ -81,44 +133,53 @@ export const language = <languages.IMonarchLanguage>{
'enum',
'extension',
'fallthrough',
'false',
'fileprivate',
'final',
'for',
'func',
'get',
'guard',
'higherThan',
'if',
'import',
'in',
'indirect',
'infix',
'init',
'inout',
'internal',
'is',
'isolated',
'lazy',
'left',
'let',
'lowerThan',
'mutating',
'nil',
'none',
'nonisolated',
'nonmutating',
'open',
'operator',
'optional',
'override',
'postfix',
'precedence',
'precedencegroup',
'prefix',
'private',
'protocol',
'Protocol',
'public',
'repeat',
'required',
'rethrows',
'return',
'right',
'safe',
'self',
'Self',
'set',
'some',
'static',
'struct',
'subscript',
@ -126,18 +187,19 @@ export const language = <languages.IMonarchLanguage>{
'switch',
'throw',
'throws',
'true',
'try',
'try!',
'Type',
'typealias',
'unowned',
'unsafe',
'var',
'weak',
'where',
'while',
'willSet',
'FALSE',
'TRUE'
'__consuming',
'__owned'
],
symbols: /[=(){}\[\].,:;@#\_&\-<>`?!+*\\\/]/,