protected boolean lastNonWhite(char c) { int i = cursor - 1; while (isWhitespace(expr[i])) i--; return c == expr[i]; }
public static boolean isStatementNotManuallyTerminated(char[] expr, int cursor) { if (cursor >= expr.length) return false; int c = cursor; while (c != expr.length && isWhitespace(expr[c])) c++; return !(c != expr.length && expr[c] == ';'); }
/** * From the specified cursor position, trim out any whitespace between the current position and beginning of the * first non-whitespace character. * * @param expr - * @param pos - * @return - */ public static int trimRight(char[] expr, int pos) { while (pos != expr.length && isWhitespace(expr[pos])) pos++; return pos; }
private void whiteSpaceSkip() { if (cursor < end) //noinspection StatementWithEmptyBody while (isWhitespace(property[cursor]) && ++cursor < end) ; }
/** * Set and finesse the expression, trimming an leading or proceeding whitespace. * * @param expression the expression */ protected void setExpression(char[] expression) { end = length = (this.expr = expression).length; while (start < length && isWhitespace(expr[start])) start++; while (length != 0 && isWhitespace(this.expr[length - 1])) length--; }
/** * Skip to the next non-whitespace position. */ protected void whiteSpaceSkip() { if (cursor < length) //noinspection StatementWithEmptyBody while (isWhitespace(expr[cursor]) && ++cursor != length) ; }
/** * From the current cursor position, trim backward over any whitespace to the first non-whitespace character. */ protected void trimWhitespace() { while (cursor != 0 && isWhitespace(expr[cursor - 1])) cursor--; }
/** * From the specified cursor position, trim out any whitespace between the current position and the end of the * last non-whitespace character. * * @param pos - current position * @return new position. */ protected int trimLeft(int pos) { if (pos > length) pos = length; while (pos > 0 && pos >= start && isWhitespace(expr[pos - 1])) pos--; return pos; }
/** * Return the previous non-whitespace character. * * @return - */ protected char lookToLast() { if (cursor == 0) return 0; int temp = cursor; while (temp != 0 && isWhitespace(expr[--temp])) ; return expr[temp]; }
/** * Skip to the next non-whitespace position. */ protected void whiteSpaceSkip() { if (cursor < length) //noinspection StatementWithEmptyBody while (isWhitespace(expr[cursor]) && ++cursor != length) ; }
public static boolean isJunct(char c) { switch (c) { case '[': case '(': return true; default: return isWhitespace(c); } }
/** * Skip to the next non-whitespace position. */ protected void whiteSpaceSkip() { if (cursor < length) //noinspection StatementWithEmptyBody while (isWhitespace(expr[cursor]) && ++cursor != length) ; }
/** * From the specified cursor position, trim out any whitespace between the current position and the end of the * last non-whitespace character. * * @param pos - current position * @return new position. */ protected int trimLeft(int pos) { if (pos > end) pos = end; while (pos > 0 && pos >= st && (isWhitespace(expr[pos - 1]) || expr[pos - 1] == ';')) pos--; return pos; }
/** * From the specified cursor position, trim out any whitespace between the current position and beginning of the * first non-whitespace character. * * @param pos - * @return - */ protected int trimRight(int pos) { while (pos != end && isWhitespace(expr[pos])) pos++; return pos; }
/** * Checks to see if the next part of the statement is an identifier part. * * @return boolean true if next part is identifier part. */ protected boolean isNextIdentifier() { while (cursor != end && isWhitespace(expr[cursor])) cursor++; return cursor != end && isIdentifierPart(expr[cursor]); }
public static int nextNonBlank(char[] expr, int cursor) { if ((cursor + 1) >= expr.length) { throw new CompileException("unexpected end of statement", expr, cursor); } int i = cursor; while (i != expr.length && isWhitespace(expr[i])) i++; return i; }
public Object parseCollection(char[] property, int start, int offset, boolean subcompile, ParserContext pCtx) { this.property = property; this.pCtx = pCtx; this.end = start + offset; while (start < end && isWhitespace(property[start])) { start++; } this.start = this.cursor = start; return parseCollection(subcompile); }
/** * Move to next cursor position from current cursor position. * @return */ public int nextNonBlank() { if ((cursor + 1) >= length) { throw new CompileException("unexpected end of statement", expr, cursor); } int i = cursor; while (i != length && isWhitespace(expr[i])) i++; return i; }
public CompiledIfNode(int begin, String name, char[] template, int start, int end, ParserContext context) { super(begin, name, template, start, end); while (cEnd > cStart && ParseTools.isWhitespace(template[cEnd])) cEnd--; if (cStart != cEnd) { ce = MVEL.compileExpression(template, cStart, cEnd - start, context); } }
public Object parseCollection(char[] property, int start, int offset, boolean subcompile, Class colType, ParserContext pCtx) { if (colType != null) this.colType = getBaseComponentType(colType); this.property = property; this.end = start + offset; while (start < end && isWhitespace(property[start])) { start++; } this.start = this.cursor = start; this.pCtx = pCtx; return parseCollection(subcompile); }