do { if (tk != null) { captureToNextTokenJunction(); skipWhitespace(); cond = expr[cursor] != '{' && expr[cursor] == 'i' && expr[++cursor] == 'f' && expr[cursor = incNextNonBlank()] == '('; if (((IfNode) (tk = _captureBlock(tk, expr, cond, type))).getElseBlock() != null) { cursor++; return first; while (ifThenElseBlockContinues()); skipWhitespace(); return _captureBlock(null, expr, false, type); captureToNextTokenJunction(); skipWhitespace(); return _captureBlock(null, expr, true, type);
/** * Handle a union between a closed statement and a residual property chain. * @param node * @return */ protected ASTNode handleUnion(ASTNode node) { if (cursor != length) { skipWhitespace(); int union = -1; switch (expr[cursor]) { case '.': union = cursor + 1; break; case '[': union = cursor; } if (union != -1) { captureToEOT(); return lastNode = new Union(expr, union, cursor, fields, node); } } return lastNode = node; }
lastNode = (ASTNode) splitAccumulator.pop(); if (cursor >= length && lastNode instanceof EndOfStatement) { return nextToken(); debugSymbols = (pCtx = getParserContext()).isDebugSymbols(); skipWhitespace(); skipWhitespace(); switch (OPERATORS.get(t)) { case NEW: if (!isIdentifierPart(expr[start = cursor = trimRight(cursor)])) { throw new CompileException("unexpected character (expected identifier): " + expr[cursor], expr, cursor); captureToNextTokenJunction(); skipWhitespace(); if (cursor < length && !lastNonWhite(']')) captureToEOT(); TypeDescriptor descr = new TypeDescriptor(subArray(start, cursor), fields); if (pCtx == null) pCtx = getParserContext(); skipWhitespace(); if (cursor != length && expr[cursor] == '{') { if (!((NewObjectNode) lastNode).getTypeDescr().isUndimensionedArray()) {
private ASTNode _captureBlock(ASTNode node, final char[] expr, boolean cond, int type) { skipWhitespace(); int startCond = 0; int endCond = 0; captureToNextTokenJunction(); if (pCtx == null) pCtx = getParserContext(); if (pCtx == null) pCtx = getParserContext(); ProtoParser.checkForPossibleUnresolvedViolations(expr, cursor, pCtx); captureToNextTokenJunction(); if (expr[cursor = nextNonBlank()] != '{') { throw new CompileException("expected '{' but found: " + expr[cursor]); if (pCtx == null) pCtx = getParserContext(); if (pCtx == null) pCtx = getParserContext(); skipWhitespace(); captureToEOSorEOL(); blockEnd = cursor + 1; return ifNode.setElseBlock(subArray(trimRight(blockStart + 1), trimLeft(blockEnd - 1))); return ifNode.setElseIf((IfNode) createBlockToken(startCond, endCond, trimRight(blockStart + 1), trimLeft(blockEnd), type));
private ASTNode _captureBlock(ASTNode node, final char[] expr, boolean cond, int type) { skipWhitespace(); int startCond = 0; int endCond = 0; captureToNextTokenJunction(); captureToNextTokenJunction(); if (expr[cursor = nextNonBlank()] != '{') { throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor); if (expr[cursor = nextNonBlank()] != '{') { throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor); skipWhitespace(); captureToEOSorEOL(); blockEnd = cursor + 1; return ifNode.setElseBlock(expr, st = trimRight(blockStart + 1), trimLeft(blockEnd) - st, pCtx); return ifNode.setElseIf((IfNode) createBlockToken(startCond, endCond, trimRight(blockStart + 1), trimLeft(blockEnd), type)); return createBlockToken(startCond, endCond, blockStart + 1, blockEnd, type); skipWhitespace(); st = cursor; captureToNextTokenJunction();
captureToEOS(); captureToEOS(); splitAccumulator.add(new TypedVarNode(subArray(start, cursor), fields | ASTNode.ASSIGN, (Class) lastNode.getLiteralValue(), pCtx)); captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, start, cursor - start), splitAccumulator.add(new ProtoVarNode(subArray(start, cursor), fields | ASTNode.ASSIGN, (Proto) lastNode, pCtx)); captureToEOS(); if (decl) { splitAccumulator.add(new DeclTypedVarNode(new String(expr, start, cursor - start), splitAccumulator.add(new TypedVarNode(subArray(start, cursor), fields | ASTNode.ASSIGN, (Class) stk.pop(), pCtx)); captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, start, cursor - start), splitAccumulator.add(new ProtoVarNode(subArray(start, cursor), fields | ASTNode.ASSIGN, (Proto) stk.pop(), pCtx)); skipWhitespace(); if (cursor < length && expr[cursor] == ',') {
lastNode.discard(); captureToEOS(); captureToEOS(); splitAccumulator.add(new TypedVarNode(expr, st, cursor - st - 1, fields | ASTNode.ASSIGN, (Class) lastNode.getLiteralValue(), pCtx)); captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, st, cursor - st), captureToEOS(); if (decl) { splitAccumulator.add(new DeclTypedVarNode(new String(expr, st, cursor - st), expr, st, cursor - st, captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, st, cursor - st), skipWhitespace(); if (cursor < end && expr[cursor] == ',') { st = ++cursor;
lastNode = (ASTNode) splitAccumulator.pop(); if (cursor >= end && lastNode instanceof EndOfStatement) { return nextToken(); skipWhitespace(); skipWhitespace(); switch (OPERATORS.get(t)) { case NEW: if (!isIdentifierPart(expr[st = cursor = trimRight(cursor)])) { throw new CompileException("unexpected character (expected identifier): " + expr[cursor], expr, st); captureToNextTokenJunction(); skipWhitespace(); if (cursor < end && !lastNonWhite(']')) captureToEOT(); TypeDescriptor descr = new TypeDescriptor(expr, st, trimLeft(cursor) - st, fields); skipWhitespace(); if (cursor != end && expr[cursor] == '{') { if (!((NewObjectNode) lastNode).getTypeDescr().isUndimensionedArray()) { if (tokenContinues()) { lastNode = new InlineCollectionNode(expr, st, cursor - st, fields, egressType, pCtx); st = cursor;
private ASTNode _captureBlock(ASTNode node, final char[] expr, boolean cond, int type) { skipWhitespace(); int startCond = 0; int endCond = 0; captureToNextTokenJunction(); captureToNextTokenJunction(); if (expr[cursor = nextNonBlank()] != '{') { throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor); if (expr[cursor = nextNonBlank()] != '{') { throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor); skipWhitespace(); captureToEOSorEOL(); blockEnd = cursor + 1; return ifNode.setElseBlock(expr, st = trimRight(blockStart + 1), trimLeft(blockEnd) - st, pCtx); return ifNode.setElseIf((IfNode) createBlockToken(startCond, endCond, trimRight(blockStart + 1), trimLeft(blockEnd), type)); return createBlockToken(startCond, endCond, blockStart + 1, blockEnd, type); skipWhitespace(); st = cursor; captureToNextTokenJunction();
lastNode.discard(); captureToEOS(); captureToEOS(); splitAccumulator.add(new TypedVarNode(expr, st, cursor - st - 1, fields | ASTNode.ASSIGN, (Class) lastNode.getLiteralValue(), pCtx)); captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, st, cursor - st), captureToEOS(); if (decl) { splitAccumulator.add(new DeclTypedVarNode(new String(expr, st, cursor - st), expr, st, cursor - st, captureToEOS(); if (decl) { splitAccumulator.add(new DeclProtoVarNode(new String(expr, st, cursor - st), skipWhitespace(); if (cursor < end && expr[cursor] == ',') { st = ++cursor;
lastNode = (ASTNode) splitAccumulator.pop(); if (cursor >= end && lastNode instanceof EndOfStatement) { return nextToken(); skipWhitespace(); skipWhitespace(); switch (OPERATORS.get(t)) { case NEW: if (!isIdentifierPart(expr[st = cursor = trimRight(cursor)])) { throw new CompileException("unexpected character (expected identifier): " + expr[cursor], expr, st); captureToNextTokenJunction(); skipWhitespace(); if (cursor < end && !lastNonWhite(']')) captureToEOT(); TypeDescriptor descr = new TypeDescriptor(expr, st, trimLeft(cursor) - st, fields); skipWhitespace(); if (cursor != end && expr[cursor] == '{') { if (!((NewObjectNode) lastNode).getTypeDescr().isUndimensionedArray()) { if (tokenContinues()) { lastNode = new InlineCollectionNode(expr, st, cursor - st, fields, egressType, pCtx); st = cursor;
do { if (tk != null) { captureToNextTokenJunction(); skipWhitespace(); cond = expr[cursor] != '{' && expr[cursor] == 'i' && expr[++cursor] == 'f' && expr[cursor = incNextNonBlank()] == '('; if (((IfNode) (tk = _captureBlock(tk, expr, cond, type))).getElseBlock() != null) { cursor++; return first; while (ifThenElseBlockContinues()); skipWhitespace(); return _captureBlock(null, expr, false, type); captureToNextTokenJunction(); skipWhitespace(); return _captureBlock(null, expr, true, type);
/** * Handle a union between a closed statement and a residual property chain. * * @param node an ast node * @return ASTNode */ protected ASTNode handleUnion(ASTNode node) { if (cursor != end) { skipWhitespace(); int union = -1; if (cursor < end) { switch (expr[cursor]) { case '.': union = cursor + 1; break; case '[': union = cursor; } } if (union != -1) { captureToEOT(); return lastNode = new Union(expr, union, cursor - union, fields, node, pCtx); } } return lastNode = node; }
do { if (tk != null) { captureToNextTokenJunction(); skipWhitespace(); cond = expr[cursor] != '{' && expr[cursor] == 'i' && expr[++cursor] == 'f' && expr[cursor = incNextNonBlank()] == '('; if (((IfNode) (tk = _captureBlock(tk, expr, cond, type))).getElseBlock() != null) { cursor++; return first; while (ifThenElseBlockContinues()); skipWhitespace(); return _captureBlock(null, expr, false, type); captureToNextTokenJunction(); skipWhitespace(); return _captureBlock(null, expr, true, type);
/** * Handle a union between a closed statement and a residual property chain. * * @param node an ast node * @return ASTNode */ protected ASTNode handleUnion(ASTNode node) { if (cursor != end) { skipWhitespace(); int union = -1; if (cursor < end) { switch (expr[cursor]) { case '.': union = cursor + 1; break; case '[': union = cursor; } } if (union != -1) { captureToEOT(); return lastNode = new Union(expr, union, cursor - union, fields, node, pCtx); } } return lastNode = node; }