capi.hh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef RUBY_PARSER_CAPI_HH
  2. #define RUBY_PARSER_CAPI_HH
  3. #include "token.hh"
  4. #include "node.hh"
  5. #include "builder.hh"
  6. #include "driver.hh"
  7. extern "C" {
  8. struct cdiagnostic {
  9. ruby_parser::dlevel level;
  10. ruby_parser::dclass type;
  11. const char *data;
  12. size_t beginPos;
  13. size_t endPos;
  14. };
  15. ruby_parser::typedruby25*
  16. rbdriver_typedruby25_new(const char* source, size_t source_length, const ruby_parser::builder* builder);
  17. void
  18. rbdriver_typedruby25_free(ruby_parser::typedruby25* parser);
  19. const void*
  20. rbdriver_parse(ruby_parser::base_driver* parser, ruby_parser::SelfPtr self);
  21. bool
  22. rbdriver_in_definition(const ruby_parser::base_driver *driver);
  23. bool
  24. rbdriver_env_is_declared(const ruby_parser::base_driver *p, const char* name, size_t length);
  25. void
  26. rbdriver_env_declare(ruby_parser::base_driver *p, const char* name, size_t length);
  27. size_t
  28. rbtoken_get_start(const ruby_parser::token* tok);
  29. size_t
  30. rbtoken_get_end(const ruby_parser::token* tok);
  31. size_t
  32. rbtoken_get_string(const ruby_parser::token* tok, const char** out_ptr);
  33. size_t
  34. rblist_get_length(const ruby_parser::node_list* list);
  35. const void*
  36. rblist_index(ruby_parser::node_list* list, size_t index);
  37. size_t
  38. rbdriver_diag_get_length(const ruby_parser::base_driver* parser);
  39. void
  40. rbdriver_diag_get(const ruby_parser::base_driver* parser, size_t index, struct cdiagnostic *diag);
  41. void
  42. rbdriver_diag_report(ruby_parser::base_driver* driver, const struct cdiagnostic *diag);
  43. }
  44. #endif