Browse Prior Art Database

Edit-system Language Parsers for Mixed Documents

IP.com Disclosure Number: IPCOM000014102D
Original Publication Date: 2000-Jun-01
Included in the Prior Art Database: 2003-Jun-19
Document File: 5 page(s) / 51K

Publishing Venue

IBM

Abstract

A live-parsing edit system for mixed language documents is disclosed which allows for the construction of mixed-language document parsers, which have the capability to attach several language-specific parsers, and switch between them as a function of the active document context. Each language parser adds to the document parser its entire language-sensitive set of capabilities (syntax highlighting, contextual help, etc.). This disclosure applies particularly to edit systems, such as development edit systems, dealing with programming languages and scripts comprising more than one syntax although the concept can be easily extended to other scenarios.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 38% of the total text.

Page 1 of 5

Edit-system Language Parsers for Mixed Documents

A live-parsing edit system for mixed language documents is disclosed which allows for the construction of mixed-language document parsers, which have the capability to attach several language-specific parsers, and switch between them as a function of the active document context. Each language parser adds to the document parser its entire language-sensitive set of capabilities (syntax highlighting, contextual help, etc.). This disclosure applies particularly to edit systems, such as development edit systems, dealing with programming languages and scripts comprising more than one syntax although the concept can be easily extended to other scenarios.

Examples of composite-language documents, in which there is a main language and one or more secondary languages, or script, sections, for use in the edit system of this disclosure include: C/C++ code with imbedded SQL code and/or imbedded CICS code, Java code with imbedded SQL code, and HTML code with JavaScript sections. Certain languages are the main language in some document types, and a secondary (imbedded) language in other document types. The disclosed system provides, for all the secondary languages in a complex document, that full set of services which is ordinarily provided by a document parser written specifically for that language as the main (or unique) document language. A well-integrated functionality and look is achieved.

Referring to the Figure, the edit system comprises the following components:
The Common Parser, from which the document parsers derive, implements a set of generic parser services and provides an interface to the edit system. The interface defines, among other things, the different types of documents/languages supported by the edit system.

The Character Stream class is used to feed most parsers a continuous stream of characters from the desired document section - the entire document for the initial total parse or a range, as determined by the particular parser, during incremental parsing.

The Document Parser is aware of the main language of the document. Document parsers are attached to the edit system via a file-type association mechanism. For example, when a *.c (C language) or *.sqc (C language with embedded SQL) file is loaded in the edit system, a C document parser is attached.

The document parser first gets control after the document file has been loaded in the edit system (to perform an initial total parse), and subsequently it is called when changes are made to the document (incremental parse). The document parser analyzes the document, and marks structural elements in it at various degrees of detail. For example, text elements which contain comments may be marked with parser class CLASS_COMMENT, method-signature elements

1

Page 2 of 5

with CLASS_METHOD, etc. Other parser 'utility' classes are typically defined, e.g., classes used to doubly-link text elements belonging to one syntax construct (such a...