XLParser  1.2.0
XLParser.ExcelFormulaParser Class Reference

Excel formula parser
Contains parser and utilities that operate directly on the parse tree, or makes working with the parse tree easier. More...

Static Public Member Functions

static ParseTreeNode Parse (string input)
 Parse a formula, return the the tree's root node More...
 
static ParseTree ParseToTree (string input)
 Parse a formula, return the the tree More...
 
static IEnumerable< ParseTreeNode > AllNodesConditional (this ParseTreeNode root, Predicate< ParseTreeNode > stopAt=null)
 Non-terminal nodes in depth-first pre-order, with a conditional stop More...
 
static IEnumerable< ParseTreeNode > AllNodes (this ParseTreeNode root)
 All non-terminal nodes in depth-first pre-order More...
 
static IEnumerable< ParseTreeNode > AllNodes (this ParseTreeNode root, string type)
 All non-terminal nodes of a certain type in depth-first pre-order More...
 
static ParseTreeNode Parent (this ParseTreeNode child, ParseTreeNode treeRoot)
 Get the parent node of a node More...
 
static string Type (this ParseTreeNode node)
 The node type/name More...
 
static bool Is (this ParseTreeNode pt, string type)
 Check if a node is of a particular type More...
 
static Boolean IsFunction (this ParseTreeNode input)
 Checks whether this node is a function More...
 
static bool IsParentheses (this ParseTreeNode input)
 Whether or not this node represents parentheses "(_)" More...
 
static bool IsBinaryOperation (this ParseTreeNode input)
 
static bool IsBinaryNonReferenceOperation (this ParseTreeNode input)
 
static bool IsBinaryReferenceOperation (this ParseTreeNode input)
 
static bool IsUnaryOperation (this ParseTreeNode input)
 
static bool IsUnaryPrefixOperation (this ParseTreeNode input)
 
static bool IsUnaryPostfixOperation (this ParseTreeNode input)
 
static string GetFunction (this ParseTreeNode input)
 Get the function or operator name of this function call More...
 
static bool MatchFunction (this ParseTreeNode input, string functionName)
 Check if this node is a specific function More...
 
static IEnumerable< ParseTreeNode > GetFunctionArguments (this ParseTreeNode input)
 Get all the arguments of a function or operation More...
 
static bool IsBuiltinFunction (this ParseTreeNode node)
 Checks whether this node is a built-in excel function More...
 
static bool IsIntersection (this ParseTreeNode input)
 Whether or not this node represents an intersection More...
 
static bool IsUnion (this ParseTreeNode input)
 Whether or not this node represents an union More...
 
static bool IsNamedFunction (this ParseTreeNode input)
 Checks whether this node is a function call with name, and not just a unary or binary operation More...
 
static bool IsOperation (this ParseTreeNode input)
 
static bool IsExternalUDFunction (this ParseTreeNode input)
 
static bool IsNumberWithSign (this ParseTreeNode input)
 True if this node presents a number constant with a sign More...
 
static PrefixInfo GetPrefixInfo (this ParseTreeNode prefix)
 Extract all of the information from a Prefix nonterminal More...
 
static ParseTreeNode SkipFormula (this ParseTreeNode input)
 Go to the first non-formula child node More...
 
static ParseTreeNode SkipToRelevant (this ParseTreeNode input)
 Go to the first "relevant" child node, i.e. skips wrapper nodes More...
 
static string Print (this ParseTreeNode input)
 Pretty-print a parse tree to a string More...
 

Detailed Description

Excel formula parser
Contains parser and utilities that operate directly on the parse tree, or makes working with the parse tree easier.

Member Function Documentation

static IEnumerable<ParseTreeNode> XLParser.ExcelFormulaParser.AllNodes ( this ParseTreeNode  root)
static

All non-terminal nodes in depth-first pre-order

