mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 09:32:53 -06:00
Load and read PGF in test-web: doesn't fail but abstract name is empty
This commit is contained in:
@@ -41,6 +41,7 @@ RUN emcc .libs/libgu.a .libs/libpgf.a -o pgf.js \
|
|||||||
ccall,\
|
ccall,\
|
||||||
FS,\
|
FS,\
|
||||||
getValue,\
|
getValue,\
|
||||||
|
AsciiToString,\
|
||||||
stringToUTF8,\
|
stringToUTF8,\
|
||||||
UTF8ToString,\
|
UTF8ToString,\
|
||||||
allocateUTF8\
|
allocateUTF8\
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
Module.onRuntimeInitialized = () => {
|
Module.onRuntimeInitialized = () => {
|
||||||
const JSPGF = mkAPI(Module);
|
const JSPGF = mkAPI(Module);
|
||||||
|
|
||||||
|
fetch('Foods.pgf')
|
||||||
|
.then((response) => response.arrayBuffer())
|
||||||
|
.then((data) => {
|
||||||
|
const pgfPathFS = '/tmp/Foods.pgf';
|
||||||
|
Module.FS.writeFile(pgfPathFS, new DataView(data));
|
||||||
|
|
||||||
|
// Read PGF
|
||||||
|
const pgf = JSPGF.readPGF(pgfPathFS);
|
||||||
|
|
||||||
|
// Print its name
|
||||||
|
console.log(JSPGF.abstractName(pgf));
|
||||||
|
})
|
||||||
|
|
||||||
// Parse expression
|
// Parse expression
|
||||||
const expr = JSPGF.readExpr("Pred (Another (x f))");
|
const expr = JSPGF.readExpr("Pred (Another (x f))");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user