1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:47:36 +00:00

Shell: Remove '#' from the list of acceptable bareword characters

This stops the shell from always interpreting '#' as the start of a
comment in non-Posix mode.
This commit is contained in:
implicitfield 2023-10-28 23:56:46 +04:00 committed by Ali Mohammad Pur
parent 4afd782477
commit 4b60a99573
3 changed files with 8 additions and 8 deletions

View file

@ -1913,7 +1913,7 @@ RefPtr<AST::Node> Parser::parse_bareword()
auto rule_start = push_start();
StringBuilder builder;
auto is_acceptable_bareword_character = [&](char c) {
return strchr("\\\"'*$&#|(){} ?;<>\n", c) == nullptr
return strchr("\\\"'*$&|(){} ?;<>\n", c) == nullptr
&& !m_extra_chars_not_allowed_in_barewords.contains_slow(c);
};
while (!at_end()) {

View file

@ -292,7 +292,7 @@ variable_ref :: '$' identifier
slice :: '[' brace_expansion_spec ']'
comment :: '#' [^\n]*
comment :: (?<!\w) '#' .*
immediate_expression :: '$' '{' immediate_function expression* '}'
@ -310,8 +310,8 @@ word_selector :: number
| '^' {== 0}
| '$' {== end}
bareword :: [^"'*$&#|()[\]{} ?;<>] bareword?
| '\' [^"'*$&#|()[\]{} ?;<>] bareword?
bareword :: [^"'*$&|()[\]{} ?;<>] bareword?
| '\' [^"'*$&|()[\]{} ?;<>] bareword?
bareword_with_tilde_expansion :: '~' bareword?