#define PyCF_DONT_IMPLY_DEDENT 0x0200
#define PyCF_ONLY_AST 0x0400
#define PyCF_IGNORE_COOKIE 0x0800
+#define PyCF_TYPE_COMMENTS 0x1000
#ifndef Py_LIMITED_API
typedef struct {
#define PyPARSE_IGNORE_COOKIE 0x0010
#define PyPARSE_BARRY_AS_BDFL 0x0020
+#define PyPARSE_TYPE_COMMENTS 0x0040
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
perrdetail *);
err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;
return NULL;
}
+ if (*flags & PyPARSE_TYPE_COMMENTS) {
+ tok->type_comments = 1;
+ }
#ifndef PGEN
Py_INCREF(err_ret->filename);
err_ret->error = E_NOMEM;
return NULL;
}
+ if (*flags & PyPARSE_TYPE_COMMENTS) {
+ tok->type_comments = 1;
+ }
#ifndef PGEN
Py_INCREF(err_ret->filename);
tok->filename = err_ret->filename;
cf.cf_flags = flags | PyCF_SOURCE_IS_UTF8;
if (flags &
- ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST))
+ ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST | PyCF_TYPE_COMMENTS))
{
PyErr_SetString(PyExc_ValueError,
"compile(): unrecognised flags");
parser_flags |= PyPARSE_IGNORE_COOKIE;
if (flags->cf_flags & CO_FUTURE_BARRY_AS_BDFL)
parser_flags |= PyPARSE_BARRY_AS_BDFL;
+ if (flags->cf_flags & PyCF_TYPE_COMMENTS)
+ parser_flags |= PyPARSE_TYPE_COMMENTS;
return parser_flags;
}