compile function can't take a const parser

This commit is contained in:
Sven M. Hallberg 2013-05-08 18:01:55 +02:00
parent af4971b265
commit 65ee3593bd
5 changed files with 8 additions and 8 deletions

View file

@ -190,7 +190,7 @@ HParseResult* h_do_parse(const HParser* parser, HParseState *state) {
}
}
int h_packrat_compile(HAllocator* mm__, const HParser* parser, const void* params) {
int h_packrat_compile(HAllocator* mm__, HParser* parser, const void* params) {
return 0; // No compilation necessary, and everything should work
// out of the box.
}

View file

@ -21,11 +21,11 @@
*/
HBenchmarkResults *h_benchmark(const HParser* parser, HParserTestcase* testcases) {
HBenchmarkResults *h_benchmark(HParser* parser, HParserTestcase* testcases) {
return h_benchmark__m(&system_allocator, parser, testcases);
}
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, const HParser* parser, HParserTestcase* testcases) {
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTestcase* testcases) {
// For now, just output the results to stderr
HParserTestcase* tc = testcases;
HParserBackend backend = PB_MIN;

View file

@ -7,10 +7,10 @@ static HParserBackendVTable *backends[PB_MAX] = {
&h__ll_backend_vtable,
};
int h_compile(const HParser* parser, HParserBackend backend, const void* params) {
int h_compile(HParser* parser, HParserBackend backend, const void* params) {
return h_compile__m(&system_allocator, parser, backend, params);
}
int h_compile__m(HAllocator* mm__, const HParser* parser, HParserBackend backend, const void* params) {
int h_compile__m(HAllocator* mm__, HParser* parser, HParserBackend backend, const void* params) {
return backends[backend]->compile(mm__, parser, params);
}

View file

@ -565,7 +565,7 @@ HAMMER_FN_DECL(void, h_pprint, FILE* stream, const HParsedToken* tok, int indent
*
* Returns -1 if grammar cannot be compiled with the specified options; 0 otherwise.
*/
HAMMER_FN_DECL(int, h_compile, const HParser* parser, HParserBackend backend, const void* params);
HAMMER_FN_DECL(int, h_compile, HParser* parser, HParserBackend backend, const void* params);
/**
* TODO: Document me
@ -590,7 +590,7 @@ const uint8_t* h_bit_writer_get_buffer(HBitWriter* w, size_t *len);
void h_bit_writer_free(HBitWriter* w);
// {{{ Benchmark functions
HAMMER_FN_DECL(HBenchmarkResults *, h_benchmark, const HParser* parser, HParserTestcase* testcases);
HAMMER_FN_DECL(HBenchmarkResults *, h_benchmark, HParser* parser, HParserTestcase* testcases);
void h_benchmark_report(FILE* stream, HBenchmarkResults* results);
void h_benchmark_dump_optimized_code(FILE* stream, HBenchmarkResults* results);
// }}}

View file

@ -130,7 +130,7 @@ struct HParseState_ {
};
typedef struct HParserBackendVTable_ {
int (*compile)(HAllocator *mm__, const HParser* parser, const void* params);
int (*compile)(HAllocator *mm__, HParser* parser, const void* params);
HParseResult* (*parse)(HAllocator *mm__, const HParser* parser, HParseState* parse_state);
} HParserBackendVTable;