summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/literals.c
diff options
context:
space:
mode:
authorkrangelov <kr.angelov@gmail.com>2020-03-05 11:58:21 +0100
committerkrangelov <kr.angelov@gmail.com>2020-03-05 11:58:21 +0100
commitf22bd70585c3f1fc23cf205c8dc2280cd9975832 (patch)
tree9240054eed80c1cb72c62a145c80fd4cf2b44b0c /src/runtime/c/pgf/literals.c
parent31339001252a63c0f86ade423cb03095f21c5862 (diff)
The APIs for callbacks and the bracketed strings now use a string for the analysis intead of an integer. This is now consistent with lookupMorpho and friends
Diffstat (limited to 'src/runtime/c/pgf/literals.c')
-rw-r--r--src/runtime/c/pgf/literals.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/runtime/c/pgf/literals.c b/src/runtime/c/pgf/literals.c
index a76b8ae77..a3116810a 100644
--- a/src/runtime/c/pgf/literals.c
+++ b/src/runtime/c/pgf/literals.c
@@ -6,11 +6,12 @@
static PgfExprProb*
pgf_match_string_lit(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString sentence, size_t* poffset,
GuPool *out_pool)
{
- gu_assert(lin_idx == 0);
+ if (strcmp("ann","s") != 0)
+ return NULL;
const uint8_t* buf = (uint8_t*) (sentence + *poffset);
const uint8_t* p = buf;
@@ -51,7 +52,7 @@ pgf_predict_empty_next(GuEnum* self, void* to, GuPool* pool)
static GuEnum*
pgf_predict_empty(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString prefix,
GuPool *out_pool)
{
@@ -67,11 +68,12 @@ static PgfLiteralCallback pgf_string_literal_callback =
static PgfExprProb*
pgf_match_int_lit(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString sentence, size_t* poffset,
GuPool *out_pool)
{
- gu_assert(lin_idx == 0);
+ if (strcmp("ann","s") != 0)
+ return NULL;
const uint8_t* buf = (uint8_t*) (sentence + *poffset);
const uint8_t* p = buf;
@@ -121,11 +123,12 @@ static PgfLiteralCallback pgf_int_literal_callback =
static PgfExprProb*
pgf_match_float_lit(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString sentence, size_t* poffset,
GuPool *out_pool)
{
- gu_assert(lin_idx == 0);
+ if (strcmp("ann","s") != 0)
+ return NULL;
const uint8_t* buf = (uint8_t*) (sentence + *poffset);
const uint8_t* p = buf;
@@ -226,11 +229,11 @@ pgf_match_name_morpho_callback(PgfMorphoCallback* self_,
static PgfExprProb*
pgf_match_name_lit(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString sentence, size_t* poffset,
GuPool *out_pool)
{
- if (lin_idx != 0)
+ if (strcmp("ann","s") != 0)
return NULL;
GuPool* tmp_pool = gu_local_pool();
@@ -349,7 +352,7 @@ pgf_match_unknown_morpho_callback(PgfMorphoCallback* self_,
static PgfExprProb*
pgf_match_unknown_lit(PgfLiteralCallback* self, PgfConcr* concr,
- size_t lin_idx,
+ GuString ann,
GuString sentence, size_t* poffset,
GuPool *out_pool)
{