[Cook] strange behaviour with include-cooked

Peter Miller peterm at platypus.net
Sun Jul 6 20:21:40 EST 2003


On Sun, 2003-07-06 at 17:35, Aryeh M. Friedman wrote:
> 	A while ago someone (Jerry?) mentioned I think that include-cooked is done
> *after* any immediate statements that proceed if that is the case why do I get the below
> output from the following cookbook:

Cook actually needs to know the token *following* the semicolon before
it finishes parsing the statement (optionally commands can be followed
by data...dataend).

Remember that preprocessor directices are >> PRE << processed. i.e.
before the underlying file contents are read and parsed.  The tokenizer
phase sees the file contents after the file and its includes have been
"flattened" into a single character stream.  (They happen in logically
separate phases, and could be implemented sequentially one after the
other, but in fact they are demand processed more-or-less in parallel.)

So, when the file exists, the token following the semicolon is "ack",
when it doesn't the next token is "all".

> cook: bar: don't know how

You would be better off with a recipe which says

    bar:
    {
        echo "'ack=bar;'">bar;
    }

rather than a top-level statement.   OR use #include instead of
#include-cooked






More information about the Cook-users mailing list