| 462 | private Exec exec = null; |
| 463 | |
| 464 | public Step(Object thing) { |
| 465 | if (thing instanceof CharSequence) { |
| 466 | this.rule = str((CharSequence) thing); |
| 467 | } else if (thing instanceof Character) { |
| 468 | this.rule = ch((Character) thing); |
| 469 | } else if (thing instanceof PegLegParser.PegLegRule) { |
| 470 | this.rule = (PegLegRule<V>) thing; |
| 471 | } else if (thing instanceof Exec) { |
| 472 | this.exec = (Exec) thing; |
| 473 | } else if (thing instanceof Runnable) { this.exec = ex((Runnable) thing); } else { |
| 474 | throw new RuntimeException("Expected String/char/PegLegRule/Exec/Runnable; found: " + thing); |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | public Exec asExec() { return this.exec; } |
| 479 | |