parser.h 921 B

123456789101112131415161718192021222324
  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. /* Parser 创建与释放 */
  10. AFUN_CORE_EXPORT af_Parser *makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size,
  11. FILE *error);
  12. AFUN_CORE_EXPORT void freeParser(af_Parser *parser);
  13. AFUN_CORE_EXPORT af_Parser *makeParserByString(char *str, bool free_str, FILE *error);
  14. AFUN_CORE_EXPORT af_Parser *makeParserByFile(FilePath path, FILE *error);
  15. /* Parser 操作函数 */
  16. AFUN_CORE_EXPORT af_Code *parserCode(af_Parser *parser);
  17. AFUN_CORE_EXPORT af_TokenType getTokenFromLexical(char **text, af_Parser *parser);
  18. AFUN_CORE_EXPORT void *getParserData(af_Parser *parser);
  19. AFUN_CORE_EXPORT void initParser(af_Parser *parser);
  20. #endif //AFUN_PARSER_H