I just updated the SQL lexer to improve the folding.
I dropped the test on initial char (probably loosing some milliseconds
on lexing a whole 1MB SQL file...), but the keyword test is more robust,
not triggering when a folding keyword is at the end of a keyword (eg.
elseif or nullif or fooloop. No, foolopp isn't a SQL keyword... but I
added it to the list of keyword to test this behaviour).
I restored the test on IF, but take EXISTS for decrementing fold level.
As in previous releases, I support folding on opening / closing
parenthesis and kept support on --{ / --}
I removed all support of indent based folding, because I find messy to
mix this kind of folding with keyword/operator based folding.
Well, mixing keywords and operators is already messy, ideally there
should be independant levels of folding, eg. if incrementing on '(' we
should not decrement on 'end'.
Of course, normally the language should take care of correctly nest
these keywords/attributes.
Now, if somebody really think indent based folding should be put back, I
can think about it. But I probably won't reuse the old code, strangely
splitted between the ColouriseDoc method and the FoldDoc one, and
seemingly broken.
Perhaps we should choose between indent based folding and keyword based
one, like I saw in Eiffel lexer, or carefully define how mixing
indenting and keywords/operators should work.
I can see the usefulness of indent base folding in such expression:
select substrb(to_char(cost),1,6) cost,
substrb(to_char(cardinality),1,6) card,
substrb(substr(' . , . , . ',1,level) ||
operation,1,20) type,
substrb(options,1,15) subtype,
substrb(object_owner,1,5) owner,
substrb(object_name,1,5) name,
substrb(object_node,1,5) link from plan_table
connect by parent_id = prior id
start with id = 0;
although perhaps we could define it as:
"After a semi-colon operator, take the indent level of the first
non-comment expression. If the following lines have a higher indent
level, mark the first line as indent header (SC_FOLDLEVELHEADERFLAG).
Reset the level to SC_FOLDLEVELBASE on semi-colon."
Perhaps we should already reset the level on a semi-colon operator in
the current code.
What do think those knowing SQL syntax better than me?
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest