Sha256: 8c447145a2cbf40dd7ab4e758de427ad5bb74863ee02b9ec13e6d559edfcd845
Contents?: true
Size: 657 Bytes
Versions: 7
Compression:
Stored size: 657 Bytes
Contents
require 'citrus' module Citrus module GrammarMethods # Permits creation of aliases within rule definitions in Ruby grammars using # the bare name of another rule instead of a Symbol, e.g.: # # rule :value do # any(:alpha, :num) # end # # can now be written as # # rule value do # any(alpha, num) # end # # The only caveat is that since this hack uses +method_missing+ you must # still use symbols for rules that have the same name as any of the methods # in GrammarMethods (root, rule, rules, etc.) def method_missing(sym, *args) sym end end end
Version data entries
7 entries across 7 versions & 1 rubygems