mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Merge pull request #2855 from philipturner/main
Update Swift language specification to version 5.5
This commit is contained in:
commit
bfb6a42e3d
2 changed files with 89 additions and 27 deletions
|
|
@ -9,12 +9,12 @@ testTokenization('swift', [
|
||||||
// Attributes
|
// Attributes
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
line: '@noescape',
|
line: '@escaping',
|
||||||
tokens: [
|
tokens: [
|
||||||
{
|
{
|
||||||
startIndex: 0,
|
startIndex: 0,
|
||||||
type: 'keyword.control.swift'
|
type: 'keyword.control.swift'
|
||||||
} /* '@noescape' */
|
} /* '@escaping' */
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -38,33 +38,84 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
|
|
||||||
// TODO(owensd): Support the full range of unicode valid identifiers.
|
// TODO(owensd): Support the full range of unicode valid identifiers.
|
||||||
identifier: /[a-zA-Z_][\w$]*/,
|
identifier: /[a-zA-Z_][\w$]*/,
|
||||||
// TODO(owensd): Support the @availability macro properly.
|
|
||||||
attributes: [
|
attributes: [
|
||||||
'@autoclosure',
|
'@GKInspectable',
|
||||||
'@noescape',
|
|
||||||
'@noreturn',
|
|
||||||
'@NSApplicationMain',
|
|
||||||
'@NSCopying',
|
|
||||||
'@NSManaged',
|
|
||||||
'@objc',
|
|
||||||
'@UIApplicationMain',
|
|
||||||
'@noreturn',
|
|
||||||
'@availability',
|
|
||||||
'@IBAction',
|
'@IBAction',
|
||||||
'@IBDesignable',
|
'@IBDesignable',
|
||||||
'@IBInspectable',
|
'@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: [
|
keywords: [
|
||||||
'__COLUMN__',
|
'#available',
|
||||||
'__FILE__',
|
'#colorLiteral',
|
||||||
'__FUNCTION__',
|
'#column',
|
||||||
'__LINE__',
|
'#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',
|
||||||
'as?',
|
'associatedtype',
|
||||||
'associativity',
|
'associativity',
|
||||||
|
'async',
|
||||||
|
'await',
|
||||||
'break',
|
'break',
|
||||||
'case',
|
'case',
|
||||||
'catch',
|
'catch',
|
||||||
|
|
@ -72,6 +123,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'continue',
|
'continue',
|
||||||
'convenience',
|
'convenience',
|
||||||
'default',
|
'default',
|
||||||
|
'defer',
|
||||||
'deinit',
|
'deinit',
|
||||||
'didSet',
|
'didSet',
|
||||||
'do',
|
'do',
|
||||||
|
|
@ -81,44 +133,53 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'enum',
|
'enum',
|
||||||
'extension',
|
'extension',
|
||||||
'fallthrough',
|
'fallthrough',
|
||||||
|
'false',
|
||||||
'fileprivate',
|
'fileprivate',
|
||||||
'final',
|
'final',
|
||||||
'for',
|
'for',
|
||||||
'func',
|
'func',
|
||||||
'get',
|
'get',
|
||||||
'guard',
|
'guard',
|
||||||
|
'higherThan',
|
||||||
'if',
|
'if',
|
||||||
'import',
|
'import',
|
||||||
'in',
|
'in',
|
||||||
|
'indirect',
|
||||||
'infix',
|
'infix',
|
||||||
'init',
|
'init',
|
||||||
'inout',
|
'inout',
|
||||||
'internal',
|
'internal',
|
||||||
'is',
|
'is',
|
||||||
|
'isolated',
|
||||||
'lazy',
|
'lazy',
|
||||||
'left',
|
'left',
|
||||||
'let',
|
'let',
|
||||||
|
'lowerThan',
|
||||||
'mutating',
|
'mutating',
|
||||||
'nil',
|
'nil',
|
||||||
'none',
|
'none',
|
||||||
|
'nonisolated',
|
||||||
'nonmutating',
|
'nonmutating',
|
||||||
|
'open',
|
||||||
'operator',
|
'operator',
|
||||||
'optional',
|
'optional',
|
||||||
'override',
|
'override',
|
||||||
'postfix',
|
'postfix',
|
||||||
'precedence',
|
'precedence',
|
||||||
|
'precedencegroup',
|
||||||
'prefix',
|
'prefix',
|
||||||
'private',
|
'private',
|
||||||
'protocol',
|
'protocol',
|
||||||
'Protocol',
|
|
||||||
'public',
|
'public',
|
||||||
'repeat',
|
'repeat',
|
||||||
'required',
|
'required',
|
||||||
|
'rethrows',
|
||||||
'return',
|
'return',
|
||||||
'right',
|
'right',
|
||||||
|
'safe',
|
||||||
'self',
|
'self',
|
||||||
'Self',
|
|
||||||
'set',
|
'set',
|
||||||
|
'some',
|
||||||
'static',
|
'static',
|
||||||
'struct',
|
'struct',
|
||||||
'subscript',
|
'subscript',
|
||||||
|
|
@ -126,18 +187,19 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'switch',
|
'switch',
|
||||||
'throw',
|
'throw',
|
||||||
'throws',
|
'throws',
|
||||||
|
'true',
|
||||||
'try',
|
'try',
|
||||||
'try!',
|
|
||||||
'Type',
|
|
||||||
'typealias',
|
'typealias',
|
||||||
'unowned',
|
'unowned',
|
||||||
|
'unsafe',
|
||||||
'var',
|
'var',
|
||||||
'weak',
|
'weak',
|
||||||
'where',
|
'where',
|
||||||
'while',
|
'while',
|
||||||
'willSet',
|
'willSet',
|
||||||
'FALSE',
|
|
||||||
'TRUE'
|
'__consuming',
|
||||||
|
'__owned'
|
||||||
],
|
],
|
||||||
|
|
||||||
symbols: /[=(){}\[\].,:;@#\_&\-<>`?!+*\\\/]/,
|
symbols: /[=(){}\[\].,:;@#\_&\-<>`?!+*\\\/]/,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue