Skip to content

Instantly share code, notes, and snippets.

@PollRobots
Created February 1, 2013 08:00
Show Gist options
  • Save PollRobots/4690035 to your computer and use it in GitHub Desktop.
Save PollRobots/4690035 to your computer and use it in GitHub Desktop.
| Rule (x, y, z) ->
ibprintfn b 0 "matchRule%s (input:string) (offset:int) = " <| capitalIdentifier x
let j = i + 4
if z = "" then codeGen b j y else
ibprintfn b j "let res = "
codeGen b (j + 4) y
ibprintfn b 0 " in"
ibprintfn b (j + 4) "match res with"
ibprintfn b (j + 4) "| (Unmatched, _) -> (Unmatched, offset)"
ibprintf b (j + 4) "| (parsed, endOffset) -> (%s input.[offset..endOffset - 1] parsed, endOffset)" z
ibprintfn b 0 ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment