@Override public String getStringValue(ISyntaxNode syntaxNode) { return syntaxNode.getType(); } }
private boolean isStrictMatch(ISyntaxNode node) { return !node.getType().contains(".nostrict"); }
private boolean isStrictMatch(ISyntaxNode node) { return !node.getType().contains(".nostrict"); }
private static IBoundNode makeErrorNode(ISyntaxNode node, IBindingContext bindingContext) { String message = "DEV: Binder is not found for node '" + node.getType() + "'"; return ANodeBinder.makeErrorNode(message, node, bindingContext); }
private boolean isArrayWithInitialization(ISyntaxNode node) { return node.getChild(0).getType().equals("new.array.initialized"); } }
private static IBoundNode makeErrorNode(ISyntaxNode node, IBindingContext bindingContext) { String message = "DEV: Binder is not found for node '" + node.getType() + "'"; return ANodeBinder.makeErrorNode(message, node, bindingContext); }
private boolean isArrayWithInitialization(ISyntaxNode node) { return node.getChild(0).getType().equals("new.array.initialized"); } }
private static ISyntaxNode getIdentifierSyntaxNode(ISyntaxNode syntaxNode) { if (!(syntaxNode instanceof IdentifierNode)) { if ("function".equals(syntaxNode.getType())) { syntaxNode = syntaxNode.getChild(syntaxNode.getNumberOfChildren() - 1); } } return syntaxNode; }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 2) { throw SyntaxNodeExceptionUtils.createError("Binary node must have 2 subnodes", node); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); return bindOperator(node, methodName, children[0], children[1], bindingContext); }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 2) { throw SyntaxNodeExceptionUtils.createError("Binary node must have 2 subnodes", node); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); return bindOperator(node, methodName, children[0], children[1], bindingContext); }
private IMemberBoundNode preBindXlsNode(ISyntaxNode syntaxNode, OpenL openl, RulesModuleBindingContext bindingContext, XlsModuleOpenClass moduleOpenClass) throws Exception { String tableSyntaxNodeType = syntaxNode.getType(); AXlsTableBinder binder = findBinder(tableSyntaxNodeType); if (binder == null) { log.debug("Unknown table type '{}'", tableSyntaxNodeType); return null; } TableSyntaxNode tableSyntaxNode = (TableSyntaxNode) syntaxNode; return binder.preBind(tableSyntaxNode, openl, bindingContext, moduleOpenClass); }
@Override protected IBoundNode createBoundNode(ISyntaxNode node, IBoundNode targetNode, IBoundNode expressionNode, ILocalVar localVar, IBindingContext bindingContext) { boolean isUnique = node.getType().contains("unique"); if (isUnique) { return new TransformToUniqueIndexNode(node, targetNode, expressionNode, localVar); } else { return new TransformIndexNode(node, targetNode, expressionNode, localVar); } } }
@Override protected IBoundNode createBoundNode(ISyntaxNode node, IBoundNode targetNode, IBoundNode expressionNode, ILocalVar localVar, IBindingContext bindingContext) { boolean isUnique = node.getType().contains("unique"); if (isUnique) { return new TransformToUniqueIndexNode(node, targetNode, expressionNode, localVar); } else { return new TransformIndexNode(node, targetNode, expressionNode, localVar); } } }
public INodeBinder getNodeBinder(ISyntaxNode node, IConfigurableResourceContext cxt) { SingleBinderFactory factory = (SingleBinderFactory) map.get(node.getType()); return factory == null ? null : (INodeBinder) factory.getResource(cxt); }
public INodeBinder getNodeBinder(ISyntaxNode node, IConfigurableResourceContext cxt) { SingleBinderFactory factory = (SingleBinderFactory) map.get(node.getType()); return factory == null ? null : (INodeBinder) factory.getResource(cxt); }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String nodeType = node.getType(); int targetInd = 0; int chainInd = 1; if (nodeType.startsWith("chain.suffix.of.the")) { targetInd = 1; chainInd = 0; } IBoundNode target = bindChildNode(node.getChild(targetInd), bindingContext); IBoundNode result = bindTargetNode(node.getChild(chainInd), bindingContext, target); return result; } }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String nodeType = node.getType(); int targetInd = 0; int chainInd = 1; if (nodeType.startsWith("chain.suffix.of.the")) { targetInd = 1; chainInd = 0; } IBoundNode target = bindChildNode(node.getChild(targetInd), bindingContext); IBoundNode result = bindTargetNode(node.getChild(chainInd), bindingContext, target); return result; } }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 1) { return makeErrorNode("Unary node should have 1 subnode", node, bindingContext); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); IOpenClass[] types = getTypes(children); IMethodCaller methodCaller = findUnaryOperatorMethodCaller(methodName, types, bindingContext); if (methodCaller == null) { String message = errorMsg(methodName, types[0]); return makeErrorNode(message, node, bindingContext); } return new UnaryOpNode(node, children, methodCaller); }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 1) { return makeErrorNode("Unary node should have 1 subnode", node, bindingContext); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); IOpenClass[] types = getTypes(children); IMethodCaller methodCaller = findUnaryOperatorMethodCaller(methodName, types, bindingContext); if (methodCaller == null) { String message = errorMsg(methodName, types[0]); return makeErrorNode(message, node, bindingContext); } return new UnaryOpNode(node, children, methodCaller); }
private static void checkForSameLeftAndRightExpression(IBoundNode conditionNode, IBindingContext bindingContext) { IBoundNode[] children = conditionNode.getChildren(); if (children != null && children.length == 2) { IBoundNode left = children[0]; IBoundNode right = children[1]; if (isSame(left, right)) { String type = conditionNode.getSyntaxNode().getType(); if (EQUAL_OPERATORS.contains(type)) { BindHelper.processWarn("Condition is always true", conditionNode.getSyntaxNode(), bindingContext); } else if (NOT_EQUAL_OPERATORS.contains(type)) { BindHelper.processWarn("Condition is always false", conditionNode.getSyntaxNode(), bindingContext); } } } }