parser.hpp 952 B

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