forked from GitHub/gf-core
change in the API for literals
The API in the C runtime as well as in the Haskell, Python and Java binding is changed. Now instead of adding the literal callbacks to the concrete syntax you need to supply them every time when you need to parse. The main reason is: - referentially transparent API for Haskell - when we start using memory mapped files we will not be allowed to change anything in the grammar data structures. At that point the old API would be impossible to use.
This commit is contained in:
@@ -58,10 +58,6 @@ int main(int argc, char* argv[]) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* // Register a callback for the literal category Symbol */
|
||||
/* pgf_parser_add_literal(from_concr, "Symb", */
|
||||
/* &pgf_nerc_literal_callback); */
|
||||
|
||||
clock_t end = clock();
|
||||
double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
|
||||
|
||||
@@ -109,7 +105,8 @@ int main(int argc, char* argv[]) {
|
||||
clock_t start = clock();
|
||||
|
||||
GuExn* parse_err = gu_new_exn(ppool);
|
||||
GuEnum* result = pgf_parse_with_heuristics(concr, cat, line, heuristics, parse_err, ppool, ppool);
|
||||
PgfCallbacksMap* callbacks = pgf_new_callbacks_map(concr, ppool);
|
||||
GuEnum* result = pgf_parse_with_heuristics(concr, cat, line, heuristics, callbacks, parse_err, ppool, ppool);
|
||||
|
||||
PgfExprProb* ep = NULL;
|
||||
if (gu_ok(parse_err))
|
||||
|
||||
Reference in New Issue
Block a user