parser.h 897 B

123456789101112131415161718192021222324252627
  1. #ifndef AFUN_PARSER_H
  2. #define AFUN_PARSER_H
  3. #include "aFunCoreExport.h"
  4. #include "tool.h"
  5. #include "token.h"
  6. #include "reader.h"
  7. #define SYNTACTIC_MAX_DEEP (1000)
  8. typedef struct af_Parser af_Parser;
  9. typedef bool ParserStdinInterruptFunc(void);
  10. #define STDIN_MAX_SIZE (1024)
  11. /* Parser 创建与释放 */
  12. AFUN_CORE_EXPORT af_Parser *
  13. makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size);
  14. AFUN_CORE_EXPORT void freeParser(af_Parser *parser);
  15. AFUN_CORE_EXPORT af_Parser *makeParserByString(char *str, bool free_str);
  16. AFUN_CORE_EXPORT af_Parser *makeParserByFile(FilePath path);
  17. AFUN_CORE_EXPORT af_Parser *makeParserByStdin(ParserStdinInterruptFunc *interrupt);
  18. /* Parser 相关操作 */
  19. AFUN_CORE_EXPORT af_Code *parserCode(FilePath file, af_Parser *parser);
  20. AFUN_CORE_EXPORT void initParser(af_Parser *parser);
  21. #endif //AFUN_PARSER_H