static IEnumerable<ParseTreeNode> XLParser.ExcelFormulaParser.AllNodes ( this ParseTreeNode  root,
string  type 
)
static

All non-terminal nodes of a certain type in depth-first pre-order

static IEnumerable<ParseTreeNode> XLParser.ExcelFormulaParser.AllNodesConditional ( this ParseTreeNode  root,
Predicate< ParseTreeNode >  stopAt = null 
)
static

Non-terminal nodes in depth-first pre-order, with a conditional stop

Parameters
stopAtDon't process the children of a node matching this predicate
static string XLParser.ExcelFormulaParser.GetFunction ( this ParseTreeNode  input)
static

Get the function or operator name of this function call

static IEnumerable<ParseTreeNode> XLParser.ExcelFormulaParser.GetFunctionArguments ( this ParseTreeNode  input)
static

Get all the arguments of a function or operation

static PrefixInfo XLParser.ExcelFormulaParser.GetPrefixInfo ( this ParseTreeNode  prefix)
static

Extract all of the information from a Prefix nonterminal

static bool XLParser.ExcelFormulaParser.Is ( this ParseTreeNode  pt,
string  type 
)
static

Check if a node is of a particular type

static bool XLParser.ExcelFormulaParser.IsBuiltinFunction ( this ParseTreeNode  node)
static

Checks whether this node is a built-in excel function

static Boolean XLParser.ExcelFormulaParser.IsFunction ( this ParseTreeNode  input)
static

Checks whether this node is a function

static bool XLParser.ExcelFormulaParser.IsIntersection ( this ParseTreeNode  input)
static

Whether or not this node represents an intersection

static bool XLParser.ExcelFormulaParser.IsNamedFunction ( this ParseTreeNode  input)
static

Checks whether this node is a function call with name, and not just a unary or binary operation

static bool XLParser.ExcelFormulaParser.IsNumberWithSign ( this ParseTreeNode  input)
static

True if this node presents a number constant with a sign

static bool XLParser.ExcelFormulaParser.IsParentheses ( this ParseTreeNode  input)
static

Whether or not this node represents parentheses "(_)"

static bool XLParser.ExcelFormulaParser.IsUnion ( this ParseTreeNode  input)
static

Whether or not this node represents an union

static bool XLParser.ExcelFormulaParser.MatchFunction ( this ParseTreeNode  input,
string  functionName 
)
static

Check if this node is a specific function

static ParseTreeNode XLParser.ExcelFormulaParser.Parent ( this ParseTreeNode  child,
ParseTreeNode  treeRoot 
)
static

Get the parent node of a node

This is an expensive operation, as the whole tree will be searched through

static ParseTreeNode XLParser.ExcelFormulaParser.Parse ( string  input)
static

Parse a formula, return the the tree's root node

Parameters
inputThe formula to be parsed.
Exceptions
ArgumentExceptionIf formula could not be parsed
Returns
Parse tree root node
static ParseTree XLParser.ExcelFormulaParser.ParseToTree ( string  input)
static

Parse a formula, return the the tree

Parameters
inputThe formula to be parsed.
Exceptions
ArgumentExceptionIf formula could not be parsed
Returns
Parse tree
static string XLParser.ExcelFormulaParser.Print ( this ParseTreeNode  input)
static

Pretty-print a parse tree to a string

static ParseTreeNode XLParser.ExcelFormulaParser.SkipFormula ( this ParseTreeNode  input)
static

Go to the first non-formula child node

static ParseTreeNode XLParser.ExcelFormulaParser.SkipToRelevant ( this ParseTreeNode  input)
static

Go to the first "relevant" child node, i.e. skips wrapper nodes

Skips:

  • FormulaWithEq and ArrayFormula nodes
  • Formula nodes
  • Parentheses
  • Reference nodes which are just wrappers
static string XLParser.ExcelFormulaParser.Type ( this ParseTreeNode  node)
static

The node type/name


The documentation for this class was generated from the following file: