File modules/editor/codemirror/mode/swift/test.min.js

Last commit: Tue May 22 22:39:49 2018 +0200	Jan Dankert	Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 // Distributed under an MIT license: http://codemirror.net/LICENSE 3 4 (function() { 5 var mode = CodeMirror.getMode({indentUnit: 2}, "swift"); 6 function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 7 8 // Ensure all number types are properly represented. 9 MT("numbers", 10 "[keyword var] [def a] [operator =] [number 17]", 11 "[keyword var] [def b] [operator =] [number -0.5]", 12 "[keyword var] [def c] [operator =] [number 0.3456e-4]", 13 "[keyword var] [def d] [operator =] [number 345e2]", 14 "[keyword var] [def e] [operator =] [number 0o7324]", 15 "[keyword var] [def f] [operator =] [number 0b10010]", 16 "[keyword var] [def g] [operator =] [number -0x35ade]", 17 "[keyword var] [def h] [operator =] [number 0xaea.ep-13]", 18 "[keyword var] [def i] [operator =] [number 0x13ep6]"); 19 20 // Variable/class/etc definition. 21 MT("definition", 22 "[keyword var] [def a] [operator =] [number 5]", 23 "[keyword let] [def b][punctuation :] [variable-2 Int] [operator =] [number 10]", 24 "[keyword class] [def C] [punctuation {] [punctuation }]", 25 "[keyword struct] [def D] [punctuation {] [punctuation }]", 26 "[keyword enum] [def E] [punctuation {] [punctuation }]", 27 "[keyword extension] [def F] [punctuation {] [punctuation }]", 28 "[keyword protocol] [def G] [punctuation {] [punctuation }]", 29 "[keyword func] [def h][punctuation ()] [punctuation {] [punctuation }]", 30 "[keyword import] [def Foundation]", 31 "[keyword typealias] [def NewString] [operator =] [variable-2 String]", 32 "[keyword associatedtype] [def I]", 33 "[keyword for] [def j] [keyword in] [number 0][punctuation ..][operator <][number 3] [punctuation {] [punctuation }]"); 34 35 // Strings and string interpolation. 36 MT("strings", 37 "[keyword var] [def a][punctuation :] [variable-2 String] [operator =] [string \"test\"]", 38 "[keyword var] [def b][punctuation :] [variable-2 String] [operator =] [string \"\\(][variable a][string )\"]"); 39 40 // Comments. 41 MT("comments", 42 "[comment // This is a comment]", 43 "[comment /* This is another comment */]", 44 "[keyword var] [def a] [operator =] [number 5] [comment // Third comment]"); 45 46 // Atoms. 47 MT("atoms", 48 "[keyword class] [def FooClass] [punctuation {]", 49 " [keyword let] [def fooBool][punctuation :] [variable-2 Bool][operator ?]", 50 " [keyword let] [def fooInt][punctuation :] [variable-2 Int][operator ?]", 51 " [keyword func] [keyword init][punctuation (][variable fooBool][punctuation :] [variable-2 Bool][punctuation ,] [variable barBool][punctuation :] [variable-2 Bool][punctuation )] [punctuation {]", 52 " [atom super][property .init][punctuation ()]", 53 " [atom self][property .fooBool] [operator =] [variable fooBool]", 54 " [variable fooInt] [operator =] [atom nil]", 55 " [keyword if] [variable barBool] [operator ==] [atom true] [punctuation {]", 56 " [variable print][punctuation (][string \"True!\"][punctuation )]", 57 " [punctuation }] [keyword else] [keyword if] [variable barBool] [operator ==] [atom false] [punctuation {]", 58 " [keyword for] [atom _] [keyword in] [number 0][punctuation ...][number 5] [punctuation {]", 59 " [variable print][punctuation (][string \"False!\"][punctuation )]", 60 " [punctuation }]", 61 " [punctuation }]", 62 " [punctuation }]", 63 "[punctuation }]"); 64 65 // Types. 66 MT("types", 67 "[keyword var] [def a] [operator =] [variable-2 Array][operator <][variable-2 Int][operator >]", 68 "[keyword var] [def b] [operator =] [variable-2 Set][operator <][variable-2 Bool][operator >]", 69 "[keyword var] [def c] [operator =] [variable-2 Dictionary][operator <][variable-2 String][punctuation ,][variable-2 Character][operator >]", 70 "[keyword var] [def d][punctuation :] [variable-2 Int64][operator ?] [operator =] [variable-2 Optional][punctuation (][number 8][punctuation )]", 71 "[keyword func] [def e][punctuation ()] [operator ->] [variable-2 Void] [punctuation {]", 72 " [keyword var] [def e1][punctuation :] [variable-2 Float] [operator =] [number 1.2]", 73 "[punctuation }]", 74 "[keyword func] [def f][punctuation ()] [operator ->] [variable-2 Never] [punctuation {]", 75 " [keyword var] [def f1][punctuation :] [variable-2 Double] [operator =] [number 2.4]", 76 "[punctuation }]"); 77 78 // Operators. 79 MT("operators", 80 "[keyword var] [def a] [operator =] [number 1] [operator +] [number 2]", 81 "[keyword var] [def b] [operator =] [number 1] [operator -] [number 2]", 82 "[keyword var] [def c] [operator =] [number 1] [operator *] [number 2]", 83 "[keyword var] [def d] [operator =] [number 1] [operator /] [number 2]", 84 "[keyword var] [def e] [operator =] [number 1] [operator %] [number 2]", 85 "[keyword var] [def f] [operator =] [number 1] [operator |] [number 2]", 86 "[keyword var] [def g] [operator =] [number 1] [operator &] [number 2]", 87 "[keyword var] [def h] [operator =] [number 1] [operator <<] [number 2]", 88 "[keyword var] [def i] [operator =] [number 1] [operator >>] [number 2]", 89 "[keyword var] [def j] [operator =] [number 1] [operator ^] [number 2]", 90 "[keyword var] [def k] [operator =] [operator ~][number 1]", 91 "[keyword var] [def l] [operator =] [variable foo] [operator ?] [number 1] [punctuation :] [number 2]", 92 "[keyword var] [def m][punctuation :] [variable-2 Int] [operator =] [variable-2 Optional][punctuation (][number 8][punctuation )][operator !]"); 93 94 // Punctuation. 95 MT("punctuation", 96 "[keyword let] [def a] [operator =] [number 1][punctuation ;] [keyword let] [def b] [operator =] [number 2]", 97 "[keyword let] [def testArr][punctuation :] [punctuation [[][variable-2 Int][punctuation ]]] [operator =] [punctuation [[][variable a][punctuation ,] [variable b][punctuation ]]]", 98 "[keyword for] [def i] [keyword in] [number 0][punctuation ..][operator <][variable testArr][property .count] [punctuation {]", 99 " [variable print][punctuation (][variable testArr][punctuation [[][variable i][punctuation ]])]", 100 "[punctuation }]"); 101 102 // Identifiers. 103 MT("identifiers", 104 "[keyword let] [def abc] [operator =] [number 1]", 105 "[keyword let] [def ABC] [operator =] [number 2]", 106 "[keyword let] [def _123] [operator =] [number 3]", 107 "[keyword let] [def _$1$2$3] [operator =] [number 4]", 108 "[keyword let] [def A1$_c32_$_] [operator =] [number 5]", 109 "[keyword let] [def `var`] [operator =] [punctuation [[][number 1][punctuation ,] [number 2][punctuation ,] [number 3][punctuation ]]]", 110 "[keyword let] [def square$] [operator =] [variable `var`][property .map] [punctuation {][variable $0] [operator *] [variable $0][punctuation }]", 111 "$$ [number 1][variable a] $[atom _] [variable _$] [variable __] `[variable a] [variable b]`"); 112 113 // Properties. 114 MT("properties", 115 "[variable print][punctuation (][variable foo][property .abc][punctuation )]", 116 "[variable print][punctuation (][variable foo][property .ABC][punctuation )]", 117 "[variable print][punctuation (][variable foo][property ._123][punctuation )]", 118 "[variable print][punctuation (][variable foo][property ._$1$2$3][punctuation )]", 119 "[variable print][punctuation (][variable foo][property .A1$_c32_$_][punctuation )]", 120 "[variable print][punctuation (][variable foo][property .`var`][punctuation )]", 121 "[variable print][punctuation (][variable foo][property .__][punctuation )]"); 122 123 // Instructions or other things that start with #. 124 MT("instructions", 125 "[keyword if] [builtin #available][punctuation (][variable iOS] [number 9][punctuation ,] [operator *][punctuation )] [punctuation {}]", 126 "[variable print][punctuation (][builtin #file][punctuation ,] [builtin #function][punctuation )]", 127 "[variable print][punctuation (][builtin #line][punctuation ,] [builtin #column][punctuation )]", 128 "[builtin #if] [atom true]", 129 "[keyword import] [def A]", 130 "[builtin #elseif] [atom false]", 131 "[keyword import] [def B]", 132 "[builtin #endif]", 133 "[builtin #sourceLocation][punctuation (][variable file][punctuation :] [string \"file.swift\"][punctuation ,] [variable line][punctuation :] [number 2][punctuation )]"); 134 135 // Attributes; things that start with @. 136 MT("attributes", 137 "[attribute @objc][punctuation (][variable objcFoo][punctuation :)]", 138 "[attribute @available][punctuation (][variable iOS][punctuation )]"); 139 140 // Property/number edge case. 141 MT("property_number", 142 "[variable print][punctuation (][variable foo][property ._123][punctuation )]", 143 "[variable print][punctuation (]") 144 145 // TODO: correctly identify when multiple variables are being declared 146 // by use of a comma-separated list. 147 // TODO: correctly identify when variables are being declared in a tuple. 148 // TODO: identify protocols as types when used before an extension? 149 })();
Download modules/editor/codemirror/mode/swift/test.min.js
History Tue, 22 May 2018 22:39:49 +0200 Jan Dankert Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.