mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:14:58 +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:
parent
4afd782477
commit
4b60a99573
3 changed files with 8 additions and 8 deletions
|
@ -104,7 +104,7 @@ Any two expressions joined by the Join operator (` ` [whitespace]), or a _variab
|
|||
* Syntactic Lists: Any _list_ enclosed in parentheses (`(` and `)`)
|
||||
|
||||
##### Comments
|
||||
Any text following a `#` in _bareword_ position, up to but not including a newline
|
||||
Any text following and including that in a word starting with `#`, up to but not including a newline
|
||||
|
||||
##### Keywords
|
||||
The following tokens:
|
||||
|
@ -497,7 +497,7 @@ variable_ref :: '$' identifier
|
|||
|
||||
slice :: '[' brace_expansion_spec ']'
|
||||
|
||||
comment :: '#' [^\n]*
|
||||
comment :: (?<!\w) '#' .*
|
||||
|
||||
immediate_expression :: '$' '{' immediate_function expression* '}'
|
||||
|
||||
|
@ -515,8 +515,8 @@ word_selector :: number
|
|||
| '^' {== 0}
|
||||
| '$' {== end}
|
||||
|
||||
bareword :: [^"'*$&#|()[\]{} ?;<>] bareword?
|
||||
| '\' [^"'*$&#|()[\]{} ?;<>] bareword?
|
||||
bareword :: [^"'*$&|()[\]{} ?;<>] bareword?
|
||||
| '\' [^"'*$&|()[\]{} ?;<>] bareword?
|
||||
|
||||
bareword_with_tilde_expansion :: '~' bareword?
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue