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
|
2015-11-02 19:44:30 +03:00
|
|
|
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
|