compile function can't take a const parser
This commit is contained in:
parent
af4971b265
commit
65ee3593bd
5 changed files with 8 additions and 8 deletions
|
|
@ -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
|
return 0; // No compilation necessary, and everything should work
|
||||||
// out of the box.
|
// out of the box.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
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
|
// For now, just output the results to stderr
|
||||||
HParserTestcase* tc = testcases;
|
HParserTestcase* tc = testcases;
|
||||||
HParserBackend backend = PB_MIN;
|
HParserBackend backend = PB_MIN;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ static HParserBackendVTable *backends[PB_MAX] = {
|
||||||
&h__ll_backend_vtable,
|
&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);
|
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);
|
return backends[backend]->compile(mm__, parser, params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* 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
|
* 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);
|
void h_bit_writer_free(HBitWriter* w);
|
||||||
|
|
||||||
// {{{ Benchmark functions
|
// {{{ 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_report(FILE* stream, HBenchmarkResults* results);
|
||||||
void h_benchmark_dump_optimized_code(FILE* stream, HBenchmarkResults* results);
|
void h_benchmark_dump_optimized_code(FILE* stream, HBenchmarkResults* results);
|
||||||
// }}}
|
// }}}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ struct HParseState_ {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct HParserBackendVTable_ {
|
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);
|
HParseResult* (*parse)(HAllocator *mm__, const HParser* parser, HParseState* parse_state);
|
||||||
} HParserBackendVTable;
|
} HParserBackendVTable;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue