summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/data.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2012-03-12 14:25:51 +0000
committerkr.angelov <kr.angelov@gmail.com>2012-03-12 14:25:51 +0000
commit230f309317af6ae79f49091c9580223f756dbfb8 (patch)
treeee1cee3c48370fcf04b63794250c71c16b28cbfb /src/runtime/c/pgf/data.h
parent1726995921f6c05686b2b06f672b1376e589f8ac (diff)
libpgf: a new implementation for literals which also allows custom literals. the same mechanism is now used for the metavariables
Diffstat (limited to 'src/runtime/c/pgf/data.h')
-rw-r--r--src/runtime/c/pgf/data.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h
index 4af0a6614..f1c107efd 100644
--- a/src/runtime/c/pgf/data.h
+++ b/src/runtime/c/pgf/data.h
@@ -209,6 +209,17 @@ extern GU_DECLARE_TYPE(PgfTransitions, GuStringMap);
typedef GuMap PgfEpsilonIdx;
extern GU_DECLARE_TYPE(PgfEpsilonIdx, GuMap);
+typedef struct PgfLiteralCallback PgfLiteralCallback;
+extern GU_DECLARE_TYPE(PgfLiteralCallback, struct);
+
+struct PgfLiteralCallback {
+ bool (*match)(PgfLiteralCallback* self, int lin_idx, PgfTokens toks,
+ PgfExprProb** out_ep, GuPool *pool);
+};
+
+typedef GuMap PgfCallbacksMap;
+extern GU_DECLARE_TYPE(PgfCallbacksMap, GuMap);
+
struct PgfConcr {
PgfFlags* cflags;
PgfPrintNames* printnames;
@@ -220,6 +231,7 @@ struct PgfConcr {
PgfCncFuns* cncfuns;
PgfSequences* sequences;
PgfCIdMap* cnccats;
+ PgfCallbacksMap* callbacks;
int total_cats;
int max_fid;
};
@@ -269,7 +281,7 @@ typedef struct PgfSymbolKP
typedef enum {
PGF_PRODUCTION_APPLY,
PGF_PRODUCTION_COERCE,
- PGF_PRODUCTION_META
+ PGF_PRODUCTION_EXTERN
} PgfProductionTag;
typedef struct PgfPArg PgfPArg;
@@ -299,14 +311,10 @@ typedef struct PgfProductionCoerce
} PgfProductionCoerce;
typedef struct {
- PgfExpr expr; // XXX
- GuLength n_toks;
- GuString toks[]; // XXX
-} PgfProductionConst;
-
-typedef struct {
+ PgfFunId fun;
PgfPArgs args;
-} PgfProductionMeta;
+ PgfLiteralCallback *callback;
+} PgfProductionExtern;
extern GU_DECLARE_TYPE(PgfPatt, GuVariant);