1
0
forked from GitHub/gf-core

an API for oracles in the GF parser

This commit is contained in:
krasimir
2016-05-10 17:11:39 +00:00
parent 3f0fe438cd
commit 80a96b3a85
5 changed files with 266 additions and 36 deletions

View File

@@ -137,6 +137,31 @@ pgf_parse_with_heuristics(PgfConcr* concr, PgfCId cat,
GuExn* err,
GuPool* pool, GuPool* out_pool);
typedef struct PgfOracleCallback PgfOracleCallback;
struct PgfOracleCallback {
bool (*predict) (PgfOracleCallback* self,
PgfCId cat,
GuString label,
size_t offset);
bool (*complete)(PgfOracleCallback* self,
PgfCId cat,
GuString label,
size_t offset);
PgfExprProb* (*literal)(PgfOracleCallback* self,
PgfCId cat,
GuString label,
size_t* poffset,
GuPool *out_pool);
};
PgfExprEnum*
pgf_parse_with_oracle(PgfConcr* concr, PgfCId cat,
GuString sentence,
PgfOracleCallback* oracle,
GuExn* err,
GuPool* pool, GuPool* out_pool);
typedef struct {
PgfToken tok;
PgfCId cat;