Extensibility is the name of the game when talking about SyntaxEditor's documents and languages. Languages are service-based objects where you can plug in any functionality you require for them. Use our free languages with your SyntaxEditor implementations, or build custom syntax language implementations if needed.
SyntaxEditor's document and language object models have been implemented in a separate assembly from UI assemblies. This allows documents, languages, and all related features (lexing, parsing, etc.) to be used independently of user interfaces.
A document is what is "edited" by a SyntaxEditor, as it is the object that provides access to all the text being edited. It supports easy file load/save and can be tied to a syntax language to provide extended functionality. The complete document text is available any time via snapshots, where each snapshot is an immutable versioned thread-safe copy of the text at the time it was created.
Snapshots allow you to parse text without fear of it changing in the middle of a parse. There are powerful text scanning classes included and offsets within a snapshot can be translated to their relative location in any other snapshot for the same document. This means that you can reliably locate a certain range of text, even after multiple edits have been made.
The text/parsing framework's text change model is extremely powerful and provides many helper methods for doing everything from simple text replace operations to append operations. Multiple operations can be queued up into a single text change and executed as a single atomic unit.
Documents have been designed for speed. Large documents can load and be input-ready in SyntaxEditor nearly instantly. This is achieved via internal storage virtualization for many features. Snapshots also reuse common sections of document text to minimize memory usage.
Syntax languages are a core piece of the text/parsing framework. They basically encapsulate all functionality for a particular code language that is being used within a SyntaxEditor control. This is everything from various types of parsing all the way to simpler features like determining word breaks or performing line commenting.
Over 20 full source sample language definitions are included with SyntaxEditor for common languages like Assembly, Batch files, C, C++, C#, CSS, HTML, INI files, Java, JScript, Lua, Markdown, MSIL, Pascal, Perl, PHP, PowerShell, Python, RTF, SQL, VB.NET, VBScript, and XML. Custom language definition can easily be created, thereby making it possible to build a code editor for any proprietary language.
While SyntaxEditor's flexible dynamic language definitions allow for nearly any language to be defined, sometimes it is necessary for more than a single language to be used. An ASP.NET language would most likely have HTML as a root language with tokens that can transition into ASP.NET, CSS, JScript, and VBScript languages on the fly.
SyntaxEditor fully supports transitions between parent languages to child languages. This feature allows you to support the complicated language switching requirements of modern web languages and code generation templates.
Lexing is the process of scanning text and breaking it up into meaningful tokens that can be examined by a higher-level parser, and used to drive syntax highlighting features in the editor. Regular expression-based and hand written lexers are supported.
Parsing is the process of performing syntax and/or semantic analysis on a text, and outputing some sort of parse data, generally an AST. SyntaxEditor supports the automated calling of parsers via worker threads following text changes. Any custom or third-party parser can be called and used with SyntaxEditor. In fact, SyntaxEditor includes free integration add-ons for several common third party parsers. SyntaxEditor also comes packed with the LL(*) Parser Framework, which is an incredible framework for quickly building LL(*) parsers.
Code fragment editing is useful in situations such as where you want an end user to only see and edit the contents of a specific method or property, or perhaps only a certain statement or expression. When using any language that has a parser, this type of editing is easily achieved with SyntaxEditor. Automated IntelliPrompt features for the language continue to function normally too.
Code fragment editing is achieved by setting a header and footer text property on the document. Neither the header nor footer are visible to the end user but for parsing purposes, they are pre- and post-pended to the document's text being edited by the end user. This allows for a complete, valid document to be parsed, even though the end user is only modifying a portion of it.
Tags that contain custom data can be applied to ranges of text, to store data with those text ranges and/or mark where special SyntaxEditor visualization features such as adornments should be rendered.
The Language Designer is an application that ships with SyntaxEditor and aids in the creation of syntax languages. It can perform code generation for a number of language features and even includes a debugger for grammars written using our LL(*) Parser Framework.
SyntaxEditor has built-in functionality for exporting syntax-highlighted text content to a string or file in HTML and/or RTF formats. Options are also available for auto-copying text in these formats when clipboard operations are performed.
Text statistics are a powerful feature that provide statistics about text in a document. By default, there are numerous text statistics available such as line, sentence, word, character counts, and even readability scores. Languages can choose to customize the statistics by supplying additional ones like commented-line counts, etc.