private int captureOrbToken() { int newStart = ++cursor; while ((cursor != length) && ParseTools.isIdentifierPart(template[cursor])) cursor++; if (cursor != length && template[cursor] == '{') return newStart; return -1; }
public static boolean isPropertyOnly(char[] array, int start, int end) { for (int i = start; i < end; i++) { if (!isIdentifierPart(array[i])) return false; } return true; }
private int captureOrbToken() { int newStart = ++cursor; while ((cursor != length) && ParseTools.isIdentifierPart(template[cursor])) cursor++; if (cursor != length && template[cursor] == '{') return newStart; return -1; }
private int captureOrbToken() { int newStart = ++cursor; while ((cursor != length) && ParseTools.isIdentifierPart(template[cursor])) cursor++; if (cursor != length && template[cursor] == '{') return newStart; return -1; }
public static boolean isPropertyOnly(char[] array, int start, int end) { for (int i = start; i < end; i++) { if (!isIdentifierPart(array[i])) return false; } return true; }
public int captureOrbToken() { int newStart = ++cursor; while ((cursor != length) && ParseTools.isIdentifierPart(template[cursor])) cursor++; if (cursor != length && template[cursor] == '{') return newStart; return -1; }
public static boolean isLiteralOnly(char[] array, int start, int end) { end = start + (end - start); for (int i = start; i < end; i++) { if (!ParseTools.isIdentifierPart(array[i])) return false; } return true; }
/** * Check if the specfied string represents a valid name of label. * * @param name - * @return - */ public static boolean isNotValidNameorLabel(String name) { for (char c : name.toCharArray()) { if (c == '.') return true; else if (!isIdentifierPart(c)) return true; } return false; }
/** * Check if the specfied string represents a valid name of label. * * @param name - * @return - */ public static boolean isNotValidNameorLabel(String name) { for (char c : name.toCharArray()) { if (c == '.') return true; else if (!isIdentifierPart(c)) return true; } return false; }
/** * Check if the specfied string represents a valid name of label. * * @param name - * @return - */ public static boolean isNotValidNameorLabel(String name) { for (char c : name.toCharArray()) { if (c == '.') return true; else if (!isIdentifierPart(c)) return true; } return false; }
/** * 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]); }
/** * 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]); }
/** * 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 != length && isWhitespace(expr[cursor])) cursor++; return cursor != length && isIdentifierPart(expr[cursor]); }
/** * Returns true if the next is an identifier or literal. * * @return true of false */ protected boolean isNextIdentifierOrLiteral() { int tmp = cursor; if (tmp == end) return false; else { while (tmp != end && isWhitespace(expr[tmp])) tmp++; if (tmp == end) return false; char n = expr[tmp]; return isIdentifierPart(n) || isDigit(n) || n == '\'' || n == '"'; } }
/** * Returns true if the next is an identifier or literal. * @return */ protected boolean isNextIdentifierOrLiteral() { int tmp = cursor; if (tmp == length) return false; else { while (tmp != length && isWhitespace(expr[tmp])) tmp++; if (tmp == length) return false; char n = expr[tmp]; return isIdentifierPart(n) || isDigit(n) || n == '\'' || n == '"'; } }
/** * Returns true if the next is an identifier or literal. * * @return true of false */ protected boolean isNextIdentifierOrLiteral() { int tmp = cursor; if (tmp == end) return false; else { while (tmp != end && isWhitespace(expr[tmp])) tmp++; if (tmp == end) return false; char n = expr[tmp]; return isIdentifierPart(n) || isDigit(n) || n == '\'' || n == '"'; } }
/** * Capture to the end of the current identifier under the cursor. */ protected void captureIdentifier() { boolean captured = false; if (cursor == end) throw new CompileException("unexpected end of statement: EOF", expr, cursor); while (cursor != end) { switch (expr[cursor]) { case ';': return; default: { if (!isIdentifierPart(expr[cursor])) { if (captured) return; throw new CompileException("unexpected symbol (was expecting an identifier): " + expr[cursor], expr, cursor); } else { captured = true; } } } cursor++; } }
/** * Capture to the end of the current identifier under the cursor. */ protected void captureIdentifier() { boolean captured = false; if (cursor == end) throw new CompileException("unexpected end of statement: EOF", expr, cursor); while (cursor != end) { switch (expr[cursor]) { case ';': return; default: { if (!isIdentifierPart(expr[cursor])) { if (captured) return; throw new CompileException("unexpected symbol (was expecting an identifier): " + expr[cursor], expr, cursor); } else { captured = true; } } } cursor++; } }
/** * Capture to the end of the current identifier under the cursor. */ protected void captureIdentifier() { boolean captured = false; if (cursor == length) throw new CompileException("unexpected end of statement: EOF", expr, cursor); while (cursor != length) { switch (expr[cursor]) { case ';': return; default: { if (!isIdentifierPart(expr[cursor])) { if (captured) return; throw new CompileException("unexpected symbol (was expecting an identifier): " + expr[cursor], expr, cursor); } else { captured = true; } } } cursor++; } }
/** * This is such a horrible hack, but it's more performant than any other horrible hack I can think of * right now. * * @param expr * @param cursor * @param pCtx */ public static void checkForPossibleUnresolvedViolations(char[] expr, int cursor, ParserContext pCtx) { if (isUnresolvedWaiting()) { LinkedHashMap<String, Object> imports = (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports(); Object o = imports.values().toArray()[imports.size() - 1]; if (o instanceof Proto) { Proto proto = (Proto) o; int last = proto.getCursorEnd(); cursor--; /** * We walk backwards to ensure that the last valid statement was a proto declaration. */ while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--; while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--; while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--; if (cursor != last) { throw new CompileException("unresolved reference (possible illegal forward-reference?): " + ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart()); } } } }