1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 04:41:47 +03:00
semantic/prototype/doubt-difftool/Argument.swift

36 lines
553 B
Swift
Raw Normal View History

2015-11-02 19:36:20 +03:00
enum Argument {
2015-11-02 19:36:52 +03:00
indirect case File(Source, Argument)
2015-11-02 19:44:52 +03:00
indirect case OutputFlag(Output, Argument)
2015-11-02 19:36:52 +03:00
case End
2015-11-02 19:37:54 +03:00
2015-11-02 19:44:18 +03:00
var rest: Argument? {
switch self {
case let .File(_, rest):
return rest
2015-11-02 19:44:52 +03:00
case let .OutputFlag(_, rest):
return rest
2015-11-02 19:44:18 +03:00
case .End:
return nil
}
}
2015-11-02 19:37:54 +03:00
var files: [Source] {
switch self {
case let .File(a, rest):
return [a] + rest.files
default:
return rest?.files ?? []
2015-11-02 19:37:54 +03:00
}
}
2015-11-02 19:44:42 +03:00
enum Output {
case Unified
case Split
}
2015-11-02 19:36:20 +03:00
}
2015-11-02 19:35:32 +03:00
2015-11-02 19:35:41 +03:00
let argumentsParser: Madness.Parser<[String], Argument>.Function = none()
import Madness