diff options
author | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2022-11-09 16:31:55 +0200 |
---|---|---|
committer | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2022-11-09 16:31:55 +0200 |
commit | eb75ad1bb21826e482b3bc3251e83ac5a9121678 (patch) | |
tree | 814c70e49220e30e62cbdd08c28dbe8b08592fa2 /src | |
parent | e41d8749567990f95def4e3d385e14bb6f1a14cf (diff) | |
download | foodtools-eb75ad1bb21826e482b3bc3251e83ac5a9121678.tar.gz foodtools-eb75ad1bb21826e482b3bc3251e83ac5a9121678.tar.bz2 foodtools-eb75ad1bb21826e482b3bc3251e83ac5a9121678.zip |
Remove prev from parse()
Diffstat (limited to 'src')
-rw-r--r-- | src/cookbook.c | 2 | ||||
-rw-r--r-- | src/food.c | 2 | ||||
-rw-r--r-- | src/parser.c | 10 | ||||
-rw-r--r-- | src/parser.h | 5 |
4 files changed, 11 insertions, 8 deletions
diff --git a/src/cookbook.c b/src/cookbook.c index b1a4f76..c67a728 100644 --- a/src/cookbook.c +++ b/src/cookbook.c @@ -140,7 +140,7 @@ main(int argc, char * argv[]) cookbook = (recipe **)malloc(sizeof(recipe *) * n); for (int i = 0; i < n; i++) { - cookbook[i] = parse(lib[i], NULL); + cookbook[i] = parse(lib[i]); if (opt.eval) { recipe * _r = eval(cookbook[i]); free_recipe(cookbook[i]); @@ -191,7 +191,7 @@ main(int argc, char * argv[]) opt.includes, opt.includes_n); for (int i = 0; i < n; i++) { - recipe * r = parse(lib[i], NULL); + recipe * r = parse(lib[i]); if (!r) { fprintf(stderr, "Couldn't parse recipe: %s\n", lib[i]); continue; diff --git a/src/parser.c b/src/parser.c index a5b1a11..75bd582 100644 --- a/src/parser.c +++ b/src/parser.c @@ -56,7 +56,7 @@ try_include(const char * s, recipe * r, char * error) } recipe * rr = NULL; - rr = parse(path, r->filename); + rr = parse(path); /* TODO: Check for path from included libs */ @@ -141,7 +141,7 @@ parse_item(const char * s, recipe * r, pt * type, char * error) return 0; } -static const int +int parse_step(const char * s, recipe * r, char * error) { fdebug("^ step\n"); @@ -162,7 +162,7 @@ parse_step(const char * s, recipe * r, char * error) } static const int -handle_line(const char * s, recipe * r, char * error, pt * type, const char * prev) +handle_line(const char * s, recipe * r, char * error, pt * type) { fdebug("Handling line: %s\n", s); @@ -247,7 +247,7 @@ file_from_path(const char * path) } recipe * -parse(char * path, const char * prev) +parse(char * path) { fdebug("Parsing: %s\n", path); @@ -273,7 +273,7 @@ parse(char * path, const char * prev) enum parser_type type = TITLE; while (!next_escaped_line(f, line, &lino, error)) { - if (handle_line(line, r, error, &type, prev)) + if (handle_line(line, r, error, &type)) break; } diff --git a/src/parser.h b/src/parser.h index 70b3120..3a25a94 100644 --- a/src/parser.h +++ b/src/parser.h @@ -18,9 +18,12 @@ typedef enum parser_type { * input from stdin */ recipe * -parse(char * path, const char * prev); +parse(char * path); int parse_item(const char * s, recipe * r, pt * type, char * error); +int +parse_step(const char * s, recipe * r, char * error); + #endif /* __PARSER_H */ |