File tree Expand file tree Collapse file tree 1 file changed +8
-22
lines changed
swift/ql/lib/codeql/swift/regex/internal Expand file tree Collapse file tree 1 file changed +8
-22
lines changed Original file line number Diff line number Diff line change @@ -303,41 +303,27 @@ abstract class RegExp extends Expr {
303303 */
304304 string getModeFromPrefix ( ) {
305305 exists ( string c | this .flagGroup ( _, _, c ) |
306- // TODO: are these correct in Swift?
307- c = "i" and result = "IGNORECASE"
306+ c = "i" and result = "IGNORECASE" // case insensitive
308307 or
309- c = "m " and result = "MULTILINE"
308+ c = "x " and result = "VERBOSE" // ignores whitespace and `#` comments within patterns
310309 or
311- c = "s" and result = "DOTALL"
310+ c = "s" and result = "DOTALL" // dot matches all characters, including line terminators
312311 or
313- c = "u " and result = "UNICODE"
312+ c = "m " and result = "MULTILINE" // `^` and `$` also match beginning and end of lines
314313 or
315- c = "x" and result = "VERBOSE"
316- or
317- c = "U" and result = "UNICODECLASS"
314+ c = "w" and result = "UNICODE" // Unicode UAX 29 word boundary mode
318315 )
319316 }
320317
321318 /**
322319 * Gets a mode (if any) of this regular expression. Can be any of:
323- * DEBUG
324320 * IGNORECASE
325- * MULTILINE
321+ * VERBOSE
326322 * DOTALL
323+ * MULTILINE
327324 * UNICODE
328- * VERBOSE
329- * UNICODECLASS
330325 */
331- string getAMode ( ) {
332- /*
333- * TODO
334- * result != "None" and
335- * usedAsRegex(this, result, _)
336- * or
337- */
338-
339- result = this .getModeFromPrefix ( )
340- }
326+ string getAMode ( ) { result = this .getModeFromPrefix ( ) }
341327
342328 /**
343329 * Holds if the `i`th character could not be parsed.
You can’t perform that action at this time.
0 commit comments