Skip to content

Commit 0a7d4bb

Browse files
authored
Merge pull request #88 from hamishknight/backrefs
2 parents 66c1364 + 3b5533f commit 0a7d4bb

File tree

8 files changed

+431
-58
lines changed

8 files changed

+431
-58
lines changed

Sources/_MatchingEngine/Regex/AST/Atom.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ extension AST {
5252
case endOfLine
5353

5454
// References
55-
//
56-
// TODO: Haven't thought through these a ton
5755
case backreference(Reference)
5856
case subpattern(Reference)
5957
case condition(Reference)
@@ -414,12 +412,8 @@ extension AST.Atom: _ASTPrintable {
414412
case .startOfLine: return "^"
415413
case .endOfLine: return "$"
416414

417-
case .backreference(_):
418-
fatalError("TODO")
419-
case .subpattern(_):
420-
fatalError("TODO")
421-
case .condition(_):
422-
fatalError("TODO")
415+
case .backreference(let r), .subpattern(let r), .condition(let r):
416+
return "\(r)"
423417

424418
case .char, .scalar:
425419
fatalError("Unreachable")

0 commit comments

Comments
 (0)