Skip to content

Delete groupTransform from AST. #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Sources/_MatchingEngine/Regex/AST/AST.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ extension AST {
case absentFunction(AbsentFunction)

case empty(Empty)

// FIXME: Move off the regex literal AST
case groupTransform(
Group, transform: CaptureTransform)
}
}

Expand All @@ -91,9 +87,6 @@ extension AST.Node {
case let .customCharacterClass(v): return v
case let .empty(v): return v
case let .absentFunction(v): return v

case let .groupTransform(g, _):
return g // FIXME: get this out of here
}
}

Expand Down Expand Up @@ -121,8 +114,7 @@ extension AST.Node {
/// Whether this node has nested somewhere inside it a capture
public var hasCapture: Bool {
switch self {
case .group(let g) where g.kind.value.isCapturing,
.groupTransform(let g, _) where g.kind.value.isCapturing:
case .group(let g) where g.kind.value.isCapturing:
return true
default:
break
Expand All @@ -139,7 +131,7 @@ extension AST.Node {
case .group, .conditional, .customCharacterClass, .absentFunction:
return true
case .alternation, .concatenation, .quantification, .quote, .trivia,
.empty, .groupTransform:
.empty:
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/_MatchingEngine/Regex/AST/Atom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ extension AST.Node {
case .alternation, .concatenation, .group,
.conditional, .quantification, .quote,
.trivia, .customCharacterClass, .empty,
.groupTransform, .absentFunction:
.absentFunction:
return nil
}
}
Expand Down
6 changes: 0 additions & 6 deletions Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ extension AST.Node {
case let .group(g):
return constructor.grouping(g.child, as: g.kind.value)

case .groupTransform(let g, let transform):
return constructor.grouping(
g.child,
as: g.kind.value,
withTransform: transform)

case .conditional(let c):
return constructor.condition(
c.condition.kind,
Expand Down
3 changes: 0 additions & 3 deletions Sources/_MatchingEngine/Regex/Printing/PrintAsCanonical.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ extension PrettyPrinter {

case .empty:
output("")

case .groupTransform:
output("/* TODO: get groupTransform out of AST */")
}
}

Expand Down
5 changes: 0 additions & 5 deletions Sources/_StringProcessing/RegexDSL/ASTConversion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ extension AST.Node {
case .empty(_):
return .empty

case let .groupTransform(v, transform):
let child = v.child.dslTreeNode
return .groupTransform(
v.kind.value, child, transform)

case let .absentFunction(a):
// TODO: What should this map to?
return .absentFunction(a)
Expand Down