]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/parse.c
2 * Copyright 1993, 2000 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
8 * Copyright 2001-2004 David Abrahams.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
23 * parse.c - make and destroy parse trees as driven by the parser
25 * 09/07/00 (seiwald) - ref count on PARSE to avoid freeing when used,
26 * as per Matt Armstrong.
27 * 09/11/00 (seiwald) - structure reworked to reflect that (*func)()
31 static PARSE
* yypsave
;
33 void parse_file( OBJECT
* f
, FRAME
* frame
)
35 /* Suspend scan of current file and push this new file in the stream. */
38 /* Now parse each block of rules and execute it. Execute it outside of the
39 * parser so that recursive calls to yyrun() work (no recursive yyparse's).
47 /* Filled by yyparse() calling parse_save(). */
50 /* If parse error or empty parse, outta here. */
51 if ( yyparse() || !( p
= yypsave
) )
54 /* Run the parse tree. */
55 func
= function_compile( p
);
57 list_free( function_run( func
, frame
, stack_global() ) );
58 function_free( func
);
65 void parse_save( PARSE
* p
)
80 PARSE
* p
= (PARSE
*)BJAM_MALLOC( sizeof( PARSE
) );
94 p
->file
= object_copy( left
->file
);
99 yyinput_last_read_token( &p
->file
, &p
->line
);
100 p
->file
= object_copy( p
->file
);
107 void parse_refer( PARSE
* p
)
113 void parse_free( PARSE
* p
)
119 object_free( p
->string
);
121 object_free( p
->string1
);
123 parse_free( p
->left
);
125 parse_free( p
->right
);
127 parse_free( p
->third
);
129 object_free( p
->rulename
);
131 object_free( p
->file
);
133 BJAM_FREE( (char *)p
);