Skip to content

Commit

Permalink
Added debug combinator
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolucent authored and Gregory Higley committed Oct 3, 2015
1 parent 76b6018 commit e4cda67
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Parsimonious/Primitives.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,9 @@ public func lift<T1, T2>(parser: ParseContext -> ParseResult<T1>, transform: T1

public func end<T>(context: ParseContext) -> ParseResult<T> {
return context.position == context.string.endIndex ? .Matched([]) : .NotMatched
}

public func debug<T>(parser: ParseContext -> ParseResult<T>)(_ context: ParseContext) -> ParseResult<T> {
print(context.remainder)
return parser(context)
}

0 comments on commit e4cda67

Please sign in to comment.