Version

Create a TextDocument

Topic Overview

Purpose

This topic introduces the TextDocument and explains how to set a language on the TextDocument.

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 process of creating a custom language.

TextDocument Introduction

Overview

The TextDocument is a class in the Infragistics.Documents namespace which provides all the functionality for parsing and modifying a document. To set custom languages use the Language property of the TextDocument class.

For example, here is how to set a C# language to the TextDocument:

In C#:

var document = new TextDocument();
document.Language = CSharpLanguage.Instance;

To load content in the document you can use the InitializeText method or one of the Load methods. As changes are made to the document, almost all tokens are reused so that the lexical analyzer only needs to analyze the parts of the document which have changed.

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the process of creating a custom language.

This topic explains how to customize the error messages produced by the Syntax Parsing Engine.

The topics in this group explain in detail how to work with the Syntax Tree.

This topic contains links to conceptual information and code snippets related to the TextDocument class.

This topic provides an overview of the TextDocumentSnapshot object’s properties and methods.

This topic provides an overview of the TextDocumentSnapshotScanner object’s properties and methods.