private int OperatorDepth(ParseTreeNode node, ISet <string> operators = null) { // Get the maximum depth of the childnodes int depth = node.ChildNodes.Count == 0 ? 0 : node.ChildNodes.Max(n => OperatorDepth(n, operators)); // If this is one of the target functions, increase depth by 1 if (node.IsFunction() && (operators == null || operators.Contains(node.GetFunction()))) { depth++; } return(depth); }
/// <summary> /// Checks whether this node is a built-in excel function /// </summary> public static bool IsBuiltinFunction(this ParseTreeNode node) { return(node.IsFunction() && (node.ChildNodes[0].Is(GrammarNames.FunctionName) || node.ChildNodes[0].Is(GrammarNames.RefFunctionName))); }
public static bool IsUnaryPostfixOperation(this ParseTreeNode input) { return(input.IsFunction() && input.ChildNodes.Count == 2 && input.ChildNodes[1].Term.Flags.HasFlag(TermFlags.IsOperator)); }
private int OperatorDepth(ParseTreeNode node, ISet<string> operators = null) { // Get the maximum depth of the childnodes int depth = node.ChildNodes.Count == 0 ? 0 : node.ChildNodes.Max(n => OperatorDepth(n, operators)); // If this is one of the target functions, increase depth by 1 if(node.IsFunction() && (operators == null || operators.Contains(node.GetFunction()))) { depth++; } return depth; }
/// <summary> /// Checks whether this node is a built-in excel function /// </summary> public static bool IsBuiltinFunction(this ParseTreeNode node) { return(node.IsFunction() && (node.Is(GrammarNames.ExcelFunction) || node.Is(GrammarNames.ReferenceFunction))); }