On 27/06/2007 12:35, SourceForge.net wrote:
Bugs item #1744090, was opened at 2007-06-27 03:35
Category: SciTE
Group: Bug
Status: Open
Summary: Keywords at end of file

Initial Comment:
SciTE does not recognize keywords that are next to end of file. For example "foreach " would be 
highlighted, but "foreach<EOF>" would not be. This is a problem in the automatic 
indentation, since it wont recognize the keywords in thease cases.

I found out why: at the end of file, the current state is pending, waiting to be completed. In my LexAHK1 lexer (not official, being rewritten), I added the following lines at the end of the main loop:

    for (; sc.More(); sc.Forward()) {
[...]
    }
    // End of file: complete any pending changeState
    if (sc.state == SCE_AHK_IDENTIFIER) {
        HighlightKeyword(sc, keywordlists, styler);
    } else if (sc.state == SCE_AHK_STRING && bInExprString) {
        sc.ChangeState(SCE_AHK_ERROR); // Unterminated string
    } else if (sc.state == SCE_AHK_VARREF) {
        sc.ChangeState(SCE_AHK_ERROR); // Unclosed variable deref
    }
    sc.Complete();

Of course, the current workaround is to always have an empty line at the end of the source file... But it would be nice if everybody applied a similar change to their favorite lexer... It is more prominent in languages where a keyword can end the file (like Lua), but it is obvious in any language while typing at the end of a buffer.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to