Reputation: 21
After reading the documentation on https://github.com/sirthias/parboiled2, I discovered that I could pop something out of the stack with the rule:
type PopRule[-L <: HList] = Rule[L, HNil]
But I could not find a working example of this type of rule for when L is not String.
For example, supose I have the following rule:
case class A()
case class B()
def foo = rule { push(A) }
def pop_rule:PopRule[A, HNil] = rule { pop(A)}
To justify this there is the general definition of a parboiled2 rule:
class Rule[-I <: HList, +O <: HList]
Where it represents a rule that pops the value from I from the stack and puts the value from O into the stack.
So far, I cannot think of an example implementation for the following rule type:
def rule_of_interest:Rule[A, B] = rule { pops(A) ~> push(B)}
Upvotes: 2
Views: 162