Skip to content

Instantly share code, notes, and snippets.

@blambeau
Created October 7, 2011 08:28
Show Gist options
  • Save blambeau/1269769 to your computer and use it in GitHub Desktop.
Save blambeau/1269769 to your computer and use it in GitHub Desktop.
Wlang dialect
require 'wlang'
$vars = []
dialect = WLang::dialect do
rule "#" do |parser, offset|
varname, reached = parser.parse(offset)
$vars << varname
["#{varname}", reached]
end
end
src = "SELECT * FROM #{table}"
context = {}
WLang::instantiate(src, context, dialect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment