| 107 | } |
| 108 | |
| 109 | public class ParentRule implements PegLegRule<V> { |
| 110 | private final PegLegRule<V> rule; |
| 111 | private Ref<?>[] refs = null; |
| 112 | |
| 113 | public ParentRule(PegLegRule<V> rule) { |
| 114 | this.rule = rule; |
| 115 | } |
| 116 | |
| 117 | public PegLegRule<V> refs(Ref<?>... refs) { |
| 118 | this.refs = refs; |
| 119 | return this; |
| 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public RuleReturn<V> rule() { |
| 124 | if (refs == null) { return rule.rule(); } |
| 125 | for (Ref<?> r : refs) { r.enterRef(); } |
| 126 | try { |
| 127 | return rule.rule(); |
| 128 | } finally { |
| 129 | for (Ref<?> r : refs) { r.exitRef(); } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | public static class SourcePosition { |
| 135 | int line = 1; |
nothing calls this directly
no outgoing calls
no test coverage detected