1
Fork 0
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:
AnotherTest 2020-07-05 19:48:26 +04:30 committed by Andreas Kling
parent 6d17fe38a4
commit f9d3055691
4 changed files with 24 additions and 7 deletions

View file

@ -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();