#4054 Batch file Syntax Coloration Bug

All
open
nobody
None
5
2015-01-22
2012-11-08
Jaime X. Ramos
No

There's a coloration bug in the example code below, where the "DO (" and the closing parathesis ")" are not being properly highlighted.

FOR /F "tokens=2-4 delims=/ " %%P IN ('ECHO %TheDate%') DO (
SET /A Month=100%%P %% 100
SET /A Day=100%%Q %% 100
SET Year=%%R
)

Thanks to whoever's going to look into it.

Discussion

  • Patrick
    Patrick
    2013-07-01

    Sorry this is really late
    but I don't think there can be a whole lot done with this problem. Batch is a really screwy scripting language, so properly highlighting commands is really hard to do for batch.

     
  • Jaime X. Ramos
    Jaime X. Ramos
    2014-02-26

    Not sure if this observation helps but I believe I narrowed it down to the presence of ECHO being in the body of the IN portion of the FOR loop. It's doing something to throw the syntax recognition.

    Thanks again

     
  • mostovsky
    mostovsky
    2015-01-22

    For example:
    We have highlight in .bat (or .cmd) file when write into text-file:

    echo REM comment > "%Dir%\123.cmd
    or
    echo REM comment >> "%Dir%\123.cmd


    but must be:

    echo REM comment > "%Dir%\123.cmd"
    or
    echo REM comment >> "%Dir%\123.cmd"

    In "Jaime X. Ramos" example we have such result for if-else construction:
    open "(" - with black color
    close ")" - with light-blue color
    example:

    if %n% GTR 0 (
    echo code in if
    ) else (
    echo code in else
    )

    and no highlight when {cursor} in the "()" area: "({cursor})"
    It must work such as in simple example:

    if 1 GTR 5 () else ({cursor})
    or
    if 1 GTR 5 ({cursor}) else ()

     
    Last edit: mostovsky 2015-01-22