[Patches] [ python-Patches-409307 ] Create parsermodule.h

noreply@sourceforge.net noreply@sourceforge.net
Fri, 16 Mar 2001 19:29:52 -0800


Patches item #409307, was updated on 2001-03-16 19:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=409307&group_id=5470

Category: Modules
Group: None
Status: Open
Priority: 7
Submitted By: Paul Prescod (prescod)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Create parsermodule.h

Initial Comment:
(this is my second try...if it comes through twice, 
close one of them!)

When Fred created parsermodule.c back in the mid-90's 
he put in a comment that some of the code should 
really be moved into a header file for more general 
use. Now I need that feature to implement compiler 
hooks.

The attached patch describes the changes to 
parsermodule.c. Here's what should be in 
include/parsermodule.h

#ifndef Py_PARSEROBJECT_H
#define Py_PARSEROBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
/*  There are two types of intermediate objects we're 
interested in:
 *  'eval' and 'exec' types.  These constants can be 
used in the ast_type
 *  field of the object type to identify which any 
given object represents.
 *
 *  The PyAST_FRAGMENT type is not currently 
supported.  Maybe not useful?
 *  Haven't decided yet.
 */

#define PyAST_EXPR      1
#define PyAST_SUITE     2
#define PyAST_FRAGMENT  3

typedef struct _PyAST_Object {
    PyObject_HEAD                       /* standard 
object header           */
    node* ast_node;                     /* the node* 
returned by the parser */
    int   ast_type;                     /* EXPR or 
SUITE ?                  */
} PyAST_Object;


extern DL_IMPORT(PyObject *)
parser_newastobject(node *ast, int type);



#ifdef __cplusplus
}
#endif
#endif /* !Py_PARSEROBJECT_H */


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=409307&group_id=5470