├── .version ├── .gitattributes ├── .gitignore ├── highlighters ├── line │ └── README.md ├── main │ ├── README.md │ └── test-data │ │ ├── backslash.zsh │ │ ├── simple-command.zsh │ │ ├── alias-loop2.zsh │ │ ├── history-expansion2.zsh │ │ ├── alias-basic.zsh │ │ ├── alias-eponymous1.zsh │ │ ├── unbackslash.zsh │ │ ├── unknown-command.zsh │ │ ├── arg0-colon.zsh │ │ ├── abspath-in-command-position1.zsh │ │ ├── alias-eponymous2.zsh │ │ ├── equals1.zsh │ │ ├── equals4.zsh │ │ ├── noglob-alias.zsh │ │ ├── abspath-in-command-position2.zsh │ │ ├── abspath-in-command-position5.zsh │ │ ├── alias-to-dir.zsh │ │ ├── path-tilde-home.zsh │ │ ├── path-tilde-home3.zsh │ │ ├── abspath-in-command-position4.zsh │ │ ├── alias-self2.zsh │ │ ├── alias-to-dir1b.zsh │ │ ├── comment-leading.zsh │ │ ├── empty-line.zsh │ │ ├── path.zsh │ │ ├── abspath-in-command-position1b.zsh │ │ ├── alias-unknown-token1.zsh │ │ ├── path-tilde-home2.zsh │ │ ├── assign-not-array2.zsh │ │ ├── brackets-mismatch3.zsh │ │ ├── brackets-mismatch4.zsh │ │ ├── parameter-elision-command-word.zsh │ │ ├── double-hyphen-option.zsh │ │ ├── empty-command.zsh │ │ ├── alias-unknown-token2.zsh │ │ ├── equals3.zsh │ │ ├── alias-empty.zsh │ │ ├── noglob3.zsh │ │ ├── precommand2.zsh │ │ ├── alias-self.zsh │ │ ├── assign-not-array.zsh │ │ ├── cdpath-abspath.zsh │ │ ├── path-dollared-word2.zsh │ │ ├── assign-subshell.zsh │ │ ├── backslash-continuation.zsh │ │ ├── brackets-mismatch5.zsh │ │ ├── tilde-command-word.zsh │ │ ├── alias-complex.zsh │ │ ├── alias-parameter.zsh │ │ ├── equals2.zsh │ │ ├── global-alias1.zsh │ │ ├── jobsubst-isnt-glob.zsh │ │ ├── jobsubst-isnt-glob2.zsh │ │ ├── alias-comment2.zsh │ │ ├── parameter-expansion-shwordsplit.zsh │ │ ├── parameter-expansion-untokenized1.zsh │ │ ├── alias-reuse3.zsh │ │ ├── arithmetic-unclosed.zsh │ │ ├── multiline-string2.zsh │ │ ├── parameter-expansion-untokenized2.zsh │ │ ├── path-space.zsh │ │ ├── redirection-comment.zsh │ │ ├── alias-comment1.zsh │ │ ├── alias-redirect.zsh │ │ ├── alias-reuse1.zsh │ │ ├── alias-reuse2.zsh │ │ ├── assign-argv.zsh │ │ ├── assignment-quoted.zsh │ │ ├── arith1.zsh │ │ ├── assign-invalid-command.zsh │ │ ├── multiline-string.zsh │ │ ├── assignment-before-resword3.zsh │ │ ├── comment-off.zsh │ │ ├── multios-negates-globbing2.zsh │ │ ├── off-by-one.zsh │ │ ├── precommand.zsh │ │ ├── brackets-matching2.zsh │ │ ├── brackets-mismatch8.zsh │ │ ├── order-path-before-globbing.zsh │ │ ├── path-mixed-quoting.zsh │ │ ├── assign-value-quote1.zsh │ │ ├── bang-assign-scalar.zsh │ │ └── noglob1.zsh ├── root │ └── README.md ├── cursor │ └── README.md ├── regexp │ ├── README.md │ └── test-data │ │ ├── subexpression.zsh │ │ └── complex.zsh ├── brackets │ ├── README.md │ └── test-data │ │ ├── empty-styles.zsh │ │ ├── only-error.zsh │ │ ├── quoted-patentheses.zsh │ │ └── cursor-matchingbracket-line-finish.zsh ├── pattern │ ├── README.md │ └── test-data │ │ └── rm-rf.zsh └── README.md ├── .revision-hash ├── images ├── after1.png ├── after2.png ├── after3.png ├── before1.png ├── before2.png ├── before3.png ├── preview.png ├── after1-smaller.png ├── after2-smaller.png ├── after3-smaller.png ├── after4-smaller.png ├── before1-smaller.png ├── before2-smaller.png ├── before3-smaller.png ├── before4-smaller.png └── preview-smaller.png ├── zsh-syntax-highlighting.plugin.zsh ├── .editorconfig ├── docs └── highlighters │ ├── line.md │ ├── cursor.md │ ├── root.md │ ├── pattern.md │ └── brackets.md ├── release.md ├── COPYING.md ├── .github └── workflows │ └── test.yml └── Makefile /.version: -------------------------------------------------------------------------------- 1 | 0.8.1-dev 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | .revision-hash export-subst 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.zwc* 2 | .pc/ 3 | docs/all.md 4 | -------------------------------------------------------------------------------- /highlighters/line/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/line.md -------------------------------------------------------------------------------- /highlighters/main/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/main.md -------------------------------------------------------------------------------- /highlighters/root/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/root.md -------------------------------------------------------------------------------- /.revision-hash: -------------------------------------------------------------------------------- 1 | 5eb677bb0fa9a3e60f0eff031dc13926e093df92 2 | -------------------------------------------------------------------------------- /highlighters/cursor/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/cursor.md -------------------------------------------------------------------------------- /highlighters/regexp/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/regexp.md -------------------------------------------------------------------------------- /highlighters/brackets/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/brackets.md -------------------------------------------------------------------------------- /highlighters/pattern/README.md: -------------------------------------------------------------------------------- 1 | ../../docs/highlighters/pattern.md -------------------------------------------------------------------------------- /images/after1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after1.png -------------------------------------------------------------------------------- /images/after2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after2.png -------------------------------------------------------------------------------- /images/after3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after3.png -------------------------------------------------------------------------------- /zsh-syntax-highlighting.plugin.zsh: -------------------------------------------------------------------------------- 1 | 0=${(%):-%N} 2 | source ${0:A:h}/zsh-syntax-highlighting.zsh 3 | -------------------------------------------------------------------------------- /images/before1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before1.png -------------------------------------------------------------------------------- /images/before2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before2.png -------------------------------------------------------------------------------- /images/before3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before3.png -------------------------------------------------------------------------------- /images/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/preview.png -------------------------------------------------------------------------------- /images/after1-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after1-smaller.png -------------------------------------------------------------------------------- /images/after2-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after2-smaller.png -------------------------------------------------------------------------------- /images/after3-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after3-smaller.png -------------------------------------------------------------------------------- /images/after4-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/after4-smaller.png -------------------------------------------------------------------------------- /images/before1-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before1-smaller.png -------------------------------------------------------------------------------- /images/before2-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before2-smaller.png -------------------------------------------------------------------------------- /images/before3-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before3-smaller.png -------------------------------------------------------------------------------- /images/before4-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/before4-smaller.png -------------------------------------------------------------------------------- /images/preview-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsh-users/zsh-syntax-highlighting/HEAD/images/preview-smaller.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Top-most editorconfig file 2 | 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | tab_width = 2 8 | indent_size = 2 9 | indent_style = space 10 | 11 | [Makefile] 12 | tab_width = 8 13 | indent_size = 8 14 | indent_style = tab 15 | 16 | -------------------------------------------------------------------------------- /highlighters/README.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters 2 | ====================================== 3 | 4 | Navigate into the individual highlighters' documentation to see 5 | what styles (`$ZSH_HIGHLIGHT_STYLES` keys) each highlighter defines. 6 | 7 | Refer to the [documentation on highlighters](../docs/highlighters.md) for further 8 | information. 9 | -------------------------------------------------------------------------------- /docs/highlighters/line.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters / line 2 | --------------------------------------------- 3 | 4 | This is the `line` highlighter, that highlights the whole line. 5 | 6 | 7 | ### How to tweak it 8 | 9 | This highlighter defines the following styles: 10 | 11 | * `line` - the style for the whole line 12 | 13 | To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, 14 | for example in `~/.zshrc`: 15 | 16 | ```zsh 17 | ZSH_HIGHLIGHT_STYLES[line]='bold' 18 | ``` 19 | 20 | The syntax for values is the same as the syntax of "types of highlighting" of 21 | the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` 22 | manual page][zshzle-Character-Highlighting]. 23 | 24 | [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting 25 | -------------------------------------------------------------------------------- /docs/highlighters/cursor.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters / cursor 2 | ----------------------------------------------- 3 | 4 | This is the `cursor` highlighter, that highlights the cursor. 5 | 6 | 7 | ### How to tweak it 8 | 9 | This highlighter defines the following styles: 10 | 11 | * `cursor` - the style for the current cursor position 12 | 13 | To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, 14 | for example in `~/.zshrc`: 15 | 16 | ```zsh 17 | ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' 18 | ``` 19 | 20 | The syntax for values is the same as the syntax of "types of highlighting" of 21 | the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` 22 | manual page][zshzle-Character-Highlighting]. 23 | 24 | [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting 25 | -------------------------------------------------------------------------------- /docs/highlighters/root.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters / root 2 | --------------------------------------------- 3 | 4 | This is the `root` highlighter, that highlights the whole line if the current 5 | user is root. 6 | 7 | 8 | ### How to tweak it 9 | 10 | This highlighter defines the following styles: 11 | 12 | * `root` - the style for the whole line if the current user is root. 13 | 14 | To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, 15 | for example in `~/.zshrc`: 16 | 17 | ```zsh 18 | ZSH_HIGHLIGHT_STYLES[root]='bg=red' 19 | ``` 20 | 21 | The syntax for values is the same as the syntax of "types of highlighting" of 22 | the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` 23 | manual page][zshzle-Character-Highlighting]. 24 | 25 | [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting 26 | -------------------------------------------------------------------------------- /docs/highlighters/pattern.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters / pattern 2 | ------------------------------------------------ 3 | 4 | This is the `pattern` highlighter, that highlights user-defined patterns. 5 | 6 | 7 | ### How to tweak it 8 | 9 | To use this highlighter, associate patterns with styles in the 10 | `ZSH_HIGHLIGHT_PATTERNS` associative array, for example in `~/.zshrc`: 11 | 12 | ```zsh 13 | # Declare the variable 14 | typeset -A ZSH_HIGHLIGHT_PATTERNS 15 | 16 | # To have commands starting with `rm -rf` in red: 17 | ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') 18 | ``` 19 | 20 | The syntax for values is the same as the syntax of "types of highlighting" of 21 | the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` 22 | manual page][zshzle-Character-Highlighting]. 23 | 24 | [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting 25 | -------------------------------------------------------------------------------- /release.md: -------------------------------------------------------------------------------- 1 | # Release procedure (for developers): 2 | 3 | - Ensure every `is-at-least` invocation passes a stable zsh release's version number as the first argument 4 | - For minor (A.B.0) releases: 5 | - Check whether the release uses any not-yet-released zsh features 6 | - Check open issues and outstanding pull requests 7 | - Confirm `make test` passes 8 | - check with multiple zsh versions 9 | (easiest to check GitHub Actions: https://github.com/zsh-users/zsh-syntax-highlighting/actions) 10 | - Update changelog.md 11 | `tig --abbrev=12 --abbrev-commit 0.4.1..upstream/master` 12 | - Make sure there are no local commits and that `git status` is clean; 13 | Remove `-dev` suffix from `./.version`; 14 | Commit that using `git commit -m "Tag version $(<.version)." .version`; 15 | Tag it using `git tag -s -m "Tag version $(<.version)" $(<.version)`; 16 | Increment `./.version` and restore the `-dev` suffix; 17 | Commit that using `git commit -C b5c30ae52638e81a38fe5329081c5613d7bd6ca5 .version`. 18 | - Push with `git push && git push --tags` 19 | - Notify downstreams (OS packages) 20 | - anitya should autodetect the tag 21 | - Update /topic on IRC 22 | -------------------------------------------------------------------------------- /docs/highlighters/brackets.md: -------------------------------------------------------------------------------- 1 | zsh-syntax-highlighting / highlighters / brackets 2 | ------------------------------------------------- 3 | 4 | This is the `brackets` highlighter, that highlights brackets and parentheses, and 5 | matches them. 6 | 7 | 8 | ### How to tweak it 9 | 10 | This highlighter defines the following styles: 11 | 12 | * `bracket-error` - unmatched brackets 13 | * `bracket-level-N` - brackets with nest level N 14 | * `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket 15 | 16 | To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, 17 | for example in `~/.zshrc`: 18 | 19 | ```zsh 20 | # To define styles for nested brackets up to level 4 21 | ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' 22 | ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' 23 | ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' 24 | ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' 25 | ``` 26 | 27 | The syntax for values is the same as the syntax of "types of highlighting" of 28 | the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` 29 | manual page][zshzle-Character-Highlighting]. 30 | 31 | [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting 32 | -------------------------------------------------------------------------------- /COPYING.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2020 zsh-syntax-highlighting contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted 5 | provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions 8 | and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, this list of 10 | conditions and the following disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 13 | may be used to endorse or promote products derived from this software without specific prior 14 | written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 18 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 19 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 22 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 23 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Tests 3 | on: 4 | push: 5 | paths-ignore: 6 | - '**.md' 7 | - '**.png' 8 | pull_request: 9 | paths-ignore: 10 | - '**.md' 11 | - '**.png' 12 | schedule: 13 | - cron: '29 7 * * 1' 14 | 15 | jobs: 16 | test: 17 | runs-on: ubuntu-latest 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | version: 22 | - master 23 | - 5.9 24 | - 5.8.1 25 | - 5.8 26 | - 5.7.1 27 | - 5.7 28 | - 5.6.2 29 | - 5.6.1 30 | - 5.6 31 | - 5.5.1 32 | - 5.5 33 | - 5.4.2 34 | - 5.4.1 35 | - 5.4 36 | - 5.3.1 37 | - 5.3 38 | - 5.2 39 | - 5.1.1 40 | - 5.1 41 | - 5.0.8 42 | - 5.0.7 43 | - 5.0.6 44 | - 5.0.5 45 | - 5.0.4 46 | - 5.0.3 47 | - 5.0.2 48 | - 5.0.1 49 | - 5.0.0 50 | - 4.3.17 51 | - 4.3.16 52 | - 4.3.15 53 | - 4.3.14 54 | - 4.3.13 55 | - 4.3.12 56 | - 4.3.11 57 | container: 58 | image: ghcr.io/zsh-users/zsh:${{ matrix.version }} 59 | steps: 60 | - uses: actions/checkout@v4 61 | - run: install_packages bsdmainutils make procps 62 | - run: make test 63 | 64 | notify: 65 | runs-on: ubuntu-latest 66 | needs: test 67 | if: failure() && (github.repository_owner == 'zsh-users') 68 | steps: 69 | - 70 | name: Notify IRC 71 | uses: Gottox/irc-message-action@v2 72 | with: 73 | channel: '#zsh-syntax-highlighting' 74 | nickname: zsyh-gh-bot 75 | message: '${{ github.ref }} failed tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' 76 | -------------------------------------------------------------------------------- /highlighters/brackets/test-data/empty-styles.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=': (x)' 31 | 32 | expected_region_highlight=( 33 | ) 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | NAME=zsh-syntax-highlighting 2 | 3 | INSTALL?=install -c 4 | PREFIX?=/usr/local 5 | SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME) 6 | DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME) 7 | ZSH?=zsh # zsh binary to run tests with 8 | 9 | all: 10 | cd docs && \ 11 | cp highlighters.md all.md && \ 12 | printf '\n\nIndividual highlighters documentation\n=====================================' >> all.md && \ 13 | for doc in highlighters/*.md; do printf '\n\n'; cat "$$doc"; done >> all.md 14 | 15 | install: all 16 | $(INSTALL) -d $(SHARE_DIR) 17 | $(INSTALL) -d $(DOC_DIR) 18 | cp .version zsh-syntax-highlighting.zsh $(SHARE_DIR) 19 | cp COPYING.md README.md changelog.md $(DOC_DIR) 20 | sed -e '1s/ .*//' -e '/^\[build-status-[a-z]*\]: /d' < README.md > $(DOC_DIR)/README.md 21 | if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \ 22 | git rev-parse HEAD; \ 23 | else \ 24 | cat .revision-hash; \ 25 | fi > $(SHARE_DIR)/.revision-hash 26 | : 27 | # The [ -e ] check below is to because sh evaluates this with (the moral 28 | # equivalent of) NONOMATCH in effect, and highlighters/*.zsh has no matches. 29 | for dirname in highlighters highlighters/*/ ; do \ 30 | $(INSTALL) -d $(SHARE_DIR)/"$$dirname"; \ 31 | for fname in "$$dirname"/*.zsh ; do [ -e "$$fname" ] && cp "$$fname" $(SHARE_DIR)"/$$dirname"; done; \ 32 | done 33 | cp -R docs/* $(DOC_DIR) 34 | 35 | clean: 36 | rm -f docs/all.md 37 | 38 | test: 39 | @$(ZSH) -fc 'echo ZSH_PATCHLEVEL=$$ZSH_PATCHLEVEL' 40 | @result=0; \ 41 | for test in highlighters/*; do \ 42 | if [ -d $$test/test-data ]; then \ 43 | echo "Running test $${test##*/}"; \ 44 | env -i QUIET=$$QUIET $${TERM:+"TERM=$$TERM"} $(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \ 45 | : $$(( result |= $$? )); \ 46 | fi \ 47 | done; \ 48 | exit $$result 49 | 50 | quiet-test: 51 | $(MAKE) test QUIET=y 52 | 53 | perf: 54 | @result=0; \ 55 | for test in highlighters/*; do \ 56 | if [ -d $$test/test-data ]; then \ 57 | echo "Running test $${test##*/}"; \ 58 | $(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \ 59 | : $$(( result |= $$? )); \ 60 | fi \ 61 | done; \ 62 | exit $$result 63 | 64 | .PHONY: all install clean test perf 65 | -------------------------------------------------------------------------------- /highlighters/main/test-data/backslash.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=$'\\' 31 | 32 | expected_region_highlight=( 33 | '1 1 unknown-token' # \\ 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/brackets/test-data/only-error.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2017 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=': x)' 31 | 32 | expected_region_highlight=( 33 | "4 4 bracket-error" # ) 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/simple-command.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='ls' 31 | 32 | expected_region_highlight=( 33 | "1 2 command" # ls 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-loop2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias ls="ls" 31 | BUFFER="ls" 32 | 33 | expected_region_highlight+=( 34 | "1 2 alias" # ls 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/brackets/test-data/quoted-patentheses.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='echo "foo ( bar"' 31 | 32 | expected_region_highlight=( 33 | "11 11 bracket-error" 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/history-expansion2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='^foo^bar' 31 | 32 | expected_region_highlight=( 33 | "1 8 history-expansion" # ^foo^bar 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-basic.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias foo="echo hello world" 31 | BUFFER="foo" 32 | 33 | expected_region_highlight+=( 34 | "1 3 alias" # foo 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-eponymous1.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2019 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias ls='command ls' 31 | 32 | BUFFER='ls' 33 | 34 | expected_region_highlight=( 35 | "1 2 alias" # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/unbackslash.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='\sh' 31 | 32 | expected_region_highlight=( 33 | "1 3 command" # \sh (runs 'sh', bypassing aliases) 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/unknown-command.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='azertyuiop' 31 | 32 | expected_region_highlight=( 33 | "1 10 unknown-token" # azertyuiop 34 | ) 35 | -------------------------------------------------------------------------------- /highlighters/main/test-data/arg0-colon.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=''\''x: /' 32 | 33 | expected_region_highlight=( 34 | '1 5 unknown-token' # \'x: / 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/abspath-in-command-position1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'/' 32 | 33 | expected_region_highlight=( 34 | '1 1 path_prefix' # / 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-eponymous2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2019 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias ls=tmp tmp='command ls' 31 | 32 | BUFFER='ls' 33 | 34 | expected_region_highlight=( 35 | "1 2 alias" # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/equals1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': =ls' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 5 path' # =ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/equals4.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': =' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 3 default' # = 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/noglob-alias.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias x=command 31 | BUFFER='x ls' 32 | 33 | expected_region_highlight=( 34 | "1 1 alias" # x 35 | "3 4 command" # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/abspath-in-command-position2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'/bi' 32 | 33 | expected_region_highlight=( 34 | '1 3 path_prefix' # /bi 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/abspath-in-command-position5.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'/bin/sh' 32 | 33 | expected_region_highlight=( 34 | '1 7 command' # /bin/sh 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-to-dir.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias x=/ 32 | BUFFER=$'x' 33 | 34 | expected_region_highlight=( 35 | '1 1 unknown-token' # x (/) 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-tilde-home.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | HOME="." 31 | BUFFER='ls ~' 32 | 33 | expected_region_highlight=( 34 | "1 2 command" # ls 35 | "4 4 path" # ~ 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-tilde-home3.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | HOME="." 31 | BUFFER='ls \~' 32 | 33 | expected_region_highlight=( 34 | "1 2 command" # ls 35 | "4 5 default" # \~ 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/abspath-in-command-position4.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'/bin/s' 32 | 33 | expected_region_highlight=( 34 | '1 6 path_prefix' # /bin/s 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-self2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias cat='cat | cat' 32 | 33 | BUFFER='cat' 34 | 35 | expected_region_highlight=( 36 | '1 3 alias' # cat 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-to-dir1b.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | setopt autocd 32 | alias x=/ 33 | BUFFER=$'x' 34 | 35 | expected_region_highlight=( 36 | '1 1 alias' # x 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/comment-leading.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | setopt interactive_comments 31 | 32 | BUFFER='# echo foo' 33 | 34 | expected_region_highlight=( 35 | "1 10 comment" # # echo foo 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/empty-line.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'\\\n; ls' 32 | 33 | expected_region_highlight=( 34 | '3 3 unknown-token' # ; 35 | '5 6 command' # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | mkdir A 31 | touch A/mu 32 | BUFFER='ls A/mu' 33 | 34 | expected_region_highlight=( 35 | "1 2 command" # ls 36 | "4 7 path" # A/mu 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/abspath-in-command-position1b.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | setopt autocd 32 | BUFFER=$'/' 33 | 34 | expected_region_highlight=( 35 | '1 1 autodirectory' # / 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-unknown-token1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2019 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias a=b b=foo 32 | 33 | BUFFER='a ' 34 | 35 | expected_region_highlight=( 36 | '1 1 unknown-token' # a 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-tilde-home2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | HOME="/nonexistent" 31 | BUFFER='ls ~' 32 | 33 | expected_region_highlight=( 34 | "1 2 command" # ls 35 | "4 4 default" # ~ 36 | ) 37 | 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-not-array2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='a=foo\( :' 31 | 32 | expected_region_highlight=( 33 | '1 7 assign' # a=foo\( 34 | '3 7 default' # foo\( 35 | '9 9 builtin' # : 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/brackets-mismatch3.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='echo )' 32 | 33 | expected_region_highlight=( 34 | '1 4 builtin' # echo 35 | '6 6 unknown-token' # ) 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/brackets-mismatch4.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='echo }' 32 | 33 | expected_region_highlight=( 34 | '1 4 builtin' # echo 35 | '6 6 unknown-token' # } 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/parameter-elision-command-word.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='$x ls' 32 | 33 | expected_region_highlight=( 34 | '1 2 comment' # $x 35 | '4 5 command' # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/double-hyphen-option.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='hello --world' 31 | 32 | expected_region_highlight=( 33 | "1 5 unknown-token" # hello 34 | "7 13 double-hyphen-option" # --world 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/empty-command.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='echo; ;' 31 | 32 | expected_region_highlight=( 33 | "1 4 builtin" # echo 34 | "5 5 commandseparator" # ; 35 | "7 7 unknown-token" # ; 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/brackets/test-data/cursor-matchingbracket-line-finish.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | WIDGET=zle-line-finish 31 | 32 | BUFFER=': $foo[bar]' 33 | CURSOR=6 # cursor is zero-based 34 | 35 | expected_region_highlight=( 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-unknown-token2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2019 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias a='() { ls "$@" ; foo }' 32 | 33 | BUFFER='a ' 34 | 35 | expected_region_highlight=( 36 | '1 1 unknown-token' # a 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/equals3.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': =nosuchcommand' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 16 unknown-token' # =nosuchcommand 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-empty.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias x='' 31 | 32 | BUFFER='x echo foo' 33 | 34 | expected_region_highlight=( 35 | '1 1 alias' # x 36 | '3 6 builtin' # echo 37 | '8 10 default' # foo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/noglob3.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | touch \* 31 | 32 | BUFFER='noglob echo *' 33 | 34 | expected_region_highlight=( 35 | "1 6 precommand" # noglob 36 | "8 11 builtin" # echo 37 | "13 13 path" # * 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/precommand2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='command -v ls' 31 | 32 | expected_region_highlight=( 33 | "1 7 precommand" # command 34 | "9 10 single-hyphen-option" # -v 35 | "12 13 command" # ls 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-self.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias echo='echo foo' 32 | 33 | BUFFER='echo bar' 34 | 35 | expected_region_highlight=( 36 | '1 4 alias' # echo 37 | '6 8 default' # bar 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-not-array.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='a=foo( bar ) :' 31 | 32 | expected_region_highlight=( 33 | '1 12 assign' # a=foo( bar ) 34 | '3 12 default' # foo( bar ) 35 | '14 14 builtin' # : 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/cdpath-abspath.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | cdpath=( $PWD ) 32 | mkdir foo foo/bar 33 | 34 | BUFFER="/foo" 35 | 36 | expected_region_highlight=( 37 | '1 4 unknown-token' # x (/) 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-dollared-word2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | local lambda="''" 31 | touch \$lambda 32 | BUFFER=': \$lambda' 33 | 34 | expected_region_highlight=( 35 | "1 1 builtin" # : 36 | "3 10 path" # \$lambda 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-subshell.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER='(A=1)' 31 | 32 | expected_region_highlight=( 33 | "1 1 reserved-word" # ( 34 | "2 4 assign" # A=1 35 | "4 4 default" # 1 36 | "5 5 reserved-word" # ) 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/backslash-continuation.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | PREBUFFER=$'echo \\\n' 31 | BUFFER='noglob' 32 | 33 | expected_region_highlight=( 34 | "1 6 default" # 'noglob' highlighted as a string, not as a precomand 35 | ) 36 | -------------------------------------------------------------------------------- /highlighters/main/test-data/brackets-mismatch5.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='echo { }' 32 | 33 | expected_region_highlight=( 34 | '1 4 builtin' # echo 35 | '6 6 default' # { 36 | '8 8 unknown-token' # } 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/tilde-command-word.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | hash -d D=/usr/bin 31 | 32 | BUFFER='~D/env foo' 33 | 34 | expected_region_highlight=( 35 | "1 6 command" # ~D/env [= /usr/bin/env 36 | "8 10 default" # foo 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/pattern/test-data/rm-rf.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') 31 | 32 | BUFFER='rm -rf /' 33 | 34 | expected_region_highlight=( 35 | "1 8 fg=white,bold,bg=red" # rm -rf / 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/regexp/test-data/subexpression.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='ls foo' 32 | ZSH_HIGHLIGHT_REGEXP=('(^| )(ls|cd)($| )' 'fg=green') 33 | 34 | expected_region_highlight=( 35 | '1 3 fg=green' # "ls " 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-complex.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias x='echo && ls; >' 31 | 32 | BUFFER='x file echo' 33 | 34 | expected_region_highlight=( 35 | '1 1 alias' # x 36 | '3 6 default' # file 37 | '8 11 builtin' # echo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-parameter.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias '$foo'='echo alias' 32 | local foo; foo=(echo param) 33 | 34 | BUFFER='$foo' 35 | 36 | expected_region_highlight=( 37 | '1 4 alias' # $foo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/equals2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | unsetopt equals 32 | 33 | BUFFER=$': =nosuchcommand' 34 | 35 | expected_region_highlight=( 36 | '1 1 builtin' # : 37 | '3 16 default' # =nosuchcommand 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/global-alias1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias -g foo=bar 32 | 33 | BUFFER=$'foo foo' 34 | 35 | expected_region_highlight=( 36 | '1 3 global-alias' # foo 37 | '5 7 global-alias' # foo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/jobsubst-isnt-glob.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018.9958 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': %? %?foo' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 4 default' # %? 36 | '6 10 default' # %?foo 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/jobsubst-isnt-glob2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': foo%?bar' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 10 default' # foo%?bar 36 | '7 7 globbing' # ? 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-comment2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | # see alias-comment1.zsh 31 | setopt NO_interactivecomments 32 | alias x=$'# foo\npwd' 33 | BUFFER='x' 34 | 35 | expected_region_highlight=( 36 | '1 1 unknown-token' # x (#) 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/parameter-expansion-shwordsplit.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2021 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | setopt sh_word_split 32 | local foo='echo foo' 33 | 34 | BUFFER='$foo' 35 | 36 | expected_region_highlight=( 37 | '1 4 builtin' # $foo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/parameter-expansion-untokenized1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | local x="()" 32 | 33 | BUFFER=$'$x ls' 34 | 35 | expected_region_highlight=( 36 | '1 2 unknown-token' # $x 37 | '4 5 command' # ls 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-reuse3.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias a=: b='a; a' 32 | 33 | BUFFER='b; b' 34 | 35 | expected_region_highlight=( 36 | '1 1 alias' # b 37 | '2 2 commandseparator' # ; 38 | '4 4 alias' # b 39 | ) 40 | -------------------------------------------------------------------------------- /highlighters/main/test-data/arithmetic-unclosed.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': $(( 1' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 7 default' # $(( 1 36 | '3 7 arithmetic-expansion' # $(( 1 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/multiline-string2.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=$'echo \'foo1\n' 31 | 32 | expected_region_highlight=( 33 | "1 4 builtin" # echo 34 | "6 11 default" # 'foo1\n 35 | "6 11 single-quoted-argument-unclosed" # 'foo1\n 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/main/test-data/parameter-expansion-untokenized2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | local x="^foo^bar" 32 | 33 | BUFFER=$'$x ls' 34 | 35 | expected_region_highlight=( 36 | '1 2 unknown-token' # $x 37 | '4 5 default' # ls 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-space.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | mkdir A 31 | touch "A/mu with spaces" 32 | BUFFER='ls A/mu\ with\ spaces' 33 | 34 | expected_region_highlight=( 35 | "1 2 command" # ls 36 | "4 21 path" # A/mu\ with\ spaces 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/redirection-comment.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2017 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | setopt interactive_comments 31 | 32 | BUFFER=': <<#foo' 33 | 34 | expected_region_highlight=( 35 | "1 1 builtin" # : 36 | "3 4 redirection" # << 37 | "5 8 comment" # #foo 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-comment1.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | # see alias-comment2.zsh and comment-followed.zsh 31 | setopt interactivecomments 32 | alias x=$'# foo\npwd' 33 | BUFFER='x' 34 | 35 | expected_region_highlight=( 36 | '1 1 alias' # x 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-redirect.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias x=\> 31 | BUFFER='x foo echo bar' 32 | 33 | expected_region_highlight=( 34 | '1 1 alias' # x 35 | '3 5 default' # foo 36 | '7 10 builtin' # echo 37 | '12 14 default' # bar 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-reuse1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias a=: b='a | a' 32 | 33 | BUFFER='b | b' 34 | 35 | expected_region_highlight=( 36 | '1 1 alias' # b 37 | '3 3 commandseparator' # | 38 | '5 5 alias' # b 39 | ) 40 | -------------------------------------------------------------------------------- /highlighters/main/test-data/alias-reuse2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | alias a=: b='a && a' 32 | 33 | BUFFER='b && b' 34 | 35 | expected_region_highlight=( 36 | '1 1 alias' # b 37 | '3 4 commandseparator' # && 38 | '6 6 alias' # b 39 | ) 40 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-argv.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | touch foo 31 | BUFFER='42=foo 43+=bar' 32 | 33 | expected_region_highlight=( 34 | "1 6 assign" # 42=foo 35 | "4 6 path" # foo 36 | "8 14 assign" # 43+=bar 37 | "12 14 default" # bar 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assignment-quoted.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'1="foo"' 32 | 33 | expected_region_highlight=( 34 | '1 7 assign' # 1="foo" 35 | '3 7 default' # "foo" 36 | '3 7 double-quoted-argument' # "foo" 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/arith1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$': $(( 6 * 9 ))' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # : 35 | '3 14 default' # $(( 6 * 9 )) 36 | '3 14 arithmetic-expansion' # $(( 6 * 9 )) 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-invalid-command.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'x=y nosuchcommand' 32 | 33 | expected_region_highlight=( 34 | '1 3 assign' # x=y 35 | '3 3 default' # y 36 | '5 17 unknown-token' # nosuchcommand 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/multiline-string.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | PREBUFFER=$'echo "foo1\n' 31 | BUFFER='foo2" ./' 32 | 33 | expected_region_highlight=( 34 | "1 5 default" # 'foo2"' 35 | "1 5 double-quoted-argument" # 'foo2"' 36 | "7 8 path" # './' 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assignment-before-resword3.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2017 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'foo=bar (( foo ))' 32 | 33 | expected_region_highlight=( 34 | '1 7 assign' # foo=bar 35 | '5 7 default' # bar 36 | '9 17 unknown-token' # (( foo )) 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/comment-off.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | unsetopt interactive_comments 31 | 32 | BUFFER='# echo foo' 33 | 34 | expected_region_highlight=( 35 | "1 1 unknown-token" # # 36 | "3 6 default" # " echo foo" 37 | "8 10 default" # " echo foo" 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/multios-negates-globbing2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'cat < *' 32 | 33 | expected_region_highlight=( 34 | '1 3 command' # cat 35 | '5 5 redirection' # < 36 | '7 7 default' # * 37 | '7 7 globbing' # * 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/off-by-one.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | alias a=: 31 | f() {} 32 | 33 | BUFFER='a;f;' 34 | 35 | expected_region_highlight=( 36 | "1 1 alias" # a 37 | "2 2 commandseparator" # ; 38 | "3 3 function" # f 39 | "4 4 commandseparator" # ; 40 | ) 41 | -------------------------------------------------------------------------------- /highlighters/main/test-data/precommand.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=': command zzzzzz' 31 | 32 | expected_region_highlight=( 33 | "1 1 builtin" # : 34 | "3 9 default" # not precommand 35 | "11 16 default" # not unknown-token (since 'zzzzzz' is not a command) 36 | ) 37 | -------------------------------------------------------------------------------- /highlighters/regexp/test-data/complex.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | ZSH_HIGHLIGHT_REGEXP+=('[0-9\+\-]+' 'fg=white,bold,bg=red') 31 | 32 | BUFFER='echo 1+9-3 7+2' 33 | 34 | expected_region_highlight=( 35 | "6 10 fg=white,bold,bg=red" 36 | "12 14 fg=white,bold,bg=red" 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/brackets-matching2.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='[ -n foo ]' 32 | 33 | expected_region_highlight=( 34 | '1 1 builtin' # [ 35 | '3 4 single-hyphen-option' # -n 36 | '6 8 default' # foo 37 | '10 10 builtin' # ] 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/brackets-mismatch8.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2016 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER='(ls&)' 32 | 33 | expected_region_highlight=( 34 | '1 1 reserved-word' # ( 35 | '2 3 command' # ls 36 | '4 4 commandseparator' # & 37 | '5 5 reserved-word' # ) 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/order-path-before-globbing.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2017 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | touch '*' 32 | BUFFER=': * \*' 33 | 34 | expected_region_highlight=( 35 | '1 1 builtin' # : 36 | '3 3 default' # * 37 | '3 3 globbing' # * 38 | '5 6 path' # \* 39 | ) 40 | -------------------------------------------------------------------------------- /highlighters/main/test-data/path-mixed-quoting.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | touch foo 32 | 33 | BUFFER=$': \'f\'oo' 34 | 35 | expected_region_highlight=( 36 | '1 1 builtin' # : 37 | '3 7 path' # \'f\'oo 38 | '3 5 single-quoted-argument' # \'f\' 39 | ) 40 | -------------------------------------------------------------------------------- /highlighters/main/test-data/assign-value-quote1.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2020 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'s="foo\'bar"' 32 | 33 | expected_region_highlight=( 34 | '1 11 assign' # s="foo'bar" 35 | '3 11 default' # "foo'bar" 36 | '3 11 double-quoted-argument' # "foo'bar" 37 | ) 38 | -------------------------------------------------------------------------------- /highlighters/main/test-data/bang-assign-scalar.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------------- 3 | # Copyright (c) 2018 zsh-syntax-highlighting contributors 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without modification, are permitted 7 | # provided that the following conditions are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 10 | # and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other materials provided 13 | # with the distribution. 14 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 15 | # may be used to endorse or promote products derived from this software without specific prior 16 | # written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | # ------------------------------------------------------------------------------------------------- 27 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 28 | # vim: ft=zsh sw=2 ts=2 et 29 | # ------------------------------------------------------------------------------------------------- 30 | 31 | BUFFER=$'foo=bar \! ls' 32 | 33 | expected_region_highlight=( 34 | '1 7 assign' # foo=bar 35 | '5 7 default' # bar 36 | '9 9 unknown-token' # \! 37 | '11 12 command' # ls 38 | ) 39 | -------------------------------------------------------------------------------- /highlighters/main/test-data/noglob1.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2015 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | BUFFER=':; noglob echo *' 31 | 32 | expected_region_highlight=( 33 | "1 1 builtin" # : 34 | "2 2 commandseparator" # ; 35 | "4 9 precommand" # noglob 36 | "11 14 builtin" # echo 37 | "16 16 default" # * 38 | ) 39 | --------------------------------------------------------------------------------