Skip to content

Commit 18c1bcb

Browse files
committed
[swift mode] Make tests syntactically valid and in agreement with the mode
Issue codemirror#4374
1 parent 4a1ed91 commit 18c1bcb

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

mode/swift/swift.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
var property = /^\.(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
4141
var instruction = /^\#[A-Za-z]+/
4242
var attribute = /^@(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
43-
var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
43+
//var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
4444

4545
function tokenBase(stream, state, prev) {
4646
if (stream.sol()) state.indented = stream.indentation()

mode/swift/test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"[keyword var] [def e] [operator =] [number 0o7324]",
1515
"[keyword var] [def f] [operator =] [number 0b10010]",
1616
"[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");
17+
"[keyword var] [def h] [operator =] [number 0xaea.ep-13]",
18+
"[keyword var] [def i] [operator =] [number 0x13ep6]");
1919

2020
// Variable/class/etc definition.
2121
MT("definition",
@@ -122,20 +122,20 @@
122122

123123
// Instructions or other things that start with #.
124124
MT("instructions",
125-
"[keyword if] [instruction #available][punctuation (][variable iOS] [number 9][punctuation ,] [operator *][punctuation )] [punctuation {}",
126-
"[variable print][punctuation (][instruction #file][punctuation ,] [instruction #function][punctuation )]",
127-
"[variable print][punctuation (][instruction #line][punctuation ,] [instruction #column][punctuation )]",
128-
"[instruction #if] [atom true]",
129-
" [keyword import] [variable A]",
130-
"[instruction #elseif] [atom false]",
131-
" [keyword import] [variable B]",
132-
"[instruction #endif]",
133-
"[instruction #sourceLocation][punctuation (][variable file][punctuation :] [string \"file.swift\"][punctuation ,] [variable line][punctuation :] [number 2][punctuation )]");
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 )]");
134134

135135
// Attributes; things that start with @.
136136
MT("attributes",
137-
"[instruction @objc][punctuation (][variable objcFoo][punctuation :)]",
138-
"[instruction @available][punctuation (][variable iOS][punctuation )]");
137+
"[attribute @objc][punctuation (][variable objcFoo][punctuation :)]",
138+
"[attribute @available][punctuation (][variable iOS][punctuation )]");
139139

140140
// Property/number edge case.
141141
MT("property_number",

0 commit comments

Comments
 (0)