/** {@inheritDoc} */ public void visitAST(final IAST<?> tree) { buf.append('('); buf.append(tree.getType()); for (IAST<?> child : tree.getChildren()) { buf.append(' '); child.acceptASTVisitor(this); } buf.append(')'); }
/** {@inheritDoc} */ public void visitAST(final IAST<?> tree) { buf.append('('); buf.append(tree.getType()); for (IAST<?> child : tree.getChildren()) { buf.append(' '); child.acceptASTVisitor(this); } buf.append(')'); }
public static String interpret(final IAST<Type> expr) { StringBuilder builder = new StringBuilder(); for (IAST<Type> child : expr.getChildren()) { switch (child.getType()) { case SingleQuoteLine: case DoubleQuoteLine: builder.append(child.childrenAsString()); break; case NewLine: builder.append('\n'); break; } } return builder.toString(); } }
public static String interpret(final IAST<Type> expr) { StringBuilder builder = new StringBuilder(); for (IAST<Type> child : expr.getChildren()) { switch (child.getType()) { case SingleQuoteLine: case DoubleQuoteLine: builder.append(child.childrenAsString()); break; case NewLine: builder.append('\n'); break; } } return builder.toString(); } }
/** {@inheritDoc} */ public void visitAST(final IAST<?> tree) { for (int i = 1; i < indentLevel; i++) { buf.append(" "); } if (indentLevel > 0) { buf.append("-> "); } buf.append(tree.getType()); indentLevel++; for (IAST<?> child : tree.getChildren()) { buf.append("\n"); child.acceptASTVisitor(this); } indentLevel--; }
/** {@inheritDoc} */ public void visitAST(final IAST<?> tree) { for (int i = 1; i < indentLevel; i++) { buf.append(" "); } if (indentLevel > 0) { buf.append("-> "); } buf.append(tree.getType()); indentLevel++; for (IAST<?> child : tree.getChildren()) { buf.append("\n"); child.acceptASTVisitor(this); } indentLevel--; }
public static String interpret(final IAST<Type> node, final Map<String, String> ctxVars) { String version = TypeFQN.Version.RELEASE; // vNode => (Release | Latest | CtxVar) IAST<Type> vNode = node.getChildren().get(0); switch (vNode.getType()) { case Release: version = TypeFQN.Version.RELEASE; break; case Latest: version = TypeFQN.Version.LATEST; break; case CtxVar: version = CtxVarExpr.interpret(vNode, ctxVars); break; } return version; } }
public static String interpret(final IAST<Type> tdefVers, final Map<String, String> ctxVars) { String version = TypeFQN.Version.LATEST; // vNode => (Integer | Latest | CtxVar) IAST<Type> vNode = tdefVers.getChildren().get(0); switch (vNode.getType()) { case Integer: String intStr = ""; for (IAST<Type> c : vNode.getChildren()) { intStr += c.toString(); } version = intStr; break; case Latest: version = TypeFQN.Version.LATEST; break; case CtxVar: version = CtxVarExpr.interpret(vNode, ctxVars); break; } return version; } }
public static String interpret(final IAST<Type> tdefVers, final Map<String, String> ctxVars) throws KevScriptException { String version = TypeFQN.Version.LATEST; // vNode => (Integer | Latest | CtxVar) IAST<Type> vNode = tdefVers.getChildren().get(0); switch (vNode.getType()) { case Integer: String intStr = ""; for (IAST<Type> c : vNode.getChildren()) { intStr += c.toString(); } version = intStr; break; case Latest: version = TypeFQN.Version.LATEST; break; case CtxVar: version = CtxVarExpr.interpret(vNode, ctxVars); break; } return version; } }
public static Map.Entry<String, String> interpret(final IAST<Type> lineNode, final Map<String, String> ctxVars) throws KevScriptException { String key = StringExpr.interpret(lineNode.getChildren().get(0)); String value; IAST<Type> valueNode = lineNode.getChildren().get(1); switch (valueNode.getType()) { case RealStringNoNewLine: value = RealStringNoNewLineExpr.interpret(valueNode); break; case CtxVar: value = CtxVarExpr.interpret(valueNode, ctxVars); break; case Latest: value = "LATEST"; break; default: case Release: value = "RELEASE"; break; } return new AbstractMap.SimpleEntry<>(key, value); } }
public static String interpret(IAST<Type> expr, Map<String, String> ctxVars) throws KevScriptException { switch (expr.getType()) { case Wildcard: return WildcardExpr.interpret(expr); case String: return StringExpr.interpret(expr); case RealString: return RealStringExpr.interpret(expr); case CtxVar: return CtxVarExpr.interpret(expr, ctxVars); case GenCtxVar: return GenCtxVarExpr.interpret(expr, ctxVars); default: return null; } } }
public static String interpret(IAST<Type> expr, Map<String, String> ctxVars) throws Exception { switch (expr.getType()) { case Wildcard: return WildcardExpr.interpret(expr); case String: return StringExpr.interpret(expr); case RealString: return RealStringExpr.interpret(expr); case CtxVar: return CtxVarExpr.interpret(expr, ctxVars); case GenCtxVar: return GenCtxVarExpr.interpret(expr, ctxVars); default: return null; } } }
public static List<Port> resolve(ContainerRoot model, IAST<Type> node) throws Exception { final List<Port> resolved = new ArrayList<Port>(); if (node.getType().equals(Type.InstancePath) && node.getChildren().size() == 3) {
public static List<Port> resolve(ContainerRoot model, IAST<Type> node) throws KevScriptException { final List<Port> resolved = new ArrayList<Port>(); if (node.getType().equals(Type.InstancePath) && node.getChildren().size() == 3) {
public static void interpret(IAST<Type> stmt, ContainerRoot model, Map<String, String> ctxVars, KevoreeRegistryResolver resolver) throws Exception { TypeFQN fqn = TypeDefExpr.interpret(stmt.getChildren().get(1), ctxVars); TypeDefinition td = resolver.resolve(fqn, model); if (td == null) { throw new KevScriptError("Unable to find TypeDefinition \"" + fqn.toString() + "\" in model"); } else { final IAST<Type> instanceNames = stmt.getChildren().get(0); if (instanceNames.getType().equals(Type.NameList)) { for (final IAST<Type> name : instanceNames.getChildren()) { apply(td, name, model, ctxVars); } } else { apply(td, instanceNames, model, ctxVars); } } }
public static void interpret(IAST<Type> stmt, ContainerRoot model, Map<String, String> ctxVars, Resolver resolver) throws KevScriptException { TypeFQN fqn = TypeDefExpr.interpret(stmt.getChildren().get(1), ctxVars); TypeDefinition td = resolver.resolve(fqn, model); if (td == null) { throw new KevScriptException("Unable to resolve \"" + fqn.toString() + "\""); } else { final IAST<Type> instanceNames = stmt.getChildren().get(0); if (instanceNames.getType().equals(Type.NameList)) { for (final IAST<Type> name : instanceNames.getChildren()) { apply(td, name, model, ctxVars); } } else { apply(td, instanceNames, model, ctxVars); } } }
switch (vNode.getType()) { default: case Release:
if (valuePart.getType().equals(Type.CtxVar)) { netprop.setValue(CtxVarExpr.interpret(valuePart, ctxVars)); } else {
if (valuePart.getType().equals(Type.CtxVar)) { netprop.setValue(CtxVarExpr.interpret(valuePart, ctxVars)); } else {
public static void interpret(IAST<Type> stmt, ContainerRoot model, Map<String, String> ctxVars, KevoreeRegistryResolver resolver) throws Exception { switch (stmt.getType()) { case Add: AddStmt.interpret(stmt, model, ctxVars, resolver); Log.info("Deprecated KevScript statement: {} ({})", stmt.getType().name(), stmt.getPosition()); break;