Skip to content

Instantly share code, notes, and snippets.

@djspiewak
Created August 21, 2014 17:19
Show Gist options
  • Save djspiewak/468fa881e94f9b50f0d5 to your computer and use it in GitHub Desktop.
Save djspiewak/468fa881e94f9b50f0d5 to your computer and use it in GitHub Desktop.
def lookahead[A](delegate: Parser[A]): Parser[(A, LineStream)] = new TerminalParser {
def parse(in: LineStream): Result[(A, LineStream)] = delegate parse in match {
case Success(value, tail) => Success((value, in), tail)
case r => r
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment