tree-sitter/spec/runtime/helpers/spy_input.h

29 lines
606 B
C
Raw Normal View History

2015-07-16 17:32:19 -07:00
#ifndef HELPERS_spy_input_H_
#define HELPERS_spy_input_H_
#include <string>
#include <vector>
#include "tree_sitter/runtime.h"
2015-07-16 17:32:19 -07:00
class SpyInput {
2014-08-06 13:00:35 -07:00
public:
2015-07-16 17:32:19 -07:00
SpyInput(std::string content, size_t chars_per_chunk);
~SpyInput();
void clear();
TSInput input();
bool insert(size_t position, std::string text);
bool erase(size_t position, size_t len);
2014-10-03 14:19:04 -07:00
const char * read(size_t *len);
int seek(size_t position);
2014-08-06 13:00:35 -07:00
std::string content;
2015-07-16 17:29:16 -07:00
size_t chars_per_chunk;
size_t buffer_size;
char *buffer;
size_t byte_offset;
2014-08-06 13:00:35 -07:00
std::vector<std::string> strings_read;
};
2015-07-16 17:32:19 -07:00
#endif // HELPERS_spy_input_H_