1 package org.antlr.works.debugger.events; 2 3 import org.antlr.runtime.Token; 4 34 35 public class DBEventFactory { 36 37 public static DBEvent createLocation(int line, int pos) { 38 return new DBEventLocation(line, pos); 39 } 40 41 public static DBEvent createConsumeToken(Token token) { 42 return new DBEventConsumeToken(token); 43 } 44 45 public static DBEvent createConsumeHiddenToken(Token token) { 46 return new DBEventConsumeHiddenToken(token); 47 } 48 49 public static DBEvent createLT(int i, Token token) { 50 return new DBEventLT(i, token); 51 } 52 53 public static DBEvent createEnterRule(String name) { 54 return new DBEventEnterRule(name); 55 } 56 57 public static DBEvent createExitRule(String name) { 58 return new DBEventExitRule(name); 59 } 60 61 public static DBEvent createEnterSubRule(int decision) { 62 return new DBEventEnterSubRule(decision); 63 } 64 65 public static DBEvent createExitSubRule(int decision) { 66 return new DBEventExitSubRule(decision); 67 } 68 69 public static DBEvent createEnterDecision(int decision) { 70 return new DBEventEnterDecision(decision); 71 } 72 73 public static DBEvent createExitDecision(int decision) { 74 return new DBEventExitDecision(decision); 75 } 76 77 public static DBEvent createEnterAlt(int alt) { 78 return new DBEventEnterAlt(alt); 79 } 80 81 public static DBEvent createMark(int i) { 82 return new DBEventMark(i); 83 } 84 85 public static DBEvent createRewind(int i) { 86 return new DBEventRewind(i); 87 } 88 89 public static DBEvent createRewind() { 90 return new DBEventRewind(); 91 } 92 93 public static DBEvent createBeginBacktrack(int level) { 94 return new DBEventBeginBacktrack(level); 95 } 96 97 public static DBEvent createEndBacktrack(int level, boolean successful) { 98 return new DBEventEndBacktrack(level, successful); 99 } 100 101 public static DBEvent createRecognitionException(Exception e) { 102 return new DBEventRecognitionException(e); 103 } 104 105 public static DBEvent createBeginResync() { 106 return new DBEvent(DBEvent.BEGIN_RESYNC); 107 } 108 109 public static DBEvent createEndResync() { 110 return new DBEvent(DBEvent.END_RESYNC); 111 } 112 113 public static DBEvent createCommence() { 114 return new DBEvent(DBEvent.COMMENCE); 115 } 116 117 public static DBEvent createTerminate() { 118 return new DBEvent(DBEvent.TERMINATE); 119 } 120 121 public static DBEvent createNilNode(int id) { 122 return new DBEventNilNode(id); 123 } 124 125 public static DBEvent createCreateNode(int id, int tokenIndex) { 126 return new DBEventCreateNode(id, tokenIndex); 127 } 128 129 public static DBEvent createCreateNode(int id, String text, int type) { 130 return new DBEventCreateNode(id, text, type); 131 } 132 133 public static DBEvent createBecomeRoot(int newRootID, int oldRootID) { 134 return new DBEventBecomeRoot(newRootID, oldRootID); 135 } 136 137 public static DBEvent createAddChild(int rootID, int childID) { 138 return new DBEventAddChild(rootID, childID); 139 } 140 141 public static DBEvent createSetTokenBoundaries(int id, int startIndex, int stopIndex) { 142 return new DBEventSetTokenBoundaries(id, startIndex, stopIndex); 143 } 144 145 } 146 | Popular Tags |