Skip to content

Commit

Permalink
[Batch File] Fix comment scope around newlines
Browse files Browse the repository at this point in the history
I wish I knew what I was doing.
  • Loading branch information
mataha committed Jun 17, 2024
1 parent 3c25c09 commit 717adef
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Batch File/Batch File.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ contexts:
comment-body:
- meta_scope: comment.line.colon.dosbatch
- include: line-continuations
- match: \n
- match: $\n?
pop: 1

ignored-tail-inner:
Expand Down
66 changes: 63 additions & 3 deletions Batch File/tests/syntax_test_batch_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,98 @@ continuation
:: ^^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^^ comment.line.colon.dosbatch

:::
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:: Me too!
:: ^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^ comment.line.colon.dosbatch

::
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:+ Me too!
:: ^^ punctuation.definition.comment.dosbatch

:+
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:= Me too!
:: ^^ punctuation.definition.comment.dosbatch

:=
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:, Me too!
:: ^^ punctuation.definition.comment.dosbatch

:,
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:; Me too!
:: ^^ punctuation.definition.comment.dosbatch

:;
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

: Me too!
:: ^^ punctuation.definition.comment.dosbatch

:
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

::^
Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

::^

Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

::^


Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

: ^
Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

: ^

Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

: ^


Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

: ^
A continued comment.^
Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

: ^

Me too!
:: ^^^^^^^ comment.line.colon.dosbatch

: ^
^
Not me, though.
:: ^^^^^^^^^^^^^^^^ - comment

:> ignored content ( & | )
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
:: ^^ punctuation.definition.comment.dosbatch
Expand All @@ -114,17 +174,17 @@ continuation
ECHO &&:: A comment
:: ^^ keyword.operator.logical.dosbatch
:: ^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^^^ comment.line.colon.dosbatch
:: ^^^^^^^^^^^^^ comment.line.colon.dosbatch

ECHO &:: A comment
:: ^ keyword.operator.logical.dosbatch
:: ^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^^^ comment.line.colon.dosbatch
:: ^^^^^^^^^^^^^ comment.line.colon.dosbatch

ECHO ||:: A comment
:: ^^ keyword.operator.logical.dosbatch
:: ^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^^^ comment.line.colon.dosbatch
:: ^^^^^^^^^^^^^ comment.line.colon.dosbatch

ECHO |:: Not a comment
:: ^ keyword.operator.assignment.pipe.dosbatch
Expand Down

0 comments on commit 717adef

Please sign in to comment.