On Saturday, November 9, 2013 9:26:41 AM UTC-6, Edward K. Ream wrote:
>
> Here is a more complex example,
>>
>> ('z',(
>> # z- or zb redraw, current line at bottom of window
>> # z. or zz redraw, current line at center of window
>> # z<CR> or zt redraw, current line at top of window
>> # N zh scroll screen N characters to the right
>> # N zl scroll screen N characters to the left
>> ('\\n',vim_zt),
>> ('.',vim_zz),
>> ('-',vim_zb),
>> ('b',vim_zb),
>> ('h',vim_zh),
>> ('l',vim_zl),
>> ('t',vim_zt),
>> ('z',vim_zz),
>> ))
>>
>
A big collapse in complexity just happened.
The data structure above should be the *result* of user arguments, not a
transliteration of the actual arguments. This makes a huge difference!
Suppose we define the entries in @data vim-commands as:
command-name <command-keys-excluding-tail>
It is then trivial to create the desired dict. It's about 8 lines of code!
We then define a new @data node, say @data vim-command-tails as:
tail-kind command-keys-excluding-tail
tail-kind will be one of:
char: the <char> field of F,T,t, etc.
motion: the motion field used by many commands.
upper_alpha: for the q command, appended to register
lower_alpha: for the q command
etc.
Now parsing the @data nodes becomes so easy that doing so is easier than
more prototyping! Examples:
@data vim-commands:
vim_a a
vim_g g
vim_g_caret g^
etc.
Order doesn't matter. Dead easy.
@data vim-command-tails
motion <
motion >
digraph Ctrl-K
char-or-number Ctrl-V
char "
char F
char T
etc.
It looks like step 1 of the project will be finished this evening.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.