aboutsummaryrefslogtreecommitdiffhomepage
path: root/tokenizer.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-11-01 21:06:16 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-11-01 21:06:16 -0700
commit4b6639f6974d14cf091beadd68041f7957415071 (patch)
tree708938318801e3be0389ef5ee1057bdcd4f2ae58 /tokenizer.cpp
parentfa588db1484b0c2a410b72f53fee3ccfbc36384d (diff)
Allow # within string tokens
This means that # must be the first character of the string to start a comment, in line with other shells Fixes #953
Diffstat (limited to 'tokenizer.cpp')
-rw-r--r--tokenizer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tokenizer.cpp b/tokenizer.cpp
index dca22281..17999356 100644
--- a/tokenizer.cpp
+++ b/tokenizer.cpp
@@ -138,6 +138,8 @@ int tok_has_next(tokenizer_t *tok)
/**
Tests if this character can be a part of a string. The redirect ^ is allowed unless it's the first character.
+ Hash (#) starts a comment if it's the first character in a token; otherwise it is considered a string character.
+ See #953.
*/
bool tok_is_string_character(wchar_t c, bool is_first)
{
@@ -150,7 +152,6 @@ bool tok_is_string_character(wchar_t c, bool is_first)
case L'|':
case L'\t':
case L';':
- case L'#':
case L'\r':
case L'<':
case L'>':
@@ -689,7 +690,7 @@ void tok_next(tokenizer_t *tok)
}
else
{
- /* Not a redirection or pipe, so just a stirng */
+ /* Not a redirection or pipe, so just a string */
read_string(tok);
}
}