Browse Prior Art Database

A Partition Strategy for Programming Language Editors

IP.com Disclosure Number: IPCOM000021495D
Original Publication Date: 2004-Jan-21
Included in the Prior Art Database: 2004-Jan-21
Document File: 3 page(s) / 45K

Publishing Venue

IBM

Abstract

Text-based source code editors are often equipped with user-friendly features like syntax-highlighting, content assist, and document outline. For performance reasons, it is not appropriate to update the presentation of entire document on every change. A technique used to perform updates in a performance-sensitive way is referred to as document partitioning. The objectives of partitioning is to determine the range of text to be updated when user edits the document. An example of a product using this technique is WebSphere Studio Application Developer. The partitions are required to be consecutive and non-overlapping. Source code of a program is parsed and a syntax tree is constructed. Language constructs, such as user-defined routines and modules, which can be nested, are represented with syntax nodes in the tree. The first task towards non-overlapping partitions is to divide any nested language construct, and corresponding syntax nodes, into a wrapping header, the nested constructs and a wrapping trailer. Two special partition types are ?error? and ?interim?, each has its unique role in the partition strategy. Besides them, a SQL-based document has partition types of document header, module header and module trailer, routine header and routine trailer, and statement. The parser is defined in such a way that each of the above content types, except ?error? and ?interim? types, are guaranteed to be parsed into a meaningful syntax node. Document updater updates only the partitions affected by an edit. One partition is parsed for content assist purposes. A delayed re-partition of entire document happens where there is a pause of activity in the editor, at which time the outline view is updated.

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

Page 1 of 3

A Partition Strategy for Programming Language Editors

Text-based source code editors are often equipped with user-friendly features like syntax-highlighting, content assist, and document outline. For performance reasons, it is not appropriate to update the presentation of entire document on every change. A technique used to perform updates in a performance-sensitive way is referred to as document partitioning. The objectives of partitioning is to determine the range of text to be updated when user edits the document. An example of a product using this technique is WebSphere Studio Application Developer.

A partition must be a segment of code that can be meaningfully rendered by the editor. The information available from the affected partition is used to generate context-aware completion proposals (content assist), syntax highlighting, and other visual ways of document presentation, such as the outline view. These objectives have conflicting requirements for partition strategy. An edit might change only a portion of a partition, but the entire partition must be updated to ensure correct presentation. To optimize editor performance, finer partitions are favored for document updates.

Content assist is a feature of program editors to list syntactically correct, context-sensitive code completion options for statements being composed by the user. A partition of code is sent to the parser to obtain completion proposals. In order for the parser to parse the partition and generate meaningful completion proposals, coarser partitions are favored. Content outline view shows the syntax tree structure of the document. Objects shown in the outline correspond to language constructs, which are often nested. The partition strategy must provide a way to extract the structure of the document for the outline view.

This document describes a document partition strategy that satisfies all requirements and objectives described above and can be used to: - Optimize editor performance by providing finer partitions for document updates, - Provide partitions with enough information for correct and complete context-sensitive content assist (code completion), - Extract document content in a form usable for the outline view, which shows language constructs (modules, routines, etc.) in the form of a syntax tree.

The system and method described in this document has been developed and implemented for a specific purpose of Extended SQL (ESQL) language within the WebSphere MQ Integrator product, but the general concepts of the invention can be applied for editing and partitioning of any structured language.

The partitions are required to be consecutive and non-overlapping. Source code of a program is parsed and a syntax tree is constructed. Language constructs, such as user-defined routines and modules, which can be nested, are represented with syntax nodes in the tree. The first task towards non-overlapping partitions is to divide any nested language construct, and co...