]>
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 static void parse_impl( FRAME
* frame
)
36 /* Now parse each block of rules and execute it. Execute it outside of the
37 * parser so that recursive calls to yyrun() work (no recursive yyparse's).
45 /* Filled by yyparse() calling parse_save(). */
48 /* If parse error or empty parse, outta here. */
49 if ( yyparse() || !( p
= yypsave
) )
52 /* Run the parse tree. */
53 func
= function_compile( p
);
55 list_free( function_run( func
, frame
, stack_global() ) );
56 function_free( func
);
63 void parse_file( OBJECT
* f
, FRAME
* frame
)
65 /* Suspend scan of current file and push this new file in the stream. */
72 void parse_string( OBJECT
* name
, const char * * lines
, FRAME
* frame
)
74 yysparse( name
, lines
);
79 void parse_save( PARSE
* p
)
94 PARSE
* p
= (PARSE
*)BJAM_MALLOC( sizeof( PARSE
) );
101 p
->string1
= string1
;
108 p
->file
= object_copy( left
->file
);
109 p
->line
= left
->line
;
113 yyinput_last_read_token( &p
->file
, &p
->line
);
114 p
->file
= object_copy( p
->file
);
121 void parse_refer( PARSE
* p
)
127 void parse_free( PARSE
* p
)
133 object_free( p
->string
);
135 object_free( p
->string1
);
137 parse_free( p
->left
);
139 parse_free( p
->right
);
141 parse_free( p
->third
);
143 object_free( p
->rulename
);
145 object_free( p
->file
);
147 BJAM_FREE( (char *)p
);