Menu

#1997 Syntaxis error in Batch scripts

Cosmetic
closed-fixed
nobody
4
2020-04-27
2018-02-12
Juan Mier
No

Description of the Issue
When coding batch scripts, the command IF's arguments will be taken as mistakes or misplaced if between brackets when in reality it works perfectly and sometimes is mandatory.

Steps to Reproduce the Issue
Select "Batch".
Input "if [whatever] (argument & argument) ELSE (argument)
Expected Behavior
The first argument in the bracket should be marked as a normal command.

Actual Behavior
Sometimes is marked as a mistake, others it marks the command's argument as the actual command.

Debug Information
http://prntscr.com/id6t92
Note that in the screenshot, 'echo' is marked differently than 'goto'.

http://prntscr.com/id6tsf
In this screenshot, Notepad++ takes 'ELSE' as a command and completely skips the other arguments.

In both cases, the script is working as expected with no error messages whatsoever.

GitHub issue that may help you out:
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4169#issuecomment-364790887

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-02-13
    • labels: --> scintilla, lexer, batch
    • status: open --> open-accepted
     
  • Neil Hodgson

    Neil Hodgson - 2018-02-13

    Its helpful to include the text of an example as transcribing from an image takes time and may be inaccurate.

    The batch lexer is too simple for these sorts of expressions. It has no knowledge of how '(' can be used in batch files.

    Its possible that someone will come forward to work on these sorts of issues but I won't be working on this myself as I do not write complex batch files.

     
  • Neil Hodgson

    Neil Hodgson - 2018-02-13

    Related bugs include [#1624] and [#1162].

     

    Related

    Bugs: #1162
    Bugs: #1624

  • Neil Hodgson

    Neil Hodgson - 2020-04-27
    • status: open-accepted --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2020-04-27

    Fixed with [bc6bc2].

     

    Related

    Commit: [bc6bc2]


Log in to post a comment.