|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote in news:3d695553@news.povray.org:
> In povray.general Chris TRIBBECK <chris@--7tharm--.com> wrote:
>> Why limit it at all ?
>
> Why, indeed. I see no reason for limiting it. (After all, there are
> other opening-closing pairs of syntax items which are unlimited, such
> as parentheses.)
Because of the current way Scintilla lexers work.
They do an incremental lexing of the document, avoiding to parse the whole
source on each typed character.
So if you type a char inside a multi-line comment, the lexer will start to
parse from the current line. It doesn't try to backtrack the beginning of
the comment up to the beginning of the document.
So it needs to know the current level of nesting at the start of the line,
so it can correctly decrement this level when meeting */s (and increment
it of course, with /*s).
In other lexers, it has been worked around by allocating lexer states to
each level of nesting. By looking at the lexing state of the beginning of
the line, it knows the nesting level. It is quite ugly, as it eats states
which is a limited resource. But it is a necessary evil. And in 99% cases,
outside testing purposes, using a limited number of nesting is enough.
Now, I recently saw there can be information stored per line, that may be
used for this purpose. I will see.
Note: parenthesis are parsed independently as single operators, we don't
track the amount of opening and closing, and don't try to change the state
according to the nesting level, although it can be done, I suppose.
However, there is a shortcut key allowing to jump from a parenthesis to
the matching one, and non-matching parenthesis are highlighted when the
caret go over them. But it is a different beast, independent of lexers.
Regards.
--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
Post a reply to this message
|
![](/i/fill.gif) |