RewriteOperation

TODO add class description

Constructors

this
this(size_t index)
Undocumented in source.
this
this(size_t index, Variant text)
Undocumented in source.

Members

Functions

execute
size_t execute(Variant buf)

Execute the rewrite operation by possibly adding to the buffer. Return the index of the next token to operate on.

toString
string toString()

@uml @override

Variables

index
size_t index;

Token buffer index.

instructionIndex
size_t instructionIndex;

What index into rewrites List are we?

text
Variant text;
Undocumented in source.

Inherited Members

From TokenStreamRewriter

DEFAULT_PROGRAM_NAME
enum string DEFAULT_PROGRAM_NAME;
Undocumented in source.
MIN_TOKEN_INDEX
enum int MIN_TOKEN_INDEX;
Undocumented in source.
programs
RewriteOperation[][string] programs;
Undocumented in source.
lastRewriteTokenIndexes
size_t[string] lastRewriteTokenIndexes;
Undocumented in source.
rollback
void rollback(int instructionIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
rollback
void rollback(string programName, int instructionIndex)

Rollback the instruction stream for a program so that the indicated instruction (via instructionIndex) is no longer in the stream. UNTESTED!

deleteProgram
void deleteProgram()
Undocumented in source. Be warned that the author may not have intended to support it.
deleteProgram
void deleteProgram(string programName)

Reset the program so that no instructions exist

insertAfter
void insertAfter(Token t, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertAfter
void insertAfter(int index, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertAfter
void insertAfter(string programName, Token t, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertAfter
void insertAfter(string programName, size_t index, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertBefore
void insertBefore(Token t, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertBefore
void insertBefore(size_t index, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertBefore
void insertBefore(string programName, Token t, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
insertBefore
void insertBefore(string programName, size_t index, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(size_t index, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(size_t from, size_t to, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(Token indexT, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(Token from, Token to, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(string programName, size_t from, size_t to, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
void replace(string programName, Token from, Token to, Variant text)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteT
void deleteT(size_t index)

Delete token (can not use delete as identifier)

deleteT
void deleteT(size_t from, size_t to)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteT
void deleteT(Token indexT)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteT
void deleteT(Token from, Token to)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteT
void deleteT(string programName, size_t from, size_t to)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteT
void deleteT(string programName, Token from, Token to)
Undocumented in source. Be warned that the author may not have intended to support it.
getLastRewriteTokenIndex
size_t getLastRewriteTokenIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
getText
Variant getText()

Return the text from the original tokens altered per the instructions given to this rewriter.

getText
Variant getText(string programName)

Return the text from the original tokens altered per the instructions given to this rewriter in programName.

getText
Variant getText(Interval interval)

Return the text associated with the tokens in the interval from the original token stream but with the alterations given to this rewriter. The interval refers to the indexes in the original token stream. We do not alter the token stream in any way, so the indexes and intervals are still consistent. Includes any operations done to the first and last token in the interval. So, if you did an insertBefore on the first token, you would get that insertion. The same is true if you do an insertAfter the stop token.

getText
Variant getText(string programName, Interval interval)
Undocumented in source. Be warned that the author may not have intended to support it.
reduceToSingleOperationPerIndex
RewriteOperation[size_t] reduceToSingleOperationPerIndex(RewriteOperation[] rewrites)

We need to combine operations and report invalid operations (like overlapping replaces that are not completed nested). Inserts to same index need to be combined etc.

catOpText
Variant catOpText(Variant a, Variant b)
Undocumented in source. Be warned that the author may not have intended to support it.
getKindOfOps
auto getKindOfOps(RewriteOperation[] rewrites, size_t before)
Undocumented in source. Be warned that the author may not have intended to support it.
tokens
TokenStream tokens()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta