[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Expressions.SyntaxNode

SyntaxNode Class

Represents a node in a formula syntax tree.

SyntaxNode is the abstract base class for all nodes in a parsed formula expression. A node can be terminal or non-terminal, depending on whether it represents a leaf value or a composite expression that contains nested nodes.

Use this type when working with formula syntax trees returned by parsing APIs or when traversing expression structures programmatically. Child nodes are exposed through Children; terminal nodes return no children, while non-terminal nodes expose their immediate descendants.

This class also serves as the common base for converting syntax trees back to formula text and for implementing tree traversal patterns in derived node types.

Inheritance
SyntaxNode
Implements
Namespace: GrapeCity.Documents.Excel.Expressions
Assembly: DS.Documents.Excel.dll
Syntax
public abstract class SyntaxNode : ICloneable
Public MustInherit Class SyntaxNode
    Implements ICloneable
Examples
SyntaxNode node = SyntaxNode.Parse("SUM(A1:A3)+B1");
IList<SyntaxNode> children = node.Children;
string formulaText = node.ToString();

Constructors

Name Description
SyntaxNode()

Properties

Name Description
Children

Gets the child nodes of this syntax node.

Use this property to traverse the formula syntax tree and inspect the immediate operands or arguments represented by the current node.

Methods

Name Description
Clone()

Clones this syntax node.

This method creates a copy of the current formula syntax node by traversing the syntax tree and rebuilding the node structure. If the node is mutable, the returned value is a cloned node. Otherwise, this method returns an equivalent node from the object pool.

Equals(object)

Checks whether this syntax node is equal to another object.

If obj is a SyntaxNode, this method compares it with the current node. If obj is not a SyntaxNode, this method returns false.

GetHashCode()

This object doesn't support getting hash code, because all fields are mutable.

Parse(string)

Loads a SyntaxNode from a string that contains a formula.

This method calls Parse(string, ParseContext) with the default parse context.

If text is null or empty, this method returns Instance.

Parse(string, ParseContext)

Loads a SyntaxNode from a formula string using the specified ParseContext.

Use the parse context to control how references in the formula are interpreted, including the 0-based base row, 0-based base column, and whether the formula uses R1C1 reference style.

If text is null or empty, this method returns the singleton empty node. If the formula text is invalid, this method throws an ArgumentException.

ToString()

Returns the formula text for this node using the default unparse context.

This method converts the syntax node back to a formula string by using GrapeCity.Documents.Excel.Expressions.UnParseContext.Default.

ToString(UnParseContext)

Returns the formula text for this node, optionally specifying context.