mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-01 23:32:51 -06:00
added PGF(pIdent,pExpr)
This commit is contained in:
@@ -227,6 +227,7 @@ PgfExprParser::PgfExprParser(PgfText *input, PgfUnmarshaller *unmarshaller)
|
||||
pos = (const char*) &inp->text;
|
||||
ch = ' ';
|
||||
u = unmarshaller;
|
||||
token_pos = NULL;
|
||||
token_value = NULL;
|
||||
|
||||
token();
|
||||
@@ -347,16 +348,18 @@ void PgfExprParser::str_char()
|
||||
|
||||
void PgfExprParser::token()
|
||||
{
|
||||
while (isspace(ch)) {
|
||||
ch = getc();
|
||||
}
|
||||
|
||||
if (token_value != NULL)
|
||||
free(token_value);
|
||||
|
||||
token_tag = PGF_TOKEN_UNKNOWN;
|
||||
token_pos = pos;
|
||||
token_value = NULL;
|
||||
|
||||
while (isspace(ch)) {
|
||||
token_pos = pos;
|
||||
ch = getc();
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case EOF:
|
||||
ch = getc();
|
||||
@@ -921,7 +924,6 @@ exit:
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
PGF_INTERNAL
|
||||
void pgf_literal_free(PgfLiteral literal)
|
||||
{
|
||||
|
||||
@@ -207,7 +207,7 @@ class PGF_INTERNAL_DECL PgfExprParser {
|
||||
PGF_TOKEN_TAG token_tag;
|
||||
PgfText *token_value;
|
||||
PgfText *inp;
|
||||
const char *pos;
|
||||
const char *token_pos, *pos;
|
||||
uint32_t ch;
|
||||
|
||||
uint32_t getc();
|
||||
@@ -224,7 +224,6 @@ public:
|
||||
PgfBind *parse_bind(PgfBind *next);
|
||||
PgfBind *parse_binds(PgfBind *next);
|
||||
|
||||
|
||||
PgfExpr parse_arg();
|
||||
PgfExpr parse_term();
|
||||
PgfExpr parse_expr();
|
||||
@@ -233,6 +232,8 @@ public:
|
||||
PgfType parse_type();
|
||||
|
||||
bool eof();
|
||||
|
||||
const char *get_token_pos() { return token_pos; }
|
||||
};
|
||||
|
||||
PGF_INTERNAL_DECL extern PgfText wildcard;
|
||||
|
||||
@@ -418,8 +418,8 @@ PgfText *pgf_print_expr(PgfExpr e,
|
||||
return printer.get_text();
|
||||
}
|
||||
|
||||
PGF_API PgfExpr
|
||||
pgf_read_expr(PgfText *input, PgfUnmarshaller *u)
|
||||
PGF_API
|
||||
PgfExpr pgf_read_expr(PgfText *input, PgfUnmarshaller *u)
|
||||
{
|
||||
PgfExprParser parser(input, u);
|
||||
PgfExpr res = parser.parse_expr();
|
||||
@@ -430,6 +430,15 @@ pgf_read_expr(PgfText *input, PgfUnmarshaller *u)
|
||||
return res;
|
||||
}
|
||||
|
||||
PGF_API
|
||||
PgfExpr pgf_read_expr_ex(PgfText *input, const char **end_pos, PgfUnmarshaller *u)
|
||||
{
|
||||
PgfExprParser parser(input, u);
|
||||
PgfExpr expr = parser.parse_expr();
|
||||
*end_pos = parser.get_token_pos();
|
||||
return expr;
|
||||
}
|
||||
|
||||
PGF_API
|
||||
PgfText *pgf_print_type(PgfType ty,
|
||||
PgfPrintContext *ctxt, int prio,
|
||||
|
||||
@@ -317,6 +317,9 @@ PgfText *pgf_print_expr(PgfExpr e,
|
||||
PGF_API_DECL
|
||||
PgfExpr pgf_read_expr(PgfText *input, PgfUnmarshaller *u);
|
||||
|
||||
PGF_API_DECL
|
||||
PgfExpr pgf_read_expr_ex(PgfText *input, const char **end_pos, PgfUnmarshaller *u);
|
||||
|
||||
PGF_API_DECL
|
||||
PgfText *pgf_print_type(PgfType ty,
|
||||
PgfPrintContext *ctxt, int prio,
|
||||
|
||||
Reference in New Issue
Block a user