mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +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 `)`)
|
* Syntactic Lists: Any _list_ enclosed in parentheses (`(` and `)`)
|
||||||
|
|
||||||
##### Comments
|
##### 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
|
##### Keywords
|
||||||
The following tokens:
|
The following tokens:
|
||||||
|
@ -497,7 +497,7 @@ variable_ref :: '$' identifier
|
||||||
|
|
||||||
slice :: '[' brace_expansion_spec ']'
|
slice :: '[' brace_expansion_spec ']'
|
||||||
|
|
||||||
comment :: '#' [^\n]*
|
comment :: (?<!\w) '#' .*
|
||||||
|
|
||||||
immediate_expression :: '$' '{' immediate_function expression* '}'
|
immediate_expression :: '$' '{' immediate_function expression* '}'
|
||||||
|
|
||||||
|
@ -515,8 +515,8 @@ word_selector :: number
|
||||||
| '^' {== 0}
|
| '^' {== 0}
|
||||||
| '$' {== end}
|
| '$' {== end}
|
||||||
|
|
||||||
bareword :: [^"'*$&#|()[\]{} ?;<>] bareword?
|
bareword :: [^"'*$&|()[\]{} ?;<>] bareword?
|
||||||
| '\' [^"'*$&#|()[\]{} ?;<>] bareword?
|
| '\' [^"'*$&|()[\]{} ?;<>] bareword?
|
||||||
|
|
||||||
bareword_with_tilde_expansion :: '~' bareword?
|
bareword_with_tilde_expansion :: '~' bareword?
|
||||||
|
|
||||||
|
|
|
@ -1913,7 +1913,7 @@ RefPtr<AST::Node> Parser::parse_bareword()
|
||||||
auto rule_start = push_start();
|
auto rule_start = push_start();
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
auto is_acceptable_bareword_character = [&](char c) {
|
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);
|
&& !m_extra_chars_not_allowed_in_barewords.contains_slow(c);
|
||||||
};
|
};
|
||||||
while (!at_end()) {
|
while (!at_end()) {
|
||||||
|
|
|
@ -292,7 +292,7 @@ variable_ref :: '$' identifier
|
||||||
|
|
||||||
slice :: '[' brace_expansion_spec ']'
|
slice :: '[' brace_expansion_spec ']'
|
||||||
|
|
||||||
comment :: '#' [^\n]*
|
comment :: (?<!\w) '#' .*
|
||||||
|
|
||||||
immediate_expression :: '$' '{' immediate_function expression* '}'
|
immediate_expression :: '$' '{' immediate_function expression* '}'
|
||||||
|
|
||||||
|
@ -310,8 +310,8 @@ word_selector :: number
|
||||||
| '^' {== 0}
|
| '^' {== 0}
|
||||||
| '$' {== end}
|
| '$' {== end}
|
||||||
|
|
||||||
bareword :: [^"'*$&#|()[\]{} ?;<>] bareword?
|
bareword :: [^"'*$&|()[\]{} ?;<>] bareword?
|
||||||
| '\' [^"'*$&#|()[\]{} ?;<>] bareword?
|
| '\' [^"'*$&|()[\]{} ?;<>] bareword?
|
||||||
|
|
||||||
bareword_with_tilde_expansion :: '~' bareword?
|
bareword_with_tilde_expansion :: '~' bareword?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue