public void LT(int i, Object t) { int ID = adaptor.getUniqueID(t); String text = adaptor.getText(t); int type = adaptor.getType(t); StringBuffer buf = new StringBuffer(50); buf.append("LN\t"); // lookahead node; distinguish from LT in protocol buf.append(i); serializeNode(buf, t); transmit(buf.toString()); }
public void createNode(Object t) { int ID = adaptor.getUniqueID(t); String text = adaptor.getText(t); int type = adaptor.getType(t); StringBuffer buf = new StringBuffer(50); buf.append("createNodeFromTokenElements\t"); buf.append(ID); buf.append("\t"); buf.append(type); serializeText(buf, text); transmit(buf.toString()); }
protected void serializeNode(StringBuffer buf, Object t) { int ID = adaptor.getUniqueID(t); String text = adaptor.getText(t); int type = adaptor.getType(t); buf.append("\t"); buf.append(ID); buf.append("\t"); buf.append(type); Token token = adaptor.getToken(t); int line = -1; int pos = -1; if (token != null) { line = token.getLine(); pos = token.getCharPositionInLine(); } buf.append("\t"); buf.append(line); buf.append("\t"); buf.append(pos); int tokenIndex = adaptor.getTokenStartIndex(t); buf.append("\t"); buf.append(tokenIndex); serializeText(buf, text); }