mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
the grammar reader in the C runtime is completely rewritten and it doesn't use the generic programming API
This commit is contained in:
@@ -351,7 +351,7 @@ typedef struct {
|
|||||||
} PgfPattApp;
|
} PgfPattApp;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PgfLiteral* lit;
|
PgfLiteral lit;
|
||||||
} PgfPattLit;
|
} PgfPattLit;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ pgf_print_type(PgfType *type, int prec, GuWriter *wtr, GuExn *err)
|
|||||||
|
|
||||||
gu_string_write(type->cid, wtr, err);
|
gu_string_write(type->cid, wtr, err);
|
||||||
|
|
||||||
for (int i = 0; i < type->n_exprs; i++) {
|
for (size_t i = 0; i < type->n_exprs; i++) {
|
||||||
gu_puts(" ", wtr, err);
|
gu_puts(" ", wtr, err);
|
||||||
pgf_print_expr(type->exprs[i], 4, wtr, err);
|
pgf_print_expr(type->exprs[i], 4, wtr, err);
|
||||||
}
|
}
|
||||||
@@ -494,7 +494,7 @@ pgf_print_type(PgfType *type, int prec, GuWriter *wtr, GuExn *err)
|
|||||||
|
|
||||||
gu_string_write(type->cid, wtr, err);
|
gu_string_write(type->cid, wtr, err);
|
||||||
|
|
||||||
for (int i = 0; i < type->n_exprs; i++) {
|
for (size_t i = 0; i < type->n_exprs; i++) {
|
||||||
gu_puts(" ", wtr, err);
|
gu_puts(" ", wtr, err);
|
||||||
pgf_print_expr(type->exprs[i], 4, wtr, err);
|
pgf_print_expr(type->exprs[i], 4, wtr, err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ extern GU_DECLARE_TYPE(PgfHypos, GuSeq);
|
|||||||
struct PgfType {
|
struct PgfType {
|
||||||
PgfHypos hypos;
|
PgfHypos hypos;
|
||||||
PgfCId cid; /// XXX: resolve to PgfCat*?
|
PgfCId cid; /// XXX: resolve to PgfCat*?
|
||||||
int n_exprs;
|
size_t n_exprs;
|
||||||
PgfExpr exprs[];
|
PgfExpr exprs[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ pgf_read(const char* fpath,
|
|||||||
GuIn* in = gu_file_in(infile, tmp_pool);
|
GuIn* in = gu_file_in(infile, tmp_pool);
|
||||||
|
|
||||||
PgfReader* rdr = pgf_new_reader(in, pool, tmp_pool, err);
|
PgfReader* rdr = pgf_new_reader(in, pool, tmp_pool, err);
|
||||||
PgfPGF* pgf = pgf_read_new(rdr, gu_type(PgfPGF), pool, NULL);
|
PgfPGF* pgf = pgf_read_pgf(rdr);
|
||||||
|
|
||||||
gu_pool_free(tmp_pool);
|
gu_pool_free(tmp_pool);
|
||||||
gu_return_on_exn(err, NULL);
|
|
||||||
return pgf;
|
return pgf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +1,3 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012 University of Gothenburg.
|
|
||||||
*
|
|
||||||
* This file is part of libpgf.
|
|
||||||
*
|
|
||||||
* Libpgf is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* Libpgf is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with libpgf. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef READER_H_
|
#ifndef READER_H_
|
||||||
#define READER_H_
|
#define READER_H_
|
||||||
|
|
||||||
@@ -29,7 +10,7 @@ typedef struct PgfReader PgfReader;
|
|||||||
PgfReader*
|
PgfReader*
|
||||||
pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err);
|
pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err);
|
||||||
|
|
||||||
void*
|
PgfPGF*
|
||||||
pgf_read_new(PgfReader* rdr, GuType* type, GuPool* pool, size_t* size_out);
|
pgf_read_pgf(PgfReader* rdr);
|
||||||
|
|
||||||
#endif // READER_H_
|
#endif // READER_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user