scala - Parboiled2 PopRule example -
after reading documentation on https://github.com/sirthias/parboiled2, discovered pop out of stack rule:
type poprule[-l <: hlist] = rule[l, hnil]
but not find working example of type of rule when l not string.
for example, supose have following rule:
case class a() case class b() def foo = rule { push(a) } def pop_rule:poprule[a, hnil] = rule { pop(a)}
to justify there general definition of parboiled2 rule:
class rule[-i <: hlist, +o <: hlist]
where represents rule pops value from stack , puts value o stack.
so far, cannot think of example implementation following rule type:
def rule_of_interest:rule[a, b] = rule { pops(a) ~> push(b)}
Comments
Post a Comment