Skip to content

Commit d5e6ad8

Browse files
committed
Remove DSLTree.Node.regexLiteral
This doesn't appear to be used.
1 parent 7e67ef6 commit d5e6ad8

File tree

4 files changed

+3
-22
lines changed

4 files changed

+3
-22
lines changed

Sources/_StringProcessing/ByteCodeGen.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,6 @@ fileprivate extension Compiler.ByteCodeGen {
812812
}
813813
}
814814

815-
case let .regexLiteral(l):
816-
return try emitNode(l.ast.dslTreeNode)
817-
818815
case let .convertedRegexLiteral(n, _):
819816
return try emitNode(n)
820817

Sources/_StringProcessing/ConsumerInterface.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ extension DSLTree.Node {
2929
// TODO: Should we handle this here?
3030
return nil
3131

32-
case .regexLiteral:
33-
fatalError(
34-
"unreachable: We should only ask atoms")
35-
3632
case let .convertedRegexLiteral(n, _):
3733
return try n.generateConsumer(opts)
3834

Sources/_StringProcessing/PrintAsPattern.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ extension PrettyPrinter {
258258
case let .quotedLiteral(v):
259259
print(v._quoted)
260260

261-
case .regexLiteral:
262-
printBackoff(node)
263-
264261
case let .convertedRegexLiteral(n, _):
265262
// FIXME: This recursion coordinates with back-off
266263
// check above, so it should work out. Need a

Sources/_StringProcessing/Regex/DSLTree.swift

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ extension DSLTree {
7171

7272
case quotedLiteral(String)
7373

74-
/// An embedded literal.
75-
case regexLiteral(_AST.ASTNode)
76-
7774
// TODO: What should we do here?
7875
///
7976
/// TODO: Consider splitting off expression functions, or have our own kind
@@ -343,7 +340,7 @@ extension DSLTree.Node {
343340

344341
case let .conditional(_, t, f): return [t,f]
345342

346-
case .trivia, .empty, .quotedLiteral, .regexLiteral,
343+
case .trivia, .empty, .quotedLiteral,
347344
.consumer, .matcher, .characterPredicate,
348345
.customCharacterClass, .atom:
349346
return []
@@ -357,7 +354,6 @@ extension DSLTree.Node {
357354
extension DSLTree.Node {
358355
var astNode: AST.Node? {
359356
switch self {
360-
case let .regexLiteral(literal): return literal.ast
361357
case let .convertedRegexLiteral(_, literal): return literal.ast
362358
default: return nil
363359
}
@@ -391,8 +387,6 @@ extension DSLTree.Node {
391387
switch self {
392388
case .capture:
393389
return true
394-
case let .regexLiteral(re):
395-
return re.ast.hasCapture
396390
case let .convertedRegexLiteral(n, re):
397391
assert(n.hasCapture == re.ast.hasCapture)
398392
return n.hasCapture
@@ -603,9 +597,6 @@ extension DSLTree.Node {
603597
}
604598
child._addCaptures(to: &list, optionalNesting: optNesting)
605599

606-
case let .regexLiteral(re):
607-
return re.ast._addCaptures(to: &list, optionalNesting: nesting)
608-
609600
case let .absentFunction(abs):
610601
switch abs.ast.kind {
611602
case .expression(_, _, let child):
@@ -634,7 +625,7 @@ extension DSLTree.Node {
634625
return true
635626
case .orderedChoice, .concatenation, .capture,
636627
.conditional, .quantification, .customCharacterClass, .atom,
637-
.trivia, .empty, .quotedLiteral, .regexLiteral, .absentFunction,
628+
.trivia, .empty, .quotedLiteral, .absentFunction,
638629
.convertedRegexLiteral, .consumer,
639630
.characterPredicate, .matcher:
640631
return false
@@ -693,7 +684,7 @@ extension DSLTree {
693684

694685
case let .conditional(_, t, f): return [_Tree(t), _Tree(f)]
695686

696-
case .trivia, .empty, .quotedLiteral, .regexLiteral,
687+
case .trivia, .empty, .quotedLiteral,
697688
.consumer, .matcher, .characterPredicate,
698689
.customCharacterClass, .atom:
699690
return []

0 commit comments

Comments
 (0)