-
Notifications
You must be signed in to change notification settings - Fork 9
Update Madness to master #11
base: master
Are you sure you want to change the base?
Conversation
@@ -105,12 +105,12 @@ private func foldr<G: GeneratorType, Result>(inout generator: G, initial: Result | |||
return generator.next().map { combine($0, foldr(&generator, initial, combine)) } ?? initial | |||
} | |||
|
|||
private func | <T, U> (left: Parser<T>.Function, right: String -> U) -> Parser<Either<T, U>>.Function { | |||
return left | { (right($0), $0) } | |||
private func | <C: CollectionType, T, U where C.Generator.Element: Equatable>(left: Parser<C, T>.Function, right: () -> U) -> Parser<C, Either<T, U>>.Function { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it would be better if the type of right was: (C, C.Index) -> U
but then compiling takes endlessly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let’s not sweat it.
👍 this is very helpful, thank you. |
(line(n)|? ++ followingLine(n)*) --> { ($0 ?? []) + flatMap($1, id) } | ||
private let followingLine: Int -> Parser<String, [Node]>.Function = { n in (ignore(comment | br)+ ++ line(n)) } | ||
private let lines: Int -> Parser<String, [Node]>.Function = { n in | ||
{ ($0 ?? []) + flatMap($1, id) } <^> (line(n)|? ++ followingLine(n)*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: tabs, not spaces.
Spaces/tabs thing is the only thing I noticed. Thanks for the PR! 👍 |
Finally fixed indentation. Sorry that it took so long 😞. Now working on converting it to swift 2, but i will do that in another PR. |
Now ogdl-swift is using an really old version of Madness. Meanwhile Madness made
Parser
generic for allCollectionType
's instead of onlyString
and this is a big change in the api, so i thought this PR would make it a bit easier to move to the next official release 😄.