Make the compile function plain C and take a JSON grammar

This commit is contained in:
Max Brunsfeld 2016-01-10 20:04:41 -08:00
parent b69e19c525
commit d4632ab9a9
54 changed files with 325 additions and 234 deletions

View file

@ -0,0 +1,28 @@
#ifndef COMPILER_COMPILE_ERROR_H_
#define COMPILER_COMPILE_ERROR_H_
#include <string>
#include "tree_sitter/compiler.h"
namespace tree_sitter {
class CompileError {
public:
CompileError(TSCompileErrorType type, std::string message)
: type(type), message(message) {}
static CompileError none() {
return CompileError(TSCompileErrorTypeNone, "");
}
bool operator==(const CompileError &other) const {
return type == other.type && message == other.message;
}
TSCompileErrorType type;
std::string message;
};
} // namespace tree_sitter
#endif // COMPILER_COMPILE_ERROR_H_