Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[Batch File] Refactor labels and label-like comments

Open deathaxe opened this issue 1 year ago • 0 comments

This PR applies tokenization rules from https://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/4095133#4095133 to labels and common command arguments.

As a result invalid labels are scoped "ignored" even without dedicated comment contexts and less special-casing patterns. They are however kept to maintain comment.line scopes for now.

Delimiter characters such as = are ignored, which fixes scoping of somewhat uncommon but valid labels like :=== label ===.

Delimiter chars are scoped punctuation.separator if not having any other special meaning (e.g.: = keyword.operator.assignment) depending on context.

Accuracy of various tokens - including some odds of batch - is increased to match highlighting better to interpreter's behavior.

deathaxe avatar Jul 09 '24 19:07 deathaxe