Incs/codemirror/mode/swift/test.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({indentUnit: 2}, "swift");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
// Ensure all number types are properly represented.
MT("numbers",
"[keyword var] [def a] [operator =] [number 17]",
"[keyword var] [def b] [operator =] [number -0.5]",
"[keyword var] [def c] [operator =] [number 0.3456e-4]",
"[keyword var] [def d] [operator =] [number 345e2]",
"[keyword var] [def e] [operator =] [number 0o7324]",
"[keyword var] [def f] [operator =] [number 0b10010]",
"[keyword var] [def g] [operator =] [number -0x35ade]",
"[keyword var] [def h] [operator =] [number 0xaea.ep-13]",
"[keyword var] [def i] [operator =] [number 0x13ep6]");
// Variable/class/etc definition.
MT("definition",
"[keyword var] [def a] [operator =] [number 5]",
"[keyword let] [def b][punctuation :] [variable-2 Int] [operator =] [number 10]",
"[keyword class] [def C] [punctuation {] [punctuation }]",
"[keyword struct] [def D] [punctuation {] [punctuation }]",
"[keyword enum] [def E] [punctuation {] [punctuation }]",
"[keyword extension] [def F] [punctuation {] [punctuation }]",
"[keyword protocol] [def G] [punctuation {] [punctuation }]",
"[keyword func] [def h][punctuation ()] [punctuation {] [punctuation }]",
"[keyword import] [def Foundation]",
"[keyword typealias] [def NewString] [operator =] [variable-2 String]",
"[keyword associatedtype] [def I]",
"[keyword for] [def j] [keyword in] [number 0][punctuation ..][operator <][number 3] [punctuation {] [punctuation }]");
// Strings and string interpolation.
MT("strings",
"[keyword var] [def a][punctuation :] [variable-2 String] [operator =] [string \"test\"]",
"[keyword var] [def b][punctuation :] [variable-2 String] [operator =] [string \"\\(][variable a][string )\"]",
"[keyword var] [def c] [operator =] [string \"\"\"]",
"[string multi]",
"[string line]",
"[string \"test\"]",
"[string \"\"\"]");
// Comments.
MT("comments",
"[comment // This is a comment]",
"[comment /* This is another comment */]",
"[keyword var] [def a] [operator =] [number 5] [comment // Third comment]");
// Atoms.
MT("atoms",
"[keyword class] [def FooClass] [punctuation {]",
" [keyword let] [def fooBool][punctuation :] [variable-2 Bool][operator ?]",
" [keyword let] [def fooInt][punctuation :] [variable-2 Int][operator ?]",
" [keyword func] [keyword init][punctuation (][variable fooBool][punctuation :] [variable-2 Bool][punctuation ,] [variable barBool][punctuation :] [variable-2 Bool][punctuation )] [punctuation {]",
" [atom super][property .init][punctuation ()]",
" [atom self][property .fooBool] [operator =] [variable fooBool]",
" [variable fooInt] [operator =] [atom nil]",
" [keyword if] [variable barBool] [operator ==] [atom true] [punctuation {]",
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
