| 523 | } |
| 524 | |
| 525 | @SuppressWarnings("unchecked") |
| 526 | private List<Step> asSteps(Object... objs) { |
| 527 | if (objs.length == 0) { |
| 528 | return Collections.emptyList(); |
| 529 | } else if (objs.length == 1) { |
| 530 | if (objs[0] instanceof PegLegParser.Step) { |
| 531 | return Collections.singletonList((Step) objs[0]); |
| 532 | } |
| 533 | return Collections.singletonList(new Step(objs[0])); |
| 534 | } |
| 535 | ArrayList<Step> ret = new ArrayList<>(); |
| 536 | for (Object o : objs) { |
| 537 | ret.add(o instanceof PegLegParser.Step ? (PegLegParser<V>.Step) o : new Step(o)); |
| 538 | } |
| 539 | return ret; |
| 540 | } |
| 541 | |
| 542 | private RuleReturn<V> innerTimesOf(String name, int min, int max, Object... objs) { |
| 543 | PegLegRule<V> rule = seqOf(objs); |