I am working on a text editor in javascript. I have created the front end and i need to prototype a backend. I need to model the structure of the document using this as hierarchy:
Character
, Word
, Tag
, Document
I am trying to create objects based on this hierarchy.
For example:
Characters are represented a linked list. Word are pointers to the first and last characters. Tags are another linked list of words, and a document is a collection of words and tags.
I am was wondering if anyone has a better suggestion to model these relationships as classes. I receive a character from the keyboard and i need to store this as an object in my document model.
thanks
7
You’ll want to take a look at Data Structures for Text Sequences, by Charles Crowley.
These 5 notes: 1, 2, 3, 4, 5, have a lot of information on Old School text editor data structures. They may interest you for a number of reasons. First, performance was limited when those were written, so they may end up as very high speed structures today. Second, programs were a lot harder to write, so the very simplicity may appeal to you if you’re just trying to get a working back end.