Skip to content

Commit

Permalink
[shell mode] Correctly highlight strings ending in dollar sign
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianheine committed Jan 19, 2018
1 parent 945c967 commit d0dca65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mode/shell/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ CodeMirror.defineMode('shell', function() {
if (next === close && !escaped) {
state.tokens.shift();
break;
} else if (next === '$' && !escaped && quote !== "'") {
} else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
escaped = true;
stream.backUp(1);
state.tokens.unshift(tokenDollar);
Expand Down
6 changes: 6 additions & 0 deletions mode/shell/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@

MT("strings in parens",
"[def FOO][operator =]([quote $(<][string \"][def $MYDIR][string \"][quote /myfile grep ][string 'hello$'][quote )])")

MT ("string ending in dollar",
'[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]')

MT ("quote ending in dollar",
"[quote $(echo a$)]")
})();

0 comments on commit d0dca65

Please sign in to comment.