#1624 Brace-matching problems with batch-files

Bug
open-accepted
Neil Hodgson
3
2014-07-14
2014-07-14
hurda77
No

In the following code-example, the second brace of ") else (" isn't being matched to any other brace when the text is being set as "Batch". This throws off the matching of all following braces.

When the text is set to "Normal Text", the brace-matching is working properly.

if "%VC12DIR%"=="" (
    rem Prepend SDK paths - Don't use the SDK SetEnv.cmd because it pulls in
    rem random VC paths which we don't want.
    rem Add the atlthunk compat library to the end of our LIB
    set "PATH=%SDKDIR%\bin;%PATH%"
    set "LIB=%SDKDIR%\lib;%LIB%;%MOZBUILDDIR%atlthunk_compat"

    if "%USEPSDKATL%"=="1" (
        if "%USEPSDKIDL%"=="1" (
            set "INCLUDE=%SDKDIR%\include;%PSDKDIR%\include\atl;%PSDKDIR%\include;%INCLUDE%"
        ) else (
            set "INCLUDE=%SDKDIR%\include;%PSDKDIR%\include\atl;%INCLUDE%"
        )
    ) else (
        if "%USEPSDKIDL%"=="1" (
            set "INCLUDE=%SDKDIR%\include;%SDKDIR%\include\atl;%PSDKDIR%\include;%INCLUDE%"
        ) else (
            set "INCLUDE=%SDKDIR%\include;%SDKDIR%\include\atl;%INCLUDE%"
        )
    )
)

Reproduced in SciTE 3.4.4, Notepad++ 6.6.7 and Notepad2-Mod r906.
Code-example taken from start-shell-msvc2013.bat of MozillaBuild 1.9 for Windows.

Discussion

  • Neil Hodgson
    Neil Hodgson
    2014-07-14

    The batch lexer colours most of the '(' as "External Commands" (style 5) but the '(' following "else" are default (style 0). Since they are in different styles they don't match.

    I'll leave fixing this to someone that is interested in the batch language.

     
  • Neil Hodgson
    Neil Hodgson
    2014-07-14

    • labels: --> scintilla, batch, lexer
    • status: open --> open-accepted
    • assigned_to: Neil Hodgson
    • Priority: 5 --> 3