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

Update Swift language specification to version 5.5 #2855

Merged
merged 14 commits into from
Jan 14, 2022
108 changes: 85 additions & 23 deletions src/basic-languages/swift/swift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,92 @@ 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',
'@GKInspectable',
'@IBAction',
'@IBDesignable',
'@IBInspectable',
'@IBOutlet',
'@IBSegueAction',
'@NSApplicationMain',
'@NSCopying',
'@NSManaged',
'@objc',
'@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',
'@availability',
'@IBAction',
'@IBDesignable',
'@IBInspectable',
'@IBOutlet'
'@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',
'class',
'continue',
'convenience',
'default',
'defer',
'deinit',
'didSet',
'do',
Expand All @@ -81,63 +133,73 @@ 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',
'super',
'switch',
'throw',
'throws',
'true',
'try',
'try!',
'Type',
'typealias',
'unowned',
'unsafe',
'var',
'weak',
'where',
'while',
'willSet',
'FALSE',
'TRUE'

'__consuming',
'__owned'
],

symbols: /[=(){}\[\].,:;@#\_&\-<>`?!+*\\\/]/,
Expand Down