diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax index 173d9b37ee..d714d9ffe2 100644 --- a/Batch File/Batch File.sublime-syntax +++ b/Batch File/Batch File.sublime-syntax @@ -1753,7 +1753,7 @@ contexts: - include: quoted-eol-pop escaped-characters: - - match: \^. + - match: \^[^%\n] scope: constant.character.escape.dosbatch escaped-variables: diff --git a/Batch File/tests/syntax_test_batch_file.bat b/Batch File/tests/syntax_test_batch_file.bat index 530fc627ce..7e80f97086 100644 --- a/Batch File/tests/syntax_test_batch_file.bat +++ b/Batch File/tests/syntax_test_batch_file.bat @@ -441,6 +441,12 @@ ECHO : Not a comment ^ ::^^ - entity :: ^ punctuation.definition.label.dosbatch :: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation +:: ^ - entity + + :^% +::^^ - entity +:: ^ punctuation.definition.label.dosbatch +:: ^^ entity.name.label.dosbatch - constant.character.escape - punctuation :: ^ - entity :%% @@ -795,6 +801,17 @@ ECHO : Not a comment ^ :: ^ punctuation.definition.label.dosbatch :: ^^^ variable.label.dosbatch - keyword :: ^^ constant.character.escape.dosbatch +:: ^^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch + + CALL :^% 10 +::^ - meta.function-call +:: ^^^^^ meta.function-call.dosbatch +:: ^^^ meta.function-call.identifier.dosbatch +:: ^^^ meta.function-call.arguments.dosbatch +:: ^ - meta.function-call +:: ^^^^ keyword.control.flow.call.dosbatch +:: ^ punctuation.definition.label.dosbatch +:: ^^^ variable.label.dosbatch - keyword - constant.character :: ^^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch CALL :%% 10 @@ -1278,6 +1295,23 @@ bar baz :: ^ variable.label.dosbatch :: ^ - variable + GOTO ^% +:: ^^^^^^^ meta.command.goto.dosbatch +:: ^ - meta.command +:: ^^^^ keyword.control.flow.goto.dosbatch +:: ^ - keyword - variable +:: ^^ variable.label.dosbatch - constant.character +:: ^ - variable + + GOTO ^%var% +:: ^^^^^^^^^^^ meta.command.goto.dosbatch +:: ^ - meta.command +:: ^^^^ keyword.control.flow.goto.dosbatch +:: ^ - keyword - variable +:: ^ variable.label.dosbatch - meta.interpolation - constant.character +:: ^^^^^ variable.label.dosbatch meta.interpolation.dosbatch - constant.character +:: ^ - variable + GOTO %var% ignored content ( & echo foo :: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch :: ^^^ - meta.command @@ -2508,6 +2542,12 @@ put arg1 arg2 :: ^^^^^^^ meta.interpolation.dosbatch :: ^ punctuation.section.interpolation.end.dosbatch + ren example.txt example_^%today%.txt +:: ^ - constant.character.escape +:: ^ punctuation.section.interpolation.begin.dosbatch +:: ^^^^^^^ meta.interpolation.dosbatch +:: ^ punctuation.section.interpolation.end.dosbatch + powershell get-date -uformat "%%Y%%m%%d">today.txt :: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch :: ^^^^^^^^ - variable.parameter