• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "Python.h"
2 
3 #include "tokenizer.h"
4 #include "pegen.h"
5 
6 mod_ty
_PyParser_ASTFromString(const char * str,PyObject * filename,int mode,PyCompilerFlags * flags,PyArena * arena)7 _PyParser_ASTFromString(const char *str, PyObject* filename, int mode,
8                         PyCompilerFlags *flags, PyArena *arena)
9 {
10     if (PySys_Audit("compile", "yO", str, filename) < 0) {
11         return NULL;
12     }
13 
14     mod_ty result = _PyPegen_run_parser_from_string(str, mode, filename, flags, arena);
15     return result;
16 }
17 
18 mod_ty
_PyParser_ASTFromFile(FILE * fp,PyObject * filename_ob,const char * enc,int mode,const char * ps1,const char * ps2,PyCompilerFlags * flags,int * errcode,PyArena * arena)19 _PyParser_ASTFromFile(FILE *fp, PyObject *filename_ob, const char *enc,
20                       int mode, const char *ps1, const char* ps2,
21                       PyCompilerFlags *flags, int *errcode, PyArena *arena)
22 {
23     if (PySys_Audit("compile", "OO", Py_None, filename_ob) < 0) {
24         return NULL;
25     }
26     return _PyPegen_run_parser_from_file_pointer(fp, mode, filename_ob, enc, ps1, ps2,
27                                         flags, errcode, arena);
28 }
29