Skip to content

Instantly share code, notes, and snippets.

@swarley
Created December 2, 2012 03:13
Show Gist options
  • Select an option

  • Save swarley/4186786 to your computer and use it in GitHub Desktop.

Select an option

Save swarley/4186786 to your computer and use it in GitHub Desktop.
What are your thoughts.
# This method is to hook sequences of Tokens from the lexer and create a new hack-hook (unintended alliteration)
# @example
# on_sequence RubyToken::TkNLINE, [RubyToken::TkSPACE], '*', RubyToken::TkNLINE do
# ... # TODO: Add in example code for this, I havn't decided on an API for Hackage::Sequence yet,
# end
# The purpose of these sequences are to detect whether we have a matching possibility for a hack, which would determine
# the necesity or lack there of to parse hooked objects in the hack type, the given example would be an implementation for
# a hack that would allow the hooking of hacks that targeted specifically single line operations.
#
# WARNING: This API is subject to many changes as I examine the way that Hackage::Lexer deals with its Tokens and whether or not they are left as
# the simple RubyTokens. I apologize for any possible and likely changes that may occur.
#
# @param [Array<RubyToken>] seq The sequence to be passed to Hackage::Sequence#new.
# @param [Proc] block The block passed to the new Hackage::Sequence object.
#
# @return [Hackage::Sequence] The new sequence object that is bound to the HackType.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment