In This Article

Parsing and Parse Data

The JSON language uses an advanced parser that has been constructed using the Actipro LL(*) Parser Framework, and provides functionality for building ASTs, reporting parse errors, and more.

The ILLParseData results returned by this parser are consumed by multiple other features of the language, such as code outlining, parse error display, etc.

AST Construction

A complete AST of parsed documents is generated by the parser, comprised of the various type-specific AST nodes created for this language. It is passed back in the ILLParseData.Ast property.

The AST node classes are all defined in the ActiproSoftware.Text.Languages.DotNet.Ast.Implementation namespace, while related enumerations and interfaces are defined in the ActiproSoftware.Text.Languages.DotNet.Ast namespace.

Parse Errors

Parse errors are reported from the parser. They are passed back in the ILLParseData.Errors property.

The parser reports errors as it performs syntax and semantic analysis of document text.

When the language is used in a SyntaxEditor control, the parse errors will have squiggle lines under them and mouse hovering over the squiggle lines will show IntelliPrompt quick info tips with error descriptions.

Parse errors can also be consumed by applications that wish to show the parse errors in a tool window.

Retrieving Parse Data

As long as an ambient parse request dispatcher has been set up, all parsing and validation is performed in a worker thread. The processing occurs after any text changes are made to documents using the language. Since the work occurs in a worker thread, the results are returned asynchronously and may not be in perfect sync with the document text. Although since the parse data includes the ITextSnapshot instance that was parsed, if known, you can easily translate offsets from the parse data snapshot to the current snapshot in a SyntaxEditor view or document.

Once a parsing operation completes, the ILLParseData results are placed into the ParseData property of the document that was parsed and its ParseDataChanged event is raised. The latest parse data results can be obtained at any time from that property.

See the Parsers topic for more detailed information on the parsing workflow and parse data.

Parsing a Text String

See the Parsers for details on how to easily parse a text string using a language's parser, such as this one.