Skip to content

Commit

Permalink
Fixed comments and < characters
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Aug 25, 2021
1 parent 8354b83 commit 5715400
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/prism-shell-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// shell symbol
/[$#%](?=\s)/.source +
// bash command
/(?:[^\\\r\n'"<$]|\\(?:[^\r]|\r\n?)|\$(?!')|<<str>>)+/.source.replace(/<<str>>/g, function () { return strings; }),
/(?:[^\\\r\n \t'"<$]|[ \t](?:(?!#)|#.*$)|\\(?:[^\r]|\r\n?)|\$(?!')|<(?!<)|<<str>>)+/.source.replace(/<<str>>/g, function () { return strings; }),
'm'
),
greedy: true,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-shell-session.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions tests/languages/shell-session/command_string_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $ cat << "EOF" > /etc/ipsec.secrets
# : RSA vpn-server-b.key
EOF

$ LC_ALL=C tr -cd 'a-zA-Z0-9_-;:!?.@\\*/#%$' < /dev/random | head -c 8
y_#!$U48

----------------------------------------------------

[
Expand Down Expand Up @@ -64,10 +67,10 @@ EOF
["builtin", "echo"],
["punctuation", "\\"],
"'a ",
["comment", "# "]
["comment", "# '"]
]]
]],
["output", "'\r\n\r\n"],

["command", [
["shell-symbol", "$"],
["bash", [
Expand All @@ -83,7 +86,28 @@ EOF
"\r\n: RSA vpn-server-a.key\r\n# : RSA vpn-server-b.key\r\nEOF"
]]
]]
]]
]],

["command", [
["shell-symbol", "$"],
["bash", [
["assign-left", [
["environment", "LC_ALL"]
]],
["operator", ["="]],
"C ",
["function", "tr"],
" -cd ",
["string", "'a-zA-Z0-9_-;:!?.@\\\\*/#%$'"],
["operator", ["<"]],
" /dev/random ",
["operator", ["|"]],
["function", "head"],
" -c ",
["number", "8"]
]]
]],
["output", "y_#!$U48"]
]

----------------------------------------------------
Expand Down

0 comments on commit 5715400

Please sign in to comment.