vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] ANN: vile-9.8s


From: Thomas Dickey
Subject: Re: [vile] ANN: vile-9.8s
Date: Sun, 18 Dec 2016 12:27:30 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Dec 18, 2016 at 03:37:57PM +0100, j. van den hoff wrote:
> thanks for explaining. I understand it's not easy, too :-). just out
> of curiosity;
> 
> * why does it not happen with `[1A', too? because it thinks it's a
> hex number?

hmm - looking at the colors, I'd say that's a bug in the highlighter :-)

tcl's parser only cares about "words", which are separated by whitespace.
But (of course), it takes the words apart and puts pieces together in
interesting ways.

lex wants the pieces up front, and doesn't have a way to first do
splitting on whitespace and then reassembling fragments.

In this case, I see only the "1" highlighted, so I could improve that...
 
> * the problem with `proc 1g {return bla}' (showing the proc name as
> a reserved word) is still a slightly different problem I guess? I
> concede it's a stupid procedure name but tcl simply allows next to
> everything (at least a lot) here ;-).

There's a lot - I have built up a collection of sample files, that
I run scripts against to compare before/after making changes, and
_try_ to review those to reduce regressions.

+ "test-syntax-filter" does the work for a given filter,
+ "test-XXX-filt" scripts do just one type of filter, and
+ "test-all-syntax-filters" walks through the set of samples and
  (with a few special cases) maps those to "test-XXX-filt" scripts.

For tcl, I've 292 sample files.  And it wasn't until this pass that
I really noticed the regular expressions.

Actually, I had set out to repair something in the perl highlighter,
and having two reports of problems in ksh and tcl got me to pay attention.
 
> in any case it sure is not a big deal ...

:-)
 
> On Sun, 18 Dec 2016 15:23:40 +0100, Thomas Dickey <address@hidden> wrote:
> 
> >On Sun, Dec 18, 2016 at 01:20:26PM +0100, j. van den hoff wrote:
> >>thanks a lot for the new version. regarding the (k)sh syntax filter
> >>I can confirm that the reported problems are gone.
> >
> >:-)
> >
> >>while testing a bit further I noted that there persists (a so far
> >>seemingly unreported) minor glitch in the tcl syntax filter, it
> >>seems:
> >>
> >>I see strange spurious highlighting by reverse video in constructs like
> >>
> >>[1G
> >>
> >>(the `1G' shows up in reverse video (red in my case))
> >>
> >>strangely this happens ony if _not_ in line one. even more strangely
> >>it does also not happen in, e.g.,
> >>
> >>[1A
> >>
> >>I have encountered the problem when defining constants containing
> >>escape sequences, e.g. like
> >>
> >>set gobol  {^[[1G}
> >
> >yes...  tcl is harder to parse reliably than it looks, since its
> >designers chose to use curly-braces to mean (from the user's point of
> >view) different things.  That makes it hard to parse with a lex-based
> >filter, since matching curly-braces has to be recursive - something
> >that lex can only approximate with a stack of different states.
> >
> >For this chunk, my filter tries to see that as a regular expression
> >because of the "^", and then sees the doubled "[" and decides it can't
> >be that because the closing curly brace (and end of line) comes before
> >it finds a valid regex.  So it treats the "[" characters specially,
> >and falls into the "1G" not being a number.
> >
> >Rather than showing it as an error, I could modify that to just
> >treat it as a literal (but the downside is that if it were meant
> >to be a regex, then it would have been an error).
> >
> >I _could_ rewrite that in C (as I did for perl and ruby) and get
> >proper recursion...
> >
> >>to move cursor to beginning of line (^[ denoting escape (octal
> >>033)). you can also see the problem with this silly example:
> >>
> >>proc 1G {return bla}
> >>puts [1G]
> >
> >This case is a little different, but again, the leading "1" makes it
> >think that should be a number, but the "G" tells it that it's not.
> >
> >>note that the reverse video might only appear after deleting and
> >>reinserting the line containing the `[1G' construct.
> >>as an aside: in this example the proc name is furthermore
> >>highlighted as a reserved word (like proc). maybe both problems are
> >>related?
> >>
> >>thanks for `vile'
> >>
> >>joerg
> >>
> >>On Sun, 18 Dec 2016 03:15:10 +0100, Thomas Dickey
> >><address@hidden> wrote:
> >
> 
> 
> -- 
> Using Opera's revolutionary email client: http://www.opera.com/mail/

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]