mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
Implement the eliminators with analysis.
This commit is contained in:
parent
24bc2610ff
commit
39c46edeb9
@ -12,30 +12,21 @@ public enum Vertex<Element> {
|
||||
}
|
||||
|
||||
public var element: Element? {
|
||||
switch self {
|
||||
case let .XY(a, _, _):
|
||||
return a
|
||||
case .End:
|
||||
return nil
|
||||
}
|
||||
return analysis(
|
||||
ifXY: { x, _, _ in x },
|
||||
ifEnd: const(nil))
|
||||
}
|
||||
|
||||
public var right: Memo<Vertex> {
|
||||
switch self {
|
||||
case let .XY(_, xs, _):
|
||||
return xs
|
||||
case .End:
|
||||
return Memo(evaluated: .End)
|
||||
}
|
||||
return analysis(
|
||||
ifXY: { _, xs, _ in xs },
|
||||
ifEnd: const(Memo(evaluated: .End)))
|
||||
}
|
||||
|
||||
public var down: Memo<Vertex> {
|
||||
switch self {
|
||||
case let .XY(_, _, ys):
|
||||
return ys
|
||||
case .End:
|
||||
return Memo(evaluated: .End)
|
||||
}
|
||||
return analysis(
|
||||
ifXY: { _, _, ys in ys },
|
||||
ifEnd: const(Memo(evaluated: .End)))
|
||||
}
|
||||
|
||||
public var diagonal: Memo<Vertex> {
|
||||
|
Loading…
Reference in New Issue
Block a user