Wednesday, December 19, 2012

Re: regexp, ANN: explainpat

v0.2 is out!

Am 19.12.2012 20:48, schrieb Christian Brabandt:
> On Mi, 19 Dez 2012, Christian Brabandt wrote:
>
>>> :ExplainPattern *
>>> if the pattern is in the clipboard)
>>>
>>> (needless to say: suggestions welcome)
>>
>> Very nice.
>
> Some observations:
> You already parse \v \V \m and \M
> but then you should also output the meaning of those atoms

There is a technical limit ... ExplainPattern only understands
magic patterns.

> :%>l doesn't seem to work correctly:
> :ExplainPattern \%>1l\&\%<6l
> match below line 1
> \& AND branch
> match above line 6
> (obviously otherway around)

Thanks for spotting!
He, "above" and "below" are ambiguous!

Now it says:
Pattern: \%>1l\&\%<6l
\%>1l match below line 1 (towards end of buffer)
\& AND branch
\%<6l match above line 6 (towards start of buffer)

> :ExplainPattern: \%>'a1
> \%>'a1 literal string (5 atom(s))
> (wrong, its 1 after mark a (2atoms)

ok, fixed.

> Possible enhancements:
> - maybe show captured string, if simple atom
> \1 match first captured string

I don't get exactly what you mean.

> - possibly highlight matching patterns, so you can see, what
> :ExplainPattern <pattern> matches in the current buffer)

You can search for a pattern and then do
:ExplainPattern /

> - :ExplainPattern: \%x31
> \%x31 match character specified with hex number 0x31
> (display character)

now it says

Pattern: \%x31
\%x31 match character specified with hex number 0x31 (1)

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: