From 06340d0a6a60e9bade273a93847f1de0b3079a3c Mon Sep 17 00:00:00 2001 From: Luca Padovani Date: Mon, 24 Mar 2003 15:18:22 +0000 Subject: [PATCH] * first draft of the formal specification --- helm/DEVEL/mathml_editor/Makefile.am | 2 +- helm/DEVEL/mathml_editor/doc/.cvsignore | 5 + helm/DEVEL/mathml_editor/doc/spec.tex | 675 ++++++++++++++++++++++++ 3 files changed, 681 insertions(+), 1 deletion(-) create mode 100644 helm/DEVEL/mathml_editor/doc/.cvsignore create mode 100644 helm/DEVEL/mathml_editor/doc/spec.tex diff --git a/helm/DEVEL/mathml_editor/Makefile.am b/helm/DEVEL/mathml_editor/Makefile.am index b5c7f5164..d2935d1a3 100644 --- a/helm/DEVEL/mathml_editor/Makefile.am +++ b/helm/DEVEL/mathml_editor/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = BUGS LICENSE aclocal.m4 +EXTRA_DIST = BUGS LICENSE aclocal.m4 editex.pc.in SUBDIRS = src test ocaml textomml CLEANFILES = core diff --git a/helm/DEVEL/mathml_editor/doc/.cvsignore b/helm/DEVEL/mathml_editor/doc/.cvsignore new file mode 100644 index 000000000..44d749510 --- /dev/null +++ b/helm/DEVEL/mathml_editor/doc/.cvsignore @@ -0,0 +1,5 @@ +spec.aux +spec.dvi +spec.log +spec.ps +*~ diff --git a/helm/DEVEL/mathml_editor/doc/spec.tex b/helm/DEVEL/mathml_editor/doc/spec.tex new file mode 100644 index 000000000..e1020146c --- /dev/null +++ b/helm/DEVEL/mathml_editor/doc/spec.tex @@ -0,0 +1,675 @@ +\documentclass[10pt]{article} + +\usepackage{a4wide} +\usepackage{palatino} +\usepackage{euler} +\usepackage{amssymb} +\usepackage{stmaryrd} + +\title{A MathML Editor Based on \TeX{} Syntax\\Formal Specification} +\author{Paolo Marinelli\\Luca Padovani\\\small\{{\tt pmarinel},{\tt lpadovan}\}{\tt @cs.unibo.it}\\\small Department of Computer Science\\\small University of Bologna} +\date{} + +\newcommand{\tmap}[1]{\llbracket#1\rrbracket} +\newcommand{\tadvance}{\vartriangle} +\newcommand{\tnext}{\rhd} +\newcommand{\G}{\texttt{g}} +\newcommand{\PNODE}{\texttt{p}} +\newcommand{\SNODE}{\texttt{s}} +\newcommand{\INODE}{\texttt{i}} +\newcommand{\NNODE}{\texttt{n}} +\newcommand{\ONODE}{\texttt{o}} +\newcommand{\CNODE}{\texttt{c}} +\newcommand{\SP}{\texttt{sp}} +\newcommand{\SB}{\texttt{sb}} +\newcommand{\CELL}{\texttt{cell}} +\newcommand{\ROW}{\texttt{row}} +\newcommand{\SLDROP}{\hookleftarrow} +\newcommand{\NLDROP}{\leftarrow} + +\begin{document} + +\maketitle + +\section{Tokens} + +The following tokens are defined: + +\begin{tabular}{lllp{0.5\textwidth}} + \textbf{\TeX{}} & \textbf{Notation} & \textbf{Node} & \textbf{Description} \\ +\hline + \verb+{+ & $\mathrm{begin}$ & \texttt{g} & Beginning of a group \\ + \verb+}+ & $\mathrm{end}$ & & End of a group \\ + \verb+$+ & $\$$ & \texttt{math} & Math shift \\ %$ \\ + & & & End-of-line \\ + \verb+#+$i$ & $p(i)$ & \texttt{p} & Parameter \\ + \verb+^+ & $\uparrow$ & \texttt{sp} & Superscript \\ + \verb+_+ & $\downarrow$ & \texttt{sb} & Subscript \\ + & $\square$ & & Space-like character that can be ignored \\ + & $s$ & \texttt{s} & Space-like character that may be significant \\ + letter & $i(v)$ & \texttt{i} & Identifier $v$ \\ + digit & $n(v)$ & \texttt{n} & Number $v$ \\ + other & $o(v)$ & \texttt{o} & Other character or operator $v$ \\ + \verb+~+ & $\sim$ & & Active character \\ + \verb+%+ & $\%$ & & Comment \\ + control & $c(v)\langle\alpha_1,\dots,\alpha_n\rangle$ & \texttt{c} & + Control sequence $v$ that expects the $\alpha_1,\dots,\alpha_n$ sequence of tokens. \\ + backspace & $\vartriangleleft$ & & \\ + backspace & $\blacktriangleleft$ & & \\ +\end{tabular} + +%% Some tokens are mapped directly into nodes of the TML tree. The following functions shows +%% the mapping: + +\begin{tabular}{r@{\quad$=$\quad}l} + $\tmap{\{}$ & \verb+g+ \\ + $\tmap{p(i)}$ & \verb+p[@index=+$i$\verb+]+ \\ + $\tmap{p_l(i)}$ & \verb+p[@index=+$i$\verb+][@left-open='1']+ \\ + $\tmap{p_r(i)}$ & \verb+p[@index=+$i$\verb+][@right-open='1']+ \\ + $\tmap{s}$ & \verb+s+ \\ + $\tmap{\uparrow}$ & \verb+sp+ \\ + $\tmap{\downarrow}$ & \verb+sb+ \\ + $\tmap{i(v)}$ & \verb+i[@value=+$v$\verb+]+ \\ + $\tmap{n(v)}$ & \verb+n[@value=+$v$\verb+]+ \\ + $\tmap{o(v)}$ & \verb+o[@value=+$v$\verb+]+ \\ + $\tmap{c(v)\langle\alpha_1,\dots,\alpha_n\rangle}$ & \verb+c[@name=+$v$\verb+][^+$\tmap{\alpha_1}\cdots\tmap{\alpha_n}$\verb+$]+\\ +\end{tabular} +%$ + +%% \section{Description and Semantics of the Pattern Language} + +%% \begin{eqnarray*} +%% \mathit{NodeTest} & ::= & \mathtt{*} \\ +%% & | & \mathit{ElementType} \\ +%% & | & \mathtt{<}~\mathit{ElementTypePattern}~\mathtt{>} \\[1ex] +%% \mathit{ElementTypePattern} & ::= & \mathtt{*} \\ +%% & | & \mathit{ElementType}~(\mathtt{|}~\mathit{ElementType})^* \\ +%% & | & \mathtt{!}\mathit{ElementType}~(\mathtt{|}~\mathit{ElementType})^*\\[1ex] +%% \mathit{NodePattern} & ::= & \mathit{NodeTest}~\mathit{AttributeQualifier}^*\\[1ex] +%% \mathit{AttributeQualifier} & ::= & \mathtt{[@}\mathit{AttributeTest}\mathtt{]}\\ +%% & | & \mathtt{[!@}\mathit{AttributeTest}\mathtt{]}\\[1ex] +%% \mathit{AttributeTest} & ::= & \mathit{AttributeName} \\ +%% & | & \mathit{AttributeName}\mathtt{='}\mathit{Text}\mathtt{'} +%% \end{eqnarray*} + +\section{Insert Rules} + +\paragraph{Begin Group:} $\{$ + +\begin{description} + \item{\verb+table/cursor+}\\ + create a \texttt{row} node, create a \texttt{cell} node, create a \texttt{g} node, + append the cursor to the \texttt{g} node, append the \texttt{g} node to the \texttt{cell} node, + append the \texttt{cell} node to the \texttt{row} node, append the \texttt{row} node to the + \texttt{c} node + \item{\verb+cursor+} \\ create a \texttt{g} node, replace the cursor with the new \texttt{g} node, + append the cursor to the new \texttt{g} node +\end{description} + +% CASE: c/g[!@id]/cursor + +% CASE: c/cursor + +% ELSE: + +% do_begin: +% CASE: c[@table='1']/cursor +% ELSE: +% create a g node with id, replace the cursor with the fresh g and append +% the cursor as only child of it + +\paragraph{End Group:} $\}$ + +\begin{description} + \item{\verb+g[@id]/cursor+}\\ + remove the cursor, put $\tadvance$ after the \texttt{g} node + \item{\verb+row/cell/g/cursor+}\\ + remove the cursor, put $\tadvance$ after the \texttt{row} node + \item{\verb+math/g[!@id]/cursor+}\\ + ? + \item{\verb+cursor+}\\ + error ? +\end{description} + +\paragraph{Math Shift:} $\$$ + +\begin{description} + \item{\verb+tex/cursor+}\\ + create a \texttt{math} node, create a \texttt{g} node, append the \texttt{g} node + as child of the \texttt{math} node, append the cursor as child of the \texttt{g} node + \item{\verb+math[@display='1']/g[!@id][*#]/cursor+}\\ + append the cursor as last child of the \texttt{math} node + \item{\verb+math/g[!@id][*#]/cursor+}\\ + remove the cursor + \item{\verb+math[!display='1']/g[!@id]/cursor+}\\ + set \verb+display='1'+ in the \texttt{math} node + \item{\verb+math/g[!@id]+}\\ + append the cursor after the \texttt{math} node + \item{\verb+math/cursor+}\\ + remove the cursor + \item{\verb+cursor+} \\ + error ? +\end{description} + +% do_shift: +% CASE: tex/cursor +% create a math node. create a g node. append g as child of math. +% append the cursor as child of g +% CASE: math[@display='1']/g[!@id][*#]/cursor +% append the cursor as last child of math +% CASE: math/g[!@id][*#]/cursor +% remove the cursor. Editing is done +% CASE: math[!display='1']/g[!@id]/cursor +% set the display attribute to '1' +% CASE: math/g[!@id] +% append the cursor after math (?) +% CASE: math/cursor +% remove the cursor. Editing is done +% ELSE: +% error + +\paragraph{Align:} $\&$ + +\begin{description} + \item{\verb+g[@id]/cursor+}\\ + create a \texttt{row} node, create a \texttt{cell} node, create a \texttt{g} node, + append the cursor to the new \texttt{g} node, append the \texttt{cell} node to the + the \texttt{row} node ? + \item{\verb+row/cell/g/cursor+}\\ + create the \texttt{g} node, create the \texttt{cell} node, append the cursor + as child of the new \texttt{g} node, append the new \texttt{g} node to the new + \texttt{cell} node after the old \texttt{cell} node + \item{\verb+cursor+}\\ + error +\end{description} + +% do_align: +% CASE: g[@id]/cursor +% create a row node. create a cell node. create a g node. append the +% cursor to g, append the g to cell, append the cell to row, ??? +% CASE: row/cell/g/cursor +% create a g node. create a cell node. appent the cursor to g, +% append the g to cell, insert the new cell after the existing cell +% ELSE: +% error + +\paragraph{End-of-line:} + +% do_eol: +% ignored + +\paragraph{Parameter:} $p(i)$ +% do_parameter: +% ignored + +\paragraph{Superscript:} $\uparrow$ + +\begin{description} + \item{\verb+[^#]/cursor+}\\ + create a \SP{} node, create a \G{} node, replace the cursor with the \SP{} node, + append the \G{} node as first child of the \SP{} node, append the cursor as last + child of the \SP{} node + \item{\verb+[*#]/cursor+}\\ + create a \SP{} node, replace \texttt{*} with the \SP{} node, append \texttt{*} to + the \SP{} node, append cursor to the \SP{} node + \item{\verb+sp[^*#$][!@over='1']/cursor+}\\ %$ + set \verb+over='1'+ in the \SP{} node + \item{\verb+sp[^*#$][@over='1']/cursor+}\\ %$ + error + \item{\verb+cursor+}\\ + error ? +\end{description} +% do_superscript: +% CASE: g[^#]/cursor +% create sp node. create g node, replace cursor with sp, append g to sp, append cursor to sp +% CASE: g[*#]/cursor +% create sp node, replace * with sp, append * to sp, append cursor to sp +% CASE: sp[^*#$][!@over='1']/cursor +% set over='1' in sp node +% CASE: sp[^*#$][@over='1']/cursor +% error +% ELSE: +% error ? + +\paragraph{Subscript:} $\downarrow$ + +\begin{description} + \item{\verb+[^#]/cursor+}\\ + create a \SB{} node, create a \G{} node, replace the cursor with the \SB{} node, + append the \G{} node as first child of the \SB{} node, append the cursor as last + child of the \SB{} node + \item{\verb+[*#]/cursor+}\\ + create a \SB{} node, replace \texttt{*} with the \SB{} node, append \texttt{*} to + the \SB{} node, append cursor to the \SB{} node + \item{\verb+sb[^*#$][!@under='1']/cursor+}\\ %$ + set \verb+under='1'+ in the \SB{} node + \item{\verb+sb[^*#$][@under='1']/cursor+}\\ %$ + error + \item{\verb+cursor+}\\ + error ? +\end{description} +% do_subscript: +% CASE: g[^#]/cursor +% create sb node. create g node, replace cursor with sb, append g to sb, append cursor to sb +% CASE: g[*#]/cursor +% create sb node, replace * with sb, append * to sb, append cursor to sb +% CASE: sb[^*#$][!@under='1']/cursor +% set over='1' in sb node +% CASE: sb[^*#$][@under='1']/cursor +% error +% ELSE: +% error ? + +\paragraph{Ignorable space:} $\square$ + +% do_ignorable_space: +% do nothing? + +\paragraph{Space:} $s$ + +\begin{description} + \item{\verb+cursor+}\\ + create \SNODE{} node, replace cursor with the \SNODE{} node, append + $\tadvance$ after \SNODE{} node +\end{description} + +% do_space +% create s node, replace cursor with s, append \advance after s + +\paragraph{Identifier:} $i(v)$ + +\begin{description} + \item{\verb+cursor+}\\ + create an \INODE{}, set \verb+value=+$v$ in the \INODE{}, replace + cursor with \INODE{}, append $\tadvance$ after the \INODE{} node +\end{description} + +% do_identifier +% create i node, replace cursor with i, append \advance after i + +\paragraph{Number:} $n(v)$ + +\begin{description} + \item{\verb+cursor+}\\ + create an \NNODE{}, set \verb+value=+$v$ in the \NNODE{}, replace + cursor with \NNODE{}, append $\tadvance$ after the \NNODE{} node +\end{description} + +% do_number +% create n node, replace cursor with n, append \advance after n + +\paragraph{Apostrophe:} $o({}')$ + +\begin{description} + \item{\verb+[(sp[*#$]/g[o[@name='prime']$])#]/cursor+}\\ + create a \ONODE{} node, set \verb+name='prime'+ in the \ONODE{}, + append the \ONODE{} to the innermost \G{} node + \item{\verb+[(sb[^sp[^*#$]/g[o[@name='prime']]$])#]/cursor+}\\ + create a \ONODE{} node, set \verb+name='prime'+ in the \ONODE{}, + append the \ONODE{} to the innermost \G{} node + \item{\verb+[*#]/cursor+}\\ + create a \ONODE{} node, set \verb+name='prime'+ in the \ONODE{}, + create a \SP{} node, create a \G{} node, replace \texttt{*} with \SP{} node, + append the new \G{} node to the \SP{} node, append the \ONODE{} + node to the new \G{} node + \item{\verb+[^#]/cursor+}\\ + error? + \item{\verb+cursor+}\\ + cursor is not in a group, error? +\end{description} + +% do_apostrophe +% CASE: g[(sp[^*#$]/g[o[@name='prime']$])#]/cursor +% append a new o[@name='prime'] node to the inner g node +% CASE: g[(sb[^sp[^*#$]/g[o[@name='prime']]$])#]/cursor +% append a new o[@name='prime'] node to the inner g node +% CASE: g[*#]/cursor +% create sp node, create g node, replace * with sp, append * to sp, append g to sp, +% append a new o[@name='prime'[ node to the new g node +% CASE: g[^#]/cursor +% error? +% ELSE: +% cursor is not in a group, error? + +\paragraph{Other:} $o(v)$ + +create an \ONODE{}, set \verb+value=+$v$ in the \ONODE{}, replace +cursor with \ONODE{}, append $\tadvance$ after the \ONODE{} node + +% do_other +% create o node, replace cursor with o, append \advance after o + +\paragraph{Active:} $\sim$ + +% do_active: +% ignored ??? + +\paragraph{Comment:} $\%$ + +% do_comment: +% ignored ??? + +\paragraph{Begin Environment:} $c(\mathtt{begin})\langle\alpha_1,\dots,\alpha_n\rangle$ + +\paragraph{End Environment:} $c(\mathtt{end})\langle\rangle$ + +\paragraph{Left Delimiter:} $c(\mathtt{left})\langle\alpha\rangle$ + +\paragraph{Right Delimiter:} $c(\mathtt{right})\langle\alpha\rangle$ + +\paragraph{Carriage-Return:} $c(\mathtt{cr})\langle\rangle$ + +\begin{description} + \item{\verb+row/cell/g/cursor+}\\ + create a \ROW{} node, create a \CELL{} node, create a \G{} + node, append the cursor to the new \G{} node, append the new \G{} + node to the new \CELL{} node, append the new \CELL{} node to the + new \ROW{} node, insert the new \ROW{} node after the old \ROW{} node + \item{\verb+cursor+}\\ + ignored? +\end{description} + +% do_cr: +% CASE: row/cell/g/cursor +% create row node, create cell node, create g node, +% append cursor to g, append g to cell, append cell to row, +% insert new row after old row +% ELSE: +% ignored ??? + +\paragraph{Macro:} $c(v)\langle\alpha_1,\dots,\alpha_n\rangle$ + +\begin{description} + \item{\verb+/cursor+}\\ + create a \CNODE{} node with the children corresponding to the pattern + $\tmap{\alpha_1}$,\dots,$\tmap{\alpha_n}$, replace the cursor with + the new \CNODE{} node. put $\tnext$ as the first child of the new + \CNODE{} node + + \item{\verb+*/cursor+}\\ + create a \CNODE{} node with the children corresponding to the pattern + $\tmap{\alpha_1}$,\dots,$\tmap{\alpha_n}$, replace the cursor with + the new \CNODE{} node, put $\tnext$ as the first child of the new + \CNODE{} node. If $n\ne0$ emit a warning (the macro has arguments but + but the context wouldn't normally allow them to be entered) +\end{description} + +% do_macro: +% CASE: g/cursor +% create a c node with children corresponding to the pattern of the macro +% append \nextparam as first child of the macro + +\section{Left Drop Rules} + +\paragraph{Normal Left Drop:} $\NLDROP$ + +\begin{description} + \item{\verb+/cursor+}\\ + error. + \item{\verb+math/cursor+}\\ + nothing to drop. + \item{\verb+g[!@id][_*#_]/cursor+}\\ + replace the cursor with the $\NLDROP$. + \item{\verb+g[!@id][^#$]/cursor+}\\ + replace the cursor with the $\NLDROP$ + \item{\verb+g[@id][_*#_]/cursor+}\\ + replace the cursor with the $\NLDROP$. + \item{\verb+g[@id][^#$]/cursor+}\\ + replace the cursor with the $\NLDROP$. + \item{\verb+c[_*#_]/cursor+}\\ + replace the cursor with the $\NLDROP$. + \item{\verb+sp[^*#$]/cursor+}\\ + replace the cursor with the $\NLDROP$. + \item{\verb+c/p/cursor+}\\ + replace the cursor with the $\NLDROP$. +\end{description} + +\paragraph{Special Left Drop:} $\SLDROP$ +\begin{description} + \item{\verb+/cursor+}\\ + error. + \item{\verb+math/cursor+}\\ + nothing to drop. + \item{\verb+g[!@id][_*#_]/cursor+}\\ + replace the cursor with the $\SLDROP$. + \item{\verb+g[!@id][^#$]/cursor+}\\ + replace the cursor with the $\SLDROP$ + \item{\verb+g[@id][_*#_]/cursor+}\\ + replace the cursor with the $\SLDROP$. + \item{\verb+g[@id][^#$]/cursor+}\\ + replace the cursor with the $\SLDROP$. + \item{\verb+c[_*#_]/cursor+}\\ + replace the cursor with the $\SLDROP$. + \item{\verb+sp[^*#$]/cursor+}\\ + replace the cursor with the $\SLDROP$. + \item{\verb+c[p#]/cursor+}\\ + remove the cursor and append the $\SLDROP$ to the \PNODE{} node. + \item{\verb+c[#]/cursor+}\\ + remove the cursor and append it before the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or \CNODE{} node. + \item{\verb+c/p/cursor+}\\ + repace the cursor with the $\SLDROP$. +\end{description} + +\section{Right Drop Rules} + +\section{$\varepsilon$-rules} + +\paragraph{Nromal Left Drop} + +\begin{description} + + %drop_prev_script(false). The results aren't \NLDROP's parent dependent. + \item{\verb+.[#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and append it to the preceding script. + + %drop_prev_group(false). The results are \NLDROP's parent independent. + \item{\verb+.[g#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and append it to the \G{} node. + + %drop_prev_macro(false). The results aren't \NLDROP's parent dependent, unless the macro is undefined. + \item{\verb+.[c[@pattern+$\sim$\verb+')'][g$]#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and append it to the \G{} node. + \item{\verb+.[c[@pattern='(]'][^g[^$]$]#]/+$\NLDROP$}\\ + remove the \CNODE{} node. + \item{\verb+.[c[@pattern='(]'][^g[_]$]#]/+$\NLDROP$}\\ + replace the \CNODE{} node with the content of the \G{} node. + \item{\verb+.[c[*]#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and append it to the \CNODE{} node. + \item{\verb+.[c[^$]#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \CNODE{} with the cursor. + + %drop_prev_macro(false), when the macro is undefined and the NLDROP's parent is not a group with id + \item{\verb+[c[@undefined='1']#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \CNODE{} node with the cursor. + + %drop_prev_macro(false), when the macro is undefined and the \NLDROP's parent is a group with id. + \item{\verb+g[@id][^c[@undefined='1']#$]/+$\NLDROP$}\\ + remove the \CNODE{} node. + \item{\verb+g[@id][^c[@undefined='1']#._]+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \CNODE{} node with the cursor. + \item{\verb+g[@id][_.c[@undefined='1']#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \CNODE{} node with the cursor. + + %drop_prev_token(false), when the \NLDROP's parent is not a group with id. + \item{\verb+[_#_]/+$\NLDROP$}\\ + replace the node preceding the $\NLDROP$ with the cursor and remove the $\NLDROP$. + + %drop_prev_token(false), when the cursor's parent is a group with id. + \item{\verb+g[@id][^#$]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \INODE{}, \NNODE{}, \ONODE{} or \SNODE{} with the $\NLDROP$. + \item{\verb+g[@id][^#._]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \INODE{}, \NNODE{}, \ONODE{} or \SNODE{} with the cursor. + \item{\verb+g[@id][_.#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and replace the \INODE{}, \NNODE{}, \ONODE{} or \SNODE{} with the cursor. + + %rgreplace_father(). + \item{\verb+g[@id][^#$]/+$\NLDROP$}\\ + replace the \G{} node with the $\NLDROP$. + + %situations where the \NLDROP is a script's child. + \item{\verb+[^g[^$]#$]/+$\NLDROP$}\\ + replace the \SP{} or \SB{} node with the $\NLDROP$. + \item{\verb+[^]/+$\NLDROP$}\\ + replace the \SP{} or \SB{} with the non-\G{} node and insert the $\NLDROP$ after it. + + %situations where the \NLDROP is a macro's child. + \item{\verb+c[p#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and append it to the \PNODE{} node. + \item{\verb+c[#]/+$\NLDROP$}\\ + remove the $\NLDROP$ and insert it before the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or the \CNODE node. + \item{\verb+c[^#][p[*]]/+$\NLDROP$}\\ + nothing to drop. Not all the parameters are empty. + \item{\verb+c[!p[*]][^#]/+$NLDROP$}\\ + replace the macro with the $\NLDROP$. + + %situations where the cursor is a phantom group's child and has no preceding node. + \item{\verb+math/g[!@id][^#$]/+$\NLDROP$}\\ + nothing to drop. + \item{\verb+c[@pattern='()'][^g[^$]#$]/g[!@id][^#$]/+$\NLDROP$}\\ + replace the \CNODE{} node with the $\NLDROP$ + \item{\verb+c[@pattern='()'][^g[*]#$]/g[!@id][^#$]/+$\NLDROP$}\\ + remove the $\NLDROP$, insert the $\NLDROP$ after the \CNODE{} node replace the \CNODE{} node with the content of the first \G{} node. + \item{\verb+c[@pattern='[)'][^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + replace the \CNODE{} node with the $\NLDROP$. + \item{\verb+c[@pattern='(]']/g[^#$]/+$\NLDROP$}\\ + error. + \item{\verb+c[@table='1']/p[^#$]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + replace the \CNODE{} with the cursor. + \item{\verb+c[@table='1']/p[row[cell[^g[!@id]$]$]#_]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + remove the \ROW{} node in which the $\NLDROP$ is and append the cursor to the \G{} node. + \item{\verb+c[@table='1']/p[^#row_]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + nothing to drop. + \item{\verb+row[_cell[^g[!@id]$]#_]/cell[^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + remove the cell in which the $\NLDROP$ is and append the cursor to the \G{} node of the preceding \CELL{} node. + \item{\verb+row[^#cell_]/cell[^#$]/g[!@id][^#$]/+$\NLDROP$}\\ + nothing to drop. + \item{\verb+sp[^*#$]/g[^#$]/+$\NLDROP$}\\ + replace the \SP{} node with it's first child and insert the cursor after it. + \item{\verb+sp[^*#$]/g[o#_]/+$\NLDROP$}\\ + remove the \ONODE{}, remove the $\NLDROP$ and insert the cursor after the \SP{} node. + + %situations where \NLDROP is a p's child + \item{\verb+c/p[^#$]/+$\NLDROP$}\\ + remove the $\NLDROP$ and insert it before the \PNODE{} node. + +\end{description} + +\paragraph{Special Left Drop} + +\begin{description} + + %drop_prev_script(true). The results aren't cursor's parent dependent. + \item{\verb+.[#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and append it to the preceding script. + + %drop_prev_group(true). The results are cursor's parent independent. + \item{\verb+.[g#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and append it to the \G{} node. + + %drop_prev_macro(true). The results aren't cursor's parent dependent. + \item{\verb+.[c[undefined='1']#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and replace the \CNODE{} with the cursor. + \item{\verb+.[c[@pattern~')'][g$]#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and append the cursor to the \G{} node. + \item{\verb+.[c[@pattern='(]'][^g[^$]$]#]/+$\SLDROP$}\\ + remove the \CNODE{} node and replace the $\SLDROP$ with the cursor. + \item{\verb+.[c[@pattern='(]'][^g[_]$]#]/+$\SLDROP$}\\ + replace the \CNODE{} node with the content of the \G{} node and replace the $\SLDROP$ with the cursor. + \item{\verb+.[c[*]#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and append it to the \CNODE{} node. + \item{\verb+.[c[^$]#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and replace the \CNODE{} with the cursor. + %here, we have to return the macro's name to the lexer. + + %drop_prev_token(true). The results aren't \SLDROP's parent dependent. + \item{\verb+.[_#_]/+$\SLDROP$}\\ + replace the node preceding the $\SLDROP$ with the cursor and remove the $\SLDROP$. + + %situations where the \SLDROP is a script's child. + \item{\verb+[^g[@id][^$]#$]/+$\SLDROP$}\\ + replace the \SP{} or \SB{} node with the \G{} node and insert the cursor after it. + \item{\verb+[^]/+$\SLDROP$}\\ + replace the \SP{} or \SB{} with the cursor. + \item{\verb+[^*#$]/+$\SLDROP$}\\ + replace the \SP{} or \SB{} node with it's first child and insert the cursor after it. + + %situations where the \SLDROP is a macro's child. + \item{\verb+c[p#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and append it to the \PNODE{} node. + \item{\verb+c[#]/+$\SLDROP$}\\ + remove the $\SLDROP$ and insert the cursor before the \INODE{}, \NNODE{}, \ONODE{}, \SNODE{} or the \CNODE node. + \item{\verb+c[^#][p[*]]/+$\SLDROP$}\\ + nothing to drop. Not all the parameters are empty. + \item{\verb+c[!p[*]][^#]/+$SLDROP$}\\ + replace the macro with the cursor. + + %situations where the \SLDROP is a phantom group's child and has no preceding node. + \item{\verb+math/g[!@id][^#$]/+$\SLDROP$}\\ + nothing to drop. + \item{\verb+c[@pattern='()'][^g[^$]#$]/g[!@id][^#$]/+$\SLDROP$}\\ + replace the \CNODE{} node with the cursor. + \item{\verb+c[@pattern='()'][^g[*]#$]/g[!@id][^#$]/+$\SLDROP$}\\ + replace the \CNODE{} with the content of the first group and insert the cursor after it. + \item{\verb+c[@pattern='[)'][^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + replace the \CNODE{} node with the cursor. + \item{\verb+c[@pattern='(]']/g[^#$]/+$\SLDROP$}\\ + error. + \item{\verb+c[@table='1']/p[^#$]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + replace the \ROW{} with the cursor. + \item{\verb+c[@table='1']/p[row[cell[^g[!@id]$]$]#_]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + remove the \ROW{} node in which the $\SLDROP$ is and append the cursor to the \G{} node. + \item{\verb+c[@table='1']/p[^#row_]/row[^#$]/cell[^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + nothing to drop. + \item{\verb+row[_cell[^g[!@id]$]#_]/cell[^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + remove the cell in which the $\SLDROP$ is and append the cursor to the \G{} node of the preceding \CELL{} node. + \item{\verb+row[^#cell_]/cell[^#$]/g[!@id][^#$]/+$\SLDROP$}\\ + nothing to drop. + \item{\verb+sp[^*#$]/g[^#$]/+$\SLDROP$}\\ + replace the \SP{} node with it's first child and insert the cursor after it. + \item{\verb+sp[^*#$]/g[o#_]/+$\SLDROP$}\\ + remove the \ONODE{}, remove the $\SLDROP$ and insert the cursor after the \SP{} node. + + %situations where the \SLDROP is a p's child + \item{\verb+c/p[^#$]/+$\SLDROP$}\\ + remove the $\SLDROP$ and insert it before the \PNODE{}. + +\end{description} + +\paragraph{Advance} + +\begin{description} + \item{\verb+g/+$\tadvance$}\\ + replace $\tadvance$ with the cursor + + \item{\verb+p[#$]/+$\tadvance$}\\ %$ + put $\tadvance$ after the \PNODE{} node + + \item{\verb+c[#p]/+$\tadvance$} \\ + remove $\tadvance$, put the cursor as first child of the \PNODE{} node + + \item{\verb+c[#*]/+$\tadvance$} \\ %$ + replace $\tadvance$ with the cursor + + \item{\verb+c[#$]/+$\tadvance$} \\ %$ + move $\tadvance$ after the \CNODE{} node +\end{description} + +\paragraph{Next Parameter} + +\paragraph{Next Token} + +%% \begin{description} +%% \item{\verb+c[#p]/+$\tnext$} \\ +%% \end{description} + +% g[@id]/(c[#$][@right-open]/g[!@id][#$]/)+cursor } let p = cursor.parent() in remove; advance(p) + +% c/g[!@id]/cursor +% c/cursor +% */cursor { let g = new group in replace + +% g[@id][^#$]/cursor <= cursor.parent().replace(cursor) +% g[@id][^#$]/cursor <- cursor +% (!g[@id][^#$])[A#B]/(g[@id][^#$]/)+cursor <- (!g[@id][^#$])[A#B]/cursor + +\end{document} -- 2.39.2