aboutsummaryrefslogtreecommitdiff
path: root/ell.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-30 01:04:03 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-30 01:04:03 +0200
commitd579e68051ac757c530f753b02fbf18ed1aa41b3 (patch)
tree5585e625d8e77d66fdaf9fa1678ea59759fc95af /ell.c
parent4698e522cc1182244a1b509d17a29b1cbdcba443 (diff)
downloadell-d579e68051ac757c530f753b02fbf18ed1aa41b3.tar.gz
ell-d579e68051ac757c530f753b02fbf18ed1aa41b3.tar.xz
ell-d579e68051ac757c530f753b02fbf18ed1aa41b3.zip
"quote" -> "block"
Update README accordingly.
Diffstat (limited to 'ell.c')
-rw-r--r--ell.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/ell.c b/ell.c
index a3a6e34..e9b5beb 100644
--- a/ell.c
+++ b/ell.c
@@ -383,12 +383,10 @@ print_string (struct item *s) {
static bool
print_block (struct item *list) {
- if (!list->head || strcmp (list->head->value, "quote")
- || !list->head->next || list->head->next->next
- || list->head->next->type != ITEM_LIST)
+ if (!list->head || strcmp (list->head->value, "block"))
return false;
- list = list->head->next->head;
+ list = list->head->next;
for (struct item *line = list; line; line = line->next)
if (line->type != ITEM_LIST)
return false;
@@ -579,8 +577,7 @@ parse_item (struct parser *self, jmp_buf out) {
while ((*tail = parse_line (self, err)))
tail = &(*tail)->next;
EXPECT (T_RBRACE);
- result = CHECK (new_list (result));
- return CHECK (parse_prefix_list (result, "quote"));
+ return CHECK (parse_prefix_list (result, "block"));
}
self->memory_failure = !(self->error = lexer_errorf (&self->lexer,
@@ -843,8 +840,9 @@ execute_item (struct context *ctx, struct item *body, struct item **result) {
struct item *args = body->next;
if (body->type == ITEM_STRING) {
const char *name = body->value;
- if (!strcmp (name, "quote"))
- return !args || check (ctx, (*result = new_clone_list (args)));
+ if (!strcmp (name, "block"))
+ return (!args || check (ctx, (args = new_clone_list (args))))
+ && check (ctx, (*result = new_list (args)));
if ((body = get (ctx, name)))
return execute_resolved (ctx, body, args, result);
return execute_native (ctx, name, args, result);
@@ -857,7 +855,7 @@ execute_item (struct context *ctx, struct item *body, struct item **result) {
return false;
// It might a bit confusing that this doesn't evaluate arguments
- // but neither does "quote" and there's nothing to do here
+ // but neither does "block" and there's nothing to do here
if (!evaluated)
return true;