Open kaby76 opened 2 years ago
There is going to be much more to this. The token stream contains a list of tokens, and each token has an index back to the token stream. In addition, the token has a line and column index into a char buffer. When a string is inserted, it should not be a tree transformation, because the node does not conform to how it was previously parsed, and I don't have a good way to redo all the features of that token except by reparsing. Since the added string must be placed in the char buffer, the all the line/columns of a token in the token stream must be adjusted. The same must be for trdelete, trmove, and so on.
The point is that once I start playing around with the tree, it's on its own until an explicit reparse by the user. The question I still need to carefully consider is whether I am inserting nodes in the tree or intertoken. Perhaps an option?
trinsert -- insert text into text buffer, no reparse. The tree is adjusted. Intertoken text not fixed yet.
List of apps which refactor:
Should these be separated into grammar-specific transformations and tree transformations?
Right now, when an edit is made on a parsing result, the tree is serialized and reparsed on each step. This should not happen because it is preventing things like this.
A better model is to leave the tree as is, and require the user to parse the result if that is what is needed for further work on a new tree. It would allow a sequence of edits of a transaction that temporarily would make the text invalid.
This would be a major, but I think necessary, change. It will make editing much faster.