diff --git a/Batch File/Batch File (Compound).sublime-syntax b/Batch File/Batch File (Compound).sublime-syntax
index 3f991917e3..c22513ec5b 100644
--- a/Batch File/Batch File (Compound).sublime-syntax
+++ b/Batch File/Batch File (Compound).sublime-syntax
@@ -21,4 +21,4 @@ hidden: true
extends: Packages/Batch File/Batch File.sublime-syntax
variables:
- command_terminator_chars: '[|&<>)]'
+ eoc_char: '[\n|&)]'
diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax
index 0811d099f3..ae250f8b11 100644
--- a/Batch File/Batch File.sublime-syntax
+++ b/Batch File/Batch File.sublime-syntax
@@ -25,7 +25,7 @@ variables:
# A character that, when unquoted, separates words. A metacharacter is a
# space, tab, newline, or one of the following characters:
# ‘|’, ‘&’, ‘,’, ‘;’, ‘<’, or ‘>’.
- metachar: '[\s=,;{{command_terminator_chars}}]'
+ metachar: '[\s=,;{{redir_or_eoc_char}}]'
# Keywords
keyword_break: (?![^{{metachar}}(.:\\/])
@@ -37,34 +37,35 @@ variables:
cmd_char: '[^{{metachar}}(]'
# Command arguments are identifiers, which may start with interpolation.
- opt_punctuation: (?:\s+|^)(--?|//?){{arg_begin}}
+ opt_punctuation: (?:--?|//?){{arg_begin}}
arg_begin: (?={{arg_char}})
arg_break: (?!{{arg_char}})
arg_char: '[^{{metachar}}:]'
- command_terminator_chars: '[|&<>]'
- command_terminators: (?:$|(?=\s*[{{command_terminator_chars}}]))
+ # Command statement terminators and redirections
+ redir_or_eoc: (?=\s*{{redir_or_eoc_char}})
+ redir_or_eoc_char: '[<>{{eoc_char}}]'
+ eoc: (?=\s*{{eoc_char}})
+ eoc_char: '[\n|&]'
label_comment: ':[^{{label_start}}]'
- label_name: '{{label_start}}{{label_char}}*'
- label_start: '[^\s+=,;:%!{{command_terminator_chars}}]'
- label_char: '[^{{metachar}}(%!]'
+ label_start: '[^{{metachar}}:+]'
- path_terminator_chars: '[\s,;"{{command_terminator_chars}}]'
+ path_terminator_chars: '[\s,;"{{redir_or_eoc_char}}]'
path_terminators: (?={{path_terminator_chars}})
set_arithmetic_operators_unquoted: (?:\+|-|\*|/|%%|~)
set_arithmetic_operators_quoted: (?:\||<<|>>|&|\^)
- set_quoted_end: \"(?![^"{{command_terminator_chars}}]*\")
+ set_quoted_end: \"(?![^"{{redir_or_eoc_char}}]*\")
expansion_begin: |-
(?x:
%
(?=
# anything but no colon, percentage or command terminator char
- ( [^:%{{command_terminator_chars}}]
+ ( [^:%{{redir_or_eoc_char}}]
# otherwise must not look like followed by a command
- | [{{command_terminator_chars}}](?!\s*\w+[\s{{command_terminator_chars}}])
+ | [{{redir_or_eoc_char}}](?!\s*\w+[\s{{redir_or_eoc_char}}])
)+
# don't check substrings and substitutions
(:~?[^%]*)? %
@@ -76,9 +77,9 @@ variables:
!
(?=
# anything but no colon, exclamation mark or command terminator char
- ( [^:!{{command_terminator_chars}}]
+ ( [^:!{{redir_or_eoc_char}}]
# otherwise must not look like followed by a command
- | [{{command_terminator_chars}}](?!\s*\w+[\s{{command_terminator_chars}}])
+ | [{{redir_or_eoc_char}}](?!\s*\w+[\s{{redir_or_eoc_char}}])
)+
# don't check substrings and substitutions
(:~?[^!]*)? !
@@ -92,7 +93,18 @@ variables:
var_break: (?![^%{{metachar}}])
var_char: (?:{{var_literal}}|{{var_escape}})
var_escape: \^[^=\s]
- var_literal: '[^="\^\s{{command_terminator_chars}}]'
+ var_literal: '[^=\s"^{{redir_or_eoc_char}}]'
+
+ # An unquoted word, which may contain escapes or interpolation,
+ # but no redirections. It is terminated by meta-chars or quoted words
+ unquoted_word_begin: (?={{unquoted_word_char}})
+ unquoted_word_break: (?!{{unquoted_word_char}})
+ unquoted_word_char: '[^"{{metachar}}]'
+
+ # Words are separated by meta-chars, only.
+ # They may contain quoted regions, escaped chars or interpolations.
+ word_break: (?!{{word_char}})
+ word_char: '[^{{metachar}}]'
builtin_commands: |-
\b(?xi:
@@ -159,30 +171,37 @@ contexts:
pop: 1
ignored-tail-outer:
- - include: unquoted-eoc-pop
+ - include: redirections
+ - include: eoc-pop
- match: (?=\S)
set: ignored-tail-body
ignored-tail-body:
- meta_scope: comment.line.ignored.dosbatch
- - include: unquoted-eoc-pop
+ - include: redirection-interpolations
+ - include: eoc-pop
+ - match: '{{unquoted_word_begin}}'
+ push: unquoted-word-end
###[ LABELS ]#################################################################
+ maybe-label:
+ - match: \:(?={{label_start}})
+ scope: entity.name.label.dosbatch punctuation.definition.label.dosbatch
+ set: label-name
+ - include: else-pop
+
labels:
- - match: ^\s*((:){{label_name}})
+ - match: ^\s*(:)(?={{label_start}})
captures:
- 1: entity.name.label.dosbatch
- 2: punctuation.definition.label.dosbatch
- push: ignored-tail-outer
+ 1: entity.name.label.dosbatch punctuation.definition.label.dosbatch
+ push: label-name
- maybe-label:
- - match: ((:){{label_name}})
- captures:
- 1: entity.name.label.dosbatch
- 2: punctuation.definition.label.dosbatch
+ label-name:
+ - meta_content_scope: entity.name.label.dosbatch
+ - match: '{{word_break}}'
set: ignored-tail-outer
- - include: else-pop
+ - include: escaped-characters
###[ BLOCKS ]#################################################################
@@ -191,14 +210,14 @@ contexts:
scope: meta.embedded.dosbatch punctuation.section.embedded.begin.dosbatch
embed: commands
embed_scope: meta.embedded.dosbatch source.dosbatch.embedded
- escape: \'(?=\s*($|['{{command_terminator_chars}}]))
+ escape: \'(?=\s*['{{redir_or_eoc_char}}])
escape_captures:
0: meta.embedded.dosbatch punctuation.section.embedded.end.dosbatch
- match: \`
scope: meta.embedded.dosbatch punctuation.section.embedded.begin.dosbatch
embed: commands
embed_scope: meta.embedded.dosbatch source.dosbatch.embedded
- escape: \`(?=\s*($|[`{{command_terminator_chars}}]))
+ escape: \`(?=\s*[`{{redir_or_eoc_char}}])
escape_captures:
0: meta.embedded.dosbatch punctuation.section.embedded.end.dosbatch
@@ -206,7 +225,7 @@ contexts:
- match: \(
scope: punctuation.section.block.begin.dosbatch
set: Packages/Batch File/Batch File (Compound).sublime-syntax#block-common
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- include: statements
blocks:
@@ -257,7 +276,8 @@ contexts:
- include: immediately-pop
ctl-if-condition:
- - include: unquoted-eoc-pop
+ - include: eoc-pop
+ - include: cmd-arg-help
- match: (?i:(/)i){{arg_break}}
scope: variable.parameter.option.dosbatch
captures:
@@ -277,7 +297,7 @@ contexts:
- maybe-operator-not
ctl-if-checks:
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- match: (?i:errorlevel|cmdextversion){{keyword_break}}
scope: variable.language.dosbatch
set:
@@ -359,6 +379,7 @@ contexts:
- include: immediately-pop
ctl-for-switches:
+ - include: cmd-arg-help
# https://ss64.com/nt/for_d.html
- match: (?i:(/)d){{arg_break}}
scope: variable.parameter.option.dir.dosbatch
@@ -381,7 +402,7 @@ contexts:
captures:
1: punctuation.definition.variable.dosbatch
push: ctl-for-maybe-r-args
- - match: (?i:/\S+){{arg_break}}
+ - match: /{{arg_char}}+
scope: invalid.illegal.parameter.dosbatch
pop: 1
- include: else-pop
@@ -389,6 +410,7 @@ contexts:
ctl-for-maybe-r-args:
- match: (?={{var_parameter}})
pop: 1
+ - include: cmd-arg-help
- include: path-pattern
ctl-for-maybe-f-args:
@@ -463,17 +485,18 @@ contexts:
- match: ':'
scope: punctuation.definition.variable.dosbatch
set: ctl-call-label
+ - include: cmd-arg-help
- include: else-pop
ctl-call-label:
- - meta_scope:
- meta.function-call.identifier.dosbatch
- variable.label.dosbatch
- - match: '{{cmd_break}}'
+ - meta_scope: meta.function-call.identifier.dosbatch variable.label.dosbatch
+ - match: '{{word_break}}'
set:
- cmd-args-meta
- - cmd-args-common
- - include: variable-interpolations
+ - cmd-args-body
+ - include: line-continuations
+ - include: escaped-characters
+ - include: variables
###[ CONTROL EXIT ]###########################################################
@@ -481,14 +504,21 @@ contexts:
# https://ss64.com/nt/exit.html
- match: (?i:exit){{keyword_break}}
scope: keyword.control.flow.exit.dosbatch
- push: ctl-exit-args
+ push:
+ - ctl-exit-meta
+ - ctl-exit-args
- ctl-exit-args:
+ ctl-exit-meta:
+ - meta_include_prototype: false
- meta_scope: meta.command.exit.dosbatch
+ - include: immediately-pop
+
+ ctl-exit-args:
- match: (?i:(/)b){{arg_break}}
scope: variable.parameter.option.dosbatch
captures:
1: punctuation.definition.variable.dosbatch
+ - include: cmd-arg-help
- include: numbers
- include: variables
- include: expect-eoc
@@ -509,22 +539,23 @@ contexts:
- include: immediately-pop
ctl-goto-args:
- - include: unquoted-eoc-pop
- - match: (:)(?i:(eof)){{cmd_break}}
+ - include: redirections
+ - include: cmd-arg-help
+ - include: eoc-pop
+ - match: (:)(?i:(eof)){{word_break}}
scope: variable.label.dosbatch
captures:
1: punctuation.definition.variable.dosbatch
2: keyword.control.flow.return.dosbatch
pop: 1
- - match: (:)?(?=\S)
- scope: punctuation.definition.variable.dosbatch
+ - match: (:)?(?={{label_start}})
+ scope: punctuation.definition.label.dosbatch
set: clt-goto-label
clt-goto-label:
- meta_scope: variable.label.dosbatch
- - match: '{{cmd_break}}'
- set: ignored-tail-outer
- - include: escaped-characters
+ - include: line-continuations
+ - include: label-name
- include: variables
###[ CONTROL PAUSE ]##########################################################
@@ -533,10 +564,17 @@ contexts:
# https://ss64.com/nt/pause.html
- match: (?i:pause){{keyword_break}}
scope: keyword.control.flow.pause.dosbatch
- push: ctl-pause-args
+ push:
+ - ctl-pause-meta
+ - ctl-pause-args
- ctl-pause-args:
+ ctl-pause-meta:
+ - meta_include_prototype: false
- meta_scope: meta.command.pause.dosbatch
+ - include: immediately-pop
+
+ ctl-pause-args:
+ - include: cmd-arg-help
- include: expect-eoc
###[ CONTEXT SETLOCAL ]#######################################################
@@ -545,16 +583,23 @@ contexts:
# https://ss64.com/nt/setlocal.html
- match: (?i:setlocal){{keyword_break}}
scope: keyword.context.setlocal.dosbatch
- push: ctl-setlocal-args
+ push:
+ - ctl-setlocal-meta
+ - ctl-setlocal-args
- ctl-setlocal-args:
+ ctl-setlocal-meta:
+ - meta_include_prototype: false
- meta_scope: meta.command.setlocal.dosbatch
+ - include: immediately-pop
+
+ ctl-setlocal-args:
- match: |-
\b(?xi:
EnableDelayedExpansion | DisableDelayedExpansion |
EnableExtensions | DisableExtensions
){{arg_break}}
scope: constant.language.dosbatch
+ - include: cmd-arg-help
- include: expect-eoc
###[ CONTEXT ENDLOCAL ]#######################################################
@@ -563,10 +608,17 @@ contexts:
# https://ss64.com/nt/endlocal.html
- match: (?i:endlocal){{keyword_break}}
scope: keyword.context.endlocal.dosbatch
- push: ctl-endlocal-args
+ push:
+ - ctl-endlocal-meta
+ - ctl-endlocal-args
- ctl-endlocal-args:
+ ctl-endlocal-meta:
+ - meta_include_prototype: false
- meta_scope: meta.command.endlocal.dosbatch
+ - include: immediately-pop
+
+ ctl-endlocal-args:
+ - include: cmd-arg-help
- include: expect-eoc
###[ COMMANDS ]###############################################################
@@ -578,7 +630,7 @@ contexts:
support.function.builtin.dosbatch
push:
- cmd-args-meta
- - cmd-args-common
+ - cmd-args-body
cmd-other:
- match: '{{cmd_begin}}'
@@ -593,14 +645,14 @@ contexts:
- match: '{{cmd_break}}'
set:
- cmd-args-meta
- - cmd-args-common
+ - cmd-args-body
- match: \"
scope: punctuation.definition.string.begin.dosbatch
push:
- cmd-other-identifier-quoted-common
- path-pattern-relative
+ - include: path-pattern-unquoted-content
- include: line-continuations
- - include: path-pattern-common
cmd-other-identifier-quoted-common:
- clear_scopes: 1
@@ -613,23 +665,39 @@ contexts:
- meta_content_scope: meta.function-call.arguments.dosbatch
- include: immediately-pop
- cmd-args-common:
+ cmd-args-body:
- include: redirections
+ - include: eoc-pop
+ - include: cmd-arg-help
- include: cmd-args-options
- include: cmd-args-values
- - include: unquoted-eoc-pop
- cmd-args-options:
- - match: (?:^|\s*)((/)\?){{arg_break}}
+ cmd-arg-help:
+ - match: (/)\?{{arg_break}}
+ scope: variable.parameter.option.help.dosbatch
captures:
- 1: variable.parameter.option.help.dosbatch
- 2: punctuation.definition.variable.dosbatch
- push: ignored-tail-outer
+ 1: punctuation.definition.variable.dosbatch
+ set: ignored-tail-outer
+
+ cmd-args-options:
+ # The shell basically just passes words to a called command.
+ # The command is responsible to parse and interpret each word.
+ #
+ # A word may be
+ # - an option `/b` or `-b`
+ # - a value `foo`
+ # - a key-value pair `/key:value` or `--key=value`
+ #
+ # Interpretation includes whether quotation marks
+ # are treated literal or whether they are removed.
+ #
+ # This context applies various heuristics to try to highlight
+ # different kinds of command line arguments and their values.
- match: '{{opt_punctuation}}'
- captures:
- 1: meta.parameter.option.dosbatch
- variable.parameter.option.dosbatch
- punctuation.definition.variable.dosbatch
+ scope:
+ meta.parameter.option.dosbatch
+ variable.parameter.option.dosbatch
+ punctuation.definition.variable.dosbatch
push: cmd-args-option-identifier
cmd-args-option-identifier:
@@ -641,19 +709,9 @@ contexts:
meta.parameter.dosbatch
keyword.operator.assignment.dosbatch
set: cmd-args-option-value
- - match: \"
- scope: punctuation.definition.string.begin.dosbatch
- push: cmd-args-option-identifier-quoted-common
- - include: line-continuations
- - include: variable-interpolations
- - match: '{{arg_break}}'
- pop: 1
-
- cmd-args-option-identifier-quoted-common:
- - clear_scopes: 1
- - meta_include_prototype: false
- - meta_scope: meta.string.dosbatch variable.parameter.option.dosbatch
- - include: string-common
+ - include: quoted-words
+ - include: unquoted-escapes-and-interpolations
+ - include: unquoted-word-end
cmd-args-option-value:
- meta_content_scope: meta.parameter.value.dosbatch
@@ -673,28 +731,9 @@ contexts:
- meta_scope: meta.string.dosbatch string.unquoted.dosbatch
- match: (?=(\.\.?|\:)[\\%{{metachar}}]|[?*]|\\(?!"))
fail: cmd-args-values
- - include: cmd-args-quoted
- - include: escapes-and-interpolations
- - include: line-continuations
- - match: '{{arg_break}}'
- pop: 1
-
- cmd-args-quoted:
- - match: \"
- push: cmd-args-quoted-body
-
- cmd-args-quoted-body:
- # echo "text" outputs quotation marks no matter where they are located.
- # Hence no `punctuation` nor `string.quoted` scopes are applied.
- # This context is needed as a limited set of escaped chars and no line
- # continuation operators are supported within quotes.
- - match: \"
- pop: 1
- - match: $
- pop: 2
- - match: '%%'
- scope: constant.character.escape.dosbatch
- - include: variable-interpolations
+ - include: quoted-words
+ - include: unquoted-escapes-and-interpolations
+ - include: unquoted-word-end
cmd-arg-illegal-options:
- match: /{{arg_char}}+
@@ -713,13 +752,13 @@ contexts:
cmd-echo-args:
- meta_content_scope: meta.command.echo.dosbatch meta.function-call.arguments.dosbatch
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- match: \s*((/)\?){{arg_break}}
captures:
1: variable.parameter.option.help.dosbatch
2: punctuation.definition.variable.dosbatch
push: ignored-tail-outer
- - match: \s*((?i:on|off)){{command_terminators}}
+ - match: \s*((?i:on|off)){{redir_or_eoc}}
captures:
1: constant.language.dosbatch
push: ignored-tail-outer
@@ -732,9 +771,10 @@ contexts:
cmd-echo-output:
- meta_scope: meta.command.echo.dosbatch meta.function-call.arguments.dosbatch
- meta_content_scope: meta.string.dosbatch string.unquoted.dosbatch
- - include: cmd-args-quoted
- - include: escapes-and-interpolations
- - include: unquoted-eoc-pop
+ - include: quoted-words
+ - include: redirection-interpolations
+ - include: unquoted-words
+ - include: eoc-pop
###[ COMMAND MODE ]###########################################################
@@ -743,11 +783,19 @@ contexts:
scope:
meta.function-call.identifier.dosbatch
support.function.external.dosbatch
- push: cmd-mode-args
+ push:
+ - cmd-mode-meta
+ - cmd-mode-args
- cmd-mode-args:
+ cmd-mode-meta:
+ - meta_include_prototype: false
- meta_scope: meta.command.mode.dosbatch
- meta_content_scope: meta.function-call.arguments.dosbatch
+ - include: immediately-pop
+
+ cmd-mode-args:
+ - include: redirections
+ - include: eoc-pop
- match: (?i:COM\d+|CON|LPT\d+):?{{arg_break}}
scope: variable.language.device.dosbatch
# known option values
@@ -761,9 +809,9 @@ contexts:
scope: variable.parameter.option.dosbatch
- match: =
scope: keyword.operator.assignment.dosbatch
+ - include: cmd-arg-help
- include: cmd-args-options
- include: cmd-args-values
- - include: unquoted-eoc-pop
###[ COMMAND REM ]############################################################
@@ -771,18 +819,24 @@ contexts:
# https://ss64.com/nt/rem.html
- match: (?i:rem){{keyword_break}}
scope: keyword.declaration.rem.dosbatch
- push: cmd-rem-body
+ push:
+ - cmd-rem-meta
+ - cmd-rem-body
+
+ cmd-rem-meta:
+ - meta_include_prototype: false
+ - meta_scope: meta.command.rem.dosbatch
+ - include: immediately-pop
cmd-rem-body:
+ - meta_include_prototype: false
+ - include: cmd-arg-help
- include: unquoted-eol-pop
- - match: \^\n
- scope: punctuation.separator.continuation.line.dosbatch
- set: cmd-rem-comment-body
- match: (?=\S)
set: cmd-rem-comment-body
cmd-rem-comment-body:
- - meta_scope: meta.command.rem.dosbatch
+ - meta_include_prototype: false
# meta_content_scope is used since rem should not be
# highlighted as a comment, but a command
- meta_content_scope: comment.line.rem.dosbatch
@@ -806,18 +860,37 @@ contexts:
- include: immediately-pop
cmd-set-type:
- - include: unquoted-eoc-pop
+ - include: redirections
+ - include: eoc-pop
- include: cmd-set-arithmetic
- include: cmd-set-prompt
+ - include: cmd-arg-help
- include: cmd-arg-illegal-options
- include: cmd-set-quoted
- include: cmd-set-unquoted
+ cmd-set-variable-inner-common:
+ - include: cmd-set-variable-common
+ - include: quoted-eol-pop
+
+ cmd-set-variable-outer-common:
+ - include: cmd-set-variable-common
+ - include: unquoted-var-pop
+
cmd-set-variable-common:
- match: \^=
scope: invalid.illegal.parameter.dosbatch
- match: \^\S
+ cmd-set-value-inner-common:
+ - include: quoted-escapes-and-interpolations
+ - include: quoted-eol-pop
+
+ cmd-set-value-outer-common:
+ - include: redirection-interpolations
+ - include: unquoted-words
+ - include: eoc-pop
+
###[ COMMAND SET "VARIABLE=VALUE" ]############################################
cmd-set-quoted:
@@ -859,8 +932,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch variable.other.readwrite.dosbatch
set: cmd-set-quoted-variable-outer
- - include: cmd-set-variable-common
- - include: quoted-eoc-pop
+ - include: cmd-set-variable-inner-common
cmd-set-quoted-variable-outer:
- meta_include_prototype: false
@@ -871,8 +943,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch variable.other.readwrite.dosbatch
set: cmd-set-quoted-variable-inner
- - include: cmd-set-variable-common
- - include: unquoted-eoc-pop
+ - include: cmd-set-variable-outer-common
cmd-set-quoted-value-inner:
- meta_include_prototype: false
@@ -886,8 +957,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-quoted-value-outer
- - include: escapes-and-interpolations
- - include: quoted-eol-pop
+ - include: cmd-set-value-inner-common
cmd-set-quoted-value-inner-continue:
- meta_include_prototype: false
@@ -898,9 +968,9 @@ contexts:
- meta_include_prototype: false
- match: '{{set_quoted_end}}'
pop: 1
- - match: '{{command_terminators}}'
+ - match: '{{eoc}}'
fail: cmd-set-quoted-value-inner
- - include: escapes-and-interpolations
+ - include: quoted-escapes-and-interpolations
- include: line-continuations
cmd-set-quoted-value-inner-end:
@@ -922,8 +992,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-quoted-value-inner
- - include: escapes-and-interpolations
- - include: unquoted-eoc-pop
+ - include: cmd-set-value-outer-common
###[ COMMAND SET VARIABLE=VALUE ]##############################################
@@ -943,8 +1012,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-unquoted-variable-outer
- - include: cmd-set-variable-common
- - include: quoted-eoc-pop
+ - include: cmd-set-variable-inner-common
cmd-set-unquoted-variable-outer:
- meta_include_prototype: false
@@ -955,8 +1023,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-unquoted-variable-inner
- - include: cmd-set-variable-common
- - include: unquoted-eoc-pop
+ - include: cmd-set-variable-outer-common
cmd-set-unquoted-value-inner:
- meta_include_prototype: false
@@ -964,8 +1031,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-unquoted-value-outer
- - include: escapes-and-interpolations
- - include: quoted-eol-pop
+ - include: cmd-set-value-inner-common
cmd-set-unquoted-value-outer:
- meta_include_prototype: false
@@ -973,8 +1039,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-unquoted-value-inner
- - include: escapes-and-interpolations
- - include: unquoted-eoc-pop
+ - include: cmd-set-value-outer-common
###[ COMMAND SET /A ]#########################################################
@@ -1007,6 +1072,7 @@ contexts:
- include: immediately-pop
cmd-set-arithmetic-start:
+ - include: cmd-arg-help
- match: \"
scope: meta.string.dosbatch punctuation.definition.string.begin.dosbatch
set:
@@ -1072,12 +1138,12 @@ contexts:
scope: meta.group.dosbatch punctuation.section.group.begin.dosbatch
push: cmd-set-arithmetic-unquoted-group
- include: cmd-set-arithmetic-unquoted-common
- - include: unquoted-eoc-pop
+ - include: eoc-pop
cmd-set-arithmetic-unquoted-group:
- meta_content_scope: meta.group.dosbatch
# Note: must be included before \) pattern to support compound termination
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- match: \"
scope: meta.group.dosbatch punctuation.definition.string.begin.dosbatch
set: cmd-set-arithmetic-quoted-first-group
@@ -1128,18 +1194,10 @@ contexts:
- include: immediately-pop
cmd-set-prompt-start:
+ - include: cmd-arg-help
- include: cmd-set-quoted-prompt
- include: cmd-set-unquoted-prompt
- cmd-set-prompt-value-inner-common:
- - include: escapes-and-interpolations
- - include: quoted-eol-pop
-
- cmd-set-prompt-value-outer-common:
- - include: redirection-interpolations
- - include: escapes-and-interpolations
- - include: unquoted-eoc-pop
-
###[ COMMAND SET /P "VARIABLE=PROMPT" ]#######################################
cmd-set-quoted-prompt:
@@ -1171,8 +1229,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-quoted-prompt-variable-outer
- - include: cmd-set-variable-common
- - include: quoted-eoc-pop
+ - include: cmd-set-variable-inner-common
cmd-set-quoted-prompt-variable-outer:
- meta_include_prototype: false
@@ -1183,8 +1240,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-quoted-prompt-variable-inner
- - include: cmd-set-variable-common
- - include: unquoted-eoc-pop
+ - include: cmd-set-variable-outer-common
cmd-set-quoted-prompt-value-inner-start:
@@ -1228,7 +1284,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.quoted.double.dosbatch
set: cmd-set-quoted-prompt-quoted-value-outer
- - include: cmd-set-prompt-value-inner-common
+ - include: cmd-set-value-inner-common
cmd-set-quoted-prompt-quoted-value-inner-continue:
- meta_include_prototype: false
@@ -1239,9 +1295,9 @@ contexts:
- meta_include_prototype: false
- match: '{{set_quoted_end}}'
pop: 1
- - match: '{{command_terminators}}'
+ - match: '{{eoc}}'
fail: cmd-set-quoted-prompt-quoted-value-inner
- - include: escapes-and-interpolations
+ - include: quoted-escapes-and-interpolations
- include: line-continuations
cmd-set-quoted-prompt-quoted-value-inner-end:
@@ -1266,7 +1322,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.quoted.double.dosbatch
set: cmd-set-quoted-prompt-quoted-value-inner
- - include: cmd-set-prompt-value-outer-common
+ - include: cmd-set-value-outer-common
cmd-set-quoted-prompt-unquoted-value-inner:
@@ -1281,7 +1337,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-quoted-prompt-unquoted-value-outer
- - include: cmd-set-prompt-value-inner-common
+ - include: cmd-set-value-inner-common
cmd-set-quoted-prompt-unquoted-value-inner-continue:
- meta_include_prototype: false
@@ -1292,9 +1348,9 @@ contexts:
- meta_include_prototype: false
- match: '{{set_quoted_end}}'
pop: 1
- - match: '{{command_terminators}}'
+ - match: '{{eoc}}'
fail: cmd-set-quoted-prompt-unquoted-value-inner
- - include: escapes-and-interpolations
+ - include: quoted-escapes-and-interpolations
- include: line-continuations
cmd-set-quoted-prompt-unquoted-value-inner-end:
@@ -1315,7 +1371,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-quoted-prompt-unquoted-value-inner
- - include: cmd-set-prompt-value-outer-common
+ - include: cmd-set-value-outer-common
###[ COMMAND SET /P VARIABLE=PROMPT ]#########################################
@@ -1337,8 +1393,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-unquoted-prompt-variable-outer
- - include: cmd-set-variable-common
- - include: quoted-eoc-pop
+ - include: cmd-set-variable-inner-common
cmd-set-unquoted-prompt-variable-outer:
- meta_include_prototype: false
@@ -1349,8 +1404,7 @@ contexts:
- match: \"
scope: variable.other.readwrite.dosbatch
set: cmd-set-unquoted-prompt-variable-inner
- - include: cmd-set-variable-common
- - include: unquoted-eoc-pop
+ - include: cmd-set-variable-outer-common
cmd-set-unquoted-prompt-value-inner-start:
@@ -1386,7 +1440,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.quoted.double.dosbatch
set: cmd-set-unquoted-prompt-quoted-value-outer
- - include: cmd-set-prompt-value-inner-common
+ - include: cmd-set-value-inner-common
cmd-set-unquoted-prompt-quoted-value-inner-continue:
- meta_include_prototype: false
@@ -1399,9 +1453,9 @@ contexts:
scope: punctuation.definition.string.end.dosbatch
pop: 2
set: ignored-tail-inner
- - match: '{{command_terminators}}'
+ - match: '{{eoc}}'
fail: cmd-set-unquoted-prompt-inner
- - include: escapes-and-interpolations
+ - include: quoted-escapes-and-interpolations
- include: line-continuations
cmd-set-unquoted-prompt-quoted-value-inner-end:
@@ -1423,7 +1477,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.quoted.double.dosbatch
set: cmd-set-unquoted-prompt-quoted-value-inner
- - include: cmd-set-prompt-value-outer-common
+ - include: cmd-set-value-outer-common
cmd-set-unquoted-prompt-unquoted-value-inner:
@@ -1432,7 +1486,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-unquoted-prompt-unquoted-value-outer
- - include: cmd-set-prompt-value-inner-common
+ - include: cmd-set-value-inner-common
cmd-set-unquoted-prompt-unquoted-value-outer:
- meta_include_prototype: false
@@ -1440,7 +1494,7 @@ contexts:
- match: \"
scope: meta.string.dosbatch string.unquoted.dosbatch
set: cmd-set-unquoted-prompt-unquoted-value-inner
- - include: cmd-set-prompt-value-outer-common
+ - include: cmd-set-value-outer-common
###[ COMMAND TITLE ]##########################################################
@@ -1454,7 +1508,7 @@ contexts:
cmd-title-args:
- meta_scope: meta.command.title.dosbatch
- meta_content_scope: meta.function-call.arguments.dosbatch
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- match: \s*((/)\?){{arg_break}}
captures:
1: variable.parameter.option.help.dosbatch
@@ -1468,7 +1522,9 @@ contexts:
meta.command.title.dosbatch
meta.function-call.arguments.dosbatch
meta.string.dosbatch string.unquoted.dosbatch
- - include: unquoted-eoc-pop
+ - include: redirection-interpolations
+ - include: unquoted-words
+ - include: eoc-pop
###[ OPERATORS ]##############################################################
@@ -1491,7 +1547,7 @@ contexts:
scope: punctuation.separator.semicolon.dosbatch
invalid-operators:
- - match: '[{{command_terminator_chars}}]'
+ - match: '{{redir_or_eoc_char}}'
scope: invalid.illegal.operator.dosbatch
###[ CONSTANTS ]##############################################################
@@ -1540,38 +1596,28 @@ contexts:
###[ PATH PATTERNS ]##########################################################
redirection-interpolations:
- - match: \s*(?=\d?(?:<&?|>[&>]?))
- push: redirection-interpolations-body
-
- redirection-interpolations-body:
- - meta_include_prototype: false
- match: (\d)?(<&?|>[&>]?)
captures:
1: meta.number.integer.decimal.dosbatch
constant.numeric.value.dosbatch
2: keyword.operator.assignment.redirection.dosbatch
- set:
- - redirection-interpolations-meta
+ push:
+ - redirection-interpolation-meta
- redirection-path
- redirection-interpolations-meta:
+ redirection-interpolation-meta:
- clear_scopes: 1
- meta_include_prototype: false
- - meta_scope: meta.interpolation.dosbatch meta.redirection.dosbatch
+ - meta_scope: meta.redirection.dosbatch
- include: immediately-pop
redirections:
- - match: (?=\d?(?:<&?|>[&>]?))
- push: redirection-body
-
- redirection-body:
- - meta_include_prototype: false
- match: (\d)?(<&?|>[&>]?)
captures:
1: meta.number.integer.decimal.dosbatch
constant.numeric.value.dosbatch
2: keyword.operator.assignment.redirection.dosbatch
- set:
+ push:
- redirection-meta
- redirection-path
@@ -1600,16 +1646,23 @@ contexts:
set:
- path-pattern-unquoted-body
- path-pattern-relative
- - include: any-pop
path-pattern-quoted-body:
- meta_scope: meta.path.dosbatch meta.string.dosbatch string.quoted.double.dosbatch
- include: string-end
+ - include: path-pattern-quoted-content
+
+ path-pattern-quoted-content:
+ - include: quoted-escapes-and-interpolations
- include: path-pattern-common
path-pattern-unquoted-body:
- meta_scope: meta.path.dosbatch meta.string.dosbatch string.unquoted.dosbatch
- include: path-pattern-unquoted-end
+ - include: path-pattern-unquoted-content
+
+ path-pattern-unquoted-content:
+ - include: unquoted-escapes-and-interpolations
- include: path-pattern-common
path-pattern-unquoted-end:
@@ -1618,7 +1671,6 @@ contexts:
- include: line-continuations
path-pattern-common:
- - include: escapes-and-interpolations
- match: '[:\\/]'
scope: punctuation.separator.path.dosbatch
push: path-pattern-relative
@@ -1627,7 +1679,7 @@ contexts:
- match: \.
scope: punctuation.separator.path.dosbatch
- match: '[*?]'
- scope: constant.other.placeholder.dosbatch
+ scope: keyword.operator.wildcard.dosbatch
path-pattern-relative:
- match: \.\.(?=[\\/])
@@ -1649,7 +1701,7 @@ contexts:
- meta_include_prototype: false
- meta_scope: meta.string.dosbatch string.quoted.double.dosbatch
- include: string-end
- - include: escapes-and-interpolations
+ - include: quoted-escapes-and-interpolations
string-end:
- match: \"
@@ -1658,17 +1710,51 @@ contexts:
- include: quoted-eol-pop
escaped-characters:
- - match: '%%|\^.'
+ - match: \^.
scope: constant.character.escape.dosbatch
+ escaped-variables:
+ - match: '%%'
+ scope: constant.character.escape.dosbatch
+
+###[ WORDS ]##################################################################
+
+ quoted-words:
+ - match: \"
+ push: quoted-word-body
+
+ quoted-word-body:
+ # echo "text" outputs quotation marks no matter where they are located.
+ # Hence no `punctuation` nor `string.quoted` scopes are applied.
+ # This context is needed as a limited set of escaped chars and no line
+ # continuation operators are supported within quotes.
+ - match: \"
+ pop: 1
+ - match: $
+ pop: 2
+ - include: quoted-escapes-and-interpolations
+
+ unquoted-words:
+ - match: '{{unquoted_word_begin}}'
+ push: unquoted-word-body
+
+ unquoted-word-body:
+ - include: unquoted-word-end
+ - include: unquoted-escapes-and-interpolations
+
+ unquoted-word-end:
+ - match: '{{unquoted_word_break}}'
+ pop: 1
+ - include: line-continuations
+
###[ INTERPOLATIONS ]#########################################################
- escapes-and-interpolations:
+ unquoted-escapes-and-interpolations:
- include: escaped-characters
- - include: variable-interpolations
+ - include: quoted-escapes-and-interpolations
- # NOTE: To be used in strings to remove `string` scope.
- variable-interpolations:
+ quoted-escapes-and-interpolations:
+ - include: escaped-variables
- include: parameter-interpolations
- include: expansion-interpolations
- include: delayed-interpolations
@@ -1708,6 +1794,7 @@ contexts:
###[ VARIABLES ]##############################################################
variables:
+ - include: escaped-variables
- include: variable-parameters
- include: variable-expansions
- include: variable-delayed
@@ -1850,13 +1937,13 @@ contexts:
1: keyword.operator.arithmetic.dosbatch
2: constant.numeric.value.dosbatch
# Note: This makes the whole expansion being handled as plain text.
- - match: ':[^%!{{command_terminator_chars}}]*'
+ - match: ':[^%!{{redir_or_eoc_char}}]*'
scope: invalid.illegal.unexpected.dosbatch
###[ ILLEGALS ]###############################################################
expect-eoc:
- - include: unquoted-eoc-pop
+ - include: eoc-pop
- match: \S
scope: invalid.illegal.expect-end-of-command.dosbatch
@@ -1867,17 +1954,13 @@ contexts:
- include: else-pop
illegal-token-pop:
+ - include: unquoted-eol-pop
- match: \S+
scope: invalid.illegal.unexpected.dosbatch
set: else-pop
- - include: unquoted-eol-pop
###[ PROTOTYPES ]#############################################################
- any-pop:
- - match: (?=\S)
- pop: 1
-
bol-pop:
# Note: empty lines are ignored
- match: ^(?!$)
@@ -1885,7 +1968,8 @@ contexts:
else-pop:
- include: unquoted-eol-pop
- - include: any-pop
+ - match: (?=\S)
+ pop: 1
immediately-pop:
- match: ''
@@ -1896,18 +1980,22 @@ contexts:
scope: punctuation.separator.continuation.line.dosbatch
push: bol-pop
- quoted-eoc-pop:
- - match: '{{command_terminators}}'
+ eoc-pop:
+ # Note: An end of command appears in unquoted regions only!
+ # `&` or `|` are literals in quoted words.
+ - match: '{{eoc}}'
pop: 1
+ - include: line-continuations
quoted-eol-pop:
- match: $
pop: 1
- unquoted-eoc-pop:
- - include: quoted-eoc-pop
- - include: line-continuations
-
unquoted-eol-pop:
- include: quoted-eol-pop
- include: line-continuations
+
+ unquoted-var-pop:
+ - match: '{{redir_or_eoc}}'
+ pop: 1
+ - include: line-continuations
diff --git a/Batch File/Indexed Reference List.tmPreferences b/Batch File/Indexed Reference List.tmPreferences
new file mode 100644
index 0000000000..da53abaa46
--- /dev/null
+++ b/Batch File/Indexed Reference List.tmPreferences
@@ -0,0 +1,14 @@
+
+
+
+ scope
+ source.dosbatch variable.label - source.dosbatch variable.label punctuation.definition.label
+ settings
+
+ showInIndexedReferenceList
+ 1
+ symbolTransformation
+ s/\^//;
+
+
+
diff --git a/Batch File/Symbol List.tmPreferences b/Batch File/Symbol List.tmPreferences
index 6d721e54e3..2deb39bbdf 100644
--- a/Batch File/Symbol List.tmPreferences
+++ b/Batch File/Symbol List.tmPreferences
@@ -2,13 +2,15 @@
scope
- source.dosbatch entity.name.label - meta.function-call
+ source.dosbatch entity.name.label - source.dosbatch entity.name.label punctuation.definition.label
settings
showInSymbolList
1
showInIndexedSymbolList
1
+ symbolTransformation
+ s/\^//;
diff --git a/Batch File/tests/syntax_test_batch_file.bat b/Batch File/tests/syntax_test_batch_file.bat
index 7c47ef38af..04ae4e01db 100644
--- a/Batch File/tests/syntax_test_batch_file.bat
+++ b/Batch File/tests/syntax_test_batch_file.bat
@@ -3,12 +3,30 @@
:::: [ Comments ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ REM/? ignored
+:: ^^^^^^^^^^^^^ meta.command.rem.dosbatch
+:: ^^^ keyword.declaration.rem.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+ REM ^
+ /? ignored
+:: ^^^^^^^^^^ meta.command.rem.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+
+ REM/?/a
+:: ^^^^^^^^ meta.command.rem.dosbatch
+:: ^^^ keyword.declaration.rem.dosbatch
+:: ^^^^^ comment.line.rem.dosbatch
+
REM I'm a (com|ment)
+:: ^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch
:: ^^^ keyword.declaration.rem.dosbatch - comment
:: ^^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch
( rem comment )
-:: ^^^^^^^^^^^^^^^^ meta.block.dosbatch
+:: ^^ meta.block.dosbatch - meta.command
+:: ^^^^^^^^^^^^^^ meta.block.dosbatch meta.command.rem.dosbatch
:: ^ punctuation.section.block.begin.dosbatch
:: ^^^ keyword.declaration.rem.dosbatch
:: ^^^^^^^^^^ comment.line.rem.dosbatch
@@ -32,6 +50,15 @@ REM This follows a REM command
:: <- keyword.declaration.rem.dosbatch - comment
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch
+REM This & and | echo "is commented out" ^
+:: <- keyword.declaration.rem.dosbatch
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch
+
+REM No line ^
+continuation
+:: <- - comment
+:: ^^^^^^^^^ - comment
+
:: Me too!
:: ^^ punctuation.definition.comment.dosbatch
:: ^^^^^^^^^^ comment.line.colon.dosbatch
@@ -64,17 +91,21 @@ REM This follows a REM command
Me too!
:: ^^^^^^^ comment.line.colon.dosbatch
- :& ignored content ( & | )
+ :> ignored content ( & | )
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+:: ^^ punctuation.definition.comment.dosbatch
- :| ignored content ( & | )
+ :< ignored content ( & | )
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+:: ^^ punctuation.definition.comment.dosbatch
- :%var% ignored content ( & | )
-:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+ :& ignored content ( & | )
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+:: ^^ punctuation.definition.comment.dosbatch
- :!var! ignored content ( & | )
-:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+ :| ignored content ( & | )
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch
+:: ^^ punctuation.definition.comment.dosbatch
ECHO &&:: A comment
:: ^^ keyword.operator.logical.dosbatch
@@ -161,46 +192,211 @@ ECHO : Not a comment ^
:: ^^^^^^^^^^^^^^^^^ meta.block.dosbatch
E@CHO john.doe@email.com
-:: ^ - keyword-operator
-:: ^ - keyword-operator
+:: ^ - keyword.operator
+:: ^ - keyword.operator
+
+ E^@CHO john.doe^@email.com
+:: ^^ constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
+
+ "E^@CHO" "john.doe^@email.com"
+:: ^^ - constant.character - keyword.operator
+:: ^^ - constant.character - keyword.operator
dir @logs
-:: ^ - keyword-operator
+:: ^ - keyword.operator
dir C:\@logs
-:: ^ - keyword-operator
+:: ^ - keyword.operator
my @
-:: ^ - keyword-operator
+:: ^ - keyword.operator
:::: [ Labels ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :This is a #@$虎 strange label
-::^ punctuation.definition.label.dosbatch
-::^^^^^ entity.name.label.dosbatch
-:: ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+ :l
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :(
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :)
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :[
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :]
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :{
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :}
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - punctuation
+:: ^ - entity
+
+ :^(
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^)
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^[
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^]
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^{
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^}
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^>
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^<
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^&
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :^|
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch constant.character.escape.dosbatch - punctuation
+:: ^ - entity
+
+ :%%
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^^ entity.name.label.dosbatch - constant.character.escape - punctuation
+:: ^ - entity
+
+ :%
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - constant.character.escape - punctuation
+:: ^ - entity
+
+ :%var% ignored content ( & echo foo
+::^ - entity
+:: ^^^^^^ entity.name.label.dosbatch
+:: ^ punctuation.definition.label.dosbatch
+:: ^ - entity - comment
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.logical.dosbatch
+:: ^^^^^^^^ meta.command.echo.dosbatch
+
+ :!
+::^ - entity
+:: ^ entity.name.label.dosbatch punctuation.definition.label.dosbatch
+:: ^ entity.name.label.dosbatch - constant.character.escape - punctuation
+:: ^ - entity
+
+ :!var! ignored content ( | echo foo
+::^ - entity
+:: ^^^^^^ entity.name.label.dosbatch
+:: ^ punctuation.definition.label.dosbatch
+:: ^ - entity - comment
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.assignment.pipe.dosbatch
+:: ^^^^^^^^ meta.command.echo.dosbatch
+
+ :This is a #@$虎 strange label
+::^ - entity
+:: ^ punctuation.definition.label.dosbatch
+:: ^^^^^ entity.name.label.dosbatch
+:: ^ - entity - comment
+:: ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ :This" is a #@$虎" strange label
+::^ - entity
+:: ^^^^^^ entity.name.label.dosbatch
+:: ^ - entity - comment
+:: ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ :"This is a #@$虎" strange label
+::^ - entity
+:: ^^^^^^ entity.name.label.dosbatch
+:: ^ - entity - comment
+:: ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
- :End
-::^ punctuation.definition.label.dosbatch
-::^^^^ entity.name.label.dosbatch
+:::: [ Control Flow ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ CALL/?
+:: ^^^^ meta.function-call.dosbatch keyword.control.flow.call.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
-:::: [ Control Flow ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ CALL /?
+:: ^^^^ meta.function-call.dosbatch keyword.control.flow.call.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
- CALL:This is a #@$虎 strange label
+ CALL:This is a #@$虎 ^strange %%label
::^ - meta.function-call
-:: ^^^^ meta.function-call.dosbatch
+:: ^^^^ meta.function-call.dosbatch
:: ^^^^^ meta.function-call.identifier.dosbatch
-:: ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch
-:: ^ - meta.function-call
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch
+:: ^ - meta.function-call
:: ^^^^ keyword.control.flow.call.dosbatch
:: ^ punctuation.definition.variable.dosbatch
:: ^^^^^ variable.label.dosbatch - keyword
-:: ^^^^^^^^^^^^^^^^^^^^^^^^ - variable
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - variable
+:: ^^ constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
CALL:EOF
::^ - meta.function-call
-:: ^^^^ meta.function-call.dosbatch
+:: ^^^^ meta.function-call.dosbatch
:: ^^^^ meta.function-call.identifier.dosbatch
:: ^ - meta.function-call
:: ^^^^ keyword.control.flow.call.dosbatch
@@ -216,7 +412,7 @@ ECHO : Not a comment ^
CALL :foo 10 %1
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^ meta.function-call.identifier.dosbatch
:: ^^^^^^ meta.function-call.arguments.dosbatch
:: ^ - meta.function-call
@@ -228,7 +424,7 @@ ECHO : Not a comment ^
CALL :foo%bar% 10
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^^^^^^ meta.function-call.identifier.dosbatch
:: ^^ meta.function-call.arguments.dosbatch
:: ^ - meta.function-call
@@ -239,7 +435,7 @@ ECHO : Not a comment ^
CALL :foo %bar% 10
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^ meta.function-call.identifier.dosbatch
:: ^^^^^^^^ meta.function-call.arguments.dosbatch
:: ^ - meta.function-call
@@ -249,9 +445,162 @@ ECHO : Not a comment ^
:: ^^^^^ meta.interpolation.dosbatch - variable.label - keyword
:: ^^ 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.variable.dosbatch
+:: ^^ variable.label.dosbatch - keyword
+:: ^^ 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.variable.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.variable.dosbatch
+:: ^^ variable.label.dosbatch - keyword
+:: ^^ 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.variable.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.variable.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.variable.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.variable.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.variable.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.variable.dosbatch
+:: ^^^ variable.label.dosbatch - keyword
+:: ^^ constant.character.escape.dosbatch
+:: ^^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
+
+ CALL :%label% 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
+:: ^ variable.label.dosbatch punctuation.definition.variable.dosbatch
+:: ^^^^^^^ variable.label.dosbatch meta.interpolation.dosbatch
+:: ^ punctuation.section.interpolation.begin.dosbatch
+:: ^^^^^ variable.other.readwrite.dosbatch
+:: ^ punctuation.section.interpolation.end.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.variable.dosbatch
+:: ^^^ variable.label.dosbatch - keyword
+:: ^^ constant.character.escape.dosbatch
+:: ^^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
+
+ CALL :!label! 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
+:: ^ variable.label.dosbatch punctuation.definition.variable.dosbatch
+:: ^^^^^^^ variable.label.dosbatch meta.interpolation.dosbatch
+:: ^ punctuation.section.interpolation.begin.dosbatch
+:: ^^^^^ variable.other.readwrite.dosbatch
+:: ^ punctuation.section.interpolation.end.dosbatch
+:: ^^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
+
+ CALL :foo^
+bar baz
+:: <- meta.function-call.identifier.dosbatch variable.label.dosbatch
+::^ meta.function-call.identifier.dosbatch variable.label.dosbatch
+:: ^^^^ meta.function-call.arguments.dosbatch
+:: ^^^ meta.string.dosbatch string.unquoted.dosbatch
+
CALL foo %bar%
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^ meta.function-call.identifier.dosbatch
:: ^^^^^^ meta.function-call.arguments.dosbatch
:: ^ - meta.function-call
@@ -261,8 +610,13 @@ ECHO : Not a comment ^
:: ^^^^^ meta.interpolation.dosbatch
CALL ^
- foo
+ foo %bar%
:: ^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch
+:: ^^^^^^ meta.function-call.arguments.dosbatch
+:: ^^^^^ meta.string.dosbatch meta.interpolation.dosbatch
+:: ^ punctuation.section.interpolation.begin.dosbatch
+:: ^^^ variable.other.readwrite.dosbatch
+:: ^ punctuation.section.interpolation.end.dosbatch
CALL SET _str=%%_var:~%_start%,%_length%%%
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -282,7 +636,7 @@ ECHO : Not a comment ^
CALL ..\foo\bar.exe /param:10
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^^^^^^^^^^^ meta.function-call.identifier.dosbatch
:: ^^^^^^^^^^ meta.function-call.arguments.dosbatch
:: ^ - meta.function-call
@@ -298,7 +652,7 @@ ECHO : Not a comment ^
CALL ..\%foo%\bar.exe /param:str
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch - meta.interpolation
:: ^^^^^ meta.function-call.identifier.dosbatch meta.interpolation.dosbatch
:: ^^^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch - meta.interpolation
@@ -318,7 +672,7 @@ ECHO : Not a comment ^
CALL foo\bar.exe /pa_am:%var%
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^^^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch
:: ^^^^^^^^ meta.function-call.arguments.dosbatch - meta.interpolation
:: ^^^^^ meta.function-call.arguments.dosbatch meta.interpolation.dosbatch
@@ -332,7 +686,7 @@ ECHO : Not a comment ^
CALL %foo%\bar.exe /pa-am:-10
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^^ meta.function-call.identifier.dosbatch meta.interpolation.dosbatch
:: ^^^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch - meta.interpolation
:: ^^^^^^^^^^^ meta.function-call.arguments.dosbatch
@@ -350,7 +704,7 @@ ECHO : Not a comment ^
CALL "d:\foo %bar%\baz.exe" /par-am=10 /D
::^ - meta.function-call
-:: ^^^^^ meta.function-call.dosbatch
+:: ^^^^^ meta.function-call.dosbatch
:: ^^^^^^^^ meta.function-call.identifier.dosbatch meta.string.dosbatch - meta.interpolation
:: ^^^^^ meta.function-call.identifier.dosbatch meta.string.dosbatch meta.interpolation.dosbatch
:: ^^^^^^^^^ meta.function-call.identifier.dosbatch meta.string.dosbatch - meta.interpolation
@@ -381,6 +735,28 @@ ECHO : Not a comment ^
EXIT
:: ^^^^ meta.command.exit.dosbatch keyword.control.flow.exit.dosbatch
+ EXIT /?
+:: ^^^^^^^ meta.command.exit.dosbatch
+:: ^^^^ keyword.control.flow.exit.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+
+ :: all arguments are ignored, if /? is present
+ EXIT /? /b > help.txt
+:: ^^^^^^^^^^^^^^^^^^^^^ meta.command.exit.dosbatch
+:: ^^^^ keyword.control.flow.exit.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^ meta.command.exit.dosbatch comment.line.ignored.dosbatch
+:: ^^^^^^^^^^ meta.redirection.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^^^^^^ meta.path.dosbatch meta.string.dosbatch string.unquoted.dosbatch
+
+ :: /b is ignored, but it's not handled
+ EXIT /b /?
+:: ^^^^^^^^^^ meta.command.exit.dosbatch
+:: ^^^^ keyword.control.flow.exit.dosbatch
+:: ^^ variable.parameter.option.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+
EXIT /b 12 illegal
:: ^^^^^^^^^^^^^^^^^^ meta.command.exit.dosbatch
:: ^^^^ keyword.control.flow.exit.dosbatch
@@ -397,6 +773,17 @@ ECHO : Not a comment ^
:: ^^^^^ meta.interpolation.dosbatch
:: ^^^^^^^ invalid.illegal.expect-end-of-command.dosbatch
+ GOTO/?
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+
+ GOTO /? ignored
+:: ^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+
GOTO:EOF
:: ^^^^^^^^ meta.command.goto.dosbatch
:: ^^^^ keyword.control.flow.goto.dosbatch
@@ -414,19 +801,225 @@ ECHO : Not a comment ^
GOTO :End
:: ^^^^^^^^^ meta.command.goto.dosbatch
:: ^^^^ keyword.control.flow.goto.dosbatch
-:: ^ punctuation.definition.variable.dosbatch
+:: ^ punctuation.definition.label.dosbatch
:: ^^^^ variable.label.dosbatch - keyword
GOTO:End
:: ^^^^^^^^ meta.command.goto.dosbatch
:: ^^^^ keyword.control.flow.goto.dosbatch
-:: ^ punctuation.definition.variable.dosbatch
+:: ^ punctuation.definition.label.dosbatch
:: ^^^^ variable.label.dosbatch - keyword
+ GOTO l
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO (
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO )
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO [
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO ]
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO {
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO }
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO ^(
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^)
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^[
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^]
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^{
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^}
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^>
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^<
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^&
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO ^|
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO %%
+:: ^^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^^ variable.label.dosbatch constant.character.escape.dosbatch
+:: ^ - variable
+
+ GOTO %
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO %var% ignored content ( & echo foo
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^ - meta.command
+:: ^^^^^^^^ meta.command.echo.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^ variable.label.dosbatch meta.interpolation.dosbatch
+:: ^ punctuation.section.interpolation.begin.dosbatch
+:: ^^^ variable.other.readwrite.dosbatch
+:: ^ punctuation.section.interpolation.end.dosbatch
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.logical.dosbatch
+
+ GOTO %%var%% ignored content ( & echo foo
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^ - meta.command
+:: ^^^^^^^^ meta.command.echo.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^^^ variable.label.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.logical.dosbatch
+
+ GOTO !
+:: ^^^^^^ meta.command.goto.dosbatch
+:: ^ - meta.command
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^ - keyword - variable
+:: ^ variable.label.dosbatch
+:: ^ - variable
+
+ GOTO !var! ignored content ( | echo foo
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^ - meta.command
+:: ^^^^^^^^ meta.command.echo.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^ variable.label.dosbatch meta.interpolation.dosbatch
+:: ^ punctuation.section.interpolation.begin.dosbatch
+:: ^^^ variable.other.readwrite.dosbatch
+:: ^ punctuation.section.interpolation.end.dosbatch
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.assignment.pipe.dosbatch
+
+ GOTO ^!var^! ignored content ( | echo foo
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^ - meta.command
+:: ^^^^^^^^ meta.command.echo.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^^^ variable.label.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.assignment.pipe.dosbatch
+
GOTO:This is a #@$虎 strange label
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
:: ^^^^ keyword.control.flow.goto.dosbatch
-:: ^ punctuation.definition.variable.dosbatch
+:: ^ punctuation.definition.label.dosbatch
:: ^^^^^ variable.label.dosbatch - keyword
:: ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
@@ -436,10 +1029,34 @@ ECHO : Not a comment ^
:: ^^^^ variable.label.dosbatch - keyword
:: ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+ GOTO This^
+is a #@$虎" strange label
+:: <- meta.command.goto.dosbatch variable.label.dosbatch
+:: ^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ GOTO This^
+ is a #@$虎" strange label
+:: <- meta.command.goto.dosbatch - variable.label.dosbatch
+:: ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
GOTO This is^
a #%@$虎 strange label
:: ^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+ GOTO This" is a #@$虎" strange label
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^ variable.label.dosbatch - keyword
+:: ^ - variable - comment
+:: ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ GOTO "This is a #@$虎" strange label
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.goto.dosbatch
+:: ^^^^ keyword.control.flow.goto.dosbatch
+:: ^^^^^ variable.label.dosbatch - keyword
+:: ^ - variable - comment
+:: ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
+
GOTO %%i
:: ^^^^ meta.command.goto.dosbatch keyword.control.flow.goto.dosbatch - meta.interpolation
:: ^ meta.command.goto.dosbatch - keyword - meta.interpolation
@@ -451,18 +1068,37 @@ ECHO : Not a comment ^
:: ^ meta.command.goto.dosbatch - keyword - meta.interpolation
:: ^^^^^ meta.command.goto.dosbatch meta.interpolation.dosbatch
+ GOTO nul )
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional.dosbatch
+:: ^ meta.group.dosbatch - meta.redirection
+:: ^^^^^^^^^ meta.group.dosbatch meta.redirection.dosbatch
+:: ^ meta.group.dosbatch - meta.redirection
+:: ^^^^^^^^^^^^ meta.block.dosbatch
+:: ^^^^ meta.redirection.dosbatch
+
+ IF nul
+:: ^^^^^^^^^^^^ meta.command.setlocal.dosbatch
+:: ^^^^ meta.command.setlocal.dosbatch meta.redirection.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+
+ ENDLOCAL /? >nul
+:: ^^^^^^^^^^^^ meta.command.endlocal.dosbatch
+:: ^^^^ meta.command.endlocal.dosbatch meta.redirection.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+
setlocal endlocal & echo hello & endlocal illegal
:: ^^^^^^^^^^^^^^^^^ meta.command.setlocal.dosbatch
:: ^^^ - meta.command
@@ -1343,17 +2065,24 @@ put arg1 arg2
:: ^^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch
:: ^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch
:: ^ meta.parameter.option.dosbatch - meta.string - meta.interpolation
-:: ^^^^^^^^ meta.parameter.option.dosbatch meta.string.dosbatch - meta.interpolation
-:: ^^^^ meta.parameter.option.dosbatch meta.string.dosbatch meta.interpolation.dosbatch
-:: ^ meta.parameter.option.dosbatch meta.string.dosbatch - meta.interpolation
-:: ^^^^^^^^^ variable.parameter.option.dosbatch
-:: ^^^^ - variable.parameter
+:: ^^^^^^^^ meta.parameter.option.dosbatch - meta.interpolation
+:: ^^^^ meta.parameter.option.dosbatch meta.interpolation.dosbatch
+:: ^ meta.parameter.option.dosbatch - meta.interpolation
:: ^ punctuation.definition.variable.dosbatch
-:: ^ punctuation.definition.string.begin.dosbatch
+:: ^ - punctuation
:: ^ punctuation.section.interpolation.begin.dosbatch
:: ^^ variable.other.readwrite.dosbatch
:: ^ punctuation.section.interpolation.end.dosbatch
-:: ^ variable.parameter.option.dosbatch punctuation.definition.string.end.dosbatch
+:: ^ - punctuation
+
+ command /param:va^l:u%var%e
+:: ^^^^^^ meta.parameter.option.dosbatch variable.parameter.option.dosbatch
+:: ^ meta.parameter.dosbatch keyword.operator.assignment.dosbatch
+:: ^^^^^^ meta.parameter.value.dosbatch meta.string.dosbatch string.unquoted.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^^^^^ meta.parameter.value.dosbatch meta.string.dosbatch meta.interpolation.dosbatch - string
+:: ^ meta.parameter.value.dosbatch meta.string.dosbatch string.unquoted.dosbatch
+:: ^ - meta.parameter
command ..\folder2\ /type:*.txt
:: ^^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch
@@ -1385,7 +2114,8 @@ put arg1 arg2
:: ^^^^^^^ meta.interpolation.dosbatch
:: ^ punctuation.section.interpolation.end.dosbatch
- powershell get-date -uformat "%%Y%%m%%d" > today.txt
+ powershell get-date -uformat "%%Y%%m%%d">today.txt
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch
:: ^^^^^^^^ - variable.parameter
:: ^^^^^^^^ meta.parameter.option.dosbatch variable.parameter.option.dosbatch
:: ^ punctuation.definition.variable.dosbatch
@@ -1396,7 +2126,25 @@ put arg1 arg2
:: ^ - constant.character.escape.dosbatch
:: ^^ constant.character.escape.dosbatch
:: ^ - constant.character.escape.dosbatch
+:: ^^^^^^^^^^ meta.redirection.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^^^^^^^ meta.path.dosbatch meta.string.dosbatch string.unquoted.dosbatch
+ powershell get-date>today.txt -uformat "%%Y%%m%%d"
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.dosbatch
+:: ^^^^^^^^ - variable.parameter
+:: ^^^^^^^^^^ meta.redirection.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^^^^^^^ meta.path.dosbatch meta.string.dosbatch string.unquoted.dosbatch
+:: ^^^^^^^^ meta.parameter.option.dosbatch variable.parameter.option.dosbatch
+:: ^ punctuation.definition.variable.dosbatch
+:: ^^^^^^^^^^^ string.unquoted.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^ - constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^ - constant.character.escape.dosbatch
+:: ^^ constant.character.escape.dosbatch
+:: ^ - constant.character.escape.dosbatch
:::: [ Redirections ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -1408,36 +2156,49 @@ put arg1 arg2
:: ^ keyword.operator.assignment.redirection.dosbatch
ECHO >> NUL
+:: ^^^^^^^^^^^ meta.command.echo.dosbatch
:: ^ - meta.redirection
:: ^^^^^^ meta.redirection.dosbatch
:: ^ - meta.redirection
:: ^^ keyword.operator.assignment.redirection.dosbatch
:: ^^^ constant.language.null.dosbatch
- dir > f.txt 2>&1
+ ECHO f.txt 2>&1 /b
+:: ^^^^^^^^^^^^^^^^^^^ meta.function-call
:: ^ - meta.redirection
:: ^^^^^^^ meta.redirection.dosbatch
:: ^ - meta.redirection
:: ^^^^ meta.redirection.dosbatch
-:: ^ - meta.redirection
+:: ^^^ - meta.redirection
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^^^^ string.unquoted.dosbatch
:: ^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
:: ^^ keyword.operator.assignment.redirection.dosbatch
:: ^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
+:: ^^ variable.parameter.option.dosbatch
- dir foo 1>nul 2>nul
+ dir foo 1>nul /b 2>nul
+:: ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call
:: ^ - meta.redirection
:: ^^^^^ meta.redirection.dosbatch
-:: ^ - meta.redirection
-:: ^^^^^ meta.redirection.dosbatch
-:: ^ - meta.redirection
+:: ^^^^ - meta.redirection
+:: ^^^^^ meta.redirection.dosbatch
+:: ^ - meta.redirection
:: ^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^^ constant.language.null.dosbatch
-:: ^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
-:: ^ keyword.operator.assignment.redirection.dosbatch
-:: ^^^ constant.language.null.dosbatch
+:: ^^ variable.parameter.option.dosbatch
+:: ^ meta.number.integer.decimal.dosbatch constant.numeric.value.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
:: Redirect any error message into a file
command 2> filename
@@ -1523,21 +2284,32 @@ put arg1 arg2
:: Redirect all output to stdout using variables
command >%STDOUT% %STDERR%>&%STDOUT%
-:: ^^^^^^^^ - meta.redirection
-:: ^^^^^^^^^ meta.redirection.dosbatch
-:: ^^^^^^^^^ - meta.redirection
-:: ^^^^^^^^^^ meta.redirection.dosbatch
-:: ^^^^^^^^^ - meta.interpolation
-:: ^^^^^^^^ meta.interpolation.dosbatch
-:: ^ - meta.interpolation
-:: ^^^^^^^^ meta.interpolation.dosbatch
-:: ^^ - meta.interpolation
-:: ^^^^^^^^ meta.interpolation.dosbatch
-:: ^ - meta.interpolation
+:: ^^^^^^^^ - meta.redirection - meta.interpolation
+:: ^ meta.redirection.dosbatch keyword.operator.assignment.redirection.dosbatch - meta.interpolation
+:: ^^^^^^^^ meta.redirection.dosbatch meta.path.dosbatch meta.string.dosbatch meta.interpolation.dosbatch
+:: ^ - meta.string - meta.redirection - meta.interpolation
+:: ^^^^^^^^ meta.string.dosbatch meta.interpolation.dosbatch - meta.redirection
+:: ^^ meta.redirection.dosbatch - meta.string - meta.interpolation
+:: ^^^^^^^^ meta.redirection.dosbatch meta.path.dosbatch meta.string.dosbatch meta.interpolation.dosbatch
:: ^^^^^^^ variable.function.dosbatch
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^ keyword.operator.assignment.redirection.dosbatch
+ (command >nul 2>&1)
+:: ^^^^^^^ variable.function.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+:: ^ constant.numeric.value.dosbatch
+:: ^^ keyword.operator.assignment.redirection.dosbatch
+:: ^ constant.numeric.value.dosbatch
+
+ (>nul 2>&1)
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+:: ^ constant.numeric.value.dosbatch
+:: ^^ keyword.operator.assignment.redirection.dosbatch
+:: ^ constant.numeric.value.dosbatch
+
:::: [ ECHO Command ] :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -1559,6 +2331,19 @@ put arg1 arg2
:: ^^^^ support.function.builtin.dosbatch
:: ^^^ constant.language.dosbatch
+ @ECHO OFF > nul
+:: ^ - meta.command
+:: ^^^^^^^^ meta.command.echo.dosbatch
+:: ^^^^ meta.function-call.identifier.dosbatch
+:: ^^^^^ meta.function-call.arguments.dosbatch
+:: ^^^^^ meta.function-call.arguments.dosbatch meta.redirection.dosbatch
+:: ^ - meta.command
+:: ^ keyword.operator.at.dosbatch
+:: ^^^^ support.function.builtin.dosbatch
+:: ^^^ constant.language.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+
@ECHO OFF :: no (comment) & :: comment
:: ^ - meta.command
:: ^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.echo.dosbatch
@@ -1825,7 +2610,7 @@ put arg1 arg2
:: ^^^^^^ - constant
:: ^^ constant.character.escape.dosbatch
:: ^^^ - constant
-:: ^ constant.other.placeholder.dosbatch
+:: ^ keyword.operator.wildcard.dosbatch
:: ^^ constant.character.escape.dosbatch
:: ^ - constant
:: ^^ constant.character.escape.dosbatch
@@ -2235,7 +3020,7 @@ put arg1 arg2
ECHO if /i "%%PROCESSOR%%"=="AMD64" goto x64>custom\SetAria2EnvVars.cmd
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.echo.dosbatch meta.string.dosbatch string.unquoted.dosbatch - meta.redirection
-:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.redirection.dosbatch - meta.command
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command meta.redirection.dosbatch
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^ constant.character.escape.dosbatch
:: ^^ constant.character.escape.dosbatch
@@ -2335,6 +3120,12 @@ put arg1 arg2
:::: [ SET variable=string ] ::::::::::::::::::::::::::::::::::::::::::::::::::
+ set /? ignored
+:: ^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+
set # & echo %#%
:: ^ variable.other.readwrite.dosbatch
:: ^ keyword.operator.logical.dosbatch
@@ -2389,13 +3180,26 @@ put arg1 arg2
:: ^^ invalid.illegal.parameter.dosbatch
set 12>nul
-:: ^^ variable.other.readwrite.dosbatch
:: ^^ - meta.redirection
:: ^^^^ meta.redirection.dosbatch
:: ^ - meta.redirection
+:: ^^ variable.other.readwrite.dosbatch
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^^ constant.language.null.dosbatch
+ set var=12>nul 3
+:: ^^^^ - meta.string - meta.redirection
+:: ^^ meta.string.dosbatch - meta.redirection
+:: ^^^^ meta.string.dosbatch meta.redirection.dosbatch
+:: ^^ meta.string.dosbatch - meta.redirection
+:: ^ - meta.string - meta.redirection
+:: ^^^ variable.other.readwrite.dosbatch
+:: ^ keyword.operator.assignment.dosbatch
+:: ^^ string.unquoted.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+:: ^^ string.unquoted.dosbatch
+
set foo_bar & echo %foo_bar%
:: ^^^^^^^^^^^ meta.command.set.dosbatch
:: ^ - meta.command
@@ -2646,6 +3450,13 @@ put arg1 arg2
:: ^ keyword.operator.assignment.dosbatch
:: ^ punctuation.definition.string.end.dosbatch
+ set "foo & echo on
+:: ^^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^^^^^^^^^^^^^ meta.string.dosbatch
+:: ^ punctuation.definition.string.begin.dosbatch
+:: ^^^^^^^^^^^^^ variable.other.readwrite.dosbatch - keyword - punctuation
+
:: "bar is output as no quote follows.
set "foo="bar" & echo !foo!
:: ^^^^ meta.command.set.dosbatch
@@ -2747,6 +3558,49 @@ put arg1 arg2
:: ^ punctuation.definition.string.end.dosbatch - string
:: ^^^^^^^ comment.line.ignored.dosbatch
+ set "foo"=ba"r & echo !foo" ignored >nul ignored
+:: ^^^^ meta.command.set.dosbatch - meta.string
+:: ^^^^^^^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch - meta.interpolation
+:: ^^^^^^^^^ meta.command.set.dosbatch - meta.redirection - meta.string
+:: ^^^^ meta.redirection.dosbatch
+:: ^^^^^^^^ meta.command.set.dosbatch - meta.redirection - meta.string
+:: ^^^ support.function.builtin.dosbatch
+:: ^ - variable.other.readwrite
+:: ^^^^ variable.other.readwrite.dosbatch
+:: ^ - punctuation
+:: ^ keyword.operator.assignment.dosbatch
+:: ^^^^^^^^^^^^^^^^ string.unquoted.dosbatch
+:: ^ - punctuation
+:: ^ - keyword
+:: ^^^^ - support
+:: ^ punctuation.definition.string.end.dosbatch - string
+:: ^^^^^^^ comment.line.ignored.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+
+ set "foo"=ba"r & echo !foo" ignored 2>nul ignored
+:: ^^^^ meta.command.set.dosbatch - meta.string
+:: ^^^^^^^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch - meta.interpolation
+:: ^^^^^^^^^ meta.command.set.dosbatch - meta.redirection - meta.string
+:: ^^^^^ meta.command.set.dosbatch meta.redirection.dosbatch
+:: ^^^^^^^^ meta.command.set.dosbatch - meta.redirection - meta.string
+:: ^ - meta.command
+:: ^^^ support.function.builtin.dosbatch
+:: ^ - variable.other.readwrite
+:: ^^^^ variable.other.readwrite.dosbatch
+:: ^ - punctuation
+:: ^ keyword.operator.assignment.dosbatch
+:: ^^^^^^^^^^^^^^^^ string.unquoted.dosbatch
+:: ^ - punctuation
+:: ^ - keyword
+:: ^^^^ - support
+:: ^ punctuation.definition.string.end.dosbatch - string
+:: ^^^^^^^ comment.line.ignored.dosbatch
+:: ^^^^^^ meta.command.set.dosbatch
+:: ^ constant.numeric.value.dosbatch
+:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^ constant.language.null.dosbatch
+
set "foo"=b"ar ba"z & echo !foo"!
:: ^^^^ meta.command.set.dosbatch - meta.string
:: ^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch - meta.interpolation
@@ -2796,6 +3650,12 @@ put arg1 arg2
:: ^^^^^^^^^^^^^^^^^^ string.unquoted.dosbatch
:: ^ punctuation.definition.string.end.dosbatch
+ set "foo"=nul
+:: ^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch meta.redirection.dosbatch
+
+ set "foo"="nul"
+:: ^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch - meta.interpolation - meta.redirection
+
set "foo=b"ar^
b)a"z & echo !foo"
:: ^^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.string.dosbatch
@@ -2859,6 +3719,19 @@ put arg1 arg2
:: ^ keyword.operator.assignment.redirection.dosbatch
:: ^^^ constant.language.null.dosbatch
+ set /? /a ignored
+:: ^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ set /A /? ignored
+:: ^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^ variable.parameter.option.expression.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+
set /A hello_world
:: ^^^ support.function.builtin.dosbatch
:: ^^^^^^^^^^^ meta.expression.dosbatch
@@ -3239,6 +4112,19 @@ put arg1 arg2
:::: [ SET /P variable=promptString ]::::::::::::::::::::::::::::::::::::::::::
+ set /? /p ignored
+:: ^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^^^^ comment.line.ignored.dosbatch
+
+ set /p /? ignored
+:: ^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
+:: ^^^ support.function.builtin.dosbatch
+:: ^^ variable.parameter.option.prompt.dosbatch
+:: ^^ variable.parameter.option.help.dosbatch
+:: ^^^^^^^ comment.line.ignored.dosbatch
+
set /p today=
:: ^^^^^^^ meta.command.set.dosbatch - meta.prompt
:: ^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch
@@ -3721,7 +4607,7 @@ put arg1 arg2
:: ^^^^^^ string.unquoted.dosbatch
:: ^^^^^^ - string
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.dosbatch
-:: ^^ constant.character.escape.dosbatch
+:: ^^ - constant.character.escape
:: ^ - keyword
:: ^ - string
@@ -3986,7 +4872,7 @@ put arg1 arg2
:: ^^^^^^^ meta.command.set.dosbatch - meta.string
:: ^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch - meta.string
:: ^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch - meta.interpolation
-:: ^^^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.interpolation.dosbatch meta.redirection.dosbatch
+:: ^^^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.redirection.dosbatch
:: ^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch - meta.interpolation
:: ^^^ support.function.builtin.dosbatch
:: ^ - keyword - variable
@@ -4000,8 +4886,8 @@ put arg1 arg2
:: ^^^^^^^ meta.command.set.dosbatch - meta.string
:: ^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch - meta.string
:: ^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch
-:: ^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.interpolation.dosbatch meta.redirection.dosbatch
-:: ^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch meta.interpolation.dosbatch meta.redirection.dosbatch meta.path.dosbatch meta.string.dosbatch
+:: ^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.redirection.dosbatch
+:: ^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch meta.redirection.dosbatch meta.path.dosbatch meta.string.dosbatch
:: ^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.string.dosbatch
:: ^^^ support.function.builtin.dosbatch
:: ^ - keyword - variable
@@ -4031,7 +4917,8 @@ put arg1 arg2
set /p "today="nul, but 12>1 is ignored
:: ^^^^^^^ meta.command.set.dosbatch - meta.string
:: ^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch - meta.string
-:: ^^^^^^^^^^^^^^^^ meta.command.set.dosbatch
-:: ^^^^^^^^^^^^ - meta.command
+:: ^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch - meta.redirection
+:: ^^^^^^^^^^ meta.command.set.dosbatch meta.redirection.dosbatch - comment
+:: ^^^^^ meta.command.set.dosbatch - meta.redirection
+:: ^^^^^ meta.command.set.dosbatch meta.redirection.dosbatch - comment
+:: ^^^^^^^^ comment.line.ignored.dosbatch - meta.redirection
+:: ^^ meta.command.set.dosbatch meta.redirection.dosbatch
+:: ^^^^^^^^^^^ comment.line.ignored.dosbatch - meta.redirection
:: ^^^ support.function.builtin.dosbatch
:: ^ - keyword - variable
:: ^ punctuation.definition.variable.dosbatch
@@ -4056,14 +4948,14 @@ put arg1 arg2
:: ^ keyword.operator.assignment.dosbatch
:: ^ punctuation.definition.prompt.end.dosbatch
:: ^ - comment - string
-:: ^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
-:: ^ - comment - keyword
+:: ^^^^^^^^^^^^^^^^ comment.line.ignored.dosbatch
:: ^ keyword.operator.assignment.redirection.dosbatch
+:: ^^^^^^^^^ meta.path.dosbatch meta.string.dosbatch string.unquoted.dosbatch
set /p "today="<"c:\this week\to day.txt"
:: ^^^^^^^ meta.command.set.dosbatch - meta.string
:: ^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch - meta.string
-:: ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.redirection.dosbatch - meta.command
+:: ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.set.dosbatch meta.prompt.dosbatch meta.redirection.dosbatch
:: ^^^ support.function.builtin.dosbatch
:: ^ - keyword - variable
:: ^ punctuation.definition.variable.dosbatch