Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created December 1, 2013 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robotlolita/7742455 to your computer and use it in GitHub Desktop.
Save robotlolita/7742455 to your computer and use it in GitHub Desktop.
Parsing combinators in LS
export char = (a) -> (state) ->
state.consume 1 .chain (b) ->
| a is b => Either.Right [state.skip 1; b]
| otherwise => Either.Left [state; "Expected #a, found #b."]
.or-else ->
Either.Left [state; "Expected #a, but reached the end of the input."]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment