From e24b9de387613ceb7182eaece828162018ad17e1 Mon Sep 17 00:00:00 2001 From: werner Date: Mon, 19 Apr 2010 22:57:51 +0000 Subject: [PATCH] %dump didn't dump the root frame because this frame was only appended to the list of frames at the end of parsing. We now tentatively append it each time a %dump is requested. - fpd.y: append the root frame before calling "dump" git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5921 99fdad57-331a-0410-800a-d7fa5415bdb3 --- fpd.y | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/fpd.y b/fpd.y index ce4d2e2..397b7aa 100644 --- a/fpd.y +++ b/fpd.y @@ -249,6 +249,16 @@ static int dbg_print(const struct expr *expr) } +static void append_root_frame(void) +{ + root_frame->prev = last_frame; + if (last_frame) + last_frame->next = root_frame; + else + frames = root_frame; +} + + %} @@ -311,11 +321,7 @@ all: } fpd { - root_frame->prev = last_frame; - if (last_frame) - last_frame->next = root_frame; - else - frames = root_frame; + append_root_frame(); } | START_EXPR expr { @@ -455,6 +461,13 @@ frame_item: } | TOK_DBG_DUMP { + /* + * It's okay to do append the root frame multiple + * times. If more frames are added afterwards, they + * just replace the root frame until it gets appended a + * final time when parsing ends. + */ + append_root_frame(); if (!dump(stdout)) { perror("stdout"); exit(1);