From fab5cc9c978ea3fbb741b7d08e5dd90e8aa3178d Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 8 Jun 2024 10:26:42 +0200 Subject: [PATCH 01/12] [ShellScript] reorganize syntax tests (#3989) * [ShellScript] Update syntax test section headers This commit updates references in syntax tests to Bash 5.2 docs as preparation to integrate new shells. Note: This commit does not change any behavior. * [ShellScript] Reorganize Shell Parameters tests This commit moves shell parameter tests next to shell functions to align tests by language manual structure. Note: This commit does not change any behavior. * [ShellScript] Reorganize Shell Parameter Expansions tests This commit aligns position of positional, special and shell parameter expansion tests with bash manual structure. Note: This commit does not change any behavior. * [ShellScript] Reorganize Bash Pattern Matching tests This commit aligns pattern matching tests to align them with bash manual structure. Note: This commit does not change any behavior. * [ShellScript] Reorganize pipeline tests * [ShellScrip] Reorganize redirection tests * [ShellScript] Reorganize loop constructs * [ShellScript] Reorganize conditional constructs * [ShellScript] Reorganize heredocs tests * [ShellScript] Reorganize posix regexp tests * [ShellScript] Add positional arguments tests * [ShellScript] Reorganize job tests --- ShellScript/test/syntax_test_bash.sh | 7075 +++++++++++++------------- 1 file changed, 3590 insertions(+), 3485 deletions(-) diff --git a/ShellScript/test/syntax_test_bash.sh b/ShellScript/test/syntax_test_bash.sh index 03b1ca00ef..a3e436d06e 100755 --- a/ShellScript/test/syntax_test_bash.sh +++ b/ShellScript/test/syntax_test_bash.sh @@ -1,8 +1,9 @@ # SYNTAX TEST "Packages/ShellScript/Bash.sublime-syntax" -#################################################################### -# Comments # -#################################################################### +############################################################################### +# 3.1.3 Comments # +# https://www.gnu.org/software/bash/manual/bash.html#Comments # +############################################################################### # This is a comment. # <- comment.line.number-sign.shell punctuation.definition.comment.shell @@ -95,9 +96,10 @@ $(( )) -#################################################################### -# The basics # -#################################################################### +############################################################################### +# 3.1.2 Quoting # +# https://www.gnu.org/software/bash/manual/bash.html#Quoting # +############################################################################### echo hello, world! #^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call @@ -169,10 +171,13 @@ echo 'no\e$capes\in\$ingle\quotes' # ^ punctuation.definition.string.end.shell echo 'singe\' \\'' -# ^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^^^ - meta.string - string -# ^^ constant.character.escape.shell -# ^^ meta.string.shell string.quoted.single.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^ meta.string.shell string.quoted.single.shell - string.unquoted +# ^ punctuation.definition.string.begin.shell +# ^^ - constant +# ^ - string +# ^^ constant.character.escape.shell - string.quoted +# ^^ meta.string.shell string.quoted.single.shell - string.unquoted # ^ - meta.string - string echo $'\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z\'' @@ -395,9 +400,10 @@ $e'ch'o Hello, world! # ^ punctuation.definition.string.end.shell -#################################################################### -# Basic Command Arguments # -#################################################################### +############################################################################### +# 3.2 Shell Commands (Basic Command Arguments) # +# https://www.gnu.org/software/bash/manual/bash.html#Simple-Commands # +############################################################################### set -e - # ^ variable.parameter.option.shell punctuation.definition.parameter.shell @@ -701,1763 +707,1863 @@ cd foo/bar2345 #^ meta.function-call.identifier.shell support.function.cd.shell # ^^^^^^^^^^^^ meta.function-call.arguments.shell - constant.numeric -#################################################################### -# Compound Command Arguments # -#################################################################### - -(foo) -o -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^^^ meta.compound.shell meta.function-call.identifier.shell variable.function.shell -# ^ meta.compound.shell punctuation.section.compound.end.shell -# ^^^ meta.compound.arguments.shell -{ foo -o } --opt -- --no-option -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^^^^^^^^^ meta.compound.shell - meta.compound meta.compound -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell - meta.compound meta.compound -# ^ - meta.compound -# ^^^ variable.function.shell -# ^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell -# ^ meta.parameter.option.shell variable.parameter.option.shell - punctuation -# ^ punctuation.section.compound.end.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell - punctuation -# ^^ keyword.operator.end-of-options.shell -# ^^^^^^^^^^^ - variable - punctuation +############################################################################### +# 3.2.3 Pipelines # +# https://www.gnu.org/software/bash/manual/bash.html#Pipelines # +############################################################################### -{ -# <- meta.compound.shell punctuation.section.compound.begin.shell -#^ meta.compound.shell - meta.compound meta.compound - { -#^ meta.compound.shell - meta.compound meta.compound -# ^^ meta.compound.shell meta.compound.shell -# ^ punctuation.section.compound.begin.shell - foo args -#^^^^^^^^^^^^ meta.compound.shell meta.compound.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^^ meta.function-call.arguments.shell - } 2>> "$stderr_log" -#^^ meta.compound.shell meta.compound.shell -# ^^^^^^^^^^^^^^^^^^ meta.compound.shell meta.compound.arguments.shell -# ^ meta.compound.shell - meta.compound meta.compound -# ^ punctuation.section.compound.end.shell - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function -} 1>> "$stdout_log" -# <- meta.compound.shell - meta.compound meta.compound -#^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell -# ^ - meta -# <- punctuation.section.compound.end.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function +cmd1 --opt1 arg1 | cmd2 --opt2 arg2 | cmd3 --opt3 arg3 +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +C2=c2 C3=c3 C4=c4 +c1 -c1 c1 && ${C2} -c2 c2 || c3 -c3 ${C3} ; c4 -${C4} c4 | c5 -c5 c5 +#^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell meta.interpolation.parameter.shell +# ^ variable.parameter - variable.function +# ^ - variable +# ^ keyword +# ^ meta.function-call.identifier.shell variable.function.shell +# ^ variable.parameter - variable.function +# ^ - variable.parameter +# ^ punctuation.terminator.statement.shell +# ^^ variable.function +# ^ variable.parameter -#################################################################### -# 3.2.5 Coprocesses # -#################################################################### -coproc -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell keyword.declaration.coproc.shell -# ^ - meta.coproc - keyword +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.1 Looping Constructs (for loops) # +# https://www.gnu.org/software/bash/manual/bash.html#index-for # +############################################################################### -coproc na\ -me args -# <- meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call +for; +#^^ keyword.control.loop.for.shell +for& +#^^ keyword.control.loop.for.shell +for| +#^^ keyword.control.loop.for.shell +for>/dev/null +#^^ keyword.control.loop.for.shell +for - +#^^ keyword.control.loop.for.shell +for() +#^^ keyword.control.loop.for.shell +for[] +#^^^^ - keyword.control +for{} +#^^^^ - keyword.control +for- +#^^^ - keyword.control +-for +#^^^ - keyword.control +for+ +#^^^ - keyword.control +for$ +#^^^ - keyword.control +for$var +#^^^^^^ - keyword.control +for= +#^^^ - keyword.control +for-= +#^^^^ - keyword.control +for+= +#^^^^ - keyword.control -coproc name ar\ -gs -# <- meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call + do; +#^^ keyword.control.loop.do.shell + do& +#^^ keyword.control.loop.do.shell + do| +#^^ keyword.control.loop.do.shell + do>/dev/null +#^^ keyword.control.loop.do.shell + do - +#^^ keyword.control.loop.do.shell + do() +#^^ keyword.control.loop.do.shell + do[] +#^^^^ - keyword.control + do{} +#^^^^ - keyword.control + do- +#^^^ - keyword.control + -do +#^^^ - keyword.control + do+ +#^^^ - keyword.control + do$ +#^^^ - keyword.control +do$var +#^^^^^^ - keyword.control + do= +#^^^ - keyword.control + do-= +#^^^^ - keyword.control + do+= +#^^^^ - keyword.control -coproc sed s/^/foo/ -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell - meta.function-call -# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call -#^^^^^ keyword.declaration.coproc.shell -# ^^^ variable.function.shell +for done +# <- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^^^^ keyword.control.loop.end.shell -coproc ls thisfiledoesntexist; read; 2>&1 -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^^ meta.coproc.command.shell - meta.function-call.identifier.shell -# ^^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^ meta.coproc.command.shell - meta.function-call.identifier.shell -# ^ - meta.coproc -#^^^^^ keyword.declaration.coproc.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +for do done +# <- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^^ keyword.control.loop.do.shell +# ^^^^ keyword.control.loop.end.shell -coproc awk '{print "foo" $0;fflush()}' -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell -# ^ - meta.coproc - meta.function-call -#^^^^^ keyword.declaration.coproc.shell -# ^^^ variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell +for x; do +#<- keyword.control.loop.for.shell +#^^ keyword.control.loop.for.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell + echo "${!x}" +# ^^^^ meta.function-call.identifier.shell support.function.echo.shell +# ^^^^^^^^ meta.function-call.arguments.shell +done +#<- keyword.control.loop.end.shell -coproc { ls thisfiledoesntexist; read; 2>&1 } | foo -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^ meta.coproc.command.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^^^^ meta.coproc.command.shell - meta.compound -# ^ - meta.function-call - meta.function.coproc -# ^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call.identifier.shell -# ^^^^ meta.function-call.identifier.shell -# ^^^^^^^^ - meta.function-call.identifier.shell -#^^^^^ keyword.declaration.coproc.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.pipe.shell -# ^^^ variable.function.shell +for (( i = 0; i < 10; i++ )); do +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# <- keyword.control.loop.for.shell +# ^^ punctuation.section.arithmetic.begin.shell +# ^ keyword.operator.assignment.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation +# ^ punctuation.terminator.statement.shell +# ^ keyword.operator.comparison.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.operator.arithmetic.shell +# ^^ punctuation.section.arithmetic.end.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell + echo $i + # <- meta.function-call support.function.echo.shell + # ^ meta.function-call.arguments punctuation.definition.variable.shell + # ^ meta.function-call.arguments variable.other.readwrite.shell +done +# <- keyword.control.loop.end.shell -coproc myls { ls thisfiledoesntexist; read; 2>&1 } | foo -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^^^^^^ meta.coproc.identifier.shell - meta.compound -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -#^^^^^ keyword.declaration.coproc.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ support.function.read.shell -# ^ punctuation.terminator.statement.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.pipe.shell -# ^^^ variable.function.shell +for (( i = 0; i < 10; i++ )) #; do +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# <- keyword.control.loop.for.shell +# ^^ punctuation.section.arithmetic.begin.shell +# ^ keyword.operator.assignment.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation +# ^ punctuation.terminator.statement.shell +# ^ keyword.operator.comparison.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.operator.arithmetic.shell +# ^^ punctuation.section.arithmetic.end.shell +# ^^^^^^ comment.line.number-sign.shell +do +#<- keyword.control.loop.do.shell + echo $i + # <- meta.function-call support.function.echo.shell + # ^ meta.function-call.arguments punctuation.definition.variable.shell + # ^ meta.function-call.arguments variable.other.readwrite.shell +done +# <- keyword.control.loop.end.shell -{ coproc tee { tee logfile ;} >&3 ;} 3>&1 -# <- meta.compound.shell punctuation.section.compound.begin.shell -# ^^^^^^ meta.compound.shell meta.coproc.shell -# ^^^^^ meta.compound.shell meta.coproc.identifier.shell -# ^^^^^^^^^^^^^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.shell -# ^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.arguments.shell -# ^^^ meta.compound.shell - meta.coproc -# ^^^^^ meta.compound.arguments.shell - meta.coproc - meta.function-call -# ^^^^^^ keyword.declaration.coproc.shell -# ^^^ entity.name.function.shell -# ^ punctuation.section.compound.begin.shell -# ^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.section.compound.end.shell -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +for i in str1 $str2 "str3" 'str4' st$r5; do echo $i; done; +# <- keyword.control.loop.for.shell +# ^ variable.other.readwrite.shell +# ^^ keyword.control.in.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^^^^ meta.string.shell string.quoted.double.shell +# ^^^^^^ meta.string.shell string.quoted.single.shell +# ^^ meta.string.shell string.unquoted.shell +# ^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.loop.do.shell +# ^^^^ meta.function-call.identifier.shell support.function.echo.shell +# ^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.loop.end.shell +# ^ punctuation.terminator.statement.shell -coproc foobar { -# <- meta.coproc.shell keyword.declaration.coproc.shell -#^^^^^ meta.coproc.shell -# ^^^^^^^^ meta.coproc.identifier.shell -# ^^ meta.coproc.command.shell meta.compound.shell -#^^^^^ keyword.declaration.coproc.shell -# ^^^^^^ entity.name.function.shell -# ^ punctuation.section.compound.begin.shell - read -#^^^^^^^^ meta.coproc.command.shell meta.compound.shell -# ^^^^ meta.coproc.command.shell meta.compound.shell meta.function-call.identifier.shell support.function.read.shell -} -# <- meta.coproc.command.shell meta.compound.shell punctuation.section.compound.end.shell -#^ - meta +for i in /dev/null +#^^ keyword.control.conditional.if.shell + if - +#^^ keyword.control.conditional.if.shell + if- +#^^^ - keyword.control + -if +#^^^ - keyword.control + if+ +#^^^ - keyword.control + if$ +#^^^ - keyword.control + if$var +#^^^^^^ - keyword.control + if= +#^^^ - keyword.control + if-= +#^^^^ - keyword.control + if+= +#^^^^ - keyword.control + if() +#^^ keyword.control.conditional.if.shell + if[] +#^^^^ - keyword.control + if{} +#^^^^ - keyword.control -function [] () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from []" -} -# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -[] -# <- meta.function-call.identifier.shell variable.function.shell -#^ meta.function-call.identifier.shell variable.function.shell + then; +#^^^^ keyword.control.conditional.then.shell + then& +#^^^^ keyword.control.conditional.then.shell + then| +#^^^^ keyword.control.conditional.then.shell + then>/dev/null +#^^^^ keyword.control.conditional.then.shell + then - +#^^^^ keyword.control.conditional.then.shell + then- +#^^^^^ - keyword.control +- then +#^^^^^ - keyword.control + then+ +#^^^^^ - keyword.control + then$ +#^^^^^ - keyword.control + then$var +#^^^^^^^^ - keyword.control + then= +#^^^^^ - keyword.control + then-= +#^^^^^^ - keyword.control + then+= +#^^^^^^ - keyword.control + then() +#^^^^ keyword.control.conditional.then.shell + then[] +#^^^^^^ - keyword.control + then{} +#^^^^^^ - keyword.control -function [[]] () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from [[]]" -} -[[]] -# <- meta.function-call.identifier.shell variable.function.shell +if cmd && \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd && + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd || \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if cmd || + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +if !cmd +# ^ punctuation.definition.history.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +! cmd +# <- keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +!cmd +# <- punctuation.definition.history.shell #^^^ meta.function-call.identifier.shell variable.function.shell - -function {} () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from {}" -} -{} -# <- meta.function-call.identifier.shell variable.function.shell -#^ meta.function-call.identifier.shell variable.function.shell - -function {{}} () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from {{}}" -} -{{}} -# <- meta.function-call.identifier.shell variable.function.shell +! \ +# <- keyword.operator.logical.shell +# ^ punctuation.separator.continuation.line.shell +! \ + cmd #^^^ meta.function-call.identifier.shell variable.function.shell - -function -foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from -foo" -} --foo -# <- meta.function-call.identifier.shell variable.function.shell +!\ +# <- punctuation.definition.history.shell +#^ punctuation.separator.continuation.line.shell +!\ + cmd #^^^ meta.function-call.identifier.shell variable.function.shell +!! +# <- variable.language.history.shell punctuation.definition.history.shell +#^ variable.language.history.shell +!-1 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell +!51 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell -function +foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from +foo" -} -+foo -# <- meta.function-call.identifier.shell variable.function.shell -#^^^ meta.function-call.identifier.shell variable.function.shell +[ ] +# <- support.function.test.begin.shell +# ^ support.function.test.end.shell -function =foo () { -#<- meta.function.shell keyword.declaration.function.shell -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -#^^^^^^^ keyword.declaration.function.shell -# ^^^^ entity.name.function.shell -# ^ punctuation.section.parameters.begin.shell -# ^ punctuation.section.parameters.end.shell -# ^ meta.compound.shell punctuation.section.compound.begin.shell - echo "Hello from =foo" -} -=foo -# <- meta.function-call.identifier.shell variable.function.shell -#^^^ meta.function-call.identifier.shell variable.function.shell +[ +] +# <- meta.conditional.shell support.function.test.end.shell -function fo${bar}'baz' () {} -# ^^^ meta.function.identifier.shell - meta.interpolation - meta.string -# ^^^^^^ meta.function.identifier.shell meta.interpolation.parameter.shell - meta.string -# ^^^^^ meta.function.identifier.shell meta.string.shell - meta.interpolation -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -# ^^ entity.name.function.shell -# ^^^^^^ - entity.name -# ^^^^^ entity.name.function.shell +! [ ] +# <- keyword.operator.logical.shell +# ^ support.function.test.begin.shell +# ^ support.function.test.end.shell -# Functions may replace booleans. Won't respect that in function calls though. -function true () {} ; function false () {} -#^^^^^^^ meta.function.shell -# ^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^^ meta.function.shell -# ^^ - meta.function -# ^^^^^^^^ meta.function.shell -# ^^^^^^^ meta.function.identifier.shell -# ^^ meta.function.parameters.shell -# ^^^ meta.function.shell -# ^^^^ entity.name.function.shell -# ^^^^^ entity.name.function.shell -# ^ punctuation.terminator.statement.shell +![ ] +# <- punctuation.definition.history.shell +#^ support.function.test.begin.shell +# ^ support.function.test.end.shell -__git_aliased_command () -{ - local word cmdline=$(__git config --get "alias.$1") - for word in $cmdline; do - case "$word" in - {) : skip start of shell helper function ;; -# ^ - punctuation.section.interpolation.begin -# ^ keyword.control.conditional.patterns.end.shell - \'*) : skip opening quote after sh -c ;; - *) - echo "$word" - return - esac - done -} -# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -#^ - meta.function +[[ ]] +# <- support.function.test.begin.shell +#^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -# <- - meta.function +[[ +]] +# <- meta.conditional.shell support.function.test.end.shell +#^ meta.conditional.shell support.function.test.end.shell +! [[ ]] +# <- keyword.operator.logical.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -#################################################################### -# alias builtin # -#################################################################### +![[ ]] +# <- punctuation.definition.history.shell +#^^^^^ meta.conditional.shell +#^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell -alias -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^ - meta.declaration.alias - storage +[[ ! ($line == ^0[1-9]$) ]] +# <- meta.conditional.shell - meta.group +#^^^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp +# ^^^^^^^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell +# ^ meta.conditional.shell meta.group.shell - meta.string +# ^^^ meta.conditional.shell - meta.group +# -alias foo=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ ! ($line != \() ]] +# <- meta.conditional.shell - meta.group +#^^^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp +# ^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell constant.character.escape.shell +# ^ meta.conditional.shell meta.group.shell - meta.string +# ^^^ meta.conditional.shell - meta.group +# -alias f'o'o=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^^^ meta.variable.shell entity.name.function.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ '-e' == -e ]] # -e undergoes pattern matching on the right +# ^^^^ meta.string.shell string.quoted.single.shell +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell meta.string.regexp.shell - variable -alias -p foo=bar 7za=qux -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ -e == -e ]] # a syntax error in bash but allowed in zsh +# ^^ - variable.parameter.option +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell meta.string.regexp.shell - variable -alias -a -p -- foo=bar baz=qux -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^ invalid.illegal.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ $foo == 'bar' || $foo == "baz" && $bar == baz ]] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.regexp.shell +# ^^ support.function.test.end.shell -alias $foo=bar -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell -# ^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^ - meta.declaration.alias -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell +[[ ( $foo == 'bar' || $foo == "baz" ) && $bar == baz ]] +# <- meta.conditional.shell support.function.test.begin.shell +#^^ meta.conditional.shell - meta.group +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell meta.group.shell +# ^^^^^^^^^^^^^^^^^^ meta.conditional.shell - meta.group +# ^ punctuation.section.group.begin.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.regexp.shell +# ^ punctuation.section.group.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.regexp.shell +# ^^ support.function.test.end.shell -alias ..='cd ..' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell string.quoted.single.shell +if [[ expr ]] && [[ expr ]] || [[ expr ]] ; then cmd ; fi +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -alias -p ..='cd ..' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell string.quoted.single.shell +if [[ expr && expr || expr ]] ; then cmd ; fi +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^ support.function.test.begin.shell +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -alias -- -='cd -' -# <- meta.declaration.alias.shell keyword.declaration.alias.shell -#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell -# ^^^^^^^^^^^^ meta.declaration.alias.arguments.shell -# ^^ keyword.operator.end-of-options.shell -# ^ meta.variable.shell entity.name.function.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^ meta.string.shell string.quoted.single.shell - - -#################################################################### -# declare builtin # -#################################################################### - -declare # comment -#<- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^ comment.line.number-sign.shell - -declare foo # 'foo' is a variable name -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ - variable.other.readwrite -# ^ - meta.declaration.variable +if [[ expr && ( expr || expr ) ]] ; then cmd ; fi +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^^^^^^^^ meta.group.shell +# ^^ support.function.test.begin.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.group.begin.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.group.end.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell -declare +A # this is a comment -#^^^^^^ meta.declaration.variable.shell -# ^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +if [[ $- =~ *i* ]] ; then echo shell is not interactive; fi +#^ keyword.control.conditional.if.shell +# ^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^ - meta.string.regexp +# ^^^ meta.string.regexp.shell +# ^^^ - meta.string.regexp +# ^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ support.function.test.begin.shell +# ^^ meta.interpolation.parameter.shell variable.language.shell +# ^ punctuation.definition.variable.shell +# ^^ keyword.operator.comparison.shell +# ^ invalid.illegal.unexpected-quantifier.regexp.shell +# ^ keyword.operator.quantifier.regexp.shell +# ^^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^ support.function.echo.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare -A foo bar # 'foo' and 'bar' are variable names -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +if [[ "$ERL_TOP" != ";"; ]];then;fi +#^ keyword.control.conditional.if.shell +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^^^^^^^^^^^^^ - meta.string.regexp +# ^^^^ meta.string.regexp.shell +# ^^^ - meta.string.regexp +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare -I foo -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^ meta.declaration.variable.arguments.shell -# ^^ variable.parameter.option.shell -# ^^^ variable.other.readwrite.shell +if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret; bar=foo # comment -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.assignment.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ - meta.string - string - comment -# ^^^^^^^^^^ comment.line.number-sign.shell +if { [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; }; then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ punctuation.section.compound.begin.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret ; -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ punctuation.terminator.statement.shell +if ( [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2 ); then PLATFORM=docker; fi +#^ keyword.control.conditional.if.shell +# ^ punctuation.section.compound.begin.shell +# ^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.identifier.shell variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string string.unquoted.shell -declare ret& -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ keyword.operator +if [ ! -f q4m-$Q4MVER.tar.gz ]; then +# ^ support.function.test.begin.shell +# ^ keyword.operator.logical.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^ - keyword.operator +# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + : +# ^ meta.function-call.identifier.shell support.function.colon.shell +fi +# <- keyword.control.conditional.end.shell -declare ret & -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -# <- keyword.declaration.variable.shell -# ^ keyword.operator +if true ; then false ; fi +#^ keyword.control.conditional.if.shell +# ^^^^ constant.language.boolean.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^^ constant.language.boolean.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -declare bar=\ -foo # comment -# <- meta.declaration.variable.arguments.shell meta.string.shell string.unquoted.shell -#^^ meta.declaration.variable.arguments.shell meta.string.shell string.unquoted.shell -# ^ - meta.function -# ^^^^^^^^^^ comment.line.number-sign.shell +if (ruby extconf.rb && +# ^ punctuation.section.compound.begin.shell + { make clean || true; } && + # <- punctuation.section.compound.begin.shell + # ^ punctuation.section.compound.end.shell + make) 1> build.log 2>&1 + # ^ punctuation.section.compound.end.shell + # ^ - variable.function +fi -declare bar=\ -(foo) # comment -#^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.function -# <- punctuation.section.sequence.begin.shell -# ^ punctuation.section.sequence.end.shell -# ^^^^^^^^^^ comment.line.number-sign.shell +if [ "$1" != "" -a "$2" != "" ]; then +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell +#^ keyword.control.conditional.if.shell +# <- keyword.control.conditional.if.shell +# ^ support.function.test.begin.shell +# ^^ keyword.operator.comparison.shell +# ^^ meta.conditional.shell variable.parameter.option.shell +# ^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^ support.function.test.end.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + local DIR=$1 + # <- keyword.declaration.variable.shell + # ^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell + local TARGET=$2 + # <- keyword.declaration.variable.shell + # ^^^^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell +elif [ "$1" ]; then +# <- keyword.control.conditional.elseif.shell +# ^^^^^^^^ meta.conditional.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell + local DIR=$PWD + # <- keyword.declaration.variable.shell + # ^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^^^ variable.other.readwrite.shell + local TARGET=$1 + # <- keyword.declaration.variable.shell + # ^^^^^^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^^ variable.other.readwrite.shell +fi +# <- keyword.control.conditional.end.shell -declare -a owners=( - # dogs -# ^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell comment.line.number-sign.shell - [susan]=labrador -# ^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell -# ^^^^^^^ meta.brackets.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell - # cats -# ^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell comment.line.number-sign.shell - [terry]=tabby -# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell meta.sequence.shell -# ^^^^^^^ meta.brackets.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.unquoted.shell -) +asdf foo && FOO=some-value pwd +# <- meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.logical.shell +# ^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.function-call.identifier.shell support.function.pwd.shell -declare -f _init_completion > /dev/null && complete -F _upto upto -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^ - meta.declaration - meta.function-call -# ^^^^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option.shell -# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^ variable.function.shell -# ^^ variable.parameter.option.shell +(cd Layer1-linux && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer2-nodejs && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer3-base && PLATFORM=${PLATFORM} ./build ) && +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +(cd Layer4-custom && PLATFORM=${PLATFORM} name=${NOSN} ./build ) || err $? +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell +# <- punctuation.section.compound.begin.shell +# ^^ keyword.operator.logical.shell +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^^^^^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.logical.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^ meta.function-call.arguments.shell +# ^^ variable.language.shell -printFunction "$variableString1" "$(declare -p variableArray)" -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option -# ^^^^^^^^^^^^^ variable.other.readwrite -# ^ punctuation.section.interpolation.end.shell -# <- - variable.other -printFunction "$variableString1" "`declare -p variableArray`" -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option -# ^^^^^^^^^^^^^ variable.other.readwrite -# ^ punctuation.section.interpolation.end.shell +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.2 Conditional Constructs (Case Statements) # +# https://www.gnu.org/software/bash/manual/bash.html#index-case # +############################################################################### +case- +# <- - keyword +#^^^^ - keyword -#################################################################### -# Exec builtins # -#################################################################### +esac +# <- keyword.control.conditional.end.shell +#^^^ keyword.control.conditional.end.shell - meta.conditional.case -exec -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell support.function.exec.shell +case +# <- meta.conditional.case.shell keyword.control.conditional.case.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.case.shell -exec -- -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -#^^^ support.function.exec.shell -# ^^^ meta.function-call.arguments.shell -# ^^ keyword.operator.end-of-options.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec 3<&- -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^ constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.terminator.file-descriptor.shell +case var in + ( patt ( esac +#^ meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.group +# ^^ meta.conditional.case.clause.patterns.shell meta.group.regexp.shell +# ^^^^ meta.conditional.case.shell +# ^ keyword.control.conditional.patterns.begin.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +# ^ - meta.conditional -exec -- foo bar -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -exec -c -l -a name git status -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^^^^ meta.function-call.arguments.shell -# <- support.function.exec.shell -#^^^ support.function.exec.shell -# ^^ variable.parameter.option.shell -# ^^ variable.parameter.option.shell -# ^^ variable.parameter.option.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^^ variable.function.shell +case # comment +#^^^^^^^^^^^^^^^^ meta.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + var # comment +#^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + in # comment +#^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# ^^ keyword.control.in.shell +# ^^^^^^^^^^ comment.line.number-sign.shell + pattern) # comment +#^ meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.patterns.shell +# ^^^^^^^^^^^ meta.conditional.case.clause.commands.shell +# ^^^^^^^^^^ comment.line.number-sign.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec -la name -i --bar -- foo bar -#^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -#^^^ support.function.exec.shell -# ^^^ variable.parameter.option.shell -# ^^^^ string.unquoted.shell -# ^^ invalid.illegal.parameter.shell -# ^^^^^ invalid.illegal.parameter.shell -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -exec -al name -#^^^ meta.function-call.identifier.shell -# ^^^^^ meta.function-call.arguments.shell -# ^^^^ meta.function-call.identifier.shell -#^^^ support.function.exec.shell -# ^^^ invalid.illegal.parameter.shell -# ^^^^ variable.function.shell +case "$1" in +# <- keyword.control.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell punctuation.definition.variable.shell +# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^^ keyword.control.in.shell +setup ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns.end.shell +echo Preparing the server... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +dep\ +loy ) +# <- - variable.function - support.function - meta.function-call +# ^ keyword.control.conditional.patterns.end.shell +echo Deploying... +# <- meta.function-call support.function.echo +# ^^^^^^^^^^^^^ meta.function-call.arguments +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +* ) +# <- constant.other.wildcard.asterisk.shell +# ^ keyword.control.conditional.patterns.end.shell +cat <<'ENDCAT' +# <- meta.function-call.identifier.shell variable.function.shell +# ^^ meta.function-call.arguments.shell - meta.string - meta.tag +# ^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.definition.tag.begin.shell - entity +# ^^^^^^ entity.name.tag.heredoc.shell +# ^ punctuation.definition.tag.end.shell - entity -exec git diff-index --check --cached $against -- -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call -# <- meta.function-call.identifier.shell support.function.exec.shell -#^^^ meta.function-call.identifier.shell -# ^ meta.function-call.arguments.shell -# ^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# <- support.function.exec.shell -#^^^ support.function.exec.shell -# ^^^ variable.function.shell -# ^^^^^^^ variable.parameter.option.shell -# ^^^^^^^^ variable.parameter.option.shell -# ^^ keyword.operator.end-of-options.shell +foo +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +ENDCAT +# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +esac +# <- meta.conditional.case.shell keyword.control.conditional.end.shell +#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -exec "$cmd" \ -#^^^ meta.function-call.identifier.shell -# ^ meta.function-call.arguments.shell -# ^^^^^^ meta.function-call.identifier.shell meta.string.shell -# ^^^ meta.function-call.arguments.shell -# ^^ punctuation.separator.continuation.line.shell -exec "$cmd" \ - $opts \ -#^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ punctuation.separator.continuation.line.shell +case "${foo}" in- in_ in=10 in +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# <- keyword.control.conditional.case.shell +#^^^ keyword.control.conditional.case.shell +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ keyword.control.in + ( help | h ) bar ;; +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin.shell + # ^ keyword.control.conditional.patterns.end.shell + # ^^ punctuation.terminator.case.clause.shell + do1 ) foo1 ;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # ^ keyword.control.conditional.patterns.end.shell + # ^^ punctuation.terminator.case.clause.shell + (do2 ) foo2 ;;& +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin.shell + # ^ keyword.control.conditional.patterns.end.shell + # ^^^ punctuation.terminator.case.clause.shell + *) bar +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell + #^ keyword.control.conditional.patterns.end.shell +esac +# <- keyword.control.conditional.end.shell -exec "$cmd" \ - $opts \ - --cmd-flag -#^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +case $TERM in + sun-cmd) + # ^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell + *xterm*|rxvt|(dt|k|E)term) + # ^ constant.other.wildcard.asterisk.shell + # ^ keyword.operator.logical.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ punctuation.definition.group.begin.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ keyword.operator.logical.regexp.shell + # ^ punctuation.definition.group.end.regexp.shell + # ^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() { print -Pn "\e]2;%~\a" };; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell + *) + # <- constant.other.wildcard.asterisk.shell + #^ keyword.control.conditional.patterns.end.shell + update_terminal_cwd() {};; + # ^ meta.function punctuation.section.compound.end.shell + # ^^ punctuation.terminator.case.clause.shell +esac +# <- keyword.control.conditional.end.shell -exec \ - -la name \ -#^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^ punctuation.separator.continuation.line.shell +case $SERVER in +# <- keyword.control.conditional.case.shell +ws-+([0-9]).host.com) echo "Web Server" +#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell +# ^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +db-+([0-9])\.host\.com) echo "DB server" +#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell +# ^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +bk-+([0-9])\.host\.com) echo "Backup server" +# ^ keyword.operator.quantifier.regexp.shell +# ^ punctuation.definition.group.begin.regexp.shell +# ^ punctuation.definition.set.begin.regexp.shell +# ^^^ constant.other.range.regexp.shell +# ^ punctuation.separator.sequence.regexp.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ punctuation.definition.group.end.regexp.shell +# ^ keyword.control.conditional.patterns.end.shell +# ^^^^ support.function.echo.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +*)echo "Unknown server" +# <- constant.other.wildcard.asterisk.shell +#^ keyword.control.conditional.patterns.end.shell +# ^^^^ support.function.echo.shell +;; +# <- punctuation.terminator.case.clause.shell +#^ punctuation.terminator.case.clause.shell +esac +# <- keyword.control.conditional.end.shell +#^^^ keyword.control.conditional.end.shell -exec \ - -la name \ - "$cmd" \ -#^ meta.function-call.arguments.shell -# ^^^^^^ meta.function-call.identifier.shell meta.string.shell -# ^^^ meta.function-call.arguments.shell -# ^^ punctuation.separator.continuation.line.shell +case $_G_unquoted_arg in +*[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") +#^ punctuation.definition.set.begin.regexp.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.shell +# ^ punctuation.definition.set.end.regexp.shell +# ^ - keyword.control + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; +*) + _G_quoted_arg=$_G_unquoted_arg +;; +esac +case $1 in +*[\\\`\"\$]*) +#^ punctuation.definition.set.begin.regexp.shell +# ^^^^^^^^ constant.character.escape.shell +# ^ punctuation.definition.set.end.regexp.shell + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; +*) + _G_unquoted_arg=$1 ;; +esac -exec \ - -la name \ - "$cmd" \ - $opts \ -#^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ punctuation.separator.continuation.line.shell -exec \ - -la name \ - "$cmd" \ - $opts \ - --cmd-flag -#^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +############################################################################### +# 3.2.5 Compound Commands # +# 3.2.5.3 Grouping Commands # +# https://www.gnu.org/software/bash/manual/bash.html#Command-Grouping # +############################################################################### +(foo) -o +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^^^ meta.compound.shell meta.function-call.identifier.shell variable.function.shell +# ^ meta.compound.shell punctuation.section.compound.end.shell +# ^^^ meta.compound.arguments.shell -#################################################################### -# export builtin # -#################################################################### +{ foo -o } --opt -- --no-option +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^^^^^^^^^ meta.compound.shell - meta.compound meta.compound +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell - meta.compound meta.compound +# ^ - meta.compound +# ^^^ variable.function.shell +# ^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell +# ^ meta.parameter.option.shell variable.parameter.option.shell - punctuation +# ^ punctuation.section.compound.end.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell punctuation.definition.parameter.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell - punctuation +# ^^ keyword.operator.end-of-options.shell +# ^^^^^^^^^^^ - variable - punctuation -export -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^ - meta.function-call +{ +# <- meta.compound.shell punctuation.section.compound.begin.shell +#^ meta.compound.shell - meta.compound meta.compound + { +#^ meta.compound.shell - meta.compound meta.compound +# ^^ meta.compound.shell meta.compound.shell +# ^ punctuation.section.compound.begin.shell + foo args +#^^^^^^^^^^^^ meta.compound.shell meta.compound.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^ meta.function-call.arguments.shell + } 2>> "$stderr_log" +#^^ meta.compound.shell meta.compound.shell +# ^^^^^^^^^^^^^^^^^^ meta.compound.shell meta.compound.arguments.shell +# ^ meta.compound.shell - meta.compound meta.compound +# ^ punctuation.section.compound.end.shell + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function +} 1>> "$stdout_log" +# <- meta.compound.shell - meta.compound meta.compound +#^^^^^^^^^^^^^^^^^^ meta.compound.arguments.shell +# ^ - meta +# <- punctuation.section.compound.end.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - variable.function -export foo # 'foo' is a variable name -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -export foo bar # 'foo' and 'bar' are variable names -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^ - variable -# ^^^ variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +############################################################################### +# 3.2.6 Coprocesses # +# https://www.gnu.org/software/bash/manual/bash.html#Coprocesses # +############################################################################### -export foo='bar' # 'foo' is a variable name -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.quoted.single.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +coproc +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell keyword.declaration.coproc.shell +# ^ - meta.coproc - keyword -export PGPASSWORD=$(cat "$DOKKU_ROOT/.postgresql/pwd_$APP") -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string - meta.interpolation -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.shell meta.interpolation.command.shell -# ^^^^^^^^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ punctuation.definition.variable.shell -# ^ punctuation.section.interpolation.begin.shell -# ^^^ variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell meta.string.shell +coproc na\ +me args +# <- meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call -export -f foo -# <- meta.function-call.identifier.shell support.function.export.shell -#^^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^ meta.function-call.arguments.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell variable.function.shell +coproc name ar\ +gs +# <- meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call -export PATH="$PATH:$HOME/.local/bin" -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string -# ^ string.quoted.double punctuation.definition.string.begin -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^ string.quoted.double punctuation.separator.sequence -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^^^^^^^^^^^^ string.quoted.double -# ^ punctuation.definition.string.end +coproc sed s/^/foo/ +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell - meta.function-call +# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call +#^^^^^ keyword.declaration.coproc.shell +# ^^^ variable.function.shell -export PATH="$PATH:~/.local/bin" -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^ string.quoted.double punctuation.definition.string.begin -# ^^^^^ meta.interpolation.parameter variable.other.readwrite -# ^ punctuation.definition.variable -# ^ string.quoted.double punctuation.separator.sequence -# ^ punctuation.definition.string.end +coproc ls thisfiledoesntexist; read; 2>&1 +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^^ meta.coproc.command.shell - meta.function-call.identifier.shell +# ^^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^ meta.coproc.command.shell - meta.function-call.identifier.shell +# ^ - meta.coproc +#^^^^^ keyword.declaration.coproc.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -export SOMETHING='/etc/test:/var/test:../foo:./foo' -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^^^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single -# ^ punctuation.definition.string.begin -# ^ punctuation.separator.sequence -# ^ punctuation.separator.sequence -# ^ punctuation.separator.sequence -# ^ punctuation.definition.string.end +coproc awk '{print "foo" $0;fflush()}' +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^^ meta.coproc.command.shell meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.function-call.arguments.shell +# ^ - meta.coproc - meta.function-call +#^^^^^ keyword.declaration.coproc.shell +# ^^^ variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell string.quoted.single.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell -export SOMETHING=/etc/test:/var/test -# ^^^^ meta.function-call.identifier.shell support.function.export.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -# ^^^^^^^^^ meta.variable variable.other.readwrite -# ^ keyword.operator.assignment -# ^^^^^^^^^^^^^^^^^^^ meta.string string.unquoted -# ^ punctuation.separator.sequence +coproc { ls thisfiledoesntexist; read; 2>&1 } | foo +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^ meta.coproc.command.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^^^^ meta.coproc.command.shell - meta.compound +# ^ - meta.function-call - meta.function.coproc +# ^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call.identifier.shell +# ^^^^ meta.function-call.identifier.shell +# ^^^^^^^^ - meta.function-call.identifier.shell +#^^^^^ keyword.declaration.coproc.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.pipe.shell +# ^^^ variable.function.shell -msg="Count: ${count}" -# ^ meta.string string.quoted.double - punctuation.separator +coproc myls { ls thisfiledoesntexist; read; 2>&1 } | foo +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^^^^^^ meta.coproc.identifier.shell - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +#^^^^^ keyword.declaration.coproc.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ support.function.read.shell +# ^ punctuation.terminator.statement.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.pipe.shell +# ^^^ variable.function.shell -url="https://sublimetext.com/" -# ^ meta.string string.quoted.double - punctuation.separator +{ coproc tee { tee logfile ;} >&3 ;} 3>&1 +# <- meta.compound.shell punctuation.section.compound.begin.shell +# ^^^^^^ meta.compound.shell meta.coproc.shell +# ^^^^^ meta.compound.shell meta.coproc.identifier.shell +# ^^^^^^^^^^^^^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.shell +# ^^^^ meta.compound.shell meta.coproc.command.shell meta.compound.arguments.shell +# ^^^ meta.compound.shell - meta.coproc +# ^^^^^ meta.compound.arguments.shell - meta.coproc - meta.function-call +# ^^^^^^ keyword.declaration.coproc.shell +# ^^^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell +# ^^^ variable.function.shell +# ^ punctuation.section.compound.end.shell +# ^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ punctuation.section.compound.end.shell +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -#################################################################### -# local builtin # -#################################################################### +coproc foobar { +# <- meta.coproc.shell keyword.declaration.coproc.shell +#^^^^^ meta.coproc.shell +# ^^^^^^^^ meta.coproc.identifier.shell +# ^^ meta.coproc.command.shell meta.compound.shell +#^^^^^ keyword.declaration.coproc.shell +# ^^^^^^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell + read +#^^^^^^^^ meta.coproc.command.shell meta.compound.shell +# ^^^^ meta.coproc.command.shell meta.compound.shell meta.function-call.identifier.shell support.function.read.shell +} +# <- meta.coproc.command.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta -local -#<- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^ - meta.declaration.variable -local; -#^^^^ keyword.declaration.variable.shell -local& -#^^^^ keyword.declaration.variable.shell -local| -#^^^^ keyword.declaration.variable.shell -local>/dev/null -#^^^^ keyword.declaration.variable.shell -local - -#^^^^ keyword.declaration.variable.shell -local() -#^^^^ keyword.declaration.variable.shell -local[] -#^^^^^^ - storage - keyword.declaration -local{} -#^^^^^^ - storage - keyword.declaration -local- -#^^^^^ - storage - keyword.declaration --local -#^^^^^ - storage - keyword.declaration -local+ -#^^^^^ - storage - keyword.declaration -local$ -#^^^^^ - storage - keyword.declaration -local$var -#^^^^^^^^ - storage - keyword.declaration -local= -#^^^^^ - storage - keyword.declaration -local-= -#^^^^^^ - storage - keyword.declaration -local+= -#^^^^^^ - storage - keyword.declaration -local foo bar # 'foo' and 'bar' are variable names -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +############################################################################### +# 3.3 Shell Functions # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Functions # +############################################################################### -local foo bar='baz' # 'foo' and 'bar' are variable names -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ meta.string.shell string.quoted.single.shell -# ^ - comment - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell + () +#^^ - meta.function +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell -local foo+=10 bar-=true -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^ keyword.operator.assignment.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^^ keyword.operator.assignment.shell -# ^^^^ constant.language.boolean.shell - -local pid="$(cat "$PIDFILE" 2>/dev/null)" -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell + () + {} +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +# ^ - meta.function +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -local -fn foo -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell -# ^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^ meta.variable.shell variable.function.shell + () \ + {} +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +# ^ - meta.function +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -f() { - local -a "$@" - # <- keyword.declaration.variable.shell - #^^^^ keyword.declaration.variable.shell - # ^^ meta.parameter.option.shell variable.parameter.option.shell - # ^^^^ meta.string.shell - local x - # <- keyword.declaration.variable.shell - #^^^^ keyword.declaration.variable.shell - # ^ meta.variable.shell variable.other.readwrite.shell + () { [[ $# == 2 ]] && tput setaf $2 || tput setaf 3; echo -e "$1"; tput setaf 15; } +#^^ source.shell - meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell - meta.function.identifier - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.shell meta.compound.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ - punctuation +# ^ punctuation.section.compound.begin.shell +# ^^ support.function.test.begin +# ^ punctuation.definition.variable +# ^ variable.language +# ^^ keyword.operator.comparison +# ^^ support.function.test.end +# ^^ keyword.operator.logical - for x; do - case $x in - $1) - local "$x"'+=(1)' ;;& - # <- keyword.declaration.variable.shell - # ^^^ punctuation.terminator.case.clause.shell - $2) - local "$x"'+=(2)' ;& - # <- keyword.declaration.variable.shell - # ^^ punctuation.terminator.case.clause.shell - $3) - local "$x"'+=(3)' ;; - # <- keyword.declaration.variable.shell - # ^^ punctuation.terminator.case.clause.shell - $1|$2) - local "$x"'+=(4)' - # <- keyword.declaration.variable.shell - esac - # <- meta.function.shell meta.compound.shell meta.conditional.case.shell - # <- keyword.control.conditional.end.shell + logC () { [[ $# == 2 ]] && tput setaf $2 || tput setaf 3; echo -e "$1"; tput setaf 15; } +#^^ source.shell - meta.function +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# ^^^^ meta.function.identifier.shell +# ^ meta.function.identifier.shell +# ^ meta.function.parameters.shell +# ^ meta.function.parameters.shell +# ^ meta.function.shell - meta.function.identifier - meta.compound +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.shell meta.compound.shell +#^^ - entity +# ^^^^ entity.name.function.shell +# ^ - entity - punctuation +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ - punctuation +# ^ punctuation.section.compound.begin.shell +# ^^ support.function.test.begin.shell +# ^ punctuation.definition.variable.shell +# ^^ variable.language.shell +# ^^ keyword.operator.comparison.shell +# ^^ support.function.test.end.shell +# ^^ keyword.operator.logical.shell - IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' - # ^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^ meta.string.shell string.unquoted.shell - # ^ keyword.declaration.variable.shell - done - # <- meta.function.shell meta.compound.shell - # <- keyword.control.loop.end.shell +logExit ( ) { +# <- source.shell meta.function.identifier.shell entity.name.function.shell +#^^^^^^^^^^^^^ source.shell - meta.function meta.function +#^^^^^^ meta.function.identifier.shell entity.name.function.shell +# ^ meta.function.identifier.shell +# ^^^ meta.function.parameters.shell +# ^ meta.function.shell - meta.compound +# ^^ meta.function.shell meta.compound.shell +#^^^^^^ entity.name.function.shell +# ^ - entity - punctuation +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ punctuation.section.compound.begin.shell + [[ $1 == '0' ]] && tput setaf 2 || tput setaf 1; + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + [[ $1 == '0' ]] && echo -e "$2 PASSED" || echo -e "$2 FAILED"; + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + # ^^ keyword.operator.logical.shell + # ^^^^ meta.function-call.identifier.shell support.function.echo.shell + tput setaf 15; + # <- meta.function meta.function-call variable.function + # ^ meta.function punctuation.terminator.statement + [[ $1 == '0' ]] || exit -1 + #<- meta.conditional.shell support.function.test.begin.shell + #^ meta.conditional.shell support.function.test.begin.shell + # ^^ meta.conditional.shell support.function.test.end.shell + # ^^ keyword.operator.logical.shell + # ^^^^ keyword.control.flow.exit.shell + # ^ keyword.operator.arithmetic.shell + # ^ meta.number.integer.decimal.shell constant.numeric.value.shell } # <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function +logExit $? $WEIRD +# <- meta.function-call.identifier.shell variable.function.shell +#^^^^^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.language.shell +# ^ - meta.interpolation - variable +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.function-call - meta.interpolation - variable -#################################################################### -# readonly builtin # -#################################################################### +function foo +#^^^^^^^^^^^^ source.shell - meta.function meta.function +# <- source.shell meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^ meta.function.identifier.shell +#^^^^^^^ keyword.declaration.function.shell +# ^ - entity - keyword - storage +# ^^^ entity.name.function.shell +# ^ - entity +{ +# <- meta.function.shell meta.compound.shell punctuation.section.compound.begin.shell + foo bar + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- variable.function.shell -readonly foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^^ variable.other.readwrite -# ^ - variable + return 0 + # <- keyword.control.flow.return.shell + #^^^^^ keyword.control.flow.return.shell + # ^ meta.number.integer.decimal.shell constant.numeric.value.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -readonly -f foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^^ meta.declaration.variable.shell -# ^^^^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ meta.variable.shell variable.function.shell -# ^ - variable +# <- - meta.function -foo=`readonly x=5` -# <- variable.other.readwrite -# ^ meta.interpolation.command.shell punctuation.section.interpolation.begin.shell -# ^^^^^^^^ meta.interpolation.command.shell keyword.declaration.variable.shell -# ^ meta.interpolation.command.shell variable.other.readwrite -# ^ meta.interpolation.command.shell keyword.operator.assignment -# ^ meta.string.shell meta.interpolation.command.shell meta.declaration.variable.arguments.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ meta.interpolation.command.shell punctuation.section.interpolation.end.shell +function func\ +name +# <- source.shell meta.function.identifier.shell entity.name.function.shell +function foo ( ) { +#^^^^^^^^^^^^^^^^^^^^^^ source.shell - meta.function meta.function +# <- source.shell meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^ meta.function.identifier.shell +# ^^^^^^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^ - entity.name.function +# ^^^ entity.name.function.shell +# ^ - entity.name.function +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ punctuation.section.compound.begin.shell + echo 'hello from foo' + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- support.function.echo.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -#################################################################### -# typeset builtin # -#################################################################### +# <- - meta.function -typeset foo # 'foo' is a variable name -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^ meta.declaration.variable.arguments.shell -# ^ - meta.declaration.variable -#^^^^^^ keyword.declaration.variable.shell -# ^ - storage - variable -# ^^^ variable.other.readwrite -# ^ - variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +f () ( +# <- meta.function.identifier.shell entity.name.function.shell +#^ meta.function.identifier.shell - entity - punctuation +# ^^ meta.function.parameters.shell +# ^ meta.function.shell - meta.compound +# ^ meta.function.shell meta.compound.shell punctuation.section.compound.begin.shell + echo hello + # <- meta.function.shell meta.compound.shell meta.function-call.identifier.shell + # <- support.function.echo.shell +) +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -typeset -f _init_completion > /dev/null && complete -F _upto upto -# <- meta.declaration.variable.shell keyword.declaration.variable.shell -#^^^^^^ meta.declaration.variable.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell -# ^^^^ - meta.declaration - meta.function-call -# ^^^^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^^^ keyword.declaration.variable.shell -# ^^ variable.parameter.option.shell -# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^ variable.function.shell -# ^^ variable.parameter.option.shell - - -#################################################################### -# test builtin # -#################################################################### +function f ( +# <- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^ meta.function.identifier.shell +# ^^ meta.function.shell meta.compound.shell +#^^^^^^^ keyword.declaration.function.shell +# ^ entity.name.function.shell +# ^ punctuation.section.compound.begin.shell + echo hello + # <- meta.function meta.function-call support.function.echo +) +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -test -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^ - meta.function-call -test; -#^^^ support.function.test.shell -test& -#^^^ support.function.test.shell -test| -#^^^ support.function.test.shell -test>/dev/null -#^^^ support.function.test.shell -test - -#^^^ support.function.test.shell -test() -#^^^ support.function.test.shell -test[] -#^^^^^ - support.function -test{} -#^^^^^ - support.function -test- -#^^^^ - support.function --test -#^^^^ - support.function -test+ -#^^^^ - support.function -test$ -#^^^^ - support.function -test$var -#^^^^^^^ - support.function -test= -#^^^^ - support.function -test-= -#^^^^^ - support.function -test+= -#^^^^^ - support.function +function foo { +# <- meta.function.shell keyword.declaration.function.shell + function bar { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call -test $var != 0 -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp -# ^ - meta.function-call -# ^^ keyword.operator.comparison.shell -# ^ constant.numeric.value.shell + bar () { + # <- meta.function meta.function + echo "baz" + } + bar + # <- meta.function meta.function-call + function function + # <- meta.function meta.function + # ^ - entity.name.function + # ^^^^^^^^ entity.name.function + # ^ - entity.name.function + { + echo "Hello! From 'function'!" + } + "function" + # <- meta.function meta.function-call +} -test $var == true -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp -# ^^ keyword.operator.comparison.shell -# ^^^^ constant.language.boolean.shell +# <- - meta.function -test str == "str" -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ string.quoted.double.shell +foo=$( + # ^ punctuation.section.interpolation.begin.shell + func() { + # <- meta.function entity.name.function + # ^ punctuation.section + echo bar + } + # <- punctuation.section + func -test var[0] != var[^0-9]*$ -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp + # <- meta.interpolation.command +) +# <- punctuation.section.interpolation.end.shell +echo $foo # prints "bar" -test ${var[0]} != var[^0-9]*$ -#<- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^ meta.interpolation.parameter.shell -# ^^^ variable.other.readwrite.shell -# ^^^ meta.item-access.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp +# <- - meta.function - meta.interpolation -test expr -a expr -o expr -- | cmd |& cmd -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ - keyword -# ^ keyword.operator.assignment.pipe.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.assignment.pipe.shell +foo:foo () { + # <- meta.function entity.name.function + echo "this foo:foo" +} +~ () { +# <- meta.function entity.name.function + echo "this is ~" +} +"~" +# <- meta.function-call.identifier.shell meta.string.shell variable.function.shell punctuation.definition.string.begin.shell +#^^ meta.function-call.identifier.shell meta.string.shell variable.function.shell +^ () { +# <- meta.function entity.name.function + echo "this is ^" +} +^ +# <- meta.function-call.identifier.shell variable.function.shell +@ () { +# <- meta.function entity.name.function + echo "this is @" +} +@ +# <- meta.function-call.identifier.shell variable.function.shell -test ! $line == ^[0-9]+$ -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell - meta.function-call.arguments -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier -# ^ - meta.function-call -#^^^ support.function.test.shell -# ^ keyword.operator.logical.shell -# ^^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell +function () () +# <- meta.function.identifier.shell entity.name.function.shell +function () {} +# <- meta.function.identifier.shell entity.name.function.shell -test ! $line =~ ^[0-9]+$ >> /file -# <- meta.function-call.identifier.shell support.function.test.shell -#^^^ meta.function-call.identifier.shell - meta.function-call.arguments -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier - meta.group -# ^ - meta.function-call -#^^^ support.function.test.shell -# ^ keyword.operator.logical.shell -# ^^^^^ variable.other.readwrite.shell -# ^^ invalid.illegal.operator.shell -# ^^^^^^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.assignment.redirection.shell +function 7zip { +# <- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell keyword.declaration.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^^^ entity.name.function.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +7zip +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -if test expr -a expr ; then echo "success"; fi -# ^ - meta.function-call -# ^^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^^^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^ support.function.echo.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +function [] () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from []" +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +[] +# <- meta.function-call.identifier.shell variable.function.shell +#^ meta.function-call.identifier.shell variable.function.shell -if test "$VAR" != ";";then;fi -# ^ - meta.function-call -# ^^^^ meta.function-call.identifier.shell support.function.test.shell -# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^^^ meta.string.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.quoted.double.shell -# ^^^^^^^^ - meta.function-call -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +function [[]] () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from [[]]" +} +[[]] +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -let test -z $2 && { } -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^ - meta.function-call - meta.compound -# ^^^ meta.compound.shell - meta.function-call -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^ punctuation.section.compound.end.shell - -let $var == test -z $5 && cmd -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^ - meta.function-call -# ^^^ meta.function-call.identifier.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^^^ variable.function.shell - -let 'test -z $2 && { }' -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^ - meta.compound -# ^ - meta.function-call -# ^ string.quoted.single.shell punctuation.definition.string.begin.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.logical.shell -# ^ string.quoted.single.shell punctuation.definition.string.end.shell +function {} () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from {}" +} +{} +# <- meta.function-call.identifier.shell variable.function.shell +#^ meta.function-call.identifier.shell variable.function.shell -let '$var == test -z \'$5\' && cmd' -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^ string.quoted.single.shell punctuation.definition.string.begin.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ constant.character.escape.shell -# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ constant.character.escape.shell -# ^^ keyword.operator.logical.shell -# ^^^ - variable.function -# ^ string.quoted.single.shell punctuation.definition.string.end.shell +function {{}} () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from {{}}" +} +{{}} +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -let "$var != test -z '$5' && cmd" -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell -# ^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell -# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call -# ^ string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^ support.function.test.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ string.quoted.single.shell -# ^^ keyword.operator.logical.shell -# ^^^ - variable.function -# ^ string.quoted.double.shell punctuation.definition.string.end.shell +function -foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from -foo" +} +-foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell +function +foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from +foo" +} ++foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -#################################################################### -# unalias builtin # -#################################################################### +function =foo () { +#<- meta.function.shell keyword.declaration.function.shell +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +#^^^^^^^ keyword.declaration.function.shell +# ^^^^ entity.name.function.shell +# ^ punctuation.section.parameters.begin.shell +# ^ punctuation.section.parameters.end.shell +# ^ meta.compound.shell punctuation.section.compound.begin.shell + echo "Hello from =foo" +} +=foo +# <- meta.function-call.identifier.shell variable.function.shell +#^^^ meta.function-call.identifier.shell variable.function.shell -unalias -unalias -a -b -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^^ variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell +function fo${bar}'baz' () {} +# ^^^ meta.function.identifier.shell - meta.interpolation - meta.string +# ^^^^^^ meta.function.identifier.shell meta.interpolation.parameter.shell - meta.string +# ^^^^^ meta.function.identifier.shell meta.string.shell - meta.interpolation +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^ entity.name.function.shell +# ^^^^^^ - entity.name +# ^^^^^ entity.name.function.shell -unalias foo -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable +# Functions may replace booleans. Won't respect that in function calls though. +function true () {} ; function false () {} +#^^^^^^^ meta.function.shell +# ^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^ - meta.function +# ^^^^^^^^ meta.function.shell +# ^^^^^^^ meta.function.identifier.shell +# ^^ meta.function.parameters.shell +# ^^^ meta.function.shell +# ^^^^ entity.name.function.shell +# ^^^^^ entity.name.function.shell +# ^ punctuation.terminator.statement.shell -unalias foo # comment -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^^^^^^^^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^^^^^^ comment.line.number-sign.shell +__git_aliased_command () +{ + local word cmdline=$(__git config --get "alias.$1") + for word in $cmdline; do + case "$word" in + {) : skip start of shell helper function ;; +# ^ - punctuation.section.interpolation.begin +# ^ keyword.control.conditional.patterns.end.shell + \'*) : skip opening quote after sh -c ;; + *) + echo "$word" + return + esac + done +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell +#^ - meta.function -unalias foo b"a"r b'a'z 7za -# <- meta.function-call.identifier.shell support.function.unalias.shell -#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^^^ entity.name.function.shell -# ^ - meta.variable - variable -# ^^^ entity.name.function.shell -# ^ - meta.variable - variable +# <- - meta.function -#################################################################### -# unset builtin # -#################################################################### - -unset -unset foo b'a'r ba${z} # 'foo' and 'bar' are variable names -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ meta.variable.shell - meta.string -# ^^^ meta.variable.shell meta.string.shell -# ^ meta.variable.shell - meta.string -#^^^^ support.function.unset.shell -# ^ - meta.variable - support - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - meta.variable - variable -# ^^^^^ variable.other.readwrite.shell -# ^ punctuation.definition.string.begin.shell -# ^ punctuation.definition.string.end.shell -# ^ - meta.variable - variable -# ^^ meta.variable.shell - meta.interpolation -# ^^^^ meta.variable.shell meta.interpolation.parameter.shell -# ^ - meta.variable - variable -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell - -unset -n -unset -nfv foo -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^^^ support.function.unset.shell -# ^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ - variable - -unset -f -n -v foo b'a'r; unset -vn foo 2>& /dev/null -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call -# ^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ - meta.string -# ^^^ meta.string.shell -# ^ - meta.string -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ - variable -# ^^^^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^^ support.function.unset.shell -# ^ - support - variable -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ - variable -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ keyword.operator.assignment.redirection.shell - -unset -f -x +v -- foo bar; unset -vn -- foo -# <- meta.function-call.identifier.shell support.function.unset.shell -#^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ - meta.function-call -# ^^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ - variable -# ^^ keyword.operator.end-of-options.shell -# ^^^ variable.function.shell -# ^ - variable -# ^^^ variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^^ support.function.unset.shell -# ^ - support - variable -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^ - variable -# ^^ keyword.operator.end-of-options.shell -# ^^^ meta.variable.shell variable.other.readwrite.shell -# ^ - variable - -unset- -# <- - support.function -unset+ -# <- - support.function -unset() -# <- support.function.unset.shell -unset[] -# <- - support.function -unset{} -# <- - support.function -unset= -# <- - support.function -unset+= -# <- - support.function -unset-= -# <- - support.function - - -#################################################################### -# Linux builtins # -#################################################################### - -sudo rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^ meta.function-call.arguments.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - -sudo -b -g network --host=$foo rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^^^^^^^ meta.string.shell string.unquoted.shell -# ^^^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ punctuation.definition.parameter.shell -# ^ keyword.operator.assignment.shell -# ^^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^ variable.function.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - -sudo --reset-timestamp -n -f -- rm -rf -# <- meta.function-call.identifier.shell support.function.sudo.shell -#^^^ meta.function-call.identifier.shell support.function.sudo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^^^^^^^^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ invalid.illegal.parameter.shell -# ^^ keyword.operator.end-of-options.shell -# ^^ variable.function.shell -# ^^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell - - -#################################################################### -# Variable assignments # -#################################################################### +############################################################################### +# 3.4 Shell Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameters # +############################################################################### x= # some comment #^ keyword.operator.assignment.shell @@ -2928,29 +3034,42 @@ commits=($(git rev-list --reverse --$abbrev-commit "$latest".. -- "$prefix")) # <- - variable.other.readwrite -#################################################################### -# Variables # -#################################################################### +############################################################################### +# 3.4.1 Positional Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Positional-Parameters # +############################################################################### -: $__ -# ^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +: $1 $2 $3 $45 $678 +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ - meta.interpolation - variable +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^ - meta.interpolation - variable -: $var_0 -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# When a positional parameter consisting of more than a single digit is expanded, +# it must be enclosed in braces. +: ${45} ${678} +# ^^^^^ meta.interpolation.parameter.shell # ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +# ^ punctuation.section.interpolation.begin.shell +# ^^ variable.other.readwrite.shell +# ^ punctuation.section.interpolation.end.shell +# ^^^^^^ meta.interpolation.parameter.shell +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^ variable.other.readwrite.shell +# ^ punctuation.section.interpolation.end.shell -: $_var0 -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable -: $_0var_ -# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ - meta.interpolation - variable +############################################################################### +# 3.4.2 Special Parameters # +# https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters # +############################################################################### # Expands to the positional parameters, starting from one. When the expansion is # not within double quotes, each positional parameter expands to a separate @@ -3024,40 +3143,31 @@ commits=($(git rev-list --reverse --$abbrev-commit "$latest".. -- "$prefix")) # ^^ meta.interpolation.parameter.shell variable.language.shell # ^ punctuation.definition.variable.shell -fg % -# ^ meta.interpolation.job.shell variable.other.readwrite.shell punctuation.definition.variable.shell -fg %% -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %+ -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %- -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %1 %2 %3 -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -# ^^ meta.interpolation.job.shell variable.language.job.shell -# ^ punctuation.definition.variable.shell -fg %ce -# ^^^ meta.interpolation.job.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -fg %?ce -# ^^^^ meta.interpolation.job.shell variable.other.readwrite.shell -# ^ punctuation.definition.variable.shell -# ^ keyword.operator.match.shell -%1 -# <- meta.interpolation.job.shell variable.language.job.shell punctuation.definition.variable.shell -#^ meta.interpolation.job.shell variable.language.job.shell +############################################################################### +# 3.5.3 Shell Parameter Expansion # +# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion# +############################################################################### + +: $__ +# ^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable + +: $var_0 +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable +: $_var0 +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable -#################################################################### -# Strings and interpolation in parameter expansion # -#################################################################### +: $_0var_ +# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ punctuation.definition.variable.shell +# ^ - meta.interpolation - variable ${foo:=bar} # <- meta.function-call.identifier.shell meta.interpolation.parameter.shell punctuation.definition.variable.shell @@ -3436,9 +3546,9 @@ ${foo:=bar} # ^ - keyword -#################################################################### +############################################################################### # Braces in parameter expansion # -#################################################################### +############################################################################### : ${foo//foo\}foo\/foo/foo} # ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.parameter.shell @@ -3560,10 +3670,10 @@ ${var%%%Pattern} # ^ comment.line punctuation -#################################################################### -# Parameter-expansion operators # -# cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # -#################################################################### +############################################################################### +# Parameter-expansion operators # +# cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # +############################################################################### ${foo//%/} # <- meta.function-call.identifier.shell meta.interpolation.parameter.shell punctuation.definition.variable.shell @@ -3852,9 +3962,10 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^^ punctuation.section.interpolation.end.shell -#################################################################### -# [3.5.8.1] Pattern Matching # -#################################################################### +############################################################################### +# 3.5.8.1 Pattern Matching # +# https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching # +############################################################################### : @([^:]*) #^^^^^^^^^ meta.function-call.arguments.shell @@ -4058,9 +4169,12 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ - keyword.control # ^ punctuation.section.interpolation.end.shell -#################################################################### -# Bash pattern matching in test expressions # -#################################################################### + +############################################################################### +# 3.5.8.1 Pattern Matching # +# https://www.gnu.org/software/bash/manual/bash.html#Pattern-Matching # +# in test expressions # +############################################################################### [[ abc == ?[a-z]? ]] # evaluates to true # ^ meta.string.regexp.shell - meta.set @@ -4205,45 +4319,12 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ punctuation.definition.group.end.regexp.shell # ^^ support.function.test.end.shell -[[ $foo == 'bar' || $foo == "baz" && $bar == baz ]] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.regexp.shell -# ^^ support.function.test.end.shell - -[[ ( $foo == 'bar' || $foo == "baz" ) && $bar == baz ]] -# <- meta.conditional.shell support.function.test.begin.shell -#^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell meta.group.shell -# ^^^^^^^^^^^^^^^^^^ meta.conditional.shell - meta.group -# ^ punctuation.section.group.begin.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.regexp.shell -# ^ punctuation.section.group.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.regexp.shell -# ^^ support.function.test.end.shell -#################################################################### -# POSIX extended regular expression pattern matching # -#################################################################### +############################################################################### +# POSIX extended regular expression pattern matching # +# https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions +# in test expressions # +############################################################################### [[ a =~ [ ]] #^^^^^^^^^^^ meta.conditional.shell @@ -4851,16 +4932,6 @@ echo ca{${x/z/t}" "{legs,f${o//a/o}d,f${o:0:1}t},r" "{tires,wh${o//a/e}ls}} # ^ punctuation.definition.literal.end.shell # ^ keyword.control.anchor.regexp.shell -[[ '-e' == -e ]] # -e undergoes pattern matching on the right -# ^^^^ meta.string.shell string.quoted.single.shell -# ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell meta.string.regexp.shell - variable - -[[ -e == -e ]] # a syntax error in bash but allowed in zsh -# ^^ - variable.parameter.option -# ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell meta.string.regexp.shell - variable - echo '([^.[:space:]]+) Class::method()' # colon not scoped as path separator # ^^^^^^^^^^^^^^^^^^^^^ string.quoted.single - punctuation.separator.sequence @@ -4900,1900 +4971,1934 @@ echo '([^.[:space:]]+) Class::method()' # colon not scoped as path separator # ^^^ meta.string.regexp.shell # ^^ support.function.test.end.shell -#################################################################### -# 6.4 Bash Conditional Expressions # -#################################################################### -[ ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^ meta.conditional.shell -# ^ support.function.test.end.shell +############################################################################### +# 3.6 Redirections # +# https://www.gnu.org/software/bash/manual/bash.html#Redirections # +############################################################################### -[ -a file ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^ meta.conditional.shell - -[ -v varname ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell +function show_help() { + echo "Usage: imgcat [-p] filename ..." 1>& 2 + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell + echo " or: cat filename | imgcat" 1>& 2 + # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +} -[ file1 -ef file2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +foo 2>&1 +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +foo 2>&- +# ^ punctuation.terminator +foo | bar 2>&1 +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +foo | bar --opt1 arg1 < file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo | bar --opt1 arg1 > file.txt +# ^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &>/dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +foo -x arg1 &> /dev/null +# ^^ meta.function-call.arguments keyword.operator.assignment.redirection +tr "o" "a" < <(echo "Foo") +# ^ keyword.operator.assignment.redirection - keyword.operator.assignment.redirection.process +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ support.function +# ^ punctuation +wc <(cat /usr/share/dict/linux.words) +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ variable.function +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ meta.function-call.arguments meta.function-call.arguments +# ^ punctuation +comm <(ls -l) <(ls -al) +# ^^^^^^^ meta.compound.shell +# ^^ - meta.compound +# ^^^^^^^^ meta.compound.shell +# ^ - meta.compound +# ^ keyword.operator.assignment.redirection.process.shell +# ^ punctuation.section.compound.begin.shell +# ^^ variable.parameter +# ^ punctuation.section.compound.end.shell +# ^ keyword.operator.assignment.redirection.process.shell +# ^ punctuation.section.compound.begin.shell +# ^ variable.function +# ^^^ variable.parameter +# ^ punctuation.section.compound.end.shell +gzip | tee >(md5sum - | sed 's/-$/mydata.lz2/'>mydata-gz.md5) > mydata.gz +# ^ keyword.operator.assignment.pipe.shell +# ^ keyword.operator.assignment.redirection.process +# ^ punctuation +# ^ keyword.operator.assignment.pipe.shell +# ^ keyword.operator.assignment.redirection +# ^ punctuation +# ^ keyword.operator.assignment.redirection +LC_ALL=C 2> /dev/null +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ keyword.operator.assignment.redirection +# ^ - variable.function +2>&1 echo foo +# <- meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +#^^ keyword.operator.assignment.redirection +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^^^ meta.function-call support.function.echo +# ^^^^ meta.function-call.arguments +touch file.txt +foo=x &${tee[1]} 2>&1 +# ^^^ meta.function-call.arguments.shell - meta.interpolation +# ^^^^^^^^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell +# ^^^^^ meta.function-call.arguments.shell - meta.interpolation +# ^^ keyword.operator.assignment.redirection +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell -[ file1 -ot file2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^^^ keyword.operator.comparison.shell -# ^^^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell -[ ! str != str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^^^ meta.conditional.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +############################################################################### +# 3.6.6 Here Documents # +# https://www.gnu.org/software/bash/manual/bash.html#Here-Documents # +############################################################################### -[ str != str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +var=world! +cat < foo.txt +#^^^^^^ - meta.string - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^^^^^^^^^^^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^ - entiy - keyword +# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entiy - keyword +# ^ keyword.operator.assignment.redirection.shell +# ^^^^^^^ - variable.function +hello +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +redirection_comes_next +#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -[ str > str ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^ meta.conditional.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ keyword.operator.comparison.shell -# ^^^ meta.string.shell string.unquoted.shell -# ^ support.function.test.end.shell +cat << FARAWAY +#^^^^^^^^^^ - meta.string - meta.tag +# ^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^ keyword.operator.assignment.redirection.shell +# ^^^^^ - entiy - keyword +# ^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entity +foo +# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell +FARAWAY +#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -[ $arg -lt 2 ] -# <- meta.conditional.shell support.function.test.begin.shell -#^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^ variable.other.readwrite.shell -# ^^^ keyword.operator.comparison.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ support.function.test.end.shell +cat <<- INDENTED +#^^^^^^^ - meta.string - meta.tag +# ^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^^ keyword.operator.assignment.redirection.shell +# ^ - entity - keyword +# ^^^^^^^^ entity.name.tag.heredoc.shell +# ^ - entity + say what now ${foo} +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation +# ^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.parameter.shell - string + INDENTED +# <- meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag +#^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -#################################################################### -# Bash Numeric Constants # -#################################################################### +cat <<- 'indented_without_expansions' +#^^^^^^^^ - meta.string - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc +# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc +# ^^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.definition.tag.begin.shell - entity +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell +# ^ punctuation.definition.tag.end.shell - entity + ${foo} +#^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation +# ^^^ - variable.other + indented_without_expansions +#^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -true false -# <- constant.language.boolean.shell -#^^^ constant.language.boolean.shell -# ^ - constant -# ^^^^^ constant.language.boolean.shell -# ^ - constant +variable=$(cat <$dummy.c +#^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - string.unquoted.heredoc +# ^^^^^^^^^^^ meta.string.shell string.quoted.single.shell +# ^^^^ - meta.string +# ^^^ meta.string.heredoc.shell meta.tag.heredoc.shell +# ^^^^^^^^^^ meta.string.heredoc.shell - meta.tag +# ^^ keyword.operator.assignment.redirection.shell +# ^^^ entity.name.tag.heredoc.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF +# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +#^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell +# ^ - meta.function-call - meta.string - meta.tag - entity -(( 0xDEADBEEF 0xdeadbeef 0x1234567890abcdefg )) -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^ - meta.number - constant -# ^^ meta.number.integer.hexadecimal.shell constant.numeric.base.shell -# ^^^^^^^^^^^^^^^^ meta.number.integer.hexadecimal.shell constant.numeric.value.shell -# ^^^^ - meta.number - constant -(( 64#123@_ )) -# ^^^ meta.number.integer.other.shell constant.numeric.base.shell -# ^^^^^ meta.number.integer.other.shell constant.numeric.value.shell +############################################################################### +# 4.2 Bash Builtin Commands (alias) # +# https://www.gnu.org/software/bash/manual/bash.html#index-alias # +# https://www.gnu.org/software/bash/manual/bash.html#Aliases # +############################################################################### +alias +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^ - meta.declaration.alias - storage -#################################################################### -# Arithmetic tests # -#################################################################### +alias foo=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a=b, a*=b, a/=b, a%=b, a+=b, a-=b, a<<=b, a>>=b, a&=b, a^=b, a|=b )) -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ variable.other.readwrite.shell -# ^ meta.arithmetic punctuation.separator -# ^ variable.other.readwrite.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^ variable.other.readwrite.shell -# ^ meta.arithmetic punctuation.separator -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic -# ^^ keyword.operator.assignment.augmented.shell -# ^ meta.arithmetic punctuation.separator -# ^^ keyword.operator.assignment.augmented.shell -# ^^^ keyword.operator.assignment.augmented.shell -# ^^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -# ^^ keyword.operator.assignment.augmented.shell -(( a++ a ++ )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( a-- a -- )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( ++a ++ a )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell -(( --a -- a )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell - -(( a/b a / b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a%b a % b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a+b a + b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a-b a - b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a*b a * b )) -# ^ keyword.operator.arithmetic.shell -# ^ keyword.operator.arithmetic.shell -(( a**16 a ** 16 )) -# ^^ keyword.operator.arithmetic.shell -# ^^ keyword.operator.arithmetic.shell +alias f'o'o=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^^^ meta.variable.shell entity.name.function.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( ~1 )) -# ^ keyword.operator.bitwise.shell -(( a&b a & b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a^b a ^ b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a|b a | b)) -# ^ keyword.operator.bitwise.shell -# ^ keyword.operator.bitwise.shell -(( a<<12 a << 16 )) -# ^^ keyword.operator.bitwise.shell -# ^^ keyword.operator.bitwise.shell -(( a>>14 a >> 14 )) -# ^^ keyword.operator.bitwise.shell -# ^^ keyword.operator.bitwise.shell +alias -p foo=bar 7za=qux +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a<=b a <= b )) -# ^^ keyword.operator.comparison.shell -# ^^ keyword.operator.comparison.shell -(( a>=b a >= b )) -# ^^ keyword.operator.comparison.shell -# ^^ keyword.operator.comparison.shell -(( ab a > b )) -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.comparison.shell +alias -a -p -- foo=bar baz=qux +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^ invalid.illegal.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( !1 ! 1 )) -# ^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -(( a&&b a && b )) -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -(( a||b a || b )) -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell +alias $foo=bar +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell +# ^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^ - meta.declaration.alias +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^ meta.string.shell string.unquoted.shell -(( a ? 0 : 1 )) -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -(((a>b) ? (a>c?a:c) : (b>c?b:c))) -# <- meta.arithmetic.shell punctuation.section.arithmetic.begin.shell - meta.group -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# ^^^^^ meta.group.shell -# ^^^ - meta.group.shell -# ^^^^^^^^^ meta.group.shell -# ^^^ - meta.group.shell -# ^^^^^^^^^ meta.group.shell -# ^^ - meta.group.shell -#^ punctuation.section.arithmetic.begin.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ punctuation.section.group.end.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.end.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.begin.shell -# ^ keyword.operator.comparison.shell -# ^ keyword.operator.ternary.shell -# ^ keyword.operator.ternary.shell -# ^ punctuation.section.group.end.shell -# ^^ punctuation.section.arithmetic.end.shell +alias ..='cd ..' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell string.quoted.single.shell -((a+=b)) -# ^ - string.unquoted +alias -p ..='cd ..' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^ meta.string.shell string.quoted.single.shell -let 5 \ - + 5 -#^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell +alias -- -='cd -' +# <- meta.declaration.alias.shell keyword.declaration.alias.shell +#^^^^ meta.declaration.alias.shell keyword.declaration.alias.shell +# ^^^^^^^^^^^^ meta.declaration.alias.arguments.shell +# ^^ keyword.operator.end-of-options.shell +# ^ meta.variable.shell entity.name.function.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^ meta.string.shell string.quoted.single.shell -let 5+5 # comment -#^^ meta.function-call.identifier.shell -# ^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^ support.function.let.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -let var[10]=5*(20+$idx) -#^^ meta.function-call.identifier.shell support.function.let.shell -# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^^^ meta.item-access.shell -# ^ punctuation.section.item-access.begin.shell -# ^^ meta.string.shell string.unquoted.shell -# ^ punctuation.section.item-access.end.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ punctuation.section.group.begin.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^^^^ variable.other.readwrite.shell -# ^ punctuation.section.group.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (declare) # +# https://www.gnu.org/software/bash/manual/bash.html#index-declare # +############################################################################### -let "two=5+5"; if [[ "$X" == "1" ]]; then X="one"; fi -#^^ meta.function-call.identifier.shell -# ^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call -#^^ support.function.let.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^^^^^^^ meta.string.shell meta.interpolation.shell - string -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.arithmetic.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^ string.quoted.double.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +declare # comment +#<- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^ comment.line.number-sign.shell +declare foo # 'foo' is a variable name +#^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# <- keyword.declaration.variable.shell +# ^ - variable.other.readwrite +# ^ - meta.declaration.variable -#################################################################### -# Command chaining operators | and, or, pipe, redirection # -#################################################################### +declare +A # this is a comment +#^^^^^^ meta.declaration.variable.shell +# ^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -function show_help() { - echo "Usage: imgcat [-p] filename ..." 1>& 2 - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell - echo " or: cat filename | imgcat" 1>& 2 - # ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -} -cmd1 --opt1 arg1 | cmd2 --opt2 arg2 | cmd3 --opt3 arg3 -# ^ meta.function-call.identifier.shell variable.function.shell -# ^ variable.parameter - variable.function -# ^ - variable -# ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable - # ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable -C2=c2 C3=c3 C4=c4 -c1 -c1 c1 && ${C2} -c2 c2 || c3 -c3 ${C3} ; c4 -${C4} c4 | c5 -c5 c5 -#^ meta.function-call.identifier.shell variable.function.shell -# ^ variable.parameter - variable.function -# ^ - variable -# ^ keyword - # ^ meta.function-call.identifier.shell meta.interpolation.parameter.shell - # ^ variable.parameter - variable.function - # ^ - variable - # ^ keyword - # ^ meta.function-call.identifier.shell variable.function.shell - # ^ variable.parameter - variable.function - # ^ - variable.parameter - # ^ punctuation.terminator.statement.shell - # ^^ variable.function - # ^ variable.parameter +declare -A foo bar # 'foo' and 'bar' are variable names +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -foo 2>&1 -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -foo 2>&- -# ^ punctuation.terminator -foo | bar 2>&1 -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -# ^ meta.function-call.arguments meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -foo | bar --opt1 arg1 < file.txt -# ^ meta.function-call.arguments keyword.operator.assignment.redirection -foo | bar --opt1 arg1 > file.txt -# ^ meta.function-call.arguments keyword.operator.assignment.redirection -foo -x arg1 &>/dev/null -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -foo -x arg1 &> /dev/null -# ^^ meta.function-call.arguments keyword.operator.assignment.redirection -tr "o" "a" < <(echo "Foo") -# ^ keyword.operator.assignment.redirection - keyword.operator.assignment.redirection.process -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ support.function -# ^ punctuation -wc <(cat /usr/share/dict/linux.words) -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ variable.function -# ^ meta.function-call.arguments meta.function-call.arguments -# ^ meta.function-call.arguments meta.function-call.arguments -# ^ punctuation -comm <(ls -l) <(ls -al) -# ^^^^^^^ meta.compound.shell -# ^^ - meta.compound -# ^^^^^^^^ meta.compound.shell -# ^ - meta.compound -# ^ keyword.operator.assignment.redirection.process.shell -# ^ punctuation.section.compound.begin.shell -# ^^ variable.parameter -# ^ punctuation.section.compound.end.shell -# ^ keyword.operator.assignment.redirection.process.shell -# ^ punctuation.section.compound.begin.shell -# ^ variable.function -# ^^^ variable.parameter -# ^ punctuation.section.compound.end.shell -gzip | tee >(md5sum - | sed 's/-$/mydata.lz2/'>mydata-gz.md5) > mydata.gz -# ^ keyword.operator.assignment.pipe.shell -# ^ keyword.operator.assignment.redirection.process -# ^ punctuation -# ^ keyword.operator.assignment.pipe.shell -# ^ keyword.operator.assignment.redirection -# ^ punctuation -# ^ keyword.operator.assignment.redirection -LC_ALL=C 2> /dev/null -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ keyword.operator.assignment.redirection -# ^ - variable.function -2>&1 echo foo -# <- meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -#^^ keyword.operator.assignment.redirection -# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell -# ^^^^ meta.function-call support.function.echo -# ^^^^ meta.function-call.arguments -touch file.txt -foo=x /dev/null && complete -F _upto upto +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^ - meta.declaration - meta.function-call +# ^^^^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option.shell +# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^ variable.function.shell +# ^^ variable.parameter.option.shell + +printFunction "$variableString1" "$(declare -p variableArray)" +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option +# ^^^^^^^^^^^^^ variable.other.readwrite +# ^ punctuation.section.interpolation.end.shell + +# <- - variable.other +printFunction "$variableString1" "`declare -p variableArray`" +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell - string +# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option +# ^^^^^^^^^^^^^ variable.other.readwrite +# ^ punctuation.section.interpolation.end.shell + + +############################################################################### +# 4.2 Bash Builtin Commands (exec) # +# https://www.gnu.org/software/bash/manual/bash.html#index-exec # +############################################################################### + +exec +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell support.function.exec.shell + +exec -- +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +#^^^ support.function.exec.shell +# ^^^ meta.function-call.arguments.shell +# ^^ keyword.operator.end-of-options.shell + +exec 3<&- +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^ constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell +# ^ punctuation.terminator.file-descriptor.shell + +exec -- foo bar +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell + +exec -c -l -a name git status +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^ meta.function-call.arguments.shell +# <- support.function.exec.shell +#^^^ support.function.exec.shell +# ^^ variable.parameter.option.shell +# ^^ variable.parameter.option.shell +# ^^ variable.parameter.option.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^^ variable.function.shell + +exec -la name -i --bar -- foo bar +#^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +#^^^ support.function.exec.shell +# ^^^ variable.parameter.option.shell +# ^^^^ string.unquoted.shell +# ^^ invalid.illegal.parameter.shell +# ^^^^^ invalid.illegal.parameter.shell +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell + +exec -al name +#^^^ meta.function-call.identifier.shell +# ^^^^^ meta.function-call.arguments.shell +# ^^^^ meta.function-call.identifier.shell +#^^^ support.function.exec.shell +# ^^^ invalid.illegal.parameter.shell +# ^^^^ variable.function.shell + +exec git diff-index --check --cached $against -- +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call +# <- meta.function-call.identifier.shell support.function.exec.shell +#^^^ meta.function-call.identifier.shell +# ^ meta.function-call.arguments.shell +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# <- support.function.exec.shell +#^^^ support.function.exec.shell +# ^^^ variable.function.shell +# ^^^^^^^ variable.parameter.option.shell +# ^^^^^^^^ variable.parameter.option.shell +# ^^ keyword.operator.end-of-options.shell + +exec "$cmd" \ +#^^^ meta.function-call.identifier.shell +# ^ meta.function-call.arguments.shell +# ^^^^^^ meta.function-call.identifier.shell meta.string.shell +# ^^^ meta.function-call.arguments.shell +# ^^ punctuation.separator.continuation.line.shell + +exec "$cmd" \ + $opts \ +#^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ punctuation.separator.continuation.line.shell + +exec "$cmd" \ + $opts \ + --cmd-flag +#^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell + +exec \ + -la name \ +#^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ meta.string.shell string.unquoted.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ +#^ meta.function-call.arguments.shell +# ^^^^^^ meta.function-call.identifier.shell meta.string.shell +# ^^^ meta.function-call.arguments.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ + $opts \ +#^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ punctuation.separator.continuation.line.shell + +exec \ + -la name \ + "$cmd" \ + $opts \ + --cmd-flag +#^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell + + +############################################################################### +# 4.2 Bash Builtin Commands (export) # +# https://www.gnu.org/software/bash/manual/bash.html#index-export # +############################################################################### + +export +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^ - meta.function-call + +export foo # 'foo' is a variable name +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -exec >&${tee[1]} 2>&1 -# ^^^ meta.function-call.arguments.shell - meta.interpolation -# ^^^^^^^^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell -# ^^^^^ meta.function-call.arguments.shell - meta.interpolation -# ^^ keyword.operator.assignment.redirection -# ^ punctuation.definition.variable.shell -# ^ punctuation.section.interpolation.begin.shell +export foo bar # 'foo' and 'bar' are variable names +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^ - variable +# ^^^ variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell +export foo='bar' # 'foo' is a variable name +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^ meta.string.shell string.quoted.single.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -#################################################################### -# 3.2.4.2 Conditional Constructs # -#################################################################### +export PGPASSWORD=$(cat "$DOKKU_ROOT/.postgresql/pwd_$APP") +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string - meta.interpolation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.shell meta.interpolation.command.shell +# ^^^^^^^^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ punctuation.definition.variable.shell +# ^ punctuation.section.interpolation.begin.shell +# ^^^ variable.function.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell meta.interpolation.command.shell meta.string.shell - if; -#^^ keyword.control.conditional.if.shell - if& -#^^ keyword.control.conditional.if.shell - if| -#^^ keyword.control.conditional.if.shell - if>/dev/null -#^^ keyword.control.conditional.if.shell - if - -#^^ keyword.control.conditional.if.shell - if- -#^^^ - keyword.control - -if -#^^^ - keyword.control - if+ -#^^^ - keyword.control - if$ -#^^^ - keyword.control - if$var -#^^^^^^ - keyword.control - if= -#^^^ - keyword.control - if-= -#^^^^ - keyword.control - if+= -#^^^^ - keyword.control - if() -#^^ keyword.control.conditional.if.shell - if[] -#^^^^ - keyword.control - if{} -#^^^^ - keyword.control +export -f foo +# <- meta.function-call.identifier.shell support.function.export.shell +#^^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^ meta.function-call.arguments.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell variable.function.shell - then; -#^^^^ keyword.control.conditional.then.shell - then& -#^^^^ keyword.control.conditional.then.shell - then| -#^^^^ keyword.control.conditional.then.shell - then>/dev/null -#^^^^ keyword.control.conditional.then.shell - then - -#^^^^ keyword.control.conditional.then.shell - then- -#^^^^^ - keyword.control -- then -#^^^^^ - keyword.control - then+ -#^^^^^ - keyword.control - then$ -#^^^^^ - keyword.control - then$var -#^^^^^^^^ - keyword.control - then= -#^^^^^ - keyword.control - then-= -#^^^^^^ - keyword.control - then+= -#^^^^^^ - keyword.control - then() -#^^^^ keyword.control.conditional.then.shell - then[] -#^^^^^^ - keyword.control - then{} -#^^^^^^ - keyword.control +export PATH="$PATH:$HOME/.local/bin" +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^ string.quoted.double punctuation.separator.sequence +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^^^^^^^^^^^^ string.quoted.double +# ^ punctuation.definition.string.end -if cmd && \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd && - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd || \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if cmd || - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if \ - ! cmd -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -if !cmd -# ^ punctuation.definition.history.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -! cmd -# <- keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -!cmd -# <- punctuation.definition.history.shell -#^^^ meta.function-call.identifier.shell variable.function.shell -! \ -# <- keyword.operator.logical.shell -# ^ punctuation.separator.continuation.line.shell -! \ - cmd -#^^^ meta.function-call.identifier.shell variable.function.shell -!\ -# <- punctuation.definition.history.shell -#^ punctuation.separator.continuation.line.shell -!\ - cmd -#^^^ meta.function-call.identifier.shell variable.function.shell -!! -# <- variable.language.history.shell punctuation.definition.history.shell -#^ variable.language.history.shell -!-1 -# <- variable.language.history.shell punctuation.definition.history.shell -#^^ variable.language.history.shell -!51 -# <- variable.language.history.shell punctuation.definition.history.shell -#^^ variable.language.history.shell +export PATH="$PATH:~/.local/bin" +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^ string.quoted.double punctuation.definition.string.begin +# ^^^^^ meta.interpolation.parameter variable.other.readwrite +# ^ punctuation.definition.variable +# ^ string.quoted.double punctuation.separator.sequence +# ^ punctuation.definition.string.end -[ ] -# <- support.function.test.begin.shell -# ^ support.function.test.end.shell +export SOMETHING='/etc/test:/var/test:../foo:./foo' +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^^^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single +# ^ punctuation.definition.string.begin +# ^ punctuation.separator.sequence +# ^ punctuation.separator.sequence +# ^ punctuation.separator.sequence +# ^ punctuation.definition.string.end -[ -] -# <- meta.conditional.shell support.function.test.end.shell +export SOMETHING=/etc/test:/var/test +# ^^^^ meta.function-call.identifier.shell support.function.export.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments +# ^^^^^^^^^ meta.variable variable.other.readwrite +# ^ keyword.operator.assignment +# ^^^^^^^^^^^^^^^^^^^ meta.string string.unquoted +# ^ punctuation.separator.sequence + +msg="Count: ${count}" +# ^ meta.string string.quoted.double - punctuation.separator + +url="https://sublimetext.com/" +# ^ meta.string string.quoted.double - punctuation.separator + +############################################################################### +# 4.2 Bash Builtin Commands (locsl) # +# https://www.gnu.org/software/bash/manual/bash.html#index-local # +############################################################################### + +local +#<- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^ - meta.declaration.variable +local; +#^^^^ keyword.declaration.variable.shell +local& +#^^^^ keyword.declaration.variable.shell +local| +#^^^^ keyword.declaration.variable.shell +local>/dev/null +#^^^^ keyword.declaration.variable.shell +local - +#^^^^ keyword.declaration.variable.shell +local() +#^^^^ keyword.declaration.variable.shell +local[] +#^^^^^^ - storage - keyword.declaration +local{} +#^^^^^^ - storage - keyword.declaration +local- +#^^^^^ - storage - keyword.declaration +-local +#^^^^^ - storage - keyword.declaration +local+ +#^^^^^ - storage - keyword.declaration +local$ +#^^^^^ - storage - keyword.declaration +local$var +#^^^^^^^^ - storage - keyword.declaration +local= +#^^^^^ - storage - keyword.declaration +local-= +#^^^^^^ - storage - keyword.declaration +local+= +#^^^^^^ - storage - keyword.declaration -! [ ] -# <- keyword.operator.logical.shell -# ^ support.function.test.begin.shell -# ^ support.function.test.end.shell +local foo bar # 'foo' and 'bar' are variable names +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -![ ] -# <- punctuation.definition.history.shell -#^ support.function.test.begin.shell -# ^ support.function.test.end.shell +local foo bar='baz' # 'foo' and 'bar' are variable names +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.declaration.variable +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^ meta.string.shell string.quoted.single.shell +# ^ - comment - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -[[ ]] -# <- support.function.test.begin.shell -#^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +local foo+=10 bar-=true +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^ keyword.operator.assignment.shell +# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^^ keyword.operator.assignment.shell +# ^^^^ constant.language.boolean.shell -[[ -]] -# <- meta.conditional.shell support.function.test.end.shell -#^ meta.conditional.shell support.function.test.end.shell +local pid="$(cat "$PIDFILE" 2>/dev/null)" +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell -! [[ ]] -# <- keyword.operator.logical.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +local -fn foo +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^ meta.declaration.variable.shell keyword.declaration.variable.shell +# ^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^ meta.variable.shell variable.function.shell -![[ ]] -# <- punctuation.definition.history.shell -#^^^^^ meta.conditional.shell -#^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell +f() { + local -a "$@" + # <- keyword.declaration.variable.shell + #^^^^ keyword.declaration.variable.shell + # ^^ meta.parameter.option.shell variable.parameter.option.shell + # ^^^^ meta.string.shell + local x + # <- keyword.declaration.variable.shell + #^^^^ keyword.declaration.variable.shell + # ^ meta.variable.shell variable.other.readwrite.shell -if [[ expr ]] && [[ expr ]] || [[ expr ]] ; then cmd ; fi -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^^ keyword.operator.logical.shell -# ^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell + for x; do + case $x in + $1) + local "$x"'+=(1)' ;;& + # <- keyword.declaration.variable.shell + # ^^^ punctuation.terminator.case.clause.shell + $2) + local "$x"'+=(2)' ;& + # <- keyword.declaration.variable.shell + # ^^ punctuation.terminator.case.clause.shell + $3) + local "$x"'+=(3)' ;; + # <- keyword.declaration.variable.shell + # ^^ punctuation.terminator.case.clause.shell + $1|$2) + local "$x"'+=(4)' + # <- keyword.declaration.variable.shell + esac + # <- meta.function.shell meta.compound.shell meta.conditional.case.shell + # <- keyword.control.conditional.end.shell -if [[ expr && expr || expr ]] ; then cmd ; fi -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^ support.function.test.begin.shell -# ^^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell + IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' + # ^ variable.other.readwrite.shell + # ^ keyword.operator.assignment.shell + # ^ meta.string.shell string.unquoted.shell + # ^ keyword.declaration.variable.shell + done + # <- meta.function.shell meta.compound.shell + # <- keyword.control.loop.end.shell +} +# <- meta.function.shell meta.compound.shell punctuation.section.compound.end.shell -if [[ expr && ( expr || expr ) ]] ; then cmd ; fi -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^^^^^^^^ meta.group.shell -# ^^ support.function.test.begin.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.group.begin.shell -# ^^ keyword.operator.logical.shell -# ^ punctuation.section.group.end.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -[[ ! ($line == ^0[1-9]$) ]] -# <- meta.conditional.shell - meta.group -#^^^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp -# ^^^^^^^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell -# ^ meta.conditional.shell meta.group.shell - meta.string -# ^^^ meta.conditional.shell - meta.group -# +############################################################################### +# 4.2 Bash Builtin Commands (readonly) # +# https://www.gnu.org/software/bash/manual/bash.html#index-readonly # +############################################################################### -[[ ! ($line != \() ]] -# <- meta.conditional.shell - meta.group -#^^^^ meta.conditional.shell - meta.group -# ^^^^^^^^^^ meta.conditional.shell meta.group.shell - meta.string.regexp -# ^^ meta.conditional.shell meta.group.shell meta.string.regexp.shell constant.character.escape.shell -# ^ meta.conditional.shell meta.group.shell - meta.string -# ^^^ meta.conditional.shell - meta.group -# +readonly foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^^ variable.other.readwrite +# ^ - variable -if [[ $- =~ *i* ]] ; then echo shell is not interactive; fi -#^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^ - meta.string.regexp -# ^^^ meta.string.regexp.shell -# ^^^ - meta.string.regexp -# ^^^^ meta.function-call.identifier.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^^ support.function.test.begin.shell -# ^^ meta.interpolation.parameter.shell variable.language.shell -# ^ punctuation.definition.variable.shell -# ^^ keyword.operator.comparison.shell -# ^ invalid.illegal.unexpected-quantifier.regexp.shell -# ^ keyword.operator.quantifier.regexp.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^ support.function.echo.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +readonly -f foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^^ meta.declaration.variable.shell +# ^^^^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ meta.variable.shell variable.function.shell +# ^ - variable -if [[ "$ERL_TOP" != ";"; ]];then;fi -#^ keyword.control.conditional.if.shell -# ^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -# ^^^^^^^^^^^^^^^^^ - meta.string.regexp -# ^^^^ meta.string.regexp.shell -# ^^^ - meta.string.regexp -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +foo=`readonly x=5` +# <- variable.other.readwrite +# ^ meta.interpolation.command.shell punctuation.section.interpolation.begin.shell +# ^^^^^^^^ meta.interpolation.command.shell keyword.declaration.variable.shell +# ^ meta.interpolation.command.shell variable.other.readwrite +# ^ meta.interpolation.command.shell keyword.operator.assignment +# ^ meta.string.shell meta.interpolation.command.shell meta.declaration.variable.arguments.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ meta.interpolation.command.shell punctuation.section.interpolation.end.shell -if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell -if { [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; }; then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ punctuation.section.compound.begin.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell +############################################################################### +# 4.2 Bash Builtin Commands (typeset) # +# https://www.gnu.org/software/bash/manual/bash.html#index-typeset # +############################################################################### + +typeset foo # 'foo' is a variable name +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^ meta.declaration.variable.arguments.shell +# ^ - meta.declaration.variable +#^^^^^^ keyword.declaration.variable.shell +# ^ - storage - variable +# ^^^ variable.other.readwrite +# ^ - variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -if ( [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2 ); then PLATFORM=docker; fi -#^ keyword.control.conditional.if.shell -# ^ punctuation.section.compound.begin.shell -# ^ keyword.operator.logical.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^ keyword.operator.logical.shell -# ^^^^ meta.function-call.identifier.shell variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string string.unquoted.shell +typeset -f _init_completion > /dev/null && complete -F _upto upto +# <- meta.declaration.variable.shell keyword.declaration.variable.shell +#^^^^^^ meta.declaration.variable.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.variable.arguments.shell +# ^^^^ - meta.declaration - meta.function-call +# ^^^^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^^^ keyword.declaration.variable.shell +# ^^ variable.parameter.option.shell +# ^^^^^^^^^^^^^^^^ meta.variable.shell variable.function.shell +# ^ keyword.operator.assignment.redirection.shell +# ^^ keyword.operator.logical.shell +# ^^^^^^^^ variable.function.shell +# ^^ variable.parameter.option.shell -if [ ! -f q4m-$Q4MVER.tar.gz ]; then -# ^ support.function.test.begin.shell -# ^ keyword.operator.logical.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^ punctuation.definition.parameter.shell -# ^ - keyword.operator -# ^^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - : -# ^ meta.function-call.identifier.shell support.function.colon.shell -fi -# <- keyword.control.conditional.end.shell -if true ; then false ; fi -#^ keyword.control.conditional.if.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell -# ^^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.conditional.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (test) # +# https://www.gnu.org/software/bash/manual/bash.html#index-test # +############################################################################### -if (ruby extconf.rb && -# ^ punctuation.section.compound.begin.shell - { make clean || true; } && - # <- punctuation.section.compound.begin.shell - # ^ punctuation.section.compound.end.shell - make) 1> build.log 2>&1 - # ^ punctuation.section.compound.end.shell - # ^ - variable.function -fi +test +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^ - meta.function-call +test; +#^^^ support.function.test.shell +test& +#^^^ support.function.test.shell +test| +#^^^ support.function.test.shell +test>/dev/null +#^^^ support.function.test.shell +test - +#^^^ support.function.test.shell +test() +#^^^ support.function.test.shell +test[] +#^^^^^ - support.function +test{} +#^^^^^ - support.function +test- +#^^^^ - support.function +-test +#^^^^ - support.function +test+ +#^^^^ - support.function +test$ +#^^^^ - support.function +test$var +#^^^^^^^ - support.function +test= +#^^^^ - support.function +test-= +#^^^^^ - support.function +test+= +#^^^^^ - support.function -if [ "$1" != "" -a "$2" != "" ]; then -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.shell -#^ keyword.control.conditional.if.shell -# <- keyword.control.conditional.if.shell -# ^ support.function.test.begin.shell +test $var != 0 +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp +# ^ - meta.function-call # ^^ keyword.operator.comparison.shell -# ^^ meta.conditional.shell variable.parameter.option.shell -# ^^ variable.other.readwrite.shell -# ^^ keyword.operator.comparison.shell -# ^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - local DIR=$1 - # <- keyword.declaration.variable.shell - # ^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell - local TARGET=$2 - # <- keyword.declaration.variable.shell - # ^^^^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell -elif [ "$1" ]; then -# <- keyword.control.conditional.elseif.shell -# ^^^^^^^^ meta.conditional.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.conditional.then.shell - local DIR=$PWD - # <- keyword.declaration.variable.shell - # ^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^^^ variable.other.readwrite.shell - local TARGET=$1 - # <- keyword.declaration.variable.shell - # ^^^^^^ variable.other.readwrite.shell - # ^ keyword.operator.assignment.shell - # ^^ variable.other.readwrite.shell -fi -# <- keyword.control.conditional.end.shell +# ^ constant.numeric.value.shell -asdf foo && FOO=some-value pwd -# <- meta.function-call.identifier.shell variable.function.shell -# ^^ keyword.operator.logical.shell -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^ meta.string.shell string.unquoted.shell -# ^^^ meta.function-call.identifier.shell support.function.pwd.shell +test $var == true +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp +# ^^ keyword.operator.comparison.shell +# ^^^^ constant.language.boolean.shell -(cd Layer1-linux && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer2-nodejs && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer3-base && PLATFORM=${PLATFORM} ./build ) && -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -(cd Layer4-custom && PLATFORM=${PLATFORM} name=${NOSN} ./build ) || err $? -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.compound.shell -# <- punctuation.section.compound.begin.shell -# ^^ keyword.operator.logical.shell -# ^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^^^^ meta.string.shell meta.interpolation.parameter.shell - string -# ^^^^^^^ variable.function.shell -# ^ punctuation.section.compound.end.shell -# ^^ keyword.operator.logical.shell -# ^^^ meta.function-call.identifier.shell variable.function.shell -# ^^^ meta.function-call.arguments.shell -# ^^ variable.language.shell +test str == "str" +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^ string.quoted.double.shell -#################################################################### -# Case Statements # -#################################################################### +test var[0] != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -case- -# <- - keyword -#^^^^ - keyword +test $var[0] != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^^ - meta.interpolation - meta.item-access - punctuation +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -esac -# <- keyword.control.conditional.end.shell -#^^^ keyword.control.conditional.end.shell - meta.conditional.case +test ${var[0]} != var[^0-9]*$ +#<- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^ meta.interpolation.parameter.shell +# ^^^ variable.other.readwrite.shell +# ^^^ meta.item-access.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^^^^ meta.string.shell string.unquoted.shell - meta.string.regexp -case -# <- meta.conditional.case.shell keyword.control.conditional.case.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.case.shell +test expr -a expr -o expr -- | cmd |& cmd +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ - keyword +# ^ keyword.operator.assignment.pipe.shell +# ^^^ meta.function-call.identifier.shell variable.function.shell +# ^^ keyword.operator.assignment.pipe.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +test ! $line == ^[0-9]+$ +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell - meta.function-call.arguments +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier +# ^ - meta.function-call +#^^^ support.function.test.shell +# ^ keyword.operator.logical.shell +# ^^^^^ variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^^^^^ meta.string.shell string.unquoted.shell -case var in - ( patt ( esac -#^ meta.conditional.case.shell -# ^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.group -# ^^ meta.conditional.case.clause.patterns.shell meta.group.regexp.shell -# ^^^^ meta.conditional.case.shell -# ^ keyword.control.conditional.patterns.begin.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^^^^ meta.conditional.case.shell keyword.control.conditional.end.shell -# ^ - meta.conditional +test ! $line =~ ^[0-9]+$ >> /file +# <- meta.function-call.identifier.shell support.function.test.shell +#^^^ meta.function-call.identifier.shell - meta.function-call.arguments +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call.identifier - meta.group +# ^ - meta.function-call +#^^^ support.function.test.shell +# ^ keyword.operator.logical.shell +# ^^^^^ variable.other.readwrite.shell +# ^^ invalid.illegal.operator.shell +# ^^^^^^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.assignment.redirection.shell +if test expr -a expr ; then echo "success"; fi +# ^ - meta.function-call +# ^^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^^^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^^^^ support.function.echo.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell -case # comment -#^^^^^^^^^^^^^^^^ meta.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - var # comment -#^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - in # comment -#^^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# ^^ keyword.control.in.shell -# ^^^^^^^^^^ comment.line.number-sign.shell - pattern) # comment -#^ meta.conditional.case.shell -# ^^^^^^^^ meta.conditional.case.clause.patterns.shell -# ^^^^^^^^^^^ meta.conditional.case.clause.commands.shell -# ^^^^^^^^^^ comment.line.number-sign.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +if test "$VAR" != ";";then;fi +# ^ - meta.function-call +# ^^^^ meta.function-call.identifier.shell support.function.test.shell +# ^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^^^ meta.string.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.quoted.double.shell +# ^^^^^^^^ - meta.function-call +# ^ punctuation.terminator.statement.shell +# ^^^^ keyword.control.conditional.then.shell +# ^ punctuation.terminator.statement.shell +# ^^ keyword.control.conditional.end.shell +let test -z $2 && { } +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^ - meta.function-call - meta.compound +# ^^^ meta.compound.shell - meta.function-call +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^ punctuation.section.compound.begin.shell +# ^ punctuation.section.compound.end.shell -case "$1" in -# <- keyword.control.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.begin.shell -# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell punctuation.definition.variable.shell -# ^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ meta.string.shell string.quoted.double.shell punctuation.definition.string.end.shell -# ^^ keyword.control.in.shell -setup ) -# <- - variable.function - support.function - meta.function-call -# ^ keyword.control.conditional.patterns.end.shell -echo Preparing the server... -# <- meta.function-call support.function.echo -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -dep\ -loy ) -# <- - variable.function - support.function - meta.function-call -# ^ keyword.control.conditional.patterns.end.shell -echo Deploying... -# <- meta.function-call support.function.echo -# ^^^^^^^^^^^^^ meta.function-call.arguments -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -* ) -# <- constant.other.wildcard.asterisk.shell -# ^ keyword.control.conditional.patterns.end.shell -cat <<'ENDCAT' -# <- meta.function-call.identifier.shell variable.function.shell -# ^^ meta.function-call.arguments.shell - meta.string - meta.tag -# ^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.definition.tag.begin.shell - entity -# ^^^^^^ entity.name.tag.heredoc.shell -# ^ punctuation.definition.tag.end.shell - entity +let $var == test -z $5 && cmd +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^ - meta.function-call +# ^^^ meta.function-call.identifier.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^^^ variable.function.shell -foo -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -ENDCAT -# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -esac -# <- meta.conditional.case.shell keyword.control.conditional.end.shell -#^^^ meta.conditional.case.shell keyword.control.conditional.end.shell +let 'test -z $2 && { }' +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^ - meta.compound +# ^ - meta.function-call +# ^ string.quoted.single.shell punctuation.definition.string.begin.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.logical.shell +# ^ string.quoted.single.shell punctuation.definition.string.end.shell +let '$var == test -z \'$5\' && cmd' +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^ string.quoted.single.shell punctuation.definition.string.begin.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ constant.character.escape.shell +# ^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ constant.character.escape.shell +# ^^ keyword.operator.logical.shell +# ^^^ - variable.function +# ^ string.quoted.single.shell punctuation.definition.string.end.shell -case "${foo}" in- in_ in=10 in -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell -# <- keyword.control.conditional.case.shell -#^^^ keyword.control.conditional.case.shell -# ^^ - keyword.control.in -# ^^ - keyword.control.in -# ^^ - keyword.control.in -# ^^ keyword.control.in - ( help | h ) bar ;; -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # <- keyword.control.conditional.patterns.begin.shell - # ^ keyword.control.conditional.patterns.end.shell - # ^^ punctuation.terminator.case.clause.shell - do1 ) foo1 ;& -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # ^ keyword.control.conditional.patterns.end.shell - # ^^ punctuation.terminator.case.clause.shell - (do2 ) foo2 ;;& -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^^^^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell -# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - # <- keyword.control.conditional.patterns.begin.shell - # ^ keyword.control.conditional.patterns.end.shell - # ^^^ punctuation.terminator.case.clause.shell - *) bar -#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands -# ^^ meta.conditional.case.clause.patterns.shell - meta.conditional.case.clause.commands - meta.conditional.case.shell -# ^^^^^ meta.conditional.case.clause.commands.shell - meta.conditional.case.clause.patterns - meta.conditional.case.shell - #^ keyword.control.conditional.patterns.end.shell -esac -# <- keyword.control.conditional.end.shell +let "$var != test -z '$5' && cmd" +#^^ meta.function-call.identifier.shell support.function.let.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.shell +# ^^^^ meta.function-call.arguments.shell meta.function-call.identifier.shell +# ^^^^^^^^ meta.function-call.arguments.shell meta.function-call.arguments.shell +# ^^^^^^^^ meta.function-call.arguments.shell - meta.function-call mete.function-call +# ^ string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ keyword.operator.comparison.shell +# ^^^^ support.function.test.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ string.quoted.single.shell +# ^^ keyword.operator.logical.shell +# ^^^ - variable.function +# ^ string.quoted.double.shell punctuation.definition.string.end.shell -case $TERM in - sun-cmd) - # ^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell - *xterm*|rxvt|(dt|k|E)term) - # ^ constant.other.wildcard.asterisk.shell - # ^ keyword.operator.logical.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ punctuation.definition.group.begin.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ keyword.operator.logical.regexp.shell - # ^ punctuation.definition.group.end.regexp.shell - # ^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() { print -Pn "\e]2;%~\a" };; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell - *) - # <- constant.other.wildcard.asterisk.shell - #^ keyword.control.conditional.patterns.end.shell - update_terminal_cwd() {};; - # ^ meta.function punctuation.section.compound.end.shell - # ^^ punctuation.terminator.case.clause.shell -esac -# <- keyword.control.conditional.end.shell -case $SERVER in -# <- keyword.control.conditional.case.shell -ws-+([0-9]).host.com) echo "Web Server" -#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell -# ^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -db-+([0-9])\.host\.com) echo "DB server" -#^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell meta.group.regexp.shell -# ^^^^^^^^^^^ meta.conditional.case.clause.patterns.shell meta.string.regexp.shell - meta.group -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -bk-+([0-9])\.host\.com) echo "Backup server" -# ^ keyword.operator.quantifier.regexp.shell -# ^ punctuation.definition.group.begin.regexp.shell -# ^ punctuation.definition.set.begin.regexp.shell -# ^^^ constant.other.range.regexp.shell -# ^ punctuation.separator.sequence.regexp.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ punctuation.definition.group.end.regexp.shell -# ^ keyword.control.conditional.patterns.end.shell -# ^^^^ support.function.echo.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -*)echo "Unknown server" -# <- constant.other.wildcard.asterisk.shell -#^ keyword.control.conditional.patterns.end.shell -# ^^^^ support.function.echo.shell -;; -# <- punctuation.terminator.case.clause.shell -#^ punctuation.terminator.case.clause.shell -esac -# <- keyword.control.conditional.end.shell -#^^^ keyword.control.conditional.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (unalias) # +# https://www.gnu.org/software/bash/manual/bash.html#index-unalias # +############################################################################### -case $_G_unquoted_arg in -*[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") -#^ punctuation.definition.set.begin.regexp.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.shell -# ^ punctuation.definition.set.end.regexp.shell -# ^ - keyword.control - _G_quoted_arg=\"$_G_unquoted_arg\" - ;; -*) - _G_quoted_arg=$_G_unquoted_arg -;; -esac -case $1 in -*[\\\`\"\$]*) -#^ punctuation.definition.set.begin.regexp.shell -# ^^^^^^^^ constant.character.escape.shell -# ^ punctuation.definition.set.end.regexp.shell - _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; -*) - _G_unquoted_arg=$1 ;; -esac +unalias +unalias -a -b +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^^ variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +unalias foo +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable -#################################################################### -# select loops # -#################################################################### +unalias foo # comment +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^^^^^^^^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^^^^^^ comment.line.number-sign.shell -select var in 1 2 3 4 5; do echo $i; done; -# <- keyword.control.loop.select.shell -# ^^^ variable.other.readwrite.shell -# ^^ keyword.control.in.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ - string -# ^ meta.string.shell string.unquoted.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ support.function.echo.shell -# ^^ variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell -# ^ punctuation.terminator.statement.shell +unalias foo b"a"r b'a'z 7za +# <- meta.function-call.identifier.shell support.function.unalias.shell +#^^^^^^ meta.function-call.identifier.shell support.function.unalias.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^^^ entity.name.function.shell +# ^ - meta.variable - variable +# ^^^ entity.name.function.shell +# ^ - meta.variable - variable -select fname in *; -# <- keyword.control.loop.select.shell -#^^^^^ keyword.control.loop.select.shell -# ^^ keyword.control.in.shell -# ^ meta.string.shell string.unquoted.shell -# ^ punctuation.terminator.statement.shell -do -# <- keyword.control.loop.do.shell - echo you picked $fname \($REPLY\) -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell -# ^ - meta.function-call - break; -# ^^^^^ keyword.control.flow.break.shell -# ^ punctuation.terminator.statement.shell -done -# <- keyword.control.loop.end.shell +############################################################################### +# 4.2 Bash Builtin Commands (unset) # +# https://www.gnu.org/software/bash/manual/bash.html#index-unset # +############################################################################### -#################################################################### -# while loops # -#################################################################### +unset +unset foo b'a'r ba${z} # 'foo' and 'bar' are variable names +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ meta.variable.shell - meta.string +# ^^^ meta.variable.shell meta.string.shell +# ^ meta.variable.shell - meta.string +#^^^^ support.function.unset.shell +# ^ - meta.variable - support - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - meta.variable - variable +# ^^^^^ variable.other.readwrite.shell +# ^ punctuation.definition.string.begin.shell +# ^ punctuation.definition.string.end.shell +# ^ - meta.variable - variable +# ^^ meta.variable.shell - meta.interpolation +# ^^^^ meta.variable.shell meta.interpolation.parameter.shell +# ^ - meta.variable - variable +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.shell -while true; do -# <- keyword.control.loop.while -#^^^^ keyword.control.loop.while.shell -# ^ - constant - keyword -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - break -# ^^^^^ keyword.control.flow.break.shell - break 2; -# ^^^^^ keyword.control.flow.break.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell - continue -# ^^^^^^^^ keyword.control.flow.continue.shell - continue 2; -# ^^^^^^^^ keyword.control.flow.continue.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -done -# <- keyword.control.loop.end +unset -n +unset -nfv foo +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^^^ support.function.unset.shell +# ^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ variable.function.shell +# ^ - variable -while ! true; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ support.function.echo.shell +unset -f -n -v foo b'a'r; unset -vn foo 2>& /dev/null +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call +# ^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ - meta.string +# ^^^ meta.string.shell +# ^ - meta.string +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ variable.function.shell +# ^ - variable +# ^^^^^ variable.function.shell +# ^ punctuation.terminator.statement.shell +# ^^^^^ support.function.unset.shell +# ^ - support - variable +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ - variable +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable +# ^ meta.file-descriptor.shell meta.number.integer.decimal.shell constant.numeric.value.shell +# ^^ keyword.operator.assignment.redirection.shell + +unset -f -x +v -- foo bar; unset -vn -- foo +# <- meta.function-call.identifier.shell support.function.unset.shell +#^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ - meta.function-call +# ^^^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ - variable +# ^^ keyword.operator.end-of-options.shell +# ^^^ variable.function.shell +# ^ - variable +# ^^^ variable.function.shell # ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell +# ^^^^^ support.function.unset.shell +# ^ - support - variable +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^^^ - variable +# ^^ keyword.operator.end-of-options.shell +# ^^^ meta.variable.shell variable.other.readwrite.shell +# ^ - variable -while ! { true; }; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^^^ constant.language.boolean.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +unset- +# <- - support.function +unset+ +# <- - support.function +unset() +# <- support.function.unset.shell +unset[] +# <- - support.function +unset{} +# <- - support.function +unset= +# <- - support.function +unset+= +# <- - support.function +unset-= +# <- - support.function -while ! { [[ true ]]; }; do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell -while ! ( [[ true ]] ); do echo bar; done -# <- keyword.control.loop.while.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.section.compound.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +############################################################################### +# Linux builtins # +############################################################################### -while read -r -d '' f; do -# <- keyword.control.loop.while.shell -# ^^^^ support.function.read.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ string.quoted.single.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -done -# <- keyword.control.loop.end.shell +sudo rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^ meta.function-call.identifier.shell variable.function.shell +# ^^^^ meta.function-call.arguments.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell -while IFS= read -r -d '' f; do -# <- keyword.control.loop.while.shell -# ^^^ variable.other.readwrite.shell -# ^ keyword.operator.assignment.shell -# ^^^^ support.function.read.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^ string.quoted.single.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -done -# <- keyword.control.loop.end.shell +sudo -b -g network --host=$foo rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +# ^^^^^^^ meta.string.shell string.unquoted.shell +# ^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ punctuation.definition.parameter.shell +# ^ keyword.operator.assignment.shell +# ^^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell +# ^^ variable.function.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell +sudo --reset-timestamp -n -f -- rm -rf +# <- meta.function-call.identifier.shell support.function.sudo.shell +#^^^ meta.function-call.identifier.shell support.function.sudo.shell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^^^^^^^^^^^^^^^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ meta.parameter.option.shell variable.parameter.option.shell +# ^^ invalid.illegal.parameter.shell +# ^^ keyword.operator.end-of-options.shell +# ^^ variable.function.shell +# ^^^ meta.parameter.option.shell variable.parameter.option.shell +# ^ punctuation.definition.parameter.shell -#################################################################### -# do...until loops # -#################################################################### -do echo bar; until ! { [[ true ]]; } -# <- keyword.control.loop.do.shell -# ^^^^^ keyword.control.loop.until.shell -# ^ keyword.operator.logical.shell -# ^ punctuation.section.compound.begin.shell -# ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell -# ^^ support.function.test.end.shell -# ^ punctuation.terminator.statement.shell -# ^ punctuation.section.compound.end.shell +############################################################################### +# 6.4 Bash Conditional Expressions # +############################################################################### +[ ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^ meta.conditional.shell +# ^ support.function.test.end.shell -#################################################################### -# for loops # -#################################################################### +[ -a file ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^ meta.conditional.shell -for; -#^^ keyword.control.loop.for.shell -for& -#^^ keyword.control.loop.for.shell -for| -#^^ keyword.control.loop.for.shell -for>/dev/null -#^^ keyword.control.loop.for.shell -for - -#^^ keyword.control.loop.for.shell -for() -#^^ keyword.control.loop.for.shell -for[] -#^^^^ - keyword.control -for{} -#^^^^ - keyword.control -for- -#^^^ - keyword.control --for -#^^^ - keyword.control -for+ -#^^^ - keyword.control -for$ -#^^^ - keyword.control -for$var -#^^^^^^ - keyword.control -for= -#^^^ - keyword.control -for-= -#^^^^ - keyword.control -for+= -#^^^^ - keyword.control +[ -v varname ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell - do; -#^^ keyword.control.loop.do.shell - do& -#^^ keyword.control.loop.do.shell - do| -#^^ keyword.control.loop.do.shell - do>/dev/null -#^^ keyword.control.loop.do.shell - do - -#^^ keyword.control.loop.do.shell - do() -#^^ keyword.control.loop.do.shell - do[] -#^^^^ - keyword.control - do{} -#^^^^ - keyword.control - do- -#^^^ - keyword.control - -do -#^^^ - keyword.control - do+ -#^^^ - keyword.control - do$ -#^^^ - keyword.control -do$var -#^^^^^^ - keyword.control - do= -#^^^ - keyword.control - do-= -#^^^^ - keyword.control - do+= -#^^^^ - keyword.control +[ file1 -ef file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for done -# <- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^^^^ keyword.control.loop.end.shell +[ file1 -nt file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ file1 -ot file2 ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^^^^ meta.conditional.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^^^ keyword.operator.comparison.shell +# ^^^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ ! str != str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^^^ meta.conditional.shell +# ^ keyword.operator.logical.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ str != str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell + +[ str == str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for do done -# <- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ keyword.control.loop.end.shell +[ str =~ str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^^ invalid.illegal.operator.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for x; do -#<- keyword.control.loop.for.shell -#^^ keyword.control.loop.for.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - echo "${!x}" -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^^^^^^^ meta.function-call.arguments.shell -done -#<- keyword.control.loop.end.shell +[ str = str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for (( i = 0; i < 10; i++ )); do -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# <- keyword.control.loop.for.shell -# ^^ punctuation.section.arithmetic.begin.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.comparison.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.operator.arithmetic.shell -# ^^ punctuation.section.arithmetic.end.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell - echo $i - # <- meta.function-call support.function.echo.shell - # ^ meta.function-call.arguments punctuation.definition.variable.shell - # ^ meta.function-call.arguments variable.other.readwrite.shell -done -# <- keyword.control.loop.end.shell -for (( i = 0; i < 10; i++ )) #; do -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell -# <- keyword.control.loop.for.shell -# ^^ punctuation.section.arithmetic.begin.shell -# ^ keyword.operator.assignment.shell -# ^ meta.number.integer.decimal.shell constant.numeric.value.shell - punctuation -# ^ punctuation.terminator.statement.shell -# ^ keyword.operator.comparison.shell -# ^^ meta.number.integer.decimal.shell constant.numeric.value.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.operator.arithmetic.shell -# ^^ punctuation.section.arithmetic.end.shell -# ^^^^^^ comment.line.number-sign.shell -do -#<- keyword.control.loop.do.shell - echo $i - # <- meta.function-call support.function.echo.shell - # ^ meta.function-call.arguments punctuation.definition.variable.shell - # ^ meta.function-call.arguments variable.other.readwrite.shell -done -# <- keyword.control.loop.end.shell +[ str < str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for i in str1 $str2 "str3" 'str4' st$r5; do echo $i; done; -# <- keyword.control.loop.for.shell -# ^ variable.other.readwrite.shell -# ^^ keyword.control.in.shell -# ^^^^ meta.string.shell string.unquoted.shell -# ^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^^^^^^ meta.string.shell string.quoted.double.shell -# ^^^^^^ meta.string.shell string.quoted.single.shell -# ^^ meta.string.shell string.unquoted.shell -# ^^^ meta.string.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^ keyword.control.loop.do.shell -# ^^^^ meta.function-call.identifier.shell support.function.echo.shell -# ^^ meta.function-call.arguments.shell meta.interpolation.parameter.shell variable.other.readwrite.shell -# ^ punctuation.terminator.statement.shell -# ^^^^ keyword.control.loop.end.shell -# ^ punctuation.terminator.statement.shell +[ str > str ] +# <- meta.conditional.shell support.function.test.begin.shell +#^^^^^^^^^^^^ meta.conditional.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ keyword.operator.comparison.shell +# ^^^ meta.string.shell string.unquoted.shell +# ^ support.function.test.end.shell -for i in >=b, a&=b, a^=b, a|=b )) +# ^ variable.other.readwrite.shell +# ^ keyword.operator.assignment.shell +# ^ variable.other.readwrite.shell +# ^ meta.arithmetic punctuation.separator +# ^ variable.other.readwrite.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^ variable.other.readwrite.shell +# ^ meta.arithmetic punctuation.separator +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic +# ^^ keyword.operator.assignment.augmented.shell +# ^ meta.arithmetic punctuation.separator +# ^^ keyword.operator.assignment.augmented.shell +# ^^^ keyword.operator.assignment.augmented.shell +# ^^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +# ^^ keyword.operator.assignment.augmented.shell +(( a++ a ++ )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( a-- a -- )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( ++a ++ a )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell +(( --a -- a )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell -# Escaped and non-escaped backticks in heredocs... -cat << backticks_are_deprecated -#^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ - entity - keyword -# ^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity -foo=\`pwd\` -#^^^^^^^^^^^ meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^ constant.character.escape.shell -# ^^ constant.character.escape.shell -foo=`pwd` -#^^^ meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.command.shell - string.unquoted.heredoc -# ^ punctuation.section.interpolation.begin.shell -# ^ punctuation.section.interpolation.end.shell -backticks_are_deprecated -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +(( a/b a / b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a%b a % b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a+b a + b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a-b a - b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a*b a * b )) +# ^ keyword.operator.arithmetic.shell +# ^ keyword.operator.arithmetic.shell +(( a**16 a ** 16 )) +# ^^ keyword.operator.arithmetic.shell +# ^^ keyword.operator.arithmetic.shell -# Redirection after heredoc token -cat << redirection_comes_next > foo.txt -#^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^^^^^^^^^^^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^ - entiy - keyword -# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entiy - keyword -# ^ keyword.operator.assignment.redirection.shell -# ^^^^^^^ - variable.function -hello -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -redirection_comes_next -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +(( ~1 )) +# ^ keyword.operator.bitwise.shell +(( a&b a & b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a^b a ^ b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a|b a | b)) +# ^ keyword.operator.bitwise.shell +# ^ keyword.operator.bitwise.shell +(( a<<12 a << 16 )) +# ^^ keyword.operator.bitwise.shell +# ^^ keyword.operator.bitwise.shell +(( a>>14 a >> 14 )) +# ^^ keyword.operator.bitwise.shell +# ^^ keyword.operator.bitwise.shell + +(( a<=b a <= b )) +# ^^ keyword.operator.comparison.shell +# ^^ keyword.operator.comparison.shell +(( a>=b a >= b )) +# ^^ keyword.operator.comparison.shell +# ^^ keyword.operator.comparison.shell +(( ab a > b )) +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.comparison.shell + +(( !1 ! 1 )) +# ^ keyword.operator.logical.shell +# ^ keyword.operator.logical.shell +(( a&&b a && b )) +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell +(( a||b a || b )) +# ^^ keyword.operator.logical.shell +# ^^ keyword.operator.logical.shell + +(( a ? 0 : 1 )) +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +(((a>b) ? (a>c?a:c) : (b>c?b:c))) +# <- meta.arithmetic.shell punctuation.section.arithmetic.begin.shell - meta.group +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.arithmetic.shell +# ^^^^^ meta.group.shell +# ^^^ - meta.group.shell +# ^^^^^^^^^ meta.group.shell +# ^^^ - meta.group.shell +# ^^^^^^^^^ meta.group.shell +# ^^ - meta.group.shell +#^ punctuation.section.arithmetic.begin.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ punctuation.section.group.end.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.end.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.begin.shell +# ^ keyword.operator.comparison.shell +# ^ keyword.operator.ternary.shell +# ^ keyword.operator.ternary.shell +# ^ punctuation.section.group.end.shell +# ^^ punctuation.section.arithmetic.end.shell -cat << FARAWAY -#^^^^^^^^^^ - meta.string - meta.tag -# ^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^ keyword.operator.assignment.redirection.shell -# ^^^^^ - entiy - keyword -# ^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity -foo -# <- meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell -FARAWAY -#<- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +((a+=b)) +# ^ - string.unquoted -cat <<- INDENTED -#^^^^^^^ - meta.string - meta.tag -# ^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^^ keyword.operator.assignment.redirection.shell -# ^ - entity - keyword -# ^^^^^^^^ entity.name.tag.heredoc.shell -# ^ - entity - say what now ${foo} -# ^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.interpolation.parameter.shell - string - INDENTED -# <- meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag -#^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +let 5 \ + + 5 +#^^^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +# ^ keyword.operator.arithmetic.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -cat <<- 'indented_without_expansions' -#^^^^^^^^ - meta.string - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.shell meta.tag.heredoc.shell - string.unquoted.heredoc -# ^ meta.string.heredoc.shell - meta.tag - string.unquoted.heredoc -# ^^^ keyword.operator.assignment.redirection.shell -# ^ punctuation.definition.tag.begin.shell - entity -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.heredoc.shell -# ^ punctuation.definition.tag.end.shell - entity - ${foo} -#^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell string.unquoted.heredoc.shell - meta.interpolation -# ^^^ - variable.other - indented_without_expansions -#^ meta.function-call.arguments.shell meta.string.heredoc.shell - meta.tag -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +let 5+5 # comment +#^^ meta.function-call.identifier.shell +# ^^^^ meta.function-call.arguments.shell +# ^ - meta.function-call +#^^ support.function.let.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell +# ^ keyword.operator.arithmetic.shell +# ^ meta.number.integer.decimal.shell constant.numeric.value.shell -variable=$(cat <$dummy.c -#^^ meta.function-call.identifier.shell variable.function.shell -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell - string.unquoted.heredoc -# ^^^^^^^^^^^ meta.string.shell string.quoted.single.shell -# ^^^^ - meta.string -# ^^^ meta.string.heredoc.shell meta.tag.heredoc.shell -# ^^^^^^^^^^ meta.string.heredoc.shell - meta.tag -# ^^ keyword.operator.assignment.redirection.shell -# ^^^ entity.name.tag.heredoc.shell -# ^ keyword.operator.assignment.redirection.shell -# ^^^^^^ meta.interpolation.parameter.shell variable.other.readwrite.shell -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF -# <- meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -#^^ meta.function-call.arguments.shell meta.string.heredoc.shell meta.tag.heredoc.shell entity.name.tag.heredoc.shell -# ^ - meta.function-call - meta.string - meta.tag - entity +%1 +# <- meta.interpolation.job.shell variable.language.job.shell punctuation.definition.variable.shell +#^ meta.interpolation.job.shell variable.language.job.shell -#################################################################### -# Misc statement tests # -#################################################################### +############################################################################### +# Misc statement tests # +############################################################################### function clk { typeset base=/sys/class/drm/card0/device From 3b7c0d35953d66d452fa139fdcc0a3f3689dae15 Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Mon, 10 Jun 2024 18:18:04 +0200 Subject: [PATCH 02/12] [Rust] Fix regexps for Cargo build system & add clippy variant (#3990) * [Rust] Fix regexps for Cargo build system The previous pattern was simply invalid (`(?|` is not a legal sequence) and furthermore the way it attempted to match different patterns isn't compatible with ST. Since I don't know off-hand where exactly the first branch is supposed to occur, I simply removed it. * [Rust] Add cargo clippy variant --- Rust/Cargo.sublime-build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Rust/Cargo.sublime-build b/Rust/Cargo.sublime-build index 4af07858f9..bb9ca0c2b3 100644 --- a/Rust/Cargo.sublime-build +++ b/Rust/Cargo.sublime-build @@ -1,6 +1,6 @@ { "cmd": ["cargo", "build"], - "file_regex": "(?|, ([^,<\n]*\\.[A-z]{2}):([0-9]+)|[ \t]*-->[ \t]*([^<\n]*):([0-9]+):([0-9]+))", + "file_regex": "^\\s+-->\\s+([^:]+):(\\d+):(\\d+)$", "syntax": "Packages/Rust/Cargo.sublime-syntax", "keyfiles": ["Cargo.toml"], "working_dir": "${folder:${project_path:${file_path}}}", @@ -22,6 +22,10 @@ { "cmd": ["cargo", "clean"], "name": "Clean" - } + }, + { + "cmd": ["cargo", "clippy"], + "name": "Clippy" + }, ] } From 681851977757ddbe186c43de2424ae8a8afb59fd Mon Sep 17 00:00:00 2001 From: /dev/mataha Date: Thu, 20 Jun 2024 17:30:21 +0200 Subject: [PATCH 03/12] [Batch File] Auto-pair exclamation mark (#3994) For use in delayed expansion mode. --- Batch File/Default.sublime-keymap | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Batch File/Default.sublime-keymap b/Batch File/Default.sublime-keymap index bcbc11792f..bb18ceef82 100644 --- a/Batch File/Default.sublime-keymap +++ b/Batch File/Default.sublime-keymap @@ -6,7 +6,7 @@ "command": "insert_snippet", "args": {"contents": "%${0:$SELECTION}%"}, "context": [ - { "key": "setting.auto_match_enabled"}, + { "key": "setting.auto_match_enabled" }, { "key": "selection_empty", "operand": false, "match_all": true }, { "key": "selector", "operand": "source.dosbatch" } ] @@ -23,4 +23,28 @@ { "key": "following_text", "operator": "regex_contains", "operand": "^%", "match_all": true } ] }, -] \ No newline at end of file + // Auto-pair exclamation mark + // Example: text -> !text! + { + "keys": ["!"], + "command": "insert_snippet", + "args": {"contents": "!${0:$SELECTION}!"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "source.dosbatch" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.dosbatch" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "!$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^!", "match_all": true } + ] + }, +] From c7ab6e57666008f7231de5574697c94b51b8d71d Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 22 Jun 2024 11:30:43 +0200 Subject: [PATCH 04/12] [Batch File] Fix newline scoped illegal in for loop sets (#3998) Fixes #3997 This commit excluded linefeed from set of illegal operators within for loops. --- Batch File/Batch File.sublime-syntax | 2 +- Batch File/tests/syntax_test_batch_file.bat | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax index c2bc3c1508..194aed11f7 100644 --- a/Batch File/Batch File.sublime-syntax +++ b/Batch File/Batch File.sublime-syntax @@ -1550,7 +1550,7 @@ contexts: scope: punctuation.separator.semicolon.dosbatch invalid-operators: - - match: '{{redir_or_eoc_char}}' + - match: '[|&<>]+' scope: invalid.illegal.operator.dosbatch ###[ CONSTANTS ]############################################################## diff --git a/Batch File/tests/syntax_test_batch_file.bat b/Batch File/tests/syntax_test_batch_file.bat index 1628327dcd..6422b7906d 100644 --- a/Batch File/tests/syntax_test_batch_file.bat +++ b/Batch File/tests/syntax_test_batch_file.bat @@ -1622,12 +1622,16 @@ is a #@$虎" strange label IN ^ ( :: ^ punctuation.section.set.begin.dosbatch +:: ^ - invalid folder1, :: ^ punctuation.separator.comma.dosbatch +:: ^ - invalid ..\folder2, :: ^^ constant.other.path.parent.dosbatch :: ^ punctuation.separator.comma.dosbatch +:: ^ - invalid C:\folder +:: ^ - invalid ) ^ DO command :: ^^ keyword.control.loop.do.dosbatch From 23c715e21cf1ab17675e8ef6cf3451c349a16acd Mon Sep 17 00:00:00 2001 From: /dev/mataha Date: Sat, 22 Jun 2024 17:22:20 +0200 Subject: [PATCH 05/12] [Batch File] Fix comment scope around newlines (#3992) This commit fixes an issue which caused a line after empty label comments being scoped comment by accident. --- Batch File/Batch File.sublime-syntax | 4 +- Batch File/tests/syntax_test_batch_file.bat | 95 ++++++++++++++++++--- 2 files changed, 83 insertions(+), 16 deletions(-) diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax index 194aed11f7..ae05fcfeb2 100644 --- a/Batch File/Batch File.sublime-syntax +++ b/Batch File/Batch File.sublime-syntax @@ -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: @@ -843,7 +843,7 @@ contexts: # meta_content_scope is used since rem should not be # highlighted as a comment, but a command - meta_content_scope: comment.line.rem.dosbatch - - match: \n + - match: $\n? scope: comment.line.rem.dosbatch pop: 1 diff --git a/Batch File/tests/syntax_test_batch_file.bat b/Batch File/tests/syntax_test_batch_file.bat index 6422b7906d..241154e9e6 100644 --- a/Batch File/tests/syntax_test_batch_file.bat +++ b/Batch File/tests/syntax_test_batch_file.bat @@ -37,14 +37,19 @@ I'm a (com|ment) :: ^^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch + REM ^ + + I'm a (com|ment) +:: ^^^^^^^^^^^^^^^^^ comment.line.rem.dosbatch + REM ^ I'm a (com|ment) ^ not a comment -:: ^^^^^^^^^^^^^ - comment +:: ^^^^^^^^^^^^^^ - comment REM not a comment -:: ^^^^^^^^^^^^^ - comment +:: ^^^^^^^^^^^^^^ - comment REM This follows a REM command :: <- keyword.declaration.rem.dosbatch - comment @@ -52,48 +57,110 @@ REM This follows a REM command REM This & and | echo "is commented out" ^ :: <- keyword.declaration.rem.dosbatch -:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch +:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch REM No line ^ continuation :: <- - comment -:: ^^^^^^^^^ - comment +:: ^^^^^^^^^^ - comment ::: Me too! :: ^^^ punctuation.definition.comment.dosbatch -:: ^^^^^^^^^^^ comment.line.colon.dosbatch +:: ^^^^^^^^^^^^ comment.line.colon.dosbatch + + ::: + Not me, though. +:: ^^^^^^^^^^^^^^^^ - comment :: Me too! :: ^^ punctuation.definition.comment.dosbatch -:: ^^^^^^^^^^ comment.line.colon.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 +:: ^^^^^^^^^^^ 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 +:: ^^^^^^^^^^^ comment.line.colon.dosbatch + + :; + Not me, though. +:: ^^^^^^^^^^^^^^^^ - comment : Me too! :: ^^ punctuation.definition.comment.dosbatch +:: ^^^^^^^^^^ comment.line.colon.dosbatch + + : + Not me, though. +:: ^^^^^^^^^^^^^^^^ - comment + + :::^ + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch + + :::^ + + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch + + ::: ^ + A continued comment.^ + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch ::^ Me too! -:: ^^^^^^^ comment.line.colon.dosbatch +:: ^^^^^^^^ comment.line.colon.dosbatch + + ::^ + + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch + + :: ^ + A continued comment.^ + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch : ^ Me too! -:: ^^^^^^^ comment.line.colon.dosbatch +:: ^^^^^^^^ comment.line.colon.dosbatch + + : ^ + + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch : ^ A continued comment.^ Me too! -:: ^^^^^^^ comment.line.colon.dosbatch +:: ^^^^^^^^ comment.line.colon.dosbatch :> ignored content ( & | ) :: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.colon.dosbatch @@ -114,30 +181,30 @@ 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 :: ^^^^^^^^^^^^^^^^ invalid.illegal.unexpected.dosbatch ECHO : Not a comment ^ -:: ^^^^^^^^^^^^^^^ - comment +:: ^^^^^^^^^^^^^^^^^^ - comment :: ^^ punctuation.separator.continuation.line.dosbatch ECHO : Not a comment ^ :: Me not, too :: <- - comment -::^^^^^^^^^^^^ - comment +::^^^^^^^^^^^^^ - comment :::: [ @ Operator ] ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: From 3cda1fd09dd70abfceb1df42ed4840ffb33483c2 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Thu, 27 Jun 2024 22:49:55 +0200 Subject: [PATCH 06/12] [Java] Fix annoted enum constans (#4002) Fixes #4001 --- Java/Java.sublime-syntax | 2 +- Java/tests/syntax_test_java.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Java/Java.sublime-syntax b/Java/Java.sublime-syntax index 9c78615598..d8e9359144 100644 --- a/Java/Java.sublime-syntax +++ b/Java/Java.sublime-syntax @@ -735,7 +735,7 @@ contexts: scope: meta.constant.identifier.java entity.name.constant.java push: enum-constant-arguments - include: punctuation-separator-comma - - include: else-pop + - include: annotation-else-pop enum-constant-arguments: - meta_content_scope: meta.constant.identifier.java diff --git a/Java/tests/syntax_test_java.java b/Java/tests/syntax_test_java.java index 1f52b0b0ff..b8faf86fe7 100644 --- a/Java/tests/syntax_test_java.java +++ b/Java/tests/syntax_test_java.java @@ -1751,9 +1751,16 @@ public enum FooBarEnum { FOO, //^^^ meta.constant.identifier.java entity.name.constant.java // ^ punctuation.separator.comma.java - BAR; + @anno + BAR, //^^^ meta.constant.identifier.java entity.name.constant.java -// ^ punctuation.terminator.java - meta.constant +// ^ punctuation.separator.comma.java + @anno + BAZ(); +//^^^ meta.constant.identifier.java entity.name.constant.java +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.begin.java +// ^ meta.constant.arguments.java meta.group.java punctuation.section.group.end.java +// ^ punctuation.terminator.java - meta.constant } // <- meta.enum.java punctuation.section.block.end.java From 16c47e79032371c58b5c6ca5fd09d8b48475f602 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 29 Jun 2024 22:15:54 +0200 Subject: [PATCH 07/12] [JavaScript] Fix ST freezing (#4003) Fixes https://github.com/sublimehq/sublime_text/issues/6416 Regressed by #3836 This commit refactors for loop conditions to prevent ST's syntax engine to run into an infinite loop, if multiple nested for loops appear within branches, such as arrow functions. The issue seems to be triggered by ```yml for-condition-contents: - match: '' branch_point: for-in-of branch: - for-in-of - for-oldstyle pop: 1 ``` in conjunction with newlines. Note: It somewhat reorganizes expressions contexts a little bit. --- JavaScript/JavaScript.sublime-syntax | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index 15142511cd..2452d6b7cf 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -842,31 +842,25 @@ contexts: - include: else-pop for-condition: - - match: '\(' - scope: punctuation.section.group.begin.js - set: - - for-condition-end - - for-condition-contents + - match: \( + scope: meta.group.js punctuation.section.group.begin.js + branch_point: for-in-of + branch: + - for-in-of + - for-oldstyle - include: else-pop for-condition-end: - meta_scope: meta.group.js - - - match: '\)' + - match: \) scope: punctuation.section.group.end.js pop: 1 - for-condition-contents: - - match: '' - branch_point: for-in-of - branch: - - for-in-of - - for-oldstyle - pop: 1 - for-in-of: + - meta_include_prototype: false - match: '' set: + - for-condition-end - expression - for-in-of-word - for-in-of-declaration @@ -916,6 +910,7 @@ contexts: fail: for-in-of for-oldstyle: + - meta_include_prototype: false - match: '' set: - for-oldstyle-rest @@ -927,16 +922,14 @@ contexts: set: - variable-binding-list-top - variable-binding-top - - match: (?=\S) - set: expression + - include: else-pop for-oldstyle-rest: - - match: (?=\)) - pop: 1 + - meta_scope: meta.group.js - match: ; scope: punctuation.separator.expression.js - - match: (?=\S) - push: expression + - include: for-condition-end + - include: expressions block-scope: - include: block @@ -1055,25 +1048,32 @@ contexts: - include: parenthesized-expression - include: expression-begin - expression-break: - - match: (?=[;})\]]) - pop: 1 + expressions: + - match: (?=\S) + push: [ expression-end, expression-begin ] expression: - meta_include_prototype: false - match: '' set: [ expression-end, expression-begin ] + expression-list: + - include: expression-break + - include: comma-separator + - include: expressions-no-comma + + expressions-no-comma: + - match: (?=\S) + push: [ expression-end-no-comma, expression-begin ] + expression-no-comma: - meta_include_prototype: false - match: '' set: [ expression-end-no-comma, expression-begin ] - expression-list: - - include: expression-break - - include: comma-separator - - match: (?=\S) - push: expression-no-comma + expression-break: + - match: (?=[;})\]]) + pop: 1 left-expression-end: - include: expression-break From 5dbbc4d9ffbccc19dc5804643cfc3e3d1dcc7c79 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Tue, 9 Jul 2024 21:13:20 +0200 Subject: [PATCH 08/12] [Batch File] Fix line continuation (#3999) * [Batch File] Fix line continuation This commit applies the following rule: If `^` appears at the end of a line, the linefeed is stripped and the next character is escaped or uses its special meaning, if any. If the next character is also a linefeed, it is treated literal. REM command seems to be working special by line continuation working only directly after the first token. * [Batch File] Only scope ^ punctuation * [Batch File] Treat first caret after continuation literal A caret (`^`) at the beginning of a continued line is printed literal as it is escaped by the continuing caret after stripping newline character. 1. It does not introduce an escape sequence. 2. It is not scoped `constant.character.escape` as it is just printed as is. 3. It differs from `^^` escape sequences by escaping caret already being scoped `punctuation.separator.continuation.line`. Rule ==== Escaped - is stripped - The next character is escaped. If at the end of line buffer, then the next line is read and processed by phases 1 and 1.5 and appended to the current one before escaping the next character. Note: Due to `^` being treated special, only at beginning of line, this construct won't be supported properly under all circumstances when embedding batch syntax into Markdown or any other syntax, with probably indented code blocks. * [Batch File] Exclude prototypes from continuation contexts May be of interest, if syntax is extended by template languages. --- Batch File/Batch File.sublime-syntax | 38 +++- Batch File/tests/syntax_test_batch_file.bat | 201 +++++++++++++++++++- 2 files changed, 224 insertions(+), 15 deletions(-) diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax index ae05fcfeb2..e73f794b4b 100644 --- a/Batch File/Batch File.sublime-syntax +++ b/Batch File/Batch File.sublime-syntax @@ -1,6 +1,7 @@ %YAML 1.2 --- # https://www.sublimetext.com/docs/syntax.html +# https://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/4095133#4095133 name: Batch File scope: source.dosbatch version: 2 @@ -836,7 +837,20 @@ contexts: - include: cmd-arg-help - include: unquoted-eol-pop - match: (?=\S) - set: cmd-rem-comment-body + set: + - cmd-rem-comment-body + - cmd-rem-comment-begin + + cmd-rem-comment-begin: + # In REM comments only the first continuation directly following + # the first token is taken into account. + - meta_include_prototype: false + - match: (\^)\n + captures: + 1: punctuation.separator.continuation.line.dosbatch + set: line-continuation-body + - match: (?={{metachar}}) + pop: 1 cmd-rem-comment-body: - meta_include_prototype: false @@ -1967,8 +1981,8 @@ contexts: ###[ PROTOTYPES ]############################################################# bol-pop: - # Note: empty lines are ignored - - match: ^(?!$) + - meta_include_prototype: false + - match: ^ pop: 1 else-pop: @@ -1981,9 +1995,21 @@ contexts: pop: 1 line-continuations: - - match: \^\n - scope: punctuation.separator.continuation.line.dosbatch - push: bol-pop + - match: (\^)\n + captures: + 1: punctuation.separator.continuation.line.dosbatch + push: line-continuation-body + + line-continuation-body: + - meta_include_prototype: false + # The first linefeed diretly following a continuation is treated literal. + # Note: Must consume \n to work. + - match: ^\n + set: bol-pop + # The first caret at a continued line is escaped by the continuation caret + # and thus printed literal. + - match: ^\^? + pop: 1 eoc-pop: # Note: An end of command appears in unquoted regions only! diff --git a/Batch File/tests/syntax_test_batch_file.bat b/Batch File/tests/syntax_test_batch_file.bat index 241154e9e6..498909c88b 100644 --- a/Batch File/tests/syntax_test_batch_file.bat +++ b/Batch File/tests/syntax_test_batch_file.bat @@ -1,7 +1,7 @@ :: SYNTAX TEST "Packages/Batch File/Batch File.sublime-syntax" -:::: [ Comments ] ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::: [ REM Comments ] ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: REM/? ignored :: ^^^^^^^^^^^^^ meta.command.rem.dosbatch @@ -47,6 +47,11 @@ not a comment :: ^^^^^^^^^^^^^^ - comment + REM ^ + Line^ + continuation after first token +:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch + REM not a comment :: ^^^^^^^^^^^^^^ - comment @@ -59,11 +64,96 @@ REM This & and | echo "is commented out" ^ :: <- keyword.declaration.rem.dosbatch :: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch +::: Test Case : single token continued at next line + +REM Line^ +continuation +:: <- meta.command.rem.dosbatch comment.line.rem.dosbatch +:: ^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch + +::: Test Case : single token continued after empty line + +REM Line^ + +continuation +:: <- meta.command.rem.dosbatch comment.line.rem.dosbatch +:: ^^^^^^^^^^ meta.command.rem.dosbatch comment.line.rem.dosbatch + +::: Test Case : no more continuation after 2nd token + +REM Line^ + +continuation^ +not a comment +:: <- - comment +:: ^^^^^^^^^^ - comment + +::: Test Case : no continuation after 2nd empty line + +REM Line^ + + +not a comment +:: <- - comment +:: ^^^^^^^ - comment + +::: Test Case : continuation beginning with literal caret + +REM Line^ +^continuation +not a comment +:: <- - comment +:: ^^^^^^^^^^ - comment + +::: Test Case : continuation beginning escaping caret after empty line + +REM Line^ + +^continuation +not a comment +:: <- - comment +:: ^^^^^^^^^^ - comment + +::: Test Case : continuation with only litaral caret, no recursive continuation + +REM Line^ +^ +not a comment +:: <- - comment +:: ^^^^^^^^^^ - comment + +::: Test Case : continuation with only escaping caret after empty line, no recursive continuation + +REM Line^ + +^ +not a comment +:: <- - comment +:: ^^^^^^^^^^ - comment + +::: Test Case : no line continuation after 2nd token #1 + REM No line ^ continuation :: <- - comment :: ^^^^^^^^^^ - comment +::: Test Case : no line continuation after 2nd token #2 + +REM No line ^ +^ +:: <- meta.function-call.identifier.dosbatch variable.function.dosbatch punctuation.separator.continuation.line.dosbatch + +::: Test Case : no line continuation after 2nd token #3 + +REM No line ^ +^ +not a comment +:: <- - comment +::^^^^^^^^^^^^ - comment + +:::: [ Label Comments ] ::::::::::::::::::::::::::::::::::::::::::::::::::::::: + ::: Me too! :: ^^^ punctuation.definition.comment.dosbatch :: ^^^^^^^^^^^^ comment.line.colon.dosbatch @@ -134,6 +224,16 @@ continuation Me too! :: ^^^^^^^^ comment.line.colon.dosbatch + ::: ^ + ^ + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch + +::: ^ +^ + Not me, though. +:: ^^^^^^^^^^^^^^^^ - comment + ::^ Me too! :: ^^^^^^^^ comment.line.colon.dosbatch @@ -148,6 +248,16 @@ continuation Me too! :: ^^^^^^^^ comment.line.colon.dosbatch + :: ^ + ^ + Me too! +:: ^^^^^^^^ comment.line.colon.dosbatch + +:: ^ +^ + Not me, though. +:: ^^^^^^^^^^^^^^^^ - comment + : ^ Me too! :: ^^^^^^^^ comment.line.colon.dosbatch @@ -162,6 +272,16 @@ continuation 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 @@ -199,7 +319,8 @@ ECHO |:: Not a comment ECHO : Not a comment ^ :: ^^^^^^^^^^^^^^^^^^ - comment -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation ECHO : Not a comment ^ :: Me not, too @@ -481,6 +602,22 @@ ECHO : Not a comment ^ :: ^ punctuation.definition.variable.dosbatch :: ^^^^ variable.label.dosbatch - keyword + CALL ^ + + :EOF +:: ^^^^ meta.function-call.identifier.dosbatch +:: ^ - meta.function-call +:: ^ punctuation.definition.variable.dosbatch +:: ^^^^ variable.label.dosbatch - keyword + + CALL ^ + + + :EOF +:: ^^^^ - meta.function-call +:: ^ punctuation.definition.label.dosbatch +:: ^^^^ entity.name.label.dosbatch + CALL :foo 10 %1 ::^ - meta.function-call :: ^^^^^ meta.function-call.dosbatch @@ -1334,7 +1471,8 @@ is a #@$虎" strange label IF^ :: ^^ - keyword.control.conditional -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation IF ^ NOT EXIST "C:\file.log" @@ -1889,7 +2027,8 @@ is a #@$虎" strange label :: ^^^^^^ meta.function-call.identifier.dosbatch variable.function.dosbatch :: ^^^^^^^^^^ meta.function-call.arguments.dosbatch out^ -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation out^ put arg1 arg2 @@ -2065,7 +2204,8 @@ put arg1 arg2 command arg^ :: ^^^^^ meta.function-call.arguments.dosbatch -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation command arg^ for @@ -2510,6 +2650,7 @@ put arg1 arg2 :: ^^^^ meta.function-call.identifier.dosbatch support.function.builtin.dosbatch :: ^^^ meta.function-call.arguments.dosbatch :: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation ECHO ^ /? ignored @@ -2652,6 +2793,44 @@ put arg1 arg2 :: ^^^ meta.string.dosbatch string.unquoted.dosbatch :: ^ - meta.command - meta.string - string + ECHO line ^ +:: ^^^^^^^ meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation + + ECHO line ^ + continuation +:: <- meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +::^^^^^^^^^^^^^ meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch + + ECHO line ^ + + continuation +:: <- meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +::^^^^^^^^^^^^^ meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch + + ECHO line ^ + ^ +:: <- meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +::^^^ meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation + + ECHO line ^ + ^ + continuation +:: <- meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch +::^^^^^^^^^^^^^ meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch + +ECHO line ^ +^ +:: <- meta.command.echo.dosbatch meta.function-call.arguments.dosbatch meta.string.dosbatch string.unquoted.dosbatch - punctuation + +ECHO line ^ +^ +no continuation +:: <- - meta.command.echo - meta.string - string +::^^^^^^^^^^^^^ - meta.command.echo :::: [ ECHO escaped characters ]::::::::::::::::::::::::::::::::::::::::::::::: @@ -3417,7 +3596,8 @@ put arg1 arg2 :: ^^^^ variable.other.readwrite.dosbatch :: ^ keyword.operator.assignment.dosbatch :: ^^^^^^ string.unquoted.dosbatch -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation set foo"="bar^ baz @@ -3446,7 +3626,8 @@ put arg1 arg2 :: ^^^^^ variable.other.readwrite.dosbatch :: ^ keyword.operator.assignment.dosbatch :: ^^^^^ string.unquoted.dosbatch -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation set fo"o"=bar^ baz @@ -3474,7 +3655,8 @@ put arg1 arg2 :: ^^^^ variable.other.readwrite.dosbatch :: ^ keyword.operator.assignment.dosbatch :: ^^^^^^^ meta.string.dosbatch string.unquoted.dosbatch -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation set fo"o"="bar"^ baz @@ -4556,7 +4738,8 @@ put arg1 arg2 :: ^^^^^ variable.other.readwrite.dosbatch :: ^ keyword.operator.assignment.dosbatch :: ^^^^^^^^^ string.unquoted.dosbatch -:: ^^ punctuation.separator.continuation.line.dosbatch +:: ^ punctuation.separator.continuation.line.dosbatch +:: ^ - punctuation :: even number of quotes in l-value :: unquoted value From a5ed29e46ddd2f3afa75b3792b4d22b028d1669c Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 12 Jul 2024 08:42:39 +0200 Subject: [PATCH 09/12] [CSS] Add :global() and :local() pseudo-classes (#3944) This commit adds `:global(selector)` and `:local(selector)` pseudo-class support. The former is used by CSS Modules, Less and Astro framework. The ladder is used by CSS Modules only, but is added for completeness. It is no default CSS feature, but appears to be specific enough to not cause any conflicts. Adding it to core CSS would avoid the need to extend CSS for Astro, just for this single reason. --- CSS/CSS.sublime-syntax | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/CSS/CSS.sublime-syntax b/CSS/CSS.sublime-syntax index 7a9b22c962..05868d9514 100644 --- a/CSS/CSS.sublime-syntax +++ b/CSS/CSS.sublime-syntax @@ -94,6 +94,21 @@ variables: keyframe_selector_begin: (?=\b(?i:from|to){{break}}|\.?[\d,%]) + pseudo_classes_with_selector_args: |- + (?xi: global | local | matches | is | where | not | has | host(?:-context)?) + + pseudo_classes_with_anb_args: |- + (?xi: + # https://drafts.csswg.org/selectors-4/#table-pseudos + nth-last-col + | nth-col + # https://drafts.csswg.org/selectors-4/#typed-child-index + | nth-last-child + | nth-child + | nth-last-of-type + | nth-of-type + ) + # Combinators # https://drafts.csswg.org/selectors-4/#combinators combinators: (?:>{1,3}|[~+]|\|{2}) @@ -1365,17 +1380,7 @@ contexts: # Functional Pseudo Classes with `An+B` param # An+B Notation: https://drafts.csswg.org/css-syntax/#anb pseudo-class-function-with-anb-args: - - match: |- - (?xi: - # https://drafts.csswg.org/selectors-4/#table-pseudos - nth-last-col - | nth-col - # https://drafts.csswg.org/selectors-4/#typed-child-index - | nth-last-child - | nth-child - | nth-last-of-type - | nth-of-type - )(?=\() + - match: '{{pseudo_classes_with_anb_args}}(?=\()' scope: meta.function-call.identifier.css entity.other.pseudo-class.css set: - pseudo-class-anb-arguments-list-body @@ -1404,7 +1409,8 @@ contexts: # Functional Pseudo Classes with selector list pseudo-class-function-with-selector-args: - - match: (?i:matches|is|where|not|has|host(?:-context)?)(?=\() + # global(), local() - CSS Modules, Less, Astro + - match: '{{pseudo_classes_with_selector_args}}(?=\()' scope: meta.function-call.identifier.css entity.other.pseudo-class.css set: - pseudo-class-selector-arguments-list-body From b319768f7b5cf17769496d30b6a9f37da8187f7d Mon Sep 17 00:00:00 2001 From: /dev/mataha Date: Sat, 13 Jul 2024 11:03:42 +0200 Subject: [PATCH 10/12] [Markdown] Match code block syntax names with Linguist aliases (#4007) Mainly because `batchfile` didn't work for batch files... This commit adds most of Linguist (GH language detector - [source][1]) aliases for languages for which fenced code block contexts exist in Markdown grammar. I've omitted a few aliases because these name separate languages with their own third-party packages (notably `cake`, `octave` and some `sh` variants). I've left ActionScript alone as I wasn't sure whether the grammar covers as3. [1]: https://github.com/github-linguist/linguist/blob/master/lib/linguist/languages.yml --- .../Code Block Syntaxes.sublime-completions | 132 ++++++++++++++++-- Markdown/Markdown.sublime-syntax | 26 ++-- Markdown/tests/syntax_test_markdown.md | 6 +- 3 files changed, 140 insertions(+), 24 deletions(-) diff --git a/Markdown/Code Block Syntaxes.sublime-completions b/Markdown/Code Block Syntaxes.sublime-completions index 084416152e..abec35fd1a 100644 --- a/Markdown/Code Block Syntaxes.sublime-completions +++ b/Markdown/Code Block Syntaxes.sublime-completions @@ -18,7 +18,7 @@ // AppleScript { - "trigger": "AppleScript", + "trigger": "applescript", "annotation": "AppleScript", "kind": ["markup", "s", "Syntax"], "details": "Specifies AppleScript code highlighting" @@ -29,6 +29,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies AppleScript code highlighting" }, + { + "trigger": "scpt", + "annotation": "AppleScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies AppleScript code highlighting" + }, // C++ { @@ -39,19 +45,19 @@ }, { "trigger": "cpp", - "annotation": "C++", + "annotation": "C++ source", "kind": ["markup", "s", "Syntax"], "details": "Specifies C++ code highlighting" }, { "trigger": "cxx", - "annotation": "C++", + "annotation": "C++ source", "kind": ["markup", "s", "Syntax"], "details": "Specifies C++ code highlighting" }, { "trigger": "c++", - "annotation": "C++", + "annotation": "C++ source", "kind": ["markup", "s", "Syntax"], "details": "Specifies C++ code highlighting" }, @@ -129,6 +135,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Diff code highlighting" }, + { + "trigger": "udiff", + "annotation": "Unified Diff", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Diff code highlighting" + }, { "trigger": "patch", "annotation": "Patch", @@ -143,6 +155,18 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies DOS batch code highlighting" }, + { + "trigger": "batch", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, + { + "trigger": "batchfile", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, { "trigger": "cmd", "annotation": "DOS batch", @@ -150,13 +174,25 @@ "details": "Specifies DOS batch code highlighting" }, { - "trigger": "dos", + "trigger": "dosbatch", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, + { + "trigger": "winbatch", "annotation": "DOS batch", "kind": ["markup", "s", "Syntax"], "details": "Specifies DOS batch code highlighting" }, // Erlang + { + "trigger": "erl", + "annotation": "Erlang", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Erlang code highlighting" + }, { "trigger": "erlang", "annotation": "Erlang", @@ -185,12 +221,24 @@ }, // GraphViz + { + "trigger": "dot", + "annotation": "GraphViz", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies GraphViz code highlighting" + }, { "trigger": "graphviz", "annotation": "GraphViz", "kind": ["markup", "s", "Syntax"], "details": "Specifies GraphViz code highlighting" }, + { + "trigger": "gv", + "annotation": "GraphViz", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies GraphViz code highlighting" + }, // Haskell { @@ -199,6 +247,18 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Haskell code highlighting" }, + { + "trigger": "hs", + "annotation": "Haskell", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Haskell code highlighting" + }, + { + "trigger": "hsc", + "annotation": "Haskell C binding", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Haskell code highlighting" + }, // HTML { @@ -207,6 +267,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies HTML code highlighting" }, + { + "trigger": "xhtml", + "annotation": "HTML", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies HTML code highlighting" + }, // Java { @@ -242,7 +308,13 @@ "details": "Specifies JavaScript code highlighting" }, { - "trigger": "JSX", + "trigger": "node", + "annotation": "JavaScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JavaScript code highlighting" + }, + { + "trigger": "jsx", "annotation": "JavaScript React", "kind": ["markup", "s", "Syntax"], "details": "Specifies JavaScript React code highlighting" @@ -253,6 +325,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies TypeScript code highlighting" }, + { + "trigger": "tsnode", + "annotation": "TypeScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies TypeScript code highlighting" + }, { "trigger": "tsx", "annotation": "TypeScript React", @@ -310,6 +388,26 @@ "details": "Specifies Lua code highlighting" }, + // Makefile + { + "trigger": "make", + "annotation": "Makefile", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Makefile code highlighting" + }, + { + "trigger": "makefile", + "annotation": "Makefile", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Makefile code highlighting" + }, + { + "trigger": "mf", + "annotation": "Makefile", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Makefile code highlighting" + }, + // Matlab { "trigger": "matlab", @@ -383,6 +481,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Perl 5 code highlighting" }, + { + "trigger": "perl5", + "annotation": "Perl 5", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Perl 5 code highlighting" + }, // PHP { @@ -391,6 +495,12 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies HTML+PHP code highlighting" }, + { + "trigger": "phtml", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies HTML+PHP code highlighting" + }, { "trigger": "inc", "annotation": "PHP", @@ -404,13 +514,19 @@ "details": "Specifies PHP code highlighting" }, - // Phyton + // Python { "trigger": "python", "annotation": "Python", "kind": ["markup", "s", "Syntax"], "details": "Specifies Python code highlighting" }, + { + "trigger": "python3", + "annotation": "Python", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Python code highlighting" + }, { "trigger": "py", "annotation": "Python", @@ -598,4 +714,4 @@ "details": "Specifies YAML code highlighting" }, ], -} \ No newline at end of file +} diff --git a/Markdown/Markdown.sublime-syntax b/Markdown/Markdown.sublime-syntax index 4db3314b1e..2185b0e70c 100644 --- a/Markdown/Markdown.sublime-syntax +++ b/Markdown/Markdown.sublime-syntax @@ -1161,7 +1161,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(applescript|osascript)) + (?i:\s*(applescript|osascript|scpt)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.applescript.markdown-gfm @@ -1293,7 +1293,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(diff|patch)) + (?i:\s*(u?diff|patch)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.diff.markdown-gfm @@ -1315,7 +1315,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(bat|cmd|dos)) + (?i:\s*(bat(?:ch(?:file)?)?|cmd|(?:dos|win)batch)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.dosbatch.markdown-gfm @@ -1337,7 +1337,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(erlang|escript)) + (?i:\s*(erl(?:ang)?|escript)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.erlang.markdown-gfm @@ -1359,7 +1359,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(graphviz)) + (?i:\s*(dot|graphviz|gv)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.graphviz.markdown-gfm @@ -1403,7 +1403,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(haskell)) + (?i:\s*(haskell|hsc?)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.haskell.markdown-gfm @@ -1425,7 +1425,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(html\+php)) + (?i:\s*(html\+php|phtml)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.html-php.markdown-gfm @@ -1447,7 +1447,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(html)) + (?i:\s*(x?html)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.html.markdown-gfm @@ -1491,7 +1491,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(javascript|js)) + (?i:\s*(javascript|js|node)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.javascript.markdown-gfm @@ -1645,7 +1645,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(makefile)) + (?i:\s*(make(?:file)?|mf)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.makefile.markdown-gfm @@ -1755,7 +1755,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(perl)) + (?i:\s*(perl5?)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.perl.markdown-gfm @@ -1799,7 +1799,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(python|py)) + (?i:\s*(python3?|py)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.python.markdown-gfm @@ -2019,7 +2019,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - (?i:\s*(typescript|ts)) + (?i:\s*(typescript|ts(?:node)?)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.typescript.markdown-gfm diff --git a/Markdown/tests/syntax_test_markdown.md b/Markdown/tests/syntax_test_markdown.md index 49b296f5ef..92e5e9e3d6 100644 --- a/Markdown/tests/syntax_test_markdown.md +++ b/Markdown/tests/syntax_test_markdown.md @@ -1842,9 +1842,9 @@ echo This is a smiley :-\) \(I have to escape the parentheses, though!\) |^^ meta.code-fence.definition.end.diff.markdown-gfm punctuation.definition.raw.code-fence.end.markdown | ^ meta.code-fence.definition.end.diff.markdown-gfm meta.fold.code-fence.end - punctuation -```Graphviz -|^^^^^^^^^^ meta.code-fence.definition.begin - meta.fold -| ^ meta.code-fence.definition.begin meta.fold.code-fence.begin +```dot +|^^^^^ meta.code-fence.definition.begin - meta.fold +| ^ meta.code-fence.definition.begin meta.fold.code-fence.begin graph n {} | ^^^ storage.type.dot From 634bebb70d8321d73c0854c98db40bae4609051d Mon Sep 17 00:00:00 2001 From: Ashley Mannix Date: Sat, 13 Jul 2024 19:05:16 +1000 Subject: [PATCH 11/12] [Rust] Add variants for short message formats (#4006) Closes #4004 I've added some variants for building, running, and checking using Rust's short message format, which gives a nicer inline error than Rust's default output. I'm not familiar with the conventions of this codebase though around naming, preferred use of regex features etc, so if it's easier to just redo this in a more idiomatic way than it is to explain it then feel free to close :slightly_smiling_face: --- Rust/Cargo.sublime-build | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Rust/Cargo.sublime-build b/Rust/Cargo.sublime-build index bb9ca0c2b3..cf2b63b79a 100644 --- a/Rust/Cargo.sublime-build +++ b/Rust/Cargo.sublime-build @@ -11,10 +11,20 @@ "cmd": ["cargo", "run"], "name": "Run" }, + { + "cmd": ["cargo", "run", "--message-format", "short"], + "file_regex": "^([^:]*):([0-9]*):([0-9]*):\\s*(.*)", + "name": "Run (Short)" + }, { "cmd": ["cargo", "test"], "name": "Test" }, + { + "cmd": ["cargo", "test", "--message-format", "short"], + "file_regex": "^([^:]*):([0-9]*):([0-9]*):\\s*(.*)", + "name": "Test (Short)" + }, { "cmd": ["cargo", "bench"], "name": "Bench" @@ -27,5 +37,19 @@ "cmd": ["cargo", "clippy"], "name": "Clippy" }, + { + "cmd": ["cargo", "clippy", "--message-format", "short"], + "file_regex": "^([^:]*):([0-9]*):([0-9]*):\\s*(.*)", + "name": "Clippy (Short)" + }, + { + "cmd": ["cargo", "check", "--all-targets"], + "name": "Check" + }, + { + "cmd": ["cargo", "check", "--all-targets", "--message-format", "short"], + "file_regex": "^([^:]*):([0-9]*):([0-9]*):\\s*(.*)", + "name": "Check (Short)" + }, ] } From 4a51942b8e0792ad0818a5aa41f6d95cfea9f2da Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Sat, 13 Jul 2024 17:06:31 +0800 Subject: [PATCH 12/12] [Mixed] Use detailed scope for true/false/null (#4009) * [Python] Use detailed scope for True/False Signed-off-by: Jack Cherng * [Bash] Use detailed scope for true/false Signed-off-by: Jack Cherng * [PHP] Use detailed scope for true/false Signed-off-by: Jack Cherng * [JSON] Use detailed scope for true/false Signed-off-by: Jack Cherng * [YAML] Use detailed scope for true/false (y/n etc) Signed-off-by: Jack Cherng * [Rust] Use detailed scope for true/false Signed-off-by: Jack Cherng * [SQL] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Scala] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Matlab] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Ruby] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Lua] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Go] Use detailed scope for true/false/nil Signed-off-by: Jack Cherng * [R] Use detailed scope for true/false/null Signed-off-by: Jack Cherng * [OCaml] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Lisp] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Java/JSP] Use detailed scope for true/false Signed-off-by: Jack Cherng * [Groovy] Use detailed scope for true/false/null Signed-off-by: Jack Cherng * [Erlang] Use detailed scope for true/false Signed-off-by: Jack Cherng * [C/C++] Use detailed scope for true/false/NULL Signed-off-by: Jack Cherng * [C#] Use detailed scope for true/false/null Signed-off-by: Jack Cherng * [ActionScript] Use detailed scope for true/false/null Signed-off-by: Jack Cherng --------- Signed-off-by: Jack Cherng --- ActionScript/ActionScript.sublime-syntax | 8 ++++- C#/C#.sublime-syntax | 8 +++-- C++/C.sublime-syntax | 8 ++++- Erlang/Erlang.sublime-syntax | 6 ++-- Erlang/syntax_test_erlang.erl | 16 ++++----- Go/Go.sublime-syntax | 8 +++-- Go/tests/syntax_test_go.go | 6 ++-- Groovy/Groovy.sublime-syntax | 8 +++-- JSON/JSON.sublime-syntax | 6 ++-- JSON/syntax_test_json.json | 2 +- Java/HTML (JSP).sublime-syntax | 13 ++++--- Java/Java.sublime-syntax | 13 ++++--- Java/tests/syntax_test_java.java | 44 ++++++++++++------------ Java/tests/syntax_test_jsp.jsp | 2 +- Lisp/Lisp.sublime-syntax | 7 ++-- Lisp/tests/syntax_test_lisp.lisp | 10 +++--- Lua/Lua.sublime-syntax | 7 ++-- Lua/tests/syntax_test_lua.lua | 10 +++--- Matlab/Matlab.sublime-syntax | 8 ++++- Matlab/syntax_test_matlab.matlab | 10 +++--- OCaml/OCaml.sublime-syntax | 6 ++-- PHP/PHP Source.sublime-syntax | 6 ++-- PHP/tests/syntax_test_php.php | 22 ++++++------ Python/Python.sublime-syntax | 7 ++-- Python/tests/syntax_test_python.py | 16 ++++----- R/R.sublime-syntax | 8 ++++- R/syntax_test_r.R | 6 ++-- Ruby/Ruby.sublime-syntax | 6 ++-- Ruby/syntax_test_ruby.rb | 4 +-- Rust/Rust.sublime-syntax | 6 ++-- SQL/SQL.sublime-syntax | 6 ++-- SQL/syntax_test_sql.sql | 2 +- Scala/Scala.sublime-syntax | 8 +++-- Scala/syntax_test_scala.scala | 12 +++---- ShellScript/Bash.sublime-syntax | 13 ++++--- ShellScript/test/syntax_test_bash.sh | 34 +++++++++--------- YAML/YAML.sublime-syntax | 41 +++++++++++++++------- YAML/tests/syntax_test_flow.yaml | 4 +-- YAML/tests/syntax_test_types.yaml | 24 ++++++------- 39 files changed, 262 insertions(+), 169 deletions(-) diff --git a/ActionScript/ActionScript.sublime-syntax b/ActionScript/ActionScript.sublime-syntax index 7e8567b8ee..9848f020a7 100644 --- a/ActionScript/ActionScript.sublime-syntax +++ b/ActionScript/ActionScript.sublime-syntax @@ -24,7 +24,13 @@ contexts: scope: keyword.control.actionscript.2 - match: \b(Boolean|Number|String|Void)\b scope: storage.type.actionscript.2 - - match: \b(null|undefined|true|false)\b + - match: \bfalse\b + scope: constant.language.boolean.false.actionscript.2 + - match: \btrue\b + scope: constant.language.boolean.true.actionscript.2 + - match: \bnull\b + scope: constant.language.null.actionscript.2 + - match: \bundefined\b scope: constant.language.actionscript.2 - match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\b' scope: constant.numeric.actionscript.2 diff --git a/C#/C#.sublime-syntax b/C#/C#.sublime-syntax index a5b715c670..2c5ce5e3dc 100644 --- a/C#/C#.sublime-syntax +++ b/C#/C#.sublime-syntax @@ -1634,8 +1634,12 @@ contexts: # bools, numbers, chars, simple strings literals: # language constants - - match: \b(true|false|null)\b - scope: constant.language.cs + - match: \bfalse\b + scope: constant.language.boolean.false.cs + - match: \btrue\b + scope: constant.language.boolean.true.cs + - match: \bnull\b + scope: constant.language.null.cs # characters - match: '''\''' scope: invalid.illegal.lone-escape.cs diff --git a/C++/C.sublime-syntax b/C++/C.sublime-syntax index 8c313daa48..cb18ab0a5a 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -211,7 +211,13 @@ contexts: scope: variable.other.readwrite.static.mac-classic.c constants: - - match: \b(__func__|NULL|true|false|TRUE|FALSE)\b + - match: \b(false|FALSE)\b + scope: constant.language.boolean.false.c + - match: \b(true|TRUE)\b + scope: constant.language.boolean.true.c + - match: \bNULL\b + scope: constant.language.null.c + - match: \b__func__\b scope: constant.language.c - match: \b(__FILE__|__FUNCTION__|__LINE__)\b scope: support.constant.c diff --git a/Erlang/Erlang.sublime-syntax b/Erlang/Erlang.sublime-syntax index ee243f0a29..59d5af2aa0 100644 --- a/Erlang/Erlang.sublime-syntax +++ b/Erlang/Erlang.sublime-syntax @@ -1386,8 +1386,10 @@ contexts: constant: # https://www.erlang.org/doc/reference_manual/data_types.html#boolean - - match: (false|true){{ident_break}} - scope: constant.language.boolean.erlang + - match: false{{ident_break}} + scope: constant.language.boolean.false.erlang + - match: true{{ident_break}} + scope: constant.language.boolean.true.erlang # https://www.erlang.org/doc/reference_manual/errors.html#exceptions - match: (error|exit|ok|throw){{ident_break}} scope: constant.language.exception.type.erlang diff --git a/Erlang/syntax_test_erlang.erl b/Erlang/syntax_test_erlang.erl index 5cd4eae68b..4e3c7a6e51 100644 --- a/Erlang/syntax_test_erlang.erl +++ b/Erlang/syntax_test_erlang.erl @@ -33,10 +33,10 @@ atom_tests() -> . % Special atom tests true -% ^^^^ constant.language.boolean.erlang +% ^^^^ constant.language.boolean.true.erlang false -% ^^^^^ constant.language.boolean.erlang +% ^^^^^ constant.language.boolean.false.erlang error % ^^^^^ constant.language.exception.type.erlang @@ -473,7 +473,7 @@ list_tests() -> . % ^ punctuation.section.sequence.begin.erlang % ^ meta.number.integer.decimal.erlang constant.numeric.value.erlang % ^^ keyword.operator.comprehension.erlang -% ^^^^ constant.language.boolean.erlang +% ^^^^ constant.language.boolean.true.erlang % ^ punctuation.section.sequence.end.erlang [2 || is_integer(2)] @@ -4137,7 +4137,7 @@ func_name ( ) when true -> % ^ punctuation.section.parameters.begin.erlang % ^ punctuation.section.parameters.end.erlang % ^^^^ keyword.control.conditional.when.erlang -% ^^^^ constant.language.boolean.erlang +% ^^^^ constant.language.boolean.true.erlang % ^^ punctuation.separator.clause-head-body.erlang . % ^ meta.function.erlang punctuation.terminator.clause.erlang @@ -4389,7 +4389,7 @@ case_tests() -> % ^ punctuation.separator.clauses.erlang % ^^^ variable.other.readwrite.erlang % ^^ keyword.operator.comparison.erlang -% ^^^^^ constant.language.boolean.erlang +% ^^^^^ constant.language.boolean.false.erlang % ^^ punctuation.separator.clause-head-body.erlang print("ok"); % ^^^^^^^^^^^^ meta.case.erlang @@ -4446,7 +4446,7 @@ if_tests() -> % ^ punctuation.separator.clauses.erlang % ^^^ variable.other.readwrite.erlang % ^^ keyword.operator.comparison.erlang -% ^^^^^ constant.language.boolean.erlang +% ^^^^^ constant.language.boolean.false.erlang % ^^ punctuation.separator.clause-head-body.erlang print("ok"); % ^^^^^^^^^^^^ meta.if.erlang @@ -4496,7 +4496,7 @@ maybe_tests() -> % ^ punctuation.separator.expressions.erlang true = A >= 0, % ^^^^^^^^^^^^^^^^^^^^^^^ meta.maybe.erlang meta.maybe.erlang -% ^^^^ constant.language.boolean.erlang +% ^^^^ constant.language.boolean.true.erlang % ^ keyword.operator.assignment.erlang % ^ variable.other.readwrite.erlang % ^^ keyword.operator.comparison.erlang @@ -5243,7 +5243,7 @@ fun_expression_tests() -> % ^^^^ keyword.control.conditional.when.erlang % ^ variable.other.readwrite.erlang % ^^ keyword.operator.comparison.erlang -% ^^^^ constant.language.boolean.erlang +% ^^^^ constant.language.boolean.true.erlang % ^ punctuation.separator.clauses.erlang % ^^^^^^^^ support.function.erlang % ^ punctuation.section.arguments.begin.erlang diff --git a/Go/Go.sublime-syntax b/Go/Go.sublime-syntax index 06a66d989e..163eccb988 100644 --- a/Go/Go.sublime-syntax +++ b/Go/Go.sublime-syntax @@ -344,8 +344,12 @@ contexts: # would be ideal, but is beyond the scope of this syntax engine; we simply # expect it to be very rare. match-predeclared-constants: - - match: \b(?:true|false|nil)\b - scope: constant.language.go + - match: \bfalse\b + scope: constant.language.boolean.false.go + - match: \btrue\b + scope: constant.language.boolean.true.go + - match: \bnil\b + scope: constant.language.null.go # Reference: https://golang.org/ref/spec#Predeclared_identifiers # diff --git a/Go/tests/syntax_test_go.go b/Go/tests/syntax_test_go.go index 62cd186e15..be5985f3a5 100644 --- a/Go/tests/syntax_test_go.go +++ b/Go/tests/syntax_test_go.go @@ -5082,9 +5082,9 @@ by accident, but if necessary, such support could be sacrificed. /* # Predeclared Constants */ true false nil -// ^^^^ constant.language.go -// ^^^^^ constant.language.go -// ^^^ constant.language.go +// ^^^^ constant.language.boolean.true.go +// ^^^^^ constant.language.boolean.false.go +// ^^^ constant.language.null.go /* # Built-in Types */ diff --git a/Groovy/Groovy.sublime-syntax b/Groovy/Groovy.sublime-syntax index c61a4d8348..ac1cc3d18e 100644 --- a/Groovy/Groovy.sublime-syntax +++ b/Groovy/Groovy.sublime-syntax @@ -116,8 +116,12 @@ contexts: constants: - match: '\b([A-Z][A-Z0-9_]+)\b' scope: constant.other.groovy - - match: \b(true|false|null)\b - scope: constant.language.groovy + - match: \bfalse\b + scope: constant.language.boolean.false.groovy + - match: \btrue\b + scope: constant.language.boolean.true.groovy + - match: \bnull\b + scope: constant.language.null.groovy groovy: - include: classes - include: methods diff --git a/JSON/JSON.sublime-syntax b/JSON/JSON.sublime-syntax index 8517e7c17c..77ebc3e8ba 100644 --- a/JSON/JSON.sublime-syntax +++ b/JSON/JSON.sublime-syntax @@ -175,8 +175,10 @@ contexts: ###[ LITERALS ]################################################################ constants: - - match: \b(?:false|true)\b - scope: constant.language.boolean.json + - match: \bfalse\b + scope: constant.language.boolean.false.json + - match: \btrue\b + scope: constant.language.boolean.true.json - match: \bnull\b scope: constant.language.null.json diff --git a/JSON/syntax_test_json.json b/JSON/syntax_test_json.json index c13d583547..4f4d374094 100644 --- a/JSON/syntax_test_json.json +++ b/JSON/syntax_test_json.json @@ -32,7 +32,7 @@ "bool": false, //^^^^^^ meta.mapping.key.json //^^^^^^^^^^^^^^ - meta.mapping meta.mapping -// ^^^^^ constant.language.boolean.json +// ^^^^^ constant.language.boolean.false.json "null": null, //^^^^^^ meta.mapping.key.json diff --git a/Java/HTML (JSP).sublime-syntax b/Java/HTML (JSP).sublime-syntax index 1080f95d42..02308d611c 100644 --- a/Java/HTML (JSP).sublime-syntax +++ b/Java/HTML (JSP).sublime-syntax @@ -640,14 +640,19 @@ contexts: - include: jstl-expressions jstl-constants: - - match: (?:false|true){{break}} - scope: constant.language.boolean.jstl + - match: false{{break}} + scope: constant.language.boolean.false.jstl + - match: true{{break}} + scope: constant.language.boolean.true.jstl - match: null{{break}} scope: constant.language.null.jstl jstl-constant: - - match: (?:false|true){{break}} - scope: constant.language.boolean.jstl + - match: false{{break}} + scope: constant.language.boolean.false.jstl + pop: 1 + - match: true{{break}} + scope: constant.language.boolean.true.jstl pop: 1 - match: null{{break}} scope: constant.language.null.jstl diff --git a/Java/Java.sublime-syntax b/Java/Java.sublime-syntax index d8e9359144..147f7f357f 100644 --- a/Java/Java.sublime-syntax +++ b/Java/Java.sublime-syntax @@ -2346,16 +2346,21 @@ contexts: literal-constants: # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.3 - - match: (?:false|true){{break}} - scope: constant.language.boolean.java + - match: false{{break}} + scope: constant.language.boolean.false.java + - match: true{{break}} + scope: constant.language.boolean.true.java # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.7 - match: null{{break}} scope: constant.language.null.java literal-constant: # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.3 - - match: (?:false|true){{break}} - scope: constant.language.boolean.java + - match: false{{break}} + scope: constant.language.boolean.false.java + pop: 1 + - match: true{{break}} + scope: constant.language.boolean.true.java pop: 1 # https://docs.oracle.com/javase/specs/jls/se13/html/jls-3.html#jls-3.10.7 - match: null{{break}} diff --git a/Java/tests/syntax_test_java.java b/Java/tests/syntax_test_java.java index b8faf86fe7..40eb730d7d 100644 --- a/Java/tests/syntax_test_java.java +++ b/Java/tests/syntax_test_java.java @@ -5434,7 +5434,7 @@ void run() { // ^ - meta.statement.conditional.if // ^ punctuation.section.block.begin.java // ^^^^^^ keyword.control.flow.return.java -// ^^^^^ constant.language.boolean.java +// ^^^^^ constant.language.boolean.false.java // ^ punctuation.section.block.end.java if (foo) else @@ -5506,7 +5506,7 @@ void run() { // ^ punctuation.section.group.begin.java // ^^^ variable.function.java // ^^ keyword.operator.comparison.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.section.group.end.java // ^^^ variable.function.java // ^^^^ keyword.control.conditional.else.java @@ -5554,7 +5554,7 @@ void run() { // ^ - keyword // ^^^^^^ keyword.control.flow.assert.java // ^ - keyword - constant -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java assert : @@ -5612,7 +5612,7 @@ void run() { // ^ punctuation.separator.expressions.java // ^^^ variable.other.java // ^^ keyword.operator.comparison.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java assert int foo=0; @@ -6459,7 +6459,7 @@ void run() { while false // ^^^^^^^^^^^^ meta.statement.loop.while.java // ^^^^^ keyword.control.loop.while.java -// ^^^^^ constant.language.boolean.java +// ^^^^^ constant.language.boolean.false.java while (false) // ^^^^^^^^^^^^^^ - meta.statement.loop.while meta.statement.loop.while @@ -6468,7 +6468,7 @@ void run() { // ^ meta.statement.loop.while.java - meta.group // ^^^^^ keyword.control.loop.while.java // ^ punctuation.section.group.begin.java -// ^^^^^ constant.language.boolean.java +// ^^^^^ constant.language.boolean.false.java // ^ punctuation.section.group.end.java while (false) { } @@ -6479,7 +6479,7 @@ void run() { // ^^^^ meta.statement.loop.while.java meta.block.java // ^^^^^ keyword.control.loop.while.java // ^ punctuation.section.group.begin.java -// ^^^^^ constant.language.boolean.java +// ^^^^^ constant.language.boolean.false.java // ^ punctuation.section.group.end.java // ^ punctuation.section.block.begin.java // ^ punctuation.section.block.end.java @@ -6491,7 +6491,7 @@ void run() { // ^^^^ meta.statement.loop.while.java meta.block.java // ^^^^^ keyword.control.loop.while.java // ^ punctuation.section.group.begin.java -// ^^^^^ constant.language.boolean.java +// ^^^^^ constant.language.boolean.false.java // ^ punctuation.section.block.begin.java // ^ punctuation.section.block.end.java } @@ -7857,7 +7857,7 @@ void invokeMethods() { // ^ punctuation.accessor.dot.java // ^^^^^^^^^^^^ variable.function.java // ^ punctuation.section.group.begin.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.section.group.end.java // ^ punctuation.terminator.java @@ -7879,7 +7879,7 @@ void invokeMethods() { // ^ punctuation.accessor.dot.java // ^^^^^^^^^^^^ variable.function.java // ^ punctuation.section.group.begin.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.section.group.end.java // ^ punctuation.terminator.java } @@ -8101,7 +8101,7 @@ public void instantiateClassesObjects() { // ^^^^^^^^ support.class.java // ^^^ meta.brackets.java // ^ punctuation.separator.comma.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.section.group.end.java // ^ punctuation.terminator.java @@ -8142,7 +8142,7 @@ public void instantiateClassesObjects() { // ^ punctuation.section.group.begin.java // ^^^ variable.other.java // ^^ keyword.operator.comparison.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.section.group.end.java // ^ punctuation.section.block.begin.java // ^ punctuation.section.block.end.java @@ -9924,7 +9924,7 @@ void anonymousFunctions() { // ^ punctuation.section.group.begin.java // ^ punctuation.section.group.end.java // ^^ keyword.declaration.function.arrow.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java Supplier supplier = _ -> true; @@ -9933,7 +9933,7 @@ void anonymousFunctions() { // ^ keyword.operator.assignment.java // ^ variable.language.anonymous.java // ^^ keyword.declaration.function.arrow.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java } @@ -10344,7 +10344,7 @@ int operatorsTests() { // ^ constant.numeric.value.java // ^ punctuation.section.brackets.end.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a[0][0] = true; @@ -10359,7 +10359,7 @@ int operatorsTests() { // ^ constant.numeric.value.java // ^ punctuation.section.brackets.end.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a [ 0 ] [ 0 ] = true; @@ -10377,7 +10377,7 @@ int operatorsTests() { // ^ constant.numeric.value.java // ^ punctuation.section.brackets.end.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a /**/ [ /**/ 0 /**/ ] /**/ [ /**/ 0 /**/ ] /**/ = /**/ true; @@ -10396,7 +10396,7 @@ int operatorsTests() { // ^ constant.numeric.value.java // ^ punctuation.section.brackets.end.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a @@ -10415,7 +10415,7 @@ int operatorsTests() { = // ^ keyword.operator.assignment.java true; -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a.c = true; @@ -10428,7 +10428,7 @@ int operatorsTests() { // ^ punctuation.accessor.dot.java // ^ variable.other.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java a[0].c[1] = true; @@ -10449,11 +10449,11 @@ int operatorsTests() { // ^ constant.numeric.value.java // ^ punctuation.section.brackets.end.java // ^ keyword.operator.assignment.java -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ punctuation.terminator.java int foo = true ? 1 : 2; -// ^^^^ constant.language.boolean.java +// ^^^^ constant.language.boolean.true.java // ^ keyword.operator.ternary.java // ^ meta.number.integer.decimal.java constant.numeric.value.java // ^ keyword.operator.ternary.java diff --git a/Java/tests/syntax_test_jsp.jsp b/Java/tests/syntax_test_jsp.jsp index 3aed505231..9916e95ee8 100644 --- a/Java/tests/syntax_test_jsp.jsp +++ b/Java/tests/syntax_test_jsp.jsp @@ -948,7 +948,7 @@ // ^^^^^^^^^^^^^ meta.path.jstl // ^^^^^^^ variable.namespace.jstl // ^ punctuation.accessor.namespace.jstl -// ^^^^^ constant.language.boolean.jstl +// ^^^^^ constant.language.boolean.false.jstl // ^ punctuation.section.embedded.end.jstl ${obj1 != null && diff --git a/Lisp/Lisp.sublime-syntax b/Lisp/Lisp.sublime-syntax index 44a9795d42..f2618b113e 100644 --- a/Lisp/Lisp.sublime-syntax +++ b/Lisp/Lisp.sublime-syntax @@ -1253,8 +1253,11 @@ contexts: scope: storage.type.lisp pop: 1 # constants - - match: (?i:true|false){{break}} - scope: constant.language.boolean.lisp + - match: (?i:false){{break}} + scope: constant.language.boolean.false.lisp + pop: 1 + - match: (?i:true){{break}} + scope: constant.language.boolean.true.lisp pop: 1 - match: (?i:nil|null){{break}} scope: constant.language.null.lisp diff --git a/Lisp/tests/syntax_test_lisp.lisp b/Lisp/tests/syntax_test_lisp.lisp index 27d76de3be..44fd1ce0fa 100644 --- a/Lisp/tests/syntax_test_lisp.lisp +++ b/Lisp/tests/syntax_test_lisp.lisp @@ -1290,10 +1290,10 @@ ; ^ constant.language (print true) -; ^^^^ constant.language.boolean.lisp +; ^^^^ constant.language.boolean.true.lisp (print false) -; ^^^^^ constant.language.boolean.lisp +; ^^^^^ constant.language.boolean.false.lisp (print nil) ; ^^^ constant.language.null.lisp @@ -2446,7 +2446,7 @@ ; ^^^ keyword.operator.logical.lisp ; ^^^^ variable.other.lisp ; ^ keyword.operator.lisp -; ^^^^ constant.language.boolean.lisp +; ^^^^ constant.language.boolean.true.lisp ;;; for-as-claus @@ -2484,9 +2484,9 @@ var = true then false ; ^^^ variable.other.lisp ; ^ keyword.operator.lisp -; ^^^^ constant.language.boolean.lisp +; ^^^^ constant.language.boolean.true.lisp ; ^^^^ keyword.control.conditional.lisp -; ^^^^^ constant.language.boolean.lisp +; ^^^^^ constant.language.boolean.false.lisp ;;; for-as-across diff --git a/Lua/Lua.sublime-syntax b/Lua/Lua.sublime-syntax index 2980da860d..932e2e35f5 100644 --- a/Lua/Lua.sublime-syntax +++ b/Lua/Lua.sublime-syntax @@ -539,8 +539,11 @@ contexts: pop: 1 builtin: - - match: (?:true|false){{identifier_break}} - scope: constant.language.boolean.lua + - match: false{{identifier_break}} + scope: constant.language.boolean.false.lua + pop: 1 + - match: true{{identifier_break}} + scope: constant.language.boolean.true.lua pop: 1 - match: nil{{identifier_break}} scope: constant.language.null.lua diff --git a/Lua/tests/syntax_test_lua.lua b/Lua/tests/syntax_test_lua.lua index f167b6cc46..814620dafb 100644 --- a/Lua/tests/syntax_test_lua.lua +++ b/Lua/tests/syntax_test_lua.lua @@ -146,10 +146,10 @@ --CONSTANTS true; --- ^^^^ constant.language.boolean.lua +-- ^^^^ constant.language.boolean.true false; --- ^^^^^ constant.language.boolean.lua +-- ^^^^^ constant.language.boolean.false nil; -- ^^^ constant.language.null @@ -342,7 +342,7 @@ not true; -- ^^^ keyword.operator.logical --- ^^^^ constant.language.boolean.lua +-- ^^^^ constant.language.boolean.true 2 + 2 - 2 * 2 / 2 // 2 % 2 ^ 2; -- ^ keyword.operator.arithmetic @@ -490,7 +490,7 @@ foo[return] foo[false] -- ^^^^^^ invalid.unexpected-keyword.lua -- ^ - meta.brackets --- ^^^^^ constant.language.boolean.lua +-- ^^^^^ constant.language.boolean.false some.return -- ^^^^^^ invalid.unexpected-keyword.lua @@ -648,7 +648,7 @@ -- ^^^ invalid.illegal.unexpected-end until true; -- ^^^^^ keyword.control.loop --- ^^^^ constant.language.boolean.lua +-- ^^^^ constant.language.boolean.true for x = 1, y, z do end -- ^^^ keyword.control.loop diff --git a/Matlab/Matlab.sublime-syntax b/Matlab/Matlab.sublime-syntax index ea577d6bd7..c33eab4229 100644 --- a/Matlab/Matlab.sublime-syntax +++ b/Matlab/Matlab.sublime-syntax @@ -1168,7 +1168,13 @@ contexts: # Functions that return essential constants, usually used without parameters builtin-constants: - - match: \b(true|false|eps|pi|Inf|NaN|NaT|flintmax|intmax|intmin|realmax|realmin|namelengthmax)\b + - match: \bfalse\b + scope: constant.language.boolean.false.matlab + push: maybe-transpose + - match: \btrue\b + scope: constant.language.boolean.true.matlab + push: maybe-transpose + - match: \b(eps|pi|Inf|NaN|NaT|flintmax|intmax|intmin|realmax|realmin|namelengthmax)\b scope: constant.language.matlab push: maybe-transpose diff --git a/Matlab/syntax_test_matlab.matlab b/Matlab/syntax_test_matlab.matlab index a7893d2836..eb543f620f 100644 --- a/Matlab/syntax_test_matlab.matlab +++ b/Matlab/syntax_test_matlab.matlab @@ -49,7 +49,7 @@ classdef (Sealed = verLessThan('matlab', '8.4'), ~Hidden) ClassName < SuperClass % ^ punctuation.separator.sequence.matlab % ^^^^^^^^^ variable.parameter.attribute.matlab % ^ keyword.operator.assignment.matlab -% ^^^^ constant.language.matlab +% ^^^^ constant.language.boolean.true.matlab % ^ punctuation.section.parens.end.matlab % ^^^^^^^^^^ comment.line.percentage.matlab PropName @@ -482,8 +482,8 @@ end % Built-in constants true; false -% ^^^^ constant.language.matlab -% ^^^^^ constant.language.matlab +% ^^^^ constant.language.boolean.true.matlab +% ^^^^^ constant.language.boolean.false.matlab Inf; NaN % ^^^ constant.language.matlab % ^^^ constant.language.matlab @@ -793,10 +793,10 @@ l = {l.n}'; "string with missing closing quote mark % ^ invalid.illegal.unclosed-string.matlab true' -% ^^^^ constant.language.matlab +% ^^^^ constant.language.boolean.true.matlab % ^ keyword.operator.transpose.matlab true.' -% ^^^^ constant.language.matlab +% ^^^^ constant.language.boolean.true.matlab % ^^ keyword.operator.transpose.matlab % If a built-in function is followed by a transpose operator, we assume that the diff --git a/OCaml/OCaml.sublime-syntax b/OCaml/OCaml.sublime-syntax index 7c374f2293..6efaf2d80e 100644 --- a/OCaml/OCaml.sublime-syntax +++ b/OCaml/OCaml.sublime-syntax @@ -391,8 +391,10 @@ contexts: 1: meta.empty-typing-pair.ocaml 2: meta.empty-typing-pair.parens.ocaml 3: meta.empty-typing-pair.ocaml - - match: \b(true|false)\b - scope: constant.language.boolean.ocaml + - match: \bfalse\b + scope: constant.language.boolean.false.ocaml + - match: \btrue\b + scope: constant.language.boolean.true.ocaml - match: '''(.|\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\]))''' scope: constant.character.ocaml diff --git a/PHP/PHP Source.sublime-syntax b/PHP/PHP Source.sublime-syntax index a30cee0c94..a1a3a86aa7 100644 --- a/PHP/PHP Source.sublime-syntax +++ b/PHP/PHP Source.sublime-syntax @@ -2107,8 +2107,10 @@ contexts: ###[ CONSTANTS ]############################################################## constants: - - match: (?i:true|false)\b - scope: constant.language.boolean.php + - match: (?i:false)\b + scope: constant.language.boolean.false.php + - match: (?i:true)\b + scope: constant.language.boolean.true.php - match: (?i:null)\b scope: constant.language.null.php - match: (?i:__CLASS__|__DIR__|__FILE__|__FUNCTION__|__LINE__|__METHOD__|__NAMESPACE__)\b diff --git a/PHP/tests/syntax_test_php.php b/PHP/tests/syntax_test_php.php index 6029d8b680..7330fe2ee3 100644 --- a/PHP/tests/syntax_test_php.php +++ b/PHP/tests/syntax_test_php.php @@ -1746,7 +1746,7 @@ class TestTypedProperties { // ^^^^ storage.type.primitive.php // ^^^^^ variable.other.php // ^ keyword.operator.assignment.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.terminator.statement.php private readonly $prop; // ^^^^^^^^ storage.modifier @@ -1945,7 +1945,7 @@ function array_values_from_keys($arr, $keys) { // ^ punctuation.separator.colon.php // ^^^^ storage.type.primitive.php // ^^ keyword.declaration.function.arrow.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.terminator.statement.php $fn = fn ($x): stringSpace\Test1 => null; @@ -3109,7 +3109,7 @@ trait: ; // ^^^^^^^^^^ meta.string.php string.quoted.single.php // ^ punctuation.section.group.end.php // ^^ keyword.operator.comparison.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.section.group.end.php // ^ punctuation.section.block.begin.php } @@ -3130,7 +3130,7 @@ trait: ; // ^^^^^^^^^^ meta.string.php string.quoted.single.php // ^ punctuation.section.group.end.php // ^^ keyword.operator.comparison.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.section.group.end.php // ^ punctuation.section.block.begin.php } @@ -3235,7 +3235,7 @@ trait: ; // ^ - meta.function-call //^^^^^^^ variable.function.php // ^ punctuation.section.group.begin.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.separator.sequence.php // ^ meta.number.integer.decimal.php constant.numeric.value.php // ^ punctuation.separator.sequence.php @@ -3313,11 +3313,11 @@ trait: ; // ^ punctuation.section.block.begin.php // ^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.separator.sequence.php // ^^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^^ constant.language.boolean.php +// ^^^^^ constant.language.boolean.false.php // ^ punctuation.section.block.end.php // ^ punctuation.section.group.end.php @@ -3336,11 +3336,11 @@ trait: ; // ^ punctuation.section.block.begin.php // ^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.separator.sequence.php // ^^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^^ constant.language.boolean.php +// ^^^^^ constant.language.boolean.false.php // ^ punctuation.section.block.end.php // ^ punctuation.section.sequence.end.php @@ -3359,11 +3359,11 @@ trait: ; // ^ punctuation.section.block.begin.php // ^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^ constant.language.boolean.php +// ^^^^ constant.language.boolean.true.php // ^ punctuation.separator.sequence.php // ^^^^^^^ meta.string.php string.quoted.double.php // ^^ punctuation.separator.key-value.php -// ^^^^^ constant.language.boolean.php +// ^^^^^ constant.language.boolean.false.php // ^ punctuation.section.block.end.php // ^ punctuation.section.block.end.php diff --git a/Python/Python.sublime-syntax b/Python/Python.sublime-syntax index 025d803bbb..86cd1f325f 100644 --- a/Python/Python.sublime-syntax +++ b/Python/Python.sublime-syntax @@ -2432,8 +2432,11 @@ contexts: scope: constant.language.python booleans: - - match: (?:True|False)\b - scope: constant.language.boolean.python + - match: False\b + scope: constant.language.boolean.false.python + push: illegal-assignment + - match: True\b + scope: constant.language.boolean.true.python push: illegal-assignment nones: diff --git a/Python/tests/syntax_test_python.py b/Python/tests/syntax_test_python.py index ca3c7d7d8b..88717e121c 100644 --- a/Python/tests/syntax_test_python.py +++ b/Python/tests/syntax_test_python.py @@ -675,7 +675,7 @@ def _(): # ^ keyword.operator.assignment # ^ punctuation.section.function.begin # ^^^^^ meta.function.inline.body -# ^^^^ constant.language.boolean.python +# ^^^^ constant.language.boolean.true.python lambda as, in=2: 0 # ^^ invalid.illegal.name @@ -1163,7 +1163,7 @@ def _(): pass elif False : # ^^^^^^^^^^^^ meta.statement.conditional.elseif.python -# ^^^^^ constant.language.boolean.python +# ^^^^^ constant.language.boolean.false.python # ^ punctuation.section.block.conditional.elseif.python pass else : @@ -1174,7 +1174,7 @@ def _(): if \ True: # ^^^^^ meta.statement.conditional.if.python -# ^^^^ constant.language.boolean.python +# ^^^^ constant.language.boolean.true.python # ^ punctuation.section.block.conditional.if.python # @@ -1325,7 +1325,7 @@ def _(): # ^^ keyword.control.conditional.if.python # ^^^ meta.generic-name.python # ^^ keyword.operator.logical.python -# ^^^^ constant.language.boolean.python +# ^^^^ constant.language.boolean.true.python # ^ punctuation.section.block.conditional.case.python case (,) if foo in ('bar', 'baz'): @@ -1392,7 +1392,7 @@ def _(): # ^^ keyword.control.conditional.if.python # ^^^ meta.generic-name.python # ^^ keyword.operator.logical.python -# ^^^^ constant.language.boolean.python +# ^^^^ constant.language.boolean.true.python # ^ punctuation.section.block.conditional.case.python case { s_key : 'value' , num.key: 100, **pattern} if foo in {'foo', 'bar'}: @@ -2179,11 +2179,11 @@ class DataClass(TypedDict, None, total=False, True=False): # ^ punctuation.separator.inheritance.python # ^^^^^ variable.parameter.class-inheritance.python # ^ keyword.operator.assignment.python -# ^^^^^ constant.language.boolean.python +# ^^^^^ constant.language.boolean.false.python # ^ punctuation.separator.inheritance.python -# ^^^^ constant.language.boolean.python +# ^^^^ constant.language.boolean.true.python # ^ invalid.illegal.assignment.python -# ^^^^^ constant.language.boolean.python +# ^^^^^ constant.language.boolean.false.python class MyClass: diff --git a/R/R.sublime-syntax b/R/R.sublime-syntax index 1b4855bee5..a192afb8bb 100644 --- a/R/R.sublime-syntax +++ b/R/R.sublime-syntax @@ -59,7 +59,13 @@ contexts: constants: - match: \b(pi|letters|LETTERS|month\.abb|month\.name)\b scope: support.constant.misc.r - - match: \b(TRUE|FALSE|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|Inf|NaN)\b + - match: \bFALSE\b + scope: constant.language.boolean.false.r + - match: \bTRUE\b + scope: constant.language.boolean.true.r + - match: \bNULL\b + scope: constant.language.null.r + - match: \b(NA|NA_integer_|NA_real_|NA_complex_|NA_character_|Inf|NaN)\b scope: constant.language.r # complex imaginary - match: \b(0[xX])(\h+)(?:(i)|(I))\b diff --git a/R/syntax_test_r.R b/R/syntax_test_r.R index a7da76f5c3..1d4e0461fc 100644 --- a/R/syntax_test_r.R +++ b/R/syntax_test_r.R @@ -84,11 +84,11 @@ month.name month.abb # <- support.constant.misc.r TRUE -# <- constant.language.r +# <- constant.language.boolean.true.r FALSE -# <- constant.language.r +# <- constant.language.boolean.false.r NULL -# <- constant.language.r +# <- constant.language.null.r NA # <- constant.language.r NA_integer_ diff --git a/Ruby/Ruby.sublime-syntax b/Ruby/Ruby.sublime-syntax index 4981db7305..3d4bd81426 100644 --- a/Ruby/Ruby.sublime-syntax +++ b/Ruby/Ruby.sublime-syntax @@ -210,8 +210,10 @@ contexts: - match: '\b(nil)\b(?![?!])' scope: constant.language.null.ruby push: after-constant - - match: '\b(true|false)\b(?![?!])' - scope: constant.language.boolean.ruby + - match: '\bfalse\b(?![?!])' + scope: constant.language.boolean.false.ruby + - match: '\btrue\b(?![?!])' + scope: constant.language.boolean.true.ruby push: after-constant - match: '\b(__(FILE|LINE|ENCODING)__|self)\b(?![?!])' scope: variable.language.ruby diff --git a/Ruby/syntax_test_ruby.rb b/Ruby/syntax_test_ruby.rb index 5803a7236d..051a687055 100644 --- a/Ruby/syntax_test_ruby.rb +++ b/Ruby/syntax_test_ruby.rb @@ -1257,9 +1257,9 @@ def keyword_args a: nil, b: true, c: false # ^^^ constant.language.null # ^ punctuation.separator # ^ punctuation.separator -# ^^^^ constant.language.boolean +# ^^^^ constant.language.boolean.true # ^ punctuation.separator.ruby -# ^^^^^ constant.language.boolean.ruby +# ^^^^^ constant.language.boolean.false.ruby end def multiline_args(a, # a comment diff --git a/Rust/Rust.sublime-syntax b/Rust/Rust.sublime-syntax index c6bcbe26fb..13ec5fdc09 100644 --- a/Rust/Rust.sublime-syntax +++ b/Rust/Rust.sublime-syntax @@ -1732,8 +1732,10 @@ contexts: scope: punctuation.separator.rust bool: - - match: \b(true|false)\b - scope: constant.language.rust + - match: \bfalse\b + scope: constant.language.boolean.false.rust + - match: \btrue\b + scope: constant.language.boolean.true.rust raw-pointer: - match: '\*\s*(?:const|mut)\b' diff --git a/SQL/SQL.sublime-syntax b/SQL/SQL.sublime-syntax index 5e2e69a9cd..262738ed9f 100644 --- a/SQL/SQL.sublime-syntax +++ b/SQL/SQL.sublime-syntax @@ -95,8 +95,10 @@ contexts: scope: storage.modifier.sql - match: \b\d+\b scope: constant.numeric.sql - - match: (?i:\b(true|false)\b) - scope: constant.language.boolean.sql + - match: (?i:\bfalse\b) + scope: constant.language.boolean.false.sql + - match: (?i:\btrue\b) + scope: constant.language.boolean.true.sql - match: (?i:\b(null)\b) scope: constant.language.null.sql - match: (?i:\b(select(\s+(distinct|top))?|insert(\s+(ignore\s+)?into)?|update|delete|truncate|from|set|where|group\s+by|with|case|when|then|else|end|union(\s+all)?|using|order\s+by|limit|(inner|cross)\s+join|join|straight_join|(left|right)(\s+outer)?\s+join|natural(\s+(left|right)(\s+outer)?)?\s+join)\b) diff --git a/SQL/syntax_test_sql.sql b/SQL/syntax_test_sql.sql index e1ebc27954..59ee2e7771 100644 --- a/SQL/syntax_test_sql.sql +++ b/SQL/syntax_test_sql.sql @@ -70,7 +70,7 @@ create table IF NOT EXISTS `testing123` ( `col` bool DEFAULT FALSE, -- ^^^^ storage.type.sql -- ^^^^^^^ storage.modifier.sql --- ^^^^^ constant.language.boolean.sql +-- ^^^^^ constant.language.boolean.false.sql -- ^ punctuation.separator.sequence `fkey` INT UNSIGNED NULL REFERENCES test2(id), -- ^^^^^^^^^^ storage.modifier.sql diff --git a/Scala/Scala.sublime-syntax b/Scala/Scala.sublime-syntax index fb36b29fd6..be239a232d 100644 --- a/Scala/Scala.sublime-syntax +++ b/Scala/Scala.sublime-syntax @@ -274,8 +274,12 @@ contexts: - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double|Any|AnyRef|AnyVal|Nothing)\b scope: storage.type.primitive.scala literal-constants: - - match: \b(?:false|null|true)\b - scope: constant.language.scala + - match: \bfalse\b + scope: constant.language.boolean.false.scala + - match: \btrue\b + scope: constant.language.boolean.true.scala + - match: \bnull\b + scope: constant.language.null.scala # TODO negation # source: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html#floating-point-literals - match: |- diff --git a/Scala/syntax_test_scala.scala b/Scala/syntax_test_scala.scala index 321283f1f6..7e255dc60c 100644 --- a/Scala/syntax_test_scala.scala +++ b/Scala/syntax_test_scala.scala @@ -334,13 +334,13 @@ type Foo = Bar[A] forSome { type A } // ^^^^^^^^ constant.character.literal.scala true -// ^^^^ constant.language.scala +// ^^^^ constant.language.boolean.true.scala false -// ^^^^^ constant.language.scala +// ^^^^^ constant.language.boolean.false.scala null -// ^^^^ constant.language.scala +// ^^^^ constant.language.null.scala Nil // ^^^ support.constant.scala @@ -629,7 +629,7 @@ type Foo = Bar[A] forSome { type A } // ^^^ entity.name.tag case true => -// ^^^ constant.language.scala +// ^^^ constant.language.boolean.true.scala case _ ⇒ _ // ^ - keyword @@ -1047,7 +1047,7 @@ def foo(a: A =:= B) def foo(a: A =:= B = null) // ^ keyword.operator.assignment.scala -// ^^^^ constant.language.scala +// ^^^^ constant.language.null.scala def foo(a: A :: B) // ^^ support.type.scala @@ -1063,7 +1063,7 @@ class Foo(a: A =:= B) class Foo(a: A =:= B = null) // ^ keyword.operator.assignment.scala -// ^^^^ constant.language.scala +// ^^^^ constant.language.null.scala class Foo(a: A :: B) // ^^ support.type.scala diff --git a/ShellScript/Bash.sublime-syntax b/ShellScript/Bash.sublime-syntax index 6c6289c9e7..29b75e45d5 100644 --- a/ShellScript/Bash.sublime-syntax +++ b/ShellScript/Bash.sublime-syntax @@ -1492,12 +1492,17 @@ contexts: ###[ CONSTANTS ]############################################################### booleans: - - match: (?:true|false)\b - scope: constant.language.boolean.shell + - match: false\b + scope: constant.language.boolean.false.shell + - match: true\b + scope: constant.language.boolean.true.shell boolean: - - match: (?:true|false)\b - scope: constant.language.boolean.shell + - match: false\b + scope: constant.language.boolean.false.shell + pop: 1 + - match: true\b + scope: constant.language.boolean.true.shell pop: 1 numbers: diff --git a/ShellScript/test/syntax_test_bash.sh b/ShellScript/test/syntax_test_bash.sh index a3e436d06e..ecceadfebf 100755 --- a/ShellScript/test/syntax_test_bash.sh +++ b/ShellScript/test/syntax_test_bash.sh @@ -541,9 +541,9 @@ foo -nfv --opt1 arg1 -p=true -d false # ^ - variable - punctuation # ^^ meta.parameter.option.shell variable.parameter.option.shell # ^ keyword.operator.assignment.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^^ meta.parameter.option.shell variable.parameter.option.shell -# ^^^^^ constant.language.boolean.shell +# ^^^^^ constant.language.boolean.false.shell foo --\ opt1=10 @@ -1089,7 +1089,7 @@ do echo bar; until ! { [[ true ]]; } # ^ keyword.operator.logical.shell # ^ punctuation.section.compound.begin.shell # ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^^ support.function.test.end.shell # ^ punctuation.terminator.statement.shell # ^ punctuation.section.compound.end.shell @@ -1105,7 +1105,7 @@ while true; do # <- keyword.control.loop.while #^^^^ keyword.control.loop.while.shell # ^ - constant - keyword -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^ punctuation.terminator.statement.shell # ^^ keyword.control.loop.do.shell break @@ -1126,7 +1126,7 @@ done while ! true; do echo bar; done # <- keyword.control.loop.while.shell # ^ keyword.operator.logical.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^ punctuation.terminator.statement.shell # ^^ keyword.control.loop.do.shell # ^^^^ support.function.echo.shell @@ -1137,7 +1137,7 @@ while ! { true; }; do echo bar; done # <- keyword.control.loop.while.shell # ^ keyword.operator.logical.shell # ^ punctuation.section.compound.begin.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^ punctuation.terminator.statement.shell # ^ punctuation.section.compound.end.shell # ^ punctuation.terminator.statement.shell @@ -1149,7 +1149,7 @@ while ! { [[ true ]]; }; do echo bar; done # ^ keyword.operator.logical.shell # ^ punctuation.section.compound.begin.shell # ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^^ support.function.test.end.shell # ^ punctuation.terminator.statement.shell # ^ punctuation.section.compound.end.shell @@ -1162,7 +1162,7 @@ while ! ( [[ true ]] ); do echo bar; done # ^ keyword.operator.logical.shell # ^ punctuation.section.compound.begin.shell # ^^ support.function.test.begin.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^^ support.function.test.end.shell # ^ punctuation.section.compound.end.shell # ^ punctuation.terminator.statement.shell @@ -1552,10 +1552,10 @@ fi if true ; then false ; fi #^ keyword.control.conditional.if.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell # ^ punctuation.terminator.statement.shell # ^^^^ keyword.control.conditional.then.shell -# ^^^^^ constant.language.boolean.shell +# ^^^^^ constant.language.boolean.false.shell # ^ punctuation.terminator.statement.shell # ^^ keyword.control.conditional.end.shell @@ -2731,12 +2731,12 @@ true=false # <- variable.other.readwrite.shell - constant #^^^ variable.other.readwrite.shell - constant # ^ keyword.operator.assignment.shell -# ^^^^^ constant.language.boolean.shell +# ^^^^^ constant.language.boolean.false.shell false=true # <- variable.other.readwrite.shell - constant #^^^^ variable.other.readwrite.shell - constant # ^ keyword.operator.assignment.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell charclass=\}ower # <- meta.variable.shell variable.other.readwrite.shell #^^^^^^^^ meta.variable.shell variable.other.readwrite.shell @@ -5902,7 +5902,7 @@ local foo+=10 bar-=true # ^^ meta.number.integer.decimal.shell constant.numeric.value.shell # ^^^ meta.variable.shell variable.other.readwrite.shell # ^^ keyword.operator.assignment.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell local pid="$(cat "$PIDFILE" 2>/dev/null)" # <- meta.declaration.variable.shell keyword.declaration.variable.shell @@ -6088,7 +6088,7 @@ test $var == true #^^^ meta.function-call.identifier.shell support.function.test.shell # ^^^^^^^^^^^^^ meta.function-call.arguments.shell - meta.string.regexp # ^^ keyword.operator.comparison.shell -# ^^^^ constant.language.boolean.shell +# ^^^^ constant.language.boolean.true.shell test str == "str" #<- meta.function-call.identifier.shell support.function.test.shell @@ -6586,10 +6586,10 @@ sudo --reset-timestamp -n -f -- rm -rf ############################################################################### true false -# <- constant.language.boolean.shell -#^^^ constant.language.boolean.shell +# <- constant.language.boolean.true.shell +#^^^ constant.language.boolean.true.shell # ^ - constant -# ^^^^^ constant.language.boolean.shell +# ^^^^^ constant.language.boolean.false.shell # ^ - constant (( 0 )) diff --git a/YAML/YAML.sublime-syntax b/YAML/YAML.sublime-syntax index b6feb6b255..8b76941b1a 100644 --- a/YAML/YAML.sublime-syntax +++ b/YAML/YAML.sublime-syntax @@ -153,14 +153,21 @@ variables: _type_null: (?:null|Null|NULL|~) # http://yaml.org/type/bool.html - _type_bool_11: |- + _type_bool_false_11: |- (?x: - y|Y|yes|Yes|YES|n|N|no|No|NO - |true|True|TRUE|false|False|FALSE - |on|On|ON|off|Off|OFF + n|N|no|No|NO + |false|False|FALSE + |off|Off|OFF + ) + _type_bool_true_11: |- + (?x: + y|Y|yes|Yes|YES + |true|True|TRUE + |on|On|ON ) # https://yaml.org/spec/1.2/spec.html#id2805071 - _type_bool_12: (?x:true | True | TRUE | false | False | FALSE) + _type_bool_false_12: (?x:false | False | FALSE) + _type_bool_true_12: (?x:true | True | TRUE) # http://yaml.org/type/int.html _type_int_binary: ([-+]?)(0b)([0-1_]+) # (base 2) @@ -544,14 +551,18 @@ contexts: pop: 1 flow-scalar-plain-in-implicit-type-11: - - match: '{{_type_bool_11}}{{_flow_scalar_end_plain_in}}' - scope: constant.language.boolean.yaml + - match: '{{_type_bool_false_11}}{{_flow_scalar_end_plain_in}}' + scope: constant.language.boolean.false.yaml + - match: '{{_type_bool_true_11}}{{_flow_scalar_end_plain_in}}' + scope: constant.language.boolean.true.yaml - include: flow-scalar-plain-in-implicit-type-common flow-scalar-plain-in-implicit-type-12: # Less aggressive variant based on the YAML 1.2 core schema - - match: '{{_type_bool_12}}{{_flow_scalar_end_plain_in}}' - scope: constant.language.boolean.yaml + - match: '{{_type_bool_false_12}}{{_flow_scalar_end_plain_in}}' + scope: constant.language.boolean.false.yaml + - match: '{{_type_bool_true_12}}{{_flow_scalar_end_plain_in}}' + scope: constant.language.boolean.true.yaml - include: flow-scalar-plain-in-implicit-type-common flow-scalar-plain-in-implicit-type-common: @@ -647,14 +658,18 @@ contexts: pop: 1 flow-scalar-plain-out-implicit-type-11: - - match: '{{_type_bool_11}}{{_flow_scalar_end_plain_out}}' - scope: constant.language.boolean.yaml + - match: '{{_type_bool_false_11}}{{_flow_scalar_end_plain_out}}' + scope: constant.language.boolean.false.yaml + - match: '{{_type_bool_true_11}}{{_flow_scalar_end_plain_out}}' + scope: constant.language.boolean.true.yaml - include: flow-scalar-plain-out-implicit-type-common flow-scalar-plain-out-implicit-type-12: # Less aggressive variant based on the YAML 1.2 core schema - - match: '{{_type_bool_12}}{{_flow_scalar_end_plain_out}}' - scope: constant.language.boolean.yaml + - match: '{{_type_bool_false_12}}{{_flow_scalar_end_plain_out}}' + scope: constant.language.boolean.false.yaml + - match: '{{_type_bool_true_12}}{{_flow_scalar_end_plain_out}}' + scope: constant.language.boolean.true.yaml - include: flow-scalar-plain-out-implicit-type-common flow-scalar-plain-out-implicit-type-common: diff --git a/YAML/tests/syntax_test_flow.yaml b/YAML/tests/syntax_test_flow.yaml index ce3c05f464..f44e9dfbb8 100644 --- a/YAML/tests/syntax_test_flow.yaml +++ b/YAML/tests/syntax_test_flow.yaml @@ -173,9 +173,9 @@ unquoted'string' #^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping #^^^^^ variable.other.alias # ^ punctuation.separator.sequence -# ^^^^ meta.mapping.key.yaml constant.language.boolean.yaml - string +# ^^^^ meta.mapping.key.yaml constant.language.boolean.true.yaml - string # ^ punctuation.separator.key-value.mapping -# ^^^^^ meta.mapping.value.yaml constant.language.boolean.yaml +# ^^^^^ meta.mapping.value.yaml constant.language.boolean.false.yaml # ^ meta.mapping.yaml punctuation.definition.mapping.end { 1: 2 } diff --git a/YAML/tests/syntax_test_types.yaml b/YAML/tests/syntax_test_types.yaml index 28f7d6020f..861b7034a7 100644 --- a/YAML/tests/syntax_test_types.yaml +++ b/YAML/tests/syntax_test_types.yaml @@ -22,15 +22,15 @@ ## http://yaml.org/type/bool.html - [yes, no, true, false, No, y, ON, off, Off, ~, oFF, nO, false true] -# ^^^ constant.language.boolean -# ^^ constant.language.boolean -# ^^^^ constant.language.boolean -# ^^^^^ constant.language.boolean -# ^^ constant.language.boolean -# ^ constant.language.boolean -# ^^ constant.language.boolean -# ^^^ constant.language.boolean -# ^^^ constant.language.boolean +# ^^^ constant.language.boolean.true +# ^^ constant.language.boolean.false +# ^^^^ constant.language.boolean.true +# ^^^^^ constant.language.boolean.false +# ^^ constant.language.boolean.false +# ^ constant.language.boolean.true +# ^^ constant.language.boolean.true +# ^^^ constant.language.boolean.false +# ^^^ constant.language.boolean.false # ^^^^^^^^^^^^^^^^^^^ - constant @@ -202,9 +202,9 @@ ## In a mapping true: false -#^^^ constant.language.boolean +#^^^ constant.language.boolean.true # ^ punctuation.separator.key-value.mapping -# ^^^^^ constant.language.boolean +# ^^^^^ constant.language.boolean.false 3.e-3: 3.e+3 #^^^^ meta.number.float.decimal.yaml constant.numeric.value.yaml #^ punctuation.separator.decimal.yaml @@ -222,4 +222,4 @@ true: false # ^ punctuation.separator.date.yaml y: n # <- -constant -# ^ constant.language.boolean.yaml +# ^ constant.language.boolean.false.yaml