- %********* rules that try to express situations completely specified (there is an effective deletion) ******
-
- % in the rules below, a token is either an i node, an n node, an o node, an s node or an empty c node.
- % an empty c node is either an undefined macro or an empty macro. These c node are handled as they actually were
- % tokens (i, n, o, s).
-
- % there is an optional sequence of groups with id, all of which having one and only one child. The last
- % child of this sequence (or the root, if the sequence is empty) is a group with id, has as first element a
- % token and has as second and last element an eventually empty sequence of groups with id, all of which having
- %one and only one child. The last element of this sequence has the cursor as its child.
- \item{\verb+(g[@id][^*$]/++\verb+)?g[@id][^(i|n|o|s|c[ ])#$]/(g[@id][^*$]/++\verb+)?cursor+}\\
- replace the whole fragment with the cursor.
-
- %*******************************************************************************************************
- %************** rules handling the case in which the cursor has a preceding node ***********************
- %*******************************************************************************************************
-
- %************************* the cursor's parent is a group or a parameter *******************************
-
- %we consider an empty macro as a token. An empty macro is either undefined or simply empty.
-
- %rule handling the case where the cursor has a preceding token and this is the first node of a group with id
- \item{\verb+g[@id][^(i||n||o||s||c[^$])#]/cursor+}\\
- remove the cursor and replace the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or \CNODE{} node with the $\NLDROP$.
- \item{\verb+<g|p>[(i||n||o||s||c[^$])#]/cursor+}\\
- remove the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or \CNODE{} node.
- %it corresponds to the drop_prev_group(false).
- \item{\verb+<g|p>[g#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \G{} node.
- %corresponds to the drop_prev_script(false).
- \item{\verb+<g|p>[(<sp|sb>)#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \SP{} or \SB{} node.
- %rules handling the right open macros preceding the cursor.
- \item{\verb+<g|p>[(c[^p[@right-open='1']$])#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \PNODE{} node.
- %we don't have a macro of this kind, but we don't know the future...
- \item{\verb+<g|p>[(c[^p[!(@right-open='1')][@left-open='1'][^$]$])#]/cursor+}\\
- remove the cursor and replace the \CNODE node with the $\NLDROP$.
- \item{\verb+<g|p>[(c[^p[!(@right-open='1')][@left-open='1']$])#]/cursor+}\\
- replace the \CNODE{} node with the content of the \PNODE node and replace the cursor with the $\NLDROP$.
- %rules handling macro with parameter(s) and preceding the cursor.
- \item{\verb+<g|p>[c#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \CNODE{} node.
- %rule handling table with rows preceding the cursor.
- \item{\verb+<g|p>[(table[row[cell[^g$]$]$])#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \G{} node, which is child of the \CELL{} node.
- %rule handling tables without rows preceding the cursor.
- \item{\verb+<g|p>[table#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the \TABLE{} node
-
- %********************************* the cursor's parent is a script ******************************
-
- %rule handling the case where the script's base is an empty group with id.
- \item{\verb+<sp|sb>[^(g[@id][^$])#$]/cursor+}\\
- replace the \SP{} or \SB{} node with the $\NLDROP$.
- %rule handling the case where the script's base is an empty group without id
- \item{\verb+<sp|sb>[^(g[^$])#$]/cursor+}\\
- replace the \SP{} or \SB{} node with the cursor.
- %rule handling the case where the script's base is something else
- \item{\verb+<sp|sb>[^*#$]/cursor+}\\
- replace the \SP{} or \SB{} node with it's first child and insert the $\NLDROP$ after it.
-
- %********************************* the cursor's parent is a macro ********************************
-
- %rule handling the case where the preceding node is a parameter
- \item{\verb+c[p#]/cursor+}\\
- remove the cursor and append the $\NLDROP$ to the PNODE{} node.
- %rule handling the case where the preceding node is a delimiter
- \item{\verb+c[(<i|n|o|s|c>)#]/cursor+}\\
- remove the cursor and insert the $\NLDROP$ before the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or \CNODE{} node.
-
- %*************************************************************************************************
- %*********** rules handling the case in which the cursor has no preceding nodes ******************
- %*************************************************************************************************
-
- %rule handling the case where the cursor has something else after it
- \item{\verb+<g|p>[#*]/cursor+}\\
- nothing to drop.
-
- %rules handling the case where the cursor's parent is a p node and the cursor has no nodes after it.
-
- %rule handling the case where the p node is a left and right open macro's child and the first p node has no elements.
- \item{\verb+c[^(p[@left-open='1'][^$])#$]/p[@right-open='1'][^#$]/cursor+}\\
- replace the \CNODE{} with the $\NLDROP$.
- %rule handling the case where the p node is a left and right open macro's child and the first p node has elements.
- \item{\verb+c[^(p[@left-open='1']#$]/p[@right-open='1'][^#$]/cursor+}\\
- replace the \CNODE{} with the content of the PNODE{} with attribute texttt{left-open='1'} and insert $\NLDROP$ after this.
- %rule handling the case where the p node is right open macro's child.
- \item{\verb+c[^#$]/p[@right-open='1'][^#$]/cursor+}\\
- replace the \CNODE{} with the $\NLDROP$.
- %rule handling the case where the p node is a macro's child and this macro has parameter.
- \item{\verb+c/p[^#$]/cursor+}\\
- remove the cursor and insert the $\NLDROP$ before the \PNODE{} node.
-
- %rule handling the case where the cursor has no nodes after it and its parent is a group with id
- \item{\verb+g[@id][^#$]/cursor+}\\
- replace the \G{} node with the $\NLDROP$.