1 package jfun.parsec.trace; 2 /** 3 * This interface is used to trace parser result. 4 * <p> 5 * @author Ben Yu 6 * @since version 1.1 7 * May 9, 2006 7:18:31 PM 8 */ 9 public interface Trace<T> { 10 /** 11 * This method is called when parser failed. 12 * @param except the pseudo exception object. null if no exception. 13 * @param src the text being parsed. 14 * @param index the index where the parser terminates. 15 * @param steps the logical steps consumed. 16 * @param offset the physical offset consumed. 17 */ 18 public void onError(Object except, CharSequence src, int index, int steps, int offset); 19 20 /** 21 * This method is called when parser succeeded. 22 * @param result the parser result. 23 * @param src the text being parsed. 24 * @param index the index where the parser terminates. 25 * @param steps the logical steps consumed. 26 * @param offset the physical offset consumed. 27 */ 28 public void onSuccess(T result, CharSequence src, int index, int steps, int offset); 29 } 30