Skip to content

Commit 5d8b471

Browse files
committed
fix: Allow t_dot as first symbol after pipe in pipeline
1 parent 0b073a7 commit 5d8b471

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/builtin/dot.c

+2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ int builtin_dot(Interpreter *interpreter, ArenaLL *ast_nodes)
4848
strncpy(program_name + 1, cmd_name.text_lit.view, cmd_name.text_lit.size);
4949
program_name[cmd_name.text_lit.size + 1] = 0;
5050

51+
#ifdef DEBUG
5152
TODO_LOG("dot builtin: Check if specified file exists and is executable");
53+
#endif
5254

5355
ArenaLL ast_nodes_cpy = { .size = ast_nodes->size - 1 };
5456
if (ast_nodes_cpy.size == 0) {

src/interpreter/parser.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ static Stmt *pipeline_stmt(Parser *parser)
389389
if (!match(parser, t_pipe))
390390
return left;
391391

392-
consume(parser, t_dt_text_lit, "Expected shell command after pipe symbol");
392+
if (!match(parser, t_dot)) {
393+
consume(parser, t_dt_text_lit, "Expected shell command after pipe symbol");
394+
}
393395
PipelineStmt *stmt = (PipelineStmt *)stmt_alloc(parser->ast_arena, STMT_PIPELINE);
394396
stmt->left = (CmdStmt *)left;
395397
stmt->right = pipeline_stmt(parser);

0 commit comments

Comments
 (0)