mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 01:25:07 +00:00
Shell: Do not treat the ending newline as part of a comment
This allows the parser to finally parse the entire source into a single AST. As a result of allowing comments inside sequences, Sequence is also marked as would_execute if its left or right node would.
This commit is contained in:
parent
6d17fe38a4
commit
f9d3055691
4 changed files with 24 additions and 7 deletions
|
@ -316,9 +316,6 @@ int Shell::run_command(const StringView& cmd)
|
|||
if (cmd.is_empty())
|
||||
return 0;
|
||||
|
||||
if (cmd.starts_with("#"))
|
||||
return 0;
|
||||
|
||||
auto command = Parser(cmd).parse();
|
||||
|
||||
if (!command)
|
||||
|
@ -505,6 +502,8 @@ bool Shell::run_file(const String& filename, bool explicitly_invoked)
|
|||
if (file_result.is_error()) {
|
||||
if (explicitly_invoked)
|
||||
fprintf(stderr, "Failed to open %s: %s\n", filename.characters(), file_result.error().characters());
|
||||
else
|
||||
dbg() << "open() failed for '" << filename << "' with " << file_result.error();
|
||||
return false;
|
||||
}
|
||||
auto file = file_result.value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue