parent
4a7462f961
commit
64b13f5c5b
@ -55,6 +55,7 @@ This highlighter defines the following styles:
|
||||
* `dollar-double-quoted-argument` - parameter expansion inside double quotes (`$foo` inside `""`)
|
||||
* `back-double-quoted-argument` - backslash escape sequences inside double-quoted arguments (`\"` in `"foo\"bar"`)
|
||||
* `back-dollar-quoted-argument` - backslash escape sequences inside dollar-quoted arguments (`\x` in `$'\x48'`)
|
||||
* `function-definition` - function name(s) when defining a function (`f` and `g` in `f g () { : }`)
|
||||
* `assign` - parameter assignments (`x=foo` and `x=( )`)
|
||||
* `redirection` - redirection operators (`<`, `>`, etc)
|
||||
* `comment` - comments, when `setopt INTERACTIVE_COMMENTS` is in effect (`echo # foo`)
|
||||
|
@ -406,6 +406,7 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
# - :regular: "Not a command word", and command delimiters are permitted.
|
||||
# Mainly used to detect premature termination of commands.
|
||||
# - :always: The word 'always' in the «{ foo } always { bar }» syntax.
|
||||
# - :function: Function names after 'function' or before '()'
|
||||
#
|
||||
# When the kind of a word is not yet known, $this_word / $next_word may contain
|
||||
# multiple states. For example, after "sudo -i", the next word may be either
|
||||
@ -682,8 +683,25 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
# try-always construct
|
||||
style=reserved-word # de facto a reserved word, although not de jure
|
||||
next_word=':start:'
|
||||
elif [[ $this_word == *:function:* ]]; then
|
||||
if [[ $arg == '()' ]]; then
|
||||
style=reserved-word
|
||||
next_word=':start:'
|
||||
elif [[ $arg == $'\x7b' ]]; then
|
||||
style=reserved-word
|
||||
next_word=':start:'
|
||||
braces_stack='Y'"$braces_stack"
|
||||
else
|
||||
style=function-definition
|
||||
next_word=':function:'
|
||||
fi
|
||||
elif [[ $this_word == *':start:'* ]]; then # $arg is the command word
|
||||
if (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg; then
|
||||
if [[ $res != reserved && $arg != '()' && ( $args[1] == '()' ||
|
||||
# TODO: Function names can be absurd; this handles the more common cases without invoking Cthulhu.
|
||||
( $zsyh_user_options[multifuncdef] == on && $args[(r)*[^[:alnum:]_-]*] == '()' ) ) ]]; then
|
||||
style=function-definition
|
||||
next_word=:function:
|
||||
elif (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg; then
|
||||
style=precommand
|
||||
flags_with_argument=${precommand_options[$arg]%:*}
|
||||
flags_sans_argument=${precommand_options[$arg]#*:}
|
||||
@ -756,6 +774,10 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
#
|
||||
# The repeat-count word will be handled like a redirection target.
|
||||
this_word=':start::regular:'
|
||||
;;
|
||||
('function')
|
||||
next_word=':function:'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
'suffix alias') style=suffix-alias;;
|
||||
@ -849,16 +871,9 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
fi
|
||||
_zsh_highlight_main__stack_pop 'R' reserved-word
|
||||
fi;;
|
||||
$'\x28\x29') # possibly a function definition
|
||||
if (( in_redirection )) || $in_array_assignment; then
|
||||
'()')
|
||||
# Function definition was handled above
|
||||
style=unknown-token
|
||||
else
|
||||
if [[ $zsyh_user_options[multifuncdef] == on ]] || false # TODO: or if the previous word was a command word
|
||||
then
|
||||
next_word+=':start:'
|
||||
fi
|
||||
style=reserved-word
|
||||
fi
|
||||
;;
|
||||
*) if false; then
|
||||
elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then
|
||||
|
@ -33,13 +33,13 @@ BUFFER=$'function f { pwd }; function { pwd }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 default' # f
|
||||
'12 12 reserved-word "issue #237"' # {
|
||||
'14 16 command "issue #237"' # pwd
|
||||
'18 18 reserved-word "issue #237"' # }
|
||||
'10 10 function-definition' # f
|
||||
'12 12 reserved-word' # {
|
||||
'14 16 builtin' # pwd
|
||||
'18 18 reserved-word' # }
|
||||
'19 19 commandseparator' # ;
|
||||
'21 28 reserved-word' # function
|
||||
'30 30 reserved-word "issue #237"' # {
|
||||
'32 34 command "issue #237"' # pwd
|
||||
'36 36 reserved-word "issue #237"' # }
|
||||
'30 30 reserved-word' # {
|
||||
'32 34 builtin' # pwd
|
||||
'36 36 reserved-word' # }
|
||||
)
|
||||
|
40
highlighters/main/test-data/function-both.zsh
Normal file
40
highlighters/main/test-data/function-both.zsh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function foo () { : }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 12 function-definition' # foo
|
||||
'14 15 reserved-word' # ()
|
||||
'17 17 reserved-word' # {
|
||||
'19 19 builtin' # :
|
||||
'21 21 reserved-word' # }
|
||||
)
|
42
highlighters/main/test-data/function-multifuncdef-off.zsh
Normal file
42
highlighters/main/test-data/function-multifuncdef-off.zsh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
setopt no_multifuncdef
|
||||
|
||||
BUFFER='foo bar () { : }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 3 unknown-token' # foo
|
||||
'5 7 default' # bar
|
||||
'9 10 unknown-token' # ()
|
||||
'12 12 default' # {
|
||||
'14 14 default' # :
|
||||
'16 16 unknown-token' # }
|
||||
)
|
40
highlighters/main/test-data/function-multifuncdef-on.zsh
Normal file
40
highlighters/main/test-data/function-multifuncdef-on.zsh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=$'foo bar () { : }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 3 function-definition' # foo
|
||||
'5 7 function-definition' # bar
|
||||
'9 10 reserved-word' # ()
|
||||
'12 12 reserved-word' # {
|
||||
'14 14 builtin' # :
|
||||
'16 16 reserved-word' # }
|
||||
)
|
@ -31,11 +31,11 @@
|
||||
BUFFER='f() pwd; f() { balanced braces }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 1 TBD "issue #223"' # f
|
||||
'1 1 function-definition' # f
|
||||
'2 3 reserved-word' # ()
|
||||
'5 7 builtin' # pwd
|
||||
'8 8 commandseparator' # ;
|
||||
'10 10 TBD "issue #223"' # f
|
||||
'10 10 function-definition' # f
|
||||
'11 12 reserved-word' # ()
|
||||
'14 14 reserved-word' # {
|
||||
'16 23 unknown-token' # balanced
|
||||
|
@ -31,9 +31,9 @@
|
||||
BUFFER='f g h () pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 1 TBD "issue #223"' # f
|
||||
'3 3 TBD "issue #223"' # g
|
||||
'5 5 TBD "issue #223"' # h
|
||||
'1 1 function-definition' # f
|
||||
'3 3 function-definition' # g
|
||||
'5 5 function-definition' # h
|
||||
'7 8 reserved-word' # ()
|
||||
'10 12 builtin' # pwd
|
||||
)
|
||||
|
38
highlighters/main/test-data/function10.zsh
Normal file
38
highlighters/main/test-data/function10.zsh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function () () pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 11 reserved-word' # ()
|
||||
'13 14 reserved-word' # ()
|
||||
'16 18 builtin' # pwd
|
||||
)
|
39
highlighters/main/test-data/function11.zsh
Normal file
39
highlighters/main/test-data/function11.zsh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function f () () pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 function-definition' # f
|
||||
'12 13 reserved-word' # ()
|
||||
'15 16 reserved-word' # ()
|
||||
'18 20 builtin' # pwd
|
||||
)
|
39
highlighters/main/test-data/function12.zsh
Normal file
39
highlighters/main/test-data/function12.zsh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function () f () pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 11 reserved-word' # ()
|
||||
'13 13 function-definition' # f
|
||||
'15 16 reserved-word' # ()
|
||||
'18 20 builtin' # pwd
|
||||
)
|
39
highlighters/main/test-data/function13.zsh
Normal file
39
highlighters/main/test-data/function13.zsh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function () () f pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 11 reserved-word' # ()
|
||||
'13 14 reserved-word' # ()
|
||||
'16 16 unknown-token' # f
|
||||
'18 20 default' # pwd
|
||||
)
|
38
highlighters/main/test-data/function14.zsh
Normal file
38
highlighters/main/test-data/function14.zsh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER=$'function f\npwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 function-definition' # f
|
||||
'11 11 unknown-token' # \n
|
||||
'12 14 builtin' # pwd
|
||||
)
|
38
highlighters/main/test-data/function2.zsh
Normal file
38
highlighters/main/test-data/function2.zsh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function { pwd }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 reserved-word' # {
|
||||
'12 14 builtin' # pwd
|
||||
'16 16 reserved-word' # }
|
||||
)
|
36
highlighters/main/test-data/function3.zsh
Normal file
36
highlighters/main/test-data/function3.zsh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 12 function-definition' # pwd
|
||||
)
|
40
highlighters/main/test-data/function4.zsh
Normal file
40
highlighters/main/test-data/function4.zsh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function >/dev/null { pwd }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 redirection' # >
|
||||
'11 19 path' # /dev/null
|
||||
'21 21 reserved-word' # {
|
||||
'23 25 builtin' # pwd
|
||||
'27 27 reserved-word' # }
|
||||
)
|
41
highlighters/main/test-data/function5.zsh
Normal file
41
highlighters/main/test-data/function5.zsh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function f >/dev/null { pwd }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 function-definition' # f
|
||||
'12 12 redirection' # >
|
||||
'13 21 path' # /dev/null
|
||||
'23 23 reserved-word' # {
|
||||
'25 27 builtin' # pwd
|
||||
'29 29 reserved-word' # }
|
||||
)
|
41
highlighters/main/test-data/function6.zsh
Normal file
41
highlighters/main/test-data/function6.zsh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='function >/dev/null : { pwd }'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 8 reserved-word' # function
|
||||
'10 10 redirection' # >
|
||||
'11 19 path' # /dev/null
|
||||
'21 21 builtin' # :
|
||||
'23 23 default' # {
|
||||
'25 27 default' # pwd
|
||||
'29 29 unknown-token' # }
|
||||
)
|
37
highlighters/main/test-data/function7.zsh
Normal file
37
highlighters/main/test-data/function7.zsh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='() {}'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 2 reserved-word' # ()
|
||||
'4 4 reserved-word' # {
|
||||
'5 5 reserved-word' # }
|
||||
)
|
36
highlighters/main/test-data/function8.zsh
Normal file
36
highlighters/main/test-data/function8.zsh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='() pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 2 reserved-word' # ()
|
||||
'4 6 builtin' # pwd
|
||||
)
|
38
highlighters/main/test-data/function9.zsh
Normal file
38
highlighters/main/test-data/function9.zsh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2018 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
# provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
# and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
BUFFER='() () () pwd'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 2 reserved-word' # ()
|
||||
'4 5 reserved-word' # ()
|
||||
'7 8 reserved-word' # ()
|
||||
'10 12 builtin' # pwd
|
||||
)
|
Loading…
Reference in New Issue
Block a user