diff options
Diffstat (limited to 'redes/preproc.c')
| -rw-r--r-- | redes/preproc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/redes/preproc.c b/redes/preproc.c index f9c6e9d..38d50f7 100644 --- a/redes/preproc.c +++ b/redes/preproc.c @@ -1,4 +1,5 @@ #include <assert.h> +#include <stdio.h> #include "syntax.h" void split_str_on_space(char* str, StrVec* result) { @@ -41,25 +42,32 @@ Pipeline* process_token_sequence(TokenVec tokens, PipelineVec* pl_pool) { PlCommand pl_cmd = { .args = make_ArgVec(256), .redirects = make_RedirectVec(256), + .conn = CONN_EOL, }; Token curr_tok; for (; ( curr_tok = *get_from_TokenVec(&tokens, tok_pos), - !(curr_tok.kind == TOK_SPEC && (curr_tok.as.spec == SPEC_PIPE && curr_tok.as.spec == SPEC_EOL)) + !(curr_tok.kind == TOK_SPEC && (curr_tok.as.spec == SPEC_PIPE || curr_tok.as.spec == SPEC_EOL)) ); tok_pos++ ) { + printf("Tok pos: %d\n", tok_pos); + StrVec exp_word; switch (curr_tok.kind) { case TOK_WORD: - StrVec exp_word = process_word(curr_tok.as.word); + exp_word = process_word(curr_tok.as.word); + printf("hi"); + fflush(stdout); for (int j = 0; j < exp_word.count; j++) { + printf("%d\n", j); + fflush(stdout); char* arg_str = *get_from_StrVec(&exp_word, j); push_to_ArgVec(&pl_cmd.args, (Arg){.kind = ARG_LIT, .as.lit_str = arg_str}); } break; default: - exit(67); // TODO: the other kinds + exit(68); // TODO: the other kinds } } Token delim_tok = *get_from_TokenVec(&tokens, tok_pos); @@ -72,7 +80,7 @@ Pipeline* process_token_sequence(TokenVec tokens, PipelineVec* pl_pool) { pl_cmd.conn = CONN_EOL; break; default: - exit(67); + exit(69); } } return push_to_PipelineVec(pl_pool, pl); |
