Daniel Shahaf
c687bddea3
Drop unnecessary shebang lines, part 2.
Follow-up to the last commit.
E: zsh-syntax-highlighting: missing-dep-for-interpreter zsh => zsh | zsh-beta (usr/share/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh)
W: zsh-syntax-highlighting: executable-not-elf-or-script usr/share/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh
hace 9 años
Daniel Shahaf
c30301d474
Drop unnecessary shebang lines.
All these files should be sourced, not executed; and Debian's lintian complains:
W: zsh-syntax-highlighting: script-not-executable usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
hace 9 años
Daniel Shahaf
e138cfd765
command word: Protect against the case that the command word starts with a minus.
hace 9 años
Daniel Shahaf
07fd773d7e
noop: Add comments.
hace 9 años
Daniel Shahaf
5cd1fb26c0
Resolve tilde expansions in command word.
This causes '~/bin/foo' to highlight as a command, rather than as a file.
Part of issue #201 .
hace 9 años
Daniel Shahaf
faed2fa49e
internal: Fix docstrings.
hace 9 años
Daniel Shahaf
800158745a
Highlight quoted command words correctly.
Fixes zsh-users/zsh-syntax-highlighting#147 .
hace 9 años
Daniel Shahaf
7b4598a764
Highlight arithmetic expansions.
Fixes zsh-users/zsh-syntax-highlighting#188 in the case that both the
opening '((' and closing '))' have been typed, The case that only the
opening '((' have been typed is also fixed, but requires a zsh development
build (zsh-5.1.1-52-g4bed2cf or newer); see comments within.
hace 9 años
Daniel Shahaf
52a2ef644b
Don't highlight escaped globbing.
Fixes zsh-users/zsh-syntax-highlighting#193 .
hace 9 años
Daniel Shahaf
6488284814
back-dollar-quoted-argument: Highlight incomplete escape sequences as unknown-token
Followup to 219184f046d40cc723606797666dab18f8a6aea7, which fixed issue #196 .
hace 9 años
Daniel Shahaf
f657406159
minor: Fix comment in last ocmmit.
hace 9 años
Daniel Shahaf
8b728522de
Add test for empty commands.
Related to issue #205 .
hace 9 años
Daniel Shahaf
79e8c2dd48
Don't highlight syntax elements as paths.
Without this, redirections, history expansions, and command separators would
be matched by path_approx.
A test case is simply LBUFFER="<" RBUFFER="" (highlighted as redirection with this
fix and as path_approx without it).
Fixes zsh-users/zsh-syntax-highlighting#204 .
hace 9 años
Daniel Shahaf
6732783d46
back-dollar-quoted-argument: Correct an off-by-one.
Highlight the last character of a «\xHH» escape when it is the last thing in
LBUFFER. This is similar to what b0cc02ed86
did
for issue #186 .
hace 9 años
Daniel Shahaf
0788514cbd
back-dollar-quoted-argument: Correct octal escape syntax.
A leading zero, as in '\0NNN', is permitted by 'echo' but not by 'print',
and «$''» follows 'print'.
hace 9 años
Daniel Shahaf
8a43bd2cd9
back-dollar-quoted-argument: Highlight \uHHHH and \UHHHHHHHH escapes.
hace 9 años
Daniel Shahaf
98366ade11
back-dollar-quoted-argument: Don't consider \0xHH a hex escape sequence.
A leading zero is not permitted in the '\xHH' syntax.
hace 9 años
Daniel Shahaf
78ad649d47
back-dollar-quoted-argument: Don't consider comma a hex character.
Character class syntax does not ignore commas between ranges.
hace 9 años
Daniel Shahaf
69fcb40275
Highlight backslash escapes within $'' strings.
Correct highlighting of backslash escapes within "" strings: highlight only
the four specific escape sequences defined there.
Fixes zsh-users/zsh-syntax-highlighting#196 .
hace 9 años
Daniel Shahaf
f4164ac86c
internal: Document a function-local variable.
hace 9 años
Daniel Shahaf
9c7a1109c8
WARN_CREATE_GLOBAL: don't leak the arithmetic for loop's index variable.
Found by code inspection; WARN_CREATE_GLOBAL missed this.
hace 9 años
Daniel Shahaf
040df93c01
Highlight redirections.
Fixes zsh-users/zsh-syntax-highlighting#23 .
hace 9 años
Daniel Shahaf
66eb801358
dollar-double-quoted-argument: Handle «"foo$"» correctly.
hace 9 años
Daniel Shahaf
b0cc02ed86
dollar-double-quoted-argument: Highlight "$foo" better.
Now, «"$42foo"» doesn't highlight the «foo», and «"$bar» highlights the «r».
hace 9 años
Daniel Shahaf
908c4fe150
Stop leaking variables into global namespace.
Set WARN_CREATE_GLOBAL to prevent recurrence.
Fixes zsh-users/zsh-syntax-highlighting#192 .
hace 9 años
Daniel Shahaf
9e80fe8f02
Bump copyright years.
hace 9 años
Daniel Shahaf
001e6cb404
tests: Cover 'back-quoted-argument'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
22fa215e05
Fixup last commit.
* highlighters/main/test-data/hashed-command.zsh:
Set the right region key. This makes the test more specific.
(Issue #184 would have caught this bug.)
hace 9 años
Daniel Shahaf
845361ef3d
tests: Cover 'hashed-command'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
5fb4cb2f72
Fix regression: Highlight ';' as commandseparator.
This was broken by c2b9327b07
and tracked as zsh-users/zsh-syntax-highlighting#199 .
This fixes the vanilla-newline.zsh test, which was was (consciously) broken
by the previous commit.
hace 9 años
Daniel Shahaf
f7cb4741d6
Followup to previous: Extend the 'alias' test.
hace 9 años
Daniel Shahaf
81c8d78d12
tests: Cover 'alias' and 'suffix-alias'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
8767e0ef66
tests: Cover 'reserved-word'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
b056f592f2
tests: Cover 'path_prefix'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
e0a7ddb6ec
tests: Cover 'history-expansion'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
416934202e
tests: Cover 'single-quoted-argument', 'double-hyphen-option', and 'function'.
This is part of issue zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
627eb71940
tests: Use $unused_highlight in more places.
Notably, the 'single-hyphen-option' and 'assign' contexts both default to the
'none' style, so before this patch, the tests would not have detected a failure
to apply those two contexts.
For other contexts, using $unused_highlight only helps detect the case where
the right highlight style (e.g., 'fg=yellow') is used as a result of applying
the wrong context — which should be a theoretical failure mode.
This is part of zsh-users/zsh-syntax-highlighting#198 .
hace 9 años
Daniel Shahaf
404d498e1d
tests: vanilla-newline.zsh: Fix expectations
hace 9 años
Daniel Shahaf
0d3a5dadea
tests: Add test for escape sequences in double-quoted strings
hace 9 años
Daniel Shahaf
186536705b
tests: path-tilde-named.zsh: Fix expectations
The path string ends at offset 26, not 23.
hace 9 años
Daniel Shahaf
80587e5419
New test for dollar-double-quoted-argument.
This exercises the previous patch.
hace 9 años
Daniel Shahaf
c46b8d169e
test harness: Fix off-by-one discrepancy between observed and expected.
Fixes issue #195 .
hace 9 años
Daniel Shahaf
a8afbdf2f5
Support $''-quoted strings.
This does not yet highlight backslash escapes within them.
hace 9 años
Daniel Shahaf
6d93ea07fd
main highlighter docs: README: Tweak.
hace 9 años
Daniel Shahaf
4f5a0fe60b
main highlighter docs: Give examples of styles.
hace 9 años
Daniel Shahaf
555e142e66
suffix aliases: Highlight differently.
Add an underline, since they are at command word position but will be executed
by something else.
Suggested-by: Daniel Hahler
hace 9 años
Daniel Shahaf
dc701501e5
Highlight ? as globbing.
Fixes zsh-users/zsh-syntax-highlighting#94 .
hace 9 años
Daniel Shahaf
9310d8ae71
Support suffix aliases
Fixes zsh-users/zsh-syntax-highlighting#126 .
hace 9 años
Daniel Shahaf
b3ceea8511
Highlight 'noglob' correctly in more cases.
Fixes zsh-users/zsh-syntax-highlighting#189 .
hace 9 años
Daniel Shahaf
a0b5bc6c71
Fix bug in previous commit ( d330b49b33
)
'local' is a reserved word in zsh 5.1 but not in earlier versions [1].
Therefore, under zsh older than 5.1, quoting is required.
This manifested as random «builtin=''» in emitted to the terminal, and
commands (such as 'echo') highlighted as errors (in red).
[1] https://github.com/zsh-users/zsh/blob/master/README#L46
(the section "Incompatibilites between 5.0.8 and 5.1")
hace 9 años