mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-28 22:12:51 -06:00
drop the SG library completely.
This commit is contained in:
@@ -918,94 +918,6 @@ pgf_read_expr(GuIn* in, GuPool* pool, GuPool* tmp_pool, GuExn* err)
|
||||
return expr;
|
||||
}
|
||||
|
||||
PGF_API int
|
||||
pgf_read_expr_tuple(GuIn* in,
|
||||
size_t n_exprs, PgfExpr exprs[],
|
||||
GuPool* pool, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
PgfExprParser* parser =
|
||||
pgf_new_parser(in, pgf_expr_parser_in_getc, pool, tmp_pool, err);
|
||||
if (parser->token_tag != PGF_TOKEN_LTRIANGLE)
|
||||
goto fail;
|
||||
pgf_expr_parser_token(parser, false);
|
||||
for (size_t i = 0; i < n_exprs; i++) {
|
||||
if (i > 0) {
|
||||
if (parser->token_tag != PGF_TOKEN_COMMA)
|
||||
goto fail;
|
||||
pgf_expr_parser_token(parser, false);
|
||||
}
|
||||
|
||||
exprs[i] = pgf_expr_parser_expr(parser, false);
|
||||
if (gu_variant_is_null(exprs[i]))
|
||||
goto fail;
|
||||
}
|
||||
if (parser->token_tag != PGF_TOKEN_RTRIANGLE)
|
||||
goto fail;
|
||||
pgf_expr_parser_token(parser, false);
|
||||
if (parser->token_tag != PGF_TOKEN_EOF)
|
||||
goto fail;
|
||||
gu_pool_free(tmp_pool);
|
||||
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
gu_pool_free(tmp_pool);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PGF_API GuSeq*
|
||||
pgf_read_expr_matrix(GuIn* in,
|
||||
size_t n_exprs,
|
||||
GuPool* pool, GuExn* err)
|
||||
{
|
||||
GuPool* tmp_pool = gu_new_pool();
|
||||
PgfExprParser* parser =
|
||||
pgf_new_parser(in, pgf_expr_parser_in_getc, pool, tmp_pool, err);
|
||||
if (parser->token_tag != PGF_TOKEN_LTRIANGLE)
|
||||
goto fail;
|
||||
pgf_expr_parser_token(parser, false);
|
||||
|
||||
GuBuf* buf = gu_new_buf(PgfExpr, pool);
|
||||
|
||||
if (parser->token_tag != PGF_TOKEN_RTRIANGLE) {
|
||||
for (;;) {
|
||||
PgfExpr* exprs = gu_buf_extend_n(buf, n_exprs);
|
||||
|
||||
for (size_t i = 0; i < n_exprs; i++) {
|
||||
if (i > 0) {
|
||||
if (parser->token_tag != PGF_TOKEN_COMMA)
|
||||
goto fail;
|
||||
pgf_expr_parser_token(parser, false);
|
||||
}
|
||||
|
||||
exprs[i] = pgf_expr_parser_expr(parser, false);
|
||||
if (gu_variant_is_null(exprs[i]))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (parser->token_tag != PGF_TOKEN_SEMI)
|
||||
break;
|
||||
|
||||
pgf_expr_parser_token(parser, false);
|
||||
}
|
||||
|
||||
if (parser->token_tag != PGF_TOKEN_RTRIANGLE)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pgf_expr_parser_token(parser, false);
|
||||
if (parser->token_tag != PGF_TOKEN_EOF)
|
||||
goto fail;
|
||||
gu_pool_free(tmp_pool);
|
||||
|
||||
return gu_buf_data_seq(buf);
|
||||
|
||||
fail:
|
||||
gu_pool_free(tmp_pool);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PGF_API PgfType*
|
||||
pgf_read_type(GuIn* in, GuPool* pool, GuPool* tmp_pool, GuExn* err)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user