@Override public void setText(CharacterIterator newText) { if (newText == null) { throw new IllegalArgumentException("newText is null"); } this.charIt = newText; this.breaks.clear(); this.peekChar = newText.current(); this.breakOffset = -1; } }
@Override public int current() { if (breakOffset < 0) { return 0; } return breakOffset < breaks.size() ? breaks.get(breakOffset) : charIt.current(); }
@Override public void setText(CharacterIterator newText) { if (newText == null) { throw new NullPointerException("newText == null"); } newText.current(); wrapped.setText(newText); }
private String characterIteratorToString(CharacterIterator it) { StringBuilder result = new StringBuilder(); for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) { result.append(ch); } return result.toString(); }
public ExpressionLexer(AviatorEvaluatorInstance instance, String expression) { this.iterator = new StringCharacterIterator(expression); this.expression = expression; this.symbolTable = new SymbolTable(); this.peek = this.iterator.current(); this.instance = instance; this.mathContext = this.instance.getOptionValue(Options.MATH_CONTEXT).mathContext; this.parseFloatIntoDecimal = this.instance.getOptionValue(Options.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL).bool; }
/** * @see UCharacterIterator#current() */ @Override public int current() { int c = iterator.current(); if(c==CharacterIterator.DONE){ return DONE; } return c; }
/** * Utility to return if the next character is a dot. * @return Whether it is a dot at the current point */ public boolean nextIsDot() { return (ci.current() == '.'); }
/** * Get the character at the current position (as returned * by getIndex()). * <br><b>Specified by:</b> java.text.CharacterIterator. */ public char current() { return iter.current(); }
private String characterIteratorToString(CharacterIterator it) { StringBuilder result = new StringBuilder(); for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) { result.append(ch); } return result.toString(); }
@Override public void setText(CharacterIterator newText) { if (newText == null) { throw new NullPointerException("newText == null"); } newText.current(); wrapped.setText(newText); }
/** * Utility to return if the next non-whitespace character is a single quote. * @return Whether it is a single quote at the current point (ignoring whitespace) */ public boolean nextIsSingleQuote() { skipWS(); return (ci.current() == '\''); }
public String remaining() { StringBuffer sb = new StringBuffer(); char c = ci.current(); while (c != CharacterIterator.DONE) { sb.append(c); c = ci.next(); } return sb.toString(); }
private String characterIteratorToString(CharacterIterator it) { StringBuilder result = new StringBuilder(); for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) { result.append(ch); } return result.toString(); }
/** * @see UCharacterIterator#next() */ @Override public int next() { int i = iterator.current(); iterator.next(); if(i==CharacterIterator.DONE){ return DONE; } return i; }
@Override public void setText(CharacterIterator newText) { if (newText == null) { throw new NullPointerException("newText == null"); } newText.current(); wrapped.setText(newText); }
/** * Check if END OF TEXT is reach * @return true if END OF TEXT is reach */ public boolean parseEOS() { skipWS(); return ci.current() == CharacterIterator.DONE; }
@Override public void setText(CharacterIterator newText) { if (newText == null) { throw new NullPointerException("newText == null"); } newText.current(); wrapped.setText(newText); }
/** * Moves the iterator past any white space. White space is ' ', '\t', '\n' * and '\r'. */ public static void skipWhiteSpace(CharacterIterator i) { char c = i.current(); while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { c = i.next(); } }
private String characterIteratorToString(CharacterIterator it) { StringBuilder result = new StringBuilder(); for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) { result.append(ch); } return result.toString(); }