Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Created July 12, 2015 21:32
Show Gist options
  • Save yorickpeterse/a8a6c9ba6be60d687bf8 to your computer and use it in GitHub Desktop.
Save yorickpeterse/a8a6c9ba6be60d687bf8 to your computer and use it in GitHub Desktop.
test, predicate = *ast
catch_arg = symbol(:predicate_matched)
process(test, input) do |matched_test_node|
catch_var = literal('predicate_matched')
catch_block = send_message('catch', catch_arg).add_block do
process(predicate, matched_test_node) do
send_message('throw', catch_arg, literal('true'))
end
end
catch_var.assign(catch_block)
.followed_by(catch_var.if_true { yield matched_test_node })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment