Undo/redo technique for token-oriented representation of program code
First Claim
1. A method of providing undo operation support in an edit buffer, the method comprising:
- representing the edit buffer as a doubly-linked list of nodes for a tokenized program representation, each node corresponding to a respective lexical token in the tokenized program representation; and
maintaining, as a side-effect of operations that modify contents of the list, an ordered set of undo objects that identify at least respective opposing-end nodes of respective sublists of one or more lexical tokens in the tokenized program representation corresponding to respective substrings inserted into the list by respective insert-type operations, wherein at least one of the sublists comprises different opposing end nodes stored non-contiguously and each of the sublists is a doubly linked list.
3 Assignments
0 Petitions
Accused Products
Abstract
An editor or software engineering tool may be configured to represent program code as a doubly-linked list of lexical tokens and to maintain, coincident with an operation that modifies contents of the list, an undo object that identifies opposing end nodes of a sublist of one or more lexical tokens corresponding to a substring that is either inserted into or removed from the list by the operation. In this way, lexical tokens corresponding to an inserted substring can be readily and efficiently excised to restore a pre-insertion tokenized list state. Similarly, lexical tokens corresponding to a removed substring can be readily and efficiently reinstated to restore a pre-deletion tokenized list state. Advantageously, undo support once employed to restore a prior tokenized list state is symmetrically available to support redo operations. In some embodiments in accordance with the present invention, undo-redo entries are maintained in an operation ordered set that is traversed to support one or more operations in either the undo or redo directions. In some realizations, such an ordered set of undo-redo entries is maintained by, or in conjunction with, an undo-redo manager.
164 Citations
27 Claims
-
1. A method of providing undo operation support in an edit buffer, the method comprising:
-
representing the edit buffer as a doubly-linked list of nodes for a tokenized program representation, each node corresponding to a respective lexical token in the tokenized program representation; and maintaining, as a side-effect of operations that modify contents of the list, an ordered set of undo objects that identify at least respective opposing-end nodes of respective sublists of one or more lexical tokens in the tokenized program representation corresponding to respective substrings inserted into the list by respective insert-type operations, wherein at least one of the sublists comprises different opposing end nodes stored non-contiguously and each of the sublists is a doubly linked list. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A software engineering tool encoded in one or more computer readable media, the software engineering tool comprising:
-
a representation of program code encoded in a computer readable medium as a doubly-linked list of nodes for a tokenized program representation, each node corresponding to a respective token in the tokenized program representation recognized in accordance with an operative set of lexical rules; functional encodings of edit methods, including at least insert-type and remove-type methods, the edit methods executable to operate on the list of nodes; and an undo-redo manager that maintains an ordered set of undo-redo objects in correspondence with operation of the edit methods, the undo-redo objects identifying opposing-end nodes of sublists of tokens inserted into the list and removed therefrom by operation of the insert-type and remove-type methods, respectively, wherein at least one of the sublists comprises different opposing end nodes stored non-contiguously and each of the sublists is a doubly-linked list. - View Dependent Claims (11, 12)
-
- 13. A software engineering tool encoded in one or more tangible computer readable media as instructions executable to represent program code as a doubly-linked list of lexical tokens for a tokenized program representation and to maintain, coincident with an operation that modifies contents of the list, a first undo object that identifies at least opposing end nodes of a sublist of one or more lexical tokens in the tokenized program representation corresponding to a substring that is either introduced into or removed from the list by the operation, wherein the sublist comprises different opposing end nodes stored non-contiguously and is a doubly-linked list.
-
21. One or more tangible computer readable media encoding a data structure that represents contents of an edit buffer as a sequence of lexical tokens, the encoded data structure comprising:
-
a doubly linked list of nodes for a tokenized program representation; token representations, each corresponding to at least one respective node of the list, wherein at least some of the token representations have associated substring encodings; and an edit-operation-ordered representation of undo objects that each identify at least opposing end nodes of respective sublists of one or more lexical tokens in the tokenized program representation that correspond to substrings that are either introduced into or removed from the list by edit operations, wherein at least one of the sublists comprises different opposing end nodes stored non-contiguously and each of the sublists is a doubly-linked list. - View Dependent Claims (22, 23, 24)
-
-
25. An apparatus comprising:
-
storage for a computer readable encoding of an edit buffer represented as a sequence of lexical tokens for a tokenized program representation; and means for maintaining an edit-operation-ordered representation of undo objects that each identify at least opposing end nodes of respective sublists of one or more lexical tokens in the tokenized program representation that correspond to substrings that are either introduced into or removed from the list by edit operations, wherein at least one of the sublists comprises different opposing end nodes stored non-contiguously and each of the sublists is a doubly-linked list. - View Dependent Claims (26, 27)
-
Specification