/** * Reads until a token is reached. * @param tok The token to read to. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public void readToToken(int tok) throws CoreException { int curr= 0; do { curr= readNext(false); } while (curr != tok); }
/** * Reads until a token is reached. * @param tok The token to read to. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public void readToToken(int tok) throws CoreException { int curr= 0; do { curr= readNext(false); } while (curr != tok); }
/** * Reads the next token from the given offset and returns the offset after the token. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread * @return Returns the start position of the next token. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int getNextEndOffset(int offset, boolean ignoreComments) throws CoreException { readNext(offset, ignoreComments); return getCurrentEndOffset(); }
/** * Reads the next token from the given offset and returns the start offset of the token. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread * @return Returns the start position of the next token. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int getNextStartOffset(int offset, boolean ignoreComments) throws CoreException { readNext(offset, ignoreComments); return getCurrentStartOffset(); }
/** * Reads the next token from the given offset. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread. * @return Returns the token id. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int readNext(int offset, boolean ignoreComments) throws CoreException { setOffset(offset); return readNext(ignoreComments); }
/** * Reads the next token from the given offset. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread. * @return Returns the token id. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int readNext(int offset, boolean ignoreComments) throws CoreException { setOffset(offset); return readNext(ignoreComments); }
/** * Reads the next token from the given offset and returns the start offset of the token. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread * @return Returns the start position of the next token. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int getNextStartOffset(int offset, boolean ignoreComments) throws CoreException { readNext(offset, ignoreComments); return getCurrentStartOffset(); }
/** * Reads the next token from the given offset. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread. * @return Returns the token id. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int readNext(int offset, boolean ignoreComments) throws CoreException { setOffset(offset); return readNext(ignoreComments); }
/** * Reads the next token from the given offset and returns the offset after the token. * @param offset The offset to start reading from. * @param ignoreComments If set, comments will be overread * @return Returns the start position of the next token. * @exception CoreException Thrown when the end of the file has been reached (code END_OF_FILE) * or a lexical error was detected while scanning (code LEXICAL_ERROR) */ public int getNextEndOffset(int offset, boolean ignoreComments) throws CoreException { readNext(offset, ignoreComments); return getCurrentEndOffset(); }
private int getPosAfterToken(int pos, int token) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == token) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; } /*
private int getPosAfterLeftBrace(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNameLBRACE) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterTry(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNametry) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterTry(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNametry) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterLeftBrace(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNameLBRACE) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterLeftBrace(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNameLBRACE) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterTry(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNametry) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private int getPosAfterToken(int pos, int token) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == token) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; } /*
private int getPosAfterLeftBrace(int pos) { try { int nextToken= getScanner().readNext(pos, true); if (nextToken == TerminalTokens.TokenNameLBRACE) { return getScanner().getCurrentEndOffset(); } } catch (CoreException e) { handleException(e); } return pos; }
private void replaceOperation(int posBeforeOperation, String newOperation, TextEditGroup editGroup) { try { getScanner().readNext(posBeforeOperation, true); doTextReplace(getScanner().getCurrentStartOffset(), getScanner().getCurrentLength(), newOperation, editGroup); } catch (CoreException e) { handleException(e); } }
private void replaceOperation(int posBeforeOperation, String newOperation, TextEditGroup editGroup) { try { getScanner().readNext(posBeforeOperation, true); doTextReplace(getScanner().getCurrentStartOffset(), getScanner().getCurrentLength(), newOperation, editGroup); } catch (CoreException e) { handleException(e); } }