Version

Syntax Tree Overview

Topic Overview

Purpose

This topic explains when the syntax tree is created and how to access it.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides an overview of the Syntax Parsing Engine.

This topic provides an overview of the Syntax Parsing Engine’s Grammar.

This topic explains the lexical analysis performed by the Syntax Parsing Engine.

This topic explains the syntax analysis performed by the Syntax Parsing Engine.

Syntax Tree

Overview

The TextDocument triggers lexical analysis automatically because the document is stored as tokens, but it does not do so for syntax analysis. This must be done by using either the Parse or ParseAsync methods. There is no difference between these methods other than the fact that ParseAsync will analyze the document on a background thread so the calling thread is not blocked. If ParseAsync is used to parse a document, the caller must listen to the PropertyChanged event to get notified when the SyntaxTree property is updated with the new syntax tree created by the syntax analyzer.

Once syntax analysis is complete, the TextDocument.SyntaxTree property will be an instance of type SyntaxTree, a class defined in the Infragistics.Documents.Parsing namespace. The SyntaxTree.RootNode property will always be associated with the Grammar.StartSymbol of the grammar used to parse the document. It is an instance of the SyntaxNode class, a class used to represent all nodes in the syntax tree. Like the snapshot, the syntax tree and all its nodes are immutable - they are for obtaining information only.

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to access the ignored content produced during syntax analysis.

This topic explains the syntax tree pruning types performed by the Syntax Parsing Engine.

This topic explains how to attach and obtain additional data to and from the syntax tree.