mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-13 23:09:31 -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,\
|
||||
FS,\
|
||||
getValue,\
|
||||
AsciiToString,\
|
||||
stringToUTF8,\
|
||||
UTF8ToString,\
|
||||
allocateUTF8\
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
Module.onRuntimeInitialized = () => {
|
||||
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
|
||||
const expr = JSPGF.readExpr("Pred (Another (x f))");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user