mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-11-05 03:35:27 -07:00
Beginnings of JavaScript bindings
This commit is contained in:
1 parent
e6960e30f6
commit
314db3ea7f
23 files changed
+311
-3065
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Deprecation notice
|
|
||||||
|
|
||||||
As of June 2019, this JavaScript version of the GF runtime is considered deprecated,
|
|
||||||
in favour of the TypeScript version in <https://github.com/GrammaticalFramework/gf-typescript>.
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# JavaScript (Node.js) bindings to PGF runtime
|
||||||
|
|
||||||
|
## Pre-requisites
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
You might need this:
|
||||||
|
```
|
||||||
|
PYTHON=/usr/bin/python2 npm install -g node-gyp
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running tests
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
abstract Editor = {
|
|
||||||
|
|
||||||
cat Adjective ;
|
|
||||||
Noun ;
|
|
||||||
Verb ;
|
|
||||||
Determiner ;
|
|
||||||
Sentence ;
|
|
||||||
|
|
||||||
fun Available : Adjective ;
|
|
||||||
Next : Adjective ;
|
|
||||||
Previous : Adjective ;
|
|
||||||
|
|
||||||
fun Bulgarian : Noun ;
|
|
||||||
Danish : Noun ;
|
|
||||||
English : Noun ;
|
|
||||||
Finnish : Noun ;
|
|
||||||
French : Noun ;
|
|
||||||
German : Noun ;
|
|
||||||
Italian : Noun ;
|
|
||||||
Norwegian : Noun ;
|
|
||||||
Russian : Noun ;
|
|
||||||
Spanish : Noun ;
|
|
||||||
Swedish : Noun ;
|
|
||||||
|
|
||||||
fun Float_N : Noun ;
|
|
||||||
Integer_N : Noun ;
|
|
||||||
String_N : Noun ;
|
|
||||||
|
|
||||||
Language : Noun ;
|
|
||||||
Node : Noun ;
|
|
||||||
Page : Noun ;
|
|
||||||
Refinement : Noun ;
|
|
||||||
Tree : Noun ;
|
|
||||||
Wrapper : Noun ;
|
|
||||||
|
|
||||||
fun Copy : Verb ;
|
|
||||||
Cut : Verb ;
|
|
||||||
Delete : Verb ;
|
|
||||||
Enter : Verb ;
|
|
||||||
Parse : Verb ;
|
|
||||||
Paste : Verb ;
|
|
||||||
Redo : Verb ;
|
|
||||||
Refine : Verb ;
|
|
||||||
Replace : Verb ;
|
|
||||||
Select : Verb ;
|
|
||||||
Show : Verb ;
|
|
||||||
Undo : Verb ;
|
|
||||||
Wrap : Verb ;
|
|
||||||
|
|
||||||
fun DefPlDet : Determiner ;
|
|
||||||
DefSgDet : Determiner ;
|
|
||||||
IndefPlDet : Determiner ;
|
|
||||||
IndefSgDet : Determiner ;
|
|
||||||
|
|
||||||
fun Command : Verb -> Determiner -> Noun -> Sentence ;
|
|
||||||
CommandAdj : Verb -> Determiner -> Adjective -> Noun -> Sentence ;
|
|
||||||
ErrorMessage : Adjective -> Noun -> Sentence ;
|
|
||||||
Label : Noun -> Sentence ;
|
|
||||||
RandomlyCommand : Verb -> Determiner -> Noun -> Sentence ;
|
|
||||||
SingleWordCommand : Verb -> Sentence ;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
--# -path=alltenses
|
|
||||||
concrete EditorEng of Editor = open GrammarEng, ParadigmsEng in {
|
|
||||||
|
|
||||||
lincat Adjective = A ;
|
|
||||||
Noun = N ;
|
|
||||||
Verb = V ;
|
|
||||||
Determiner = Det ;
|
|
||||||
Sentence = Utt ;
|
|
||||||
|
|
||||||
lin Available = mkA "available" ;
|
|
||||||
Next = mkA "next" ;
|
|
||||||
Previous = mkA "previous" ;
|
|
||||||
|
|
||||||
lin Bulgarian = mkN "Bulgarian" ;
|
|
||||||
Danish = mkN "Danish" ;
|
|
||||||
English = mkN "English" ;
|
|
||||||
Finnish = mkN "Finnish" ;
|
|
||||||
French = mkN "French" ;
|
|
||||||
German = mkN "German" ;
|
|
||||||
Italian = mkN "Italian" ;
|
|
||||||
Norwegian = mkN "Norwegian" ;
|
|
||||||
Russian = mkN "Russian" ;
|
|
||||||
Spanish = mkN "Spanish" ;
|
|
||||||
Swedish = mkN "Swedish" ;
|
|
||||||
|
|
||||||
lin Float_N = mkN "float" ;
|
|
||||||
Integer_N = mkN "integer" ;
|
|
||||||
String_N = mkN "string" ;
|
|
||||||
|
|
||||||
Language = mkN "language" ;
|
|
||||||
Node = mkN "node" ;
|
|
||||||
Page = mkN "page" ;
|
|
||||||
Refinement = mkN "refinement" ;
|
|
||||||
Tree = mkN "tree" ;
|
|
||||||
Wrapper = mkN "wrapper" ;
|
|
||||||
|
|
||||||
lin Copy = mkV "copy" ;
|
|
||||||
Cut = mkV "cut" ;
|
|
||||||
Delete = mkV "delete" ;
|
|
||||||
Enter = mkV "enter" ;
|
|
||||||
Parse = mkV "parse" ;
|
|
||||||
Paste = mkV "paste" ;
|
|
||||||
Redo = mkV "redo" ;
|
|
||||||
Refine = mkV "refine" ;
|
|
||||||
Replace = mkV "replace" ;
|
|
||||||
Select = mkV "select" ;
|
|
||||||
Show = mkV "show" ;
|
|
||||||
Undo = mkV "undo" ;
|
|
||||||
Wrap = mkV "wrap" ;
|
|
||||||
|
|
||||||
lin DefPlDet = DetQuant DefArt NumPl ;
|
|
||||||
DefSgDet = DetQuant DefArt NumSg ;
|
|
||||||
IndefPlDet = DetQuant IndefArt NumPl ;
|
|
||||||
IndefSgDet = DetQuant IndefArt NumSg ;
|
|
||||||
|
|
||||||
lin Command v d n = UttImpSg PPos (ImpVP (ComplSlash (SlashV2a (mkV2 v)) (DetCN d (UseN n)))) ;
|
|
||||||
CommandAdj v d a n = UttImpSg PPos (ImpVP (ComplSlash (SlashV2a (mkV2 v)) (DetCN d (AdjCN (PositA a) (UseN n))))) ;
|
|
||||||
ErrorMessage a n = UttNP (DetCN (DetQuant no_Quant NumPl) (AdjCN (PositA a) (UseN n))) ;
|
|
||||||
Label n = UttNP (MassNP (UseN n)) ;
|
|
||||||
RandomlyCommand v d n = UttImpSg PPos (ImpVP (AdvVP (ComplSlash (SlashV2a (mkV2 v)) (DetCN d (UseN n))) (PrepNP (mkPrep "at") (MassNP (UseN (mkN "random")))))) ;
|
|
||||||
SingleWordCommand v = UttImpSg PPos (ImpVP (UseV v)) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
|
||||||
<script type="text/javascript" src="gflib.js"></script>
|
|
||||||
<script type="text/javascript" src="editorGrammar.js"></script>
|
|
||||||
<script type="text/javascript" src="grammar.js"></script>
|
|
||||||
<script type="text/javascript" src="gfjseditor.js"></script>
|
|
||||||
<title>Web-based Syntax Editor</title>
|
|
||||||
</head>
|
|
||||||
<body onload="mkEditor('editor', Foods)" onkeydown="return hotKeys(event)">
|
|
||||||
<div id="editor">
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
var Editor = new GFGrammar(new GFAbstract("S",{Available: new Type([], "Adjective"), Bulgarian: new Type([], "Noun"), Command: new Type(["Verb", "Determiner", "Noun"], "Sentence"), CommandAdj: new Type(["Verb", "Determiner", "Adjective", "Noun"], "Sentence"), Copy: new Type([], "Verb"), Cut: new Type([], "Verb"), Danish: new Type([], "Noun"), DefPlDet: new Type([], "Determiner"), DefSgDet: new Type([], "Determiner"), Delete: new Type([], "Verb"), English: new Type([], "Noun"), Enter: new Type([], "Verb"), ErrorMessage: new Type(["Adjective", "Noun"], "Sentence"), Finnish: new Type([], "Noun"), Float_N: new Type([], "Noun"), French: new Type([], "Noun"), German: new Type([], "Noun"), IndefPlDet: new Type([], "Determiner"), IndefSgDet: new Type([], "Determiner"), Integer_N: new Type([], "Noun"), Italian: new Type([], "Noun"), Label: new Type(["Noun"], "Sentence"), Language: new Type([], "Noun"), Next: new Type([], "Adjective"), Node: new Type([], "Noun"), Norwegian: new Type([], "Noun"), Page: new Type([], "Noun"), Parse: new Type([], "Verb"), Paste: new Type([], "Verb"), Previous: new Type([], "Adjective"), RandomlyCommand: new Type(["Verb", "Determiner", "Noun"], "Sentence"), Redo: new Type([], "Verb"), Refine: new Type([], "Verb"), Refinement: new Type([], "Noun"), Replace: new Type([], "Verb"), Russian: new Type([], "Noun"), Select: new Type([], "Verb"), Show: new Type([], "Verb"), SingleWordCommand: new Type(["Verb"], "Sentence"), Spanish: new Type([], "Noun"), String_N: new Type([], "Noun"), Swedish: new Type([], "Noun"), Tree: new Type([], "Noun"), Undo: new Type([], "Verb"), Wrap: new Type([], "Verb"), Wrapper: new Type([], "Noun")}),{EditorEng: new GFConcrete({},{0:[new Apply(5,[]), new Apply(34,[]), new Apply(40,[])], 2:[new Apply(19,[]), new Apply(29,[])], 4:[new Apply(18,[]), new Apply(28,[])], 5:[new Apply(6,[]), new Apply(17,[]), new Apply(21,[]), new Apply(24,[]), new Apply(25,[]), new Apply(26,[]), new Apply(27,[]), new Apply(30,[]), new Apply(31,[]), new Apply(33,[]), new Apply(35,[]), new Apply(36,[]), new Apply(37,[]), new Apply(47,[]), new Apply(49,[]), new Apply(54,[]), new Apply(55,[]), new Apply(56,[]), new Apply(57,[]), new Apply(60,[])], 8:[new Apply(7,[new PArg(9), new PArg(12), new PArg(13)]), new Apply(8,[new PArg(10), new PArg(12), new PArg(13)]), new Apply(9,[new PArg(9), new PArg(14), new PArg(13)]), new Apply(10,[new PArg(10), new PArg(14), new PArg(13)]), new Apply(11,[new PArg(9), new PArg(12), new PArg(0), new PArg(13)]), new Apply(12,[new PArg(10), new PArg(12), new PArg(0), new PArg(13)]), new Apply(13,[new PArg(9), new PArg(14), new PArg(0), new PArg(13)]), new Apply(14,[new PArg(10), new PArg(14), new PArg(0), new PArg(13)]), new Apply(23,[new PArg(0), new PArg(13)]), new Apply(32,[new PArg(13)]), new Apply(41,[new PArg(9), new PArg(12), new PArg(13)]), new Apply(42,[new PArg(10), new PArg(12), new PArg(13)]), new Apply(43,[new PArg(9), new PArg(14), new PArg(13)]), new Apply(44,[new PArg(10), new PArg(14), new PArg(13)]), new Apply(52,[new PArg(9)]), new Apply(53,[new PArg(10)])], 10:[new Apply(15,[]), new Apply(16,[]), new Apply(20,[]), new Apply(22,[]), new Apply(38,[]), new Apply(39,[]), new Apply(45,[]), new Apply(46,[]), new Apply(48,[]), new Apply(50,[]), new Apply(51,[]), new Apply(58,[]), new Apply(59,[])], 12:[new Coerce(1), new Coerce(2)], 13:[new Coerce(5), new Coerce(6), new Coerce(7)], 14:[new Coerce(3), new Coerce(4)]},[new CncFun("lindef Adjective",[0, 0, 0, 0, 0, 0, 0]), new CncFun("lindef Determiner",[0, 0, 0, 0]), new CncFun("lindef Noun",[0, 0, 0, 0]), new CncFun("lindef Sentence",[0]), new CncFun("lindef Verb",[0, 0, 0, 0, 0]), new CncFun("Available",[1, 2, 3, 4, 5, 6, 7]), new CncFun("Bulgarian",[8, 9, 10, 11]), new CncFun("Command",[12]), new CncFun("Command",[13]), new CncFun("Command",[14]), new CncFun("Command",[15]), new CncFun("CommandAdj",[16]), new CncFun("CommandAdj",[17]), new CncFun("CommandAdj",[18]), new CncFun("CommandAdj",[19]), new CncFun("Copy",[20, 21, 22, 23, 22]), new CncFun("Cut",[24, 25, 26, 27, 26]), new CncFun("Danish",[28, 29, 30, 31]), new CncFun("DefPlDet",[32, 33, 34, 35]), new CncFun("DefSgDet",[32, 36, 37, 36]), new CncFun("Delete",[38, 39, 40, 41, 40]), new CncFun("English",[42, 43, 44, 45]), new CncFun("Enter",[46, 47, 48, 49, 48]), new CncFun("ErrorMessage",[50]), new CncFun("Finnish",[51, 52, 53, 54]), new CncFun("Float_N",[55, 56, 57, 58]), new CncFun("French",[59, 60, 61, 62]), new CncFun("German",[63, 64, 65, 66]), new CncFun("IndefPlDet",[67, 68, 69, 68]), new CncFun("IndefSgDet",[70, 71, 72, 71]), new CncFun("Integer_N",[73, 74, 75, 76]), new CncFun("Italian",[77, 78, 79, 80]), new CncFun("Label",[81]), new CncFun("Language",[82, 83, 84, 85]), new CncFun("Next",[86, 87, 88, 89, 90, 91, 92]), new CncFun("Node",[93, 94, 95, 96]), new CncFun("Norwegian",[97, 98, 99, 100]), new CncFun("Page",[101, 102, 103, 104]), new CncFun("Parse",[105, 106, 107, 108, 107]), new CncFun("Paste",[109, 110, 111, 112, 111]), new CncLine truncated
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 161 B |
File diff suppressed because it is too large.
Load diff
@@ -1,54 +0,0 @@
|
|||||||
/* Output */
|
|
||||||
|
|
||||||
function sayText(text) {
|
|
||||||
document.voice_output_text = text;
|
|
||||||
activateForm("voice_output");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XHTML+Voice Utilities */
|
|
||||||
|
|
||||||
function activateForm(formid) {
|
|
||||||
var form = document.getElementById(formid);
|
|
||||||
var e = document.createEvent("UIEvents");
|
|
||||||
e.initEvent("DOMActivate","true","true");
|
|
||||||
form.dispatchEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* DOM utilities */
|
|
||||||
|
|
||||||
/* Gets the head element of the document. */
|
|
||||||
function getHeadElement() {
|
|
||||||
var hs = document.getElementsByTagName("head");
|
|
||||||
if (hs.length == 0) {
|
|
||||||
var head = document.createElement("head");
|
|
||||||
document.documentElement.insertBefore(head, document.documentElement.firstChild);
|
|
||||||
return head;
|
|
||||||
} else {
|
|
||||||
return hs[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Gets the body element of the document. */
|
|
||||||
function getBodyElement() {
|
|
||||||
var bs = document.getElementsByTagName("body");
|
|
||||||
if (bs.length == 0) {
|
|
||||||
var body = document.createElement("body");
|
|
||||||
document.documentElement.appendChild(body);
|
|
||||||
return body;
|
|
||||||
} else {
|
|
||||||
return bs[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Removes all the children of a node */
|
|
||||||
function removeChildren(node) {
|
|
||||||
while (node.hasChildNodes()) {
|
|
||||||
node.removeChild(node.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setText(node, text) {
|
|
||||||
removeChildren(node);
|
|
||||||
node.appendChild(document.createTextNode(text));
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1 +0,0 @@
|
|||||||
var Foods = new GFGrammar(new GFAbstract("Phrase",{Boring: new Type([], "Quality"), Cheese: new Type([], "Kind"), Delicious: new Type([], "Quality"), Expensive: new Type([], "Quality"), Fish: new Type([], "Kind"), Fresh: new Type([], "Quality"), Is: new Type(["Item", "Quality"], "Phrase"), Italian: new Type([], "Quality"), Pizza: new Type([], "Kind"), QKind: new Type(["Quality", "Kind"], "Kind"), That: new Type(["Kind"], "Item"), These: new Type(["Kind"], "Item"), This: new Type(["Kind"], "Item"), Those: new Type(["Kind"], "Item"), Very: new Type(["Quality"], "Quality"), Warm: new Type([], "Quality"), Wine: new Type([], "Kind")}),{FoodsEng: new GFConcrete({},{0:[new Apply(19,[new PArg(2)]), new Apply(21,[new PArg(2)])], 1:[new Apply(20,[new PArg(2)]), new Apply(22,[new PArg(2)])], 2:[new Apply(9,[]), new Apply(12,[]), new Apply(17,[]), new Apply(18,[new PArg(4), new PArg(2)]), new Apply(25,[])], 3:[new Apply(14,[new PArg(0), new PArg(4)]), new Apply(15,[new PArg(1), new PArg(4)])], 4:[new Apply(8,[]), new Apply(10,[]), new Apply(11,[]), new Apply(13,[]), new Apply(16,[]), new Apply(23,[new PArg(4)]), new Apply(24,[])]},[new CncFun("'lindef Item'",[5]), new CncFun("'lindef Item'",[0]), new CncFun("'lindef Kind'",[5, 5]), new CncFun("'lindef Kind'",[0]), new CncFun("'lindef Phrase'",[5]), new CncFun("'lindef Phrase'",[0]), new CncFun("'lindef Quality'",[5]), new CncFun("'lindef Quality'",[0]), new CncFun("Boring",[7]), new CncFun("Cheese",[8, 9]), new CncFun("Delicious",[10]), new CncFun("Expensive",[11]), new CncFun("Fish",[12, 12]), new CncFun("Fresh",[13]), new CncFun("Is",[4]), new CncFun("Is",[3]), new CncFun("Italian",[6]), new CncFun("Pizza",[14, 15]), new CncFun("QKind",[1, 2]), new CncFun("That",[16]), new CncFun("These",[17]), new CncFun("This",[18]), new CncFun("Those",[19]), new CncFun("Very",[20]), new CncFun("Warm",[21]), new CncFun("Wine",[22, 23])],[[new SymCat(0, 0)],[new SymCat(0, 0), new SymCat(1, 0)],[new SymCat(0, 0), new SymCat(1, 1)],[new SymCat(0, 0), new SymKS("are"), new SymCat(1, 0)],[new SymCat(0, 0), new SymKS("is"), new SymCat(1, 0)],[new SymLit(0, 0)],[new SymKS("Italian")],[new SymKS("boring")],[new SymKS("cheese")],[new SymKS("cheeses")],[new SymKS("delicious")],[new SymKS("expensive")],[new SymKS("fish")],[new SymKS("fresh")],[new SymKS("pizza")],[new SymKS("pizzas")],[new SymKS("that"), new SymCat(0, 0)],[new SymKS("these"), new SymCat(0, 1)],[new SymKS("this"), new SymCat(0, 0)],[new SymKS("those"), new SymCat(0, 1)],[new SymKS("very"), new SymCat(0, 0)],[new SymKS("warm")],[new SymKS("wine")],[new SymKS("wines")]],{Float:{s: -3, e: -3}, Int:{s: -2, e: -2}, Item:{s: 0, e: 1}, Kind:{s: 2, e: 2}, Phrase:{s: 3, e: 3}, Quality:{s: 4, e: 4}, String:{s: -1, e: -1}}, 5), FoodsIta: new GFConcrete({},{0:[new Apply(22,[new PArg(4)]), new Apply(26,[new PArg(4)])], 1:[new Apply(23,[new PArg(5)]), new Apply(27,[new PArg(5)])], 2:[new Apply(24,[new PArg(4)]), new Apply(28,[new PArg(4)])], 3:[new Apply(25,[new PArg(5)]), new Apply(29,[new PArg(5)])], 4:[new Apply(9,[]), new Apply(12,[]), new Apply(20,[new PArg(7), new PArg(4)]), new Apply(32,[])], 5:[new Apply(19,[]), new Apply(21,[new PArg(7), new PArg(5)])], 6:[new Apply(14,[new PArg(0), new PArg(7)]), new Apply(15,[new PArg(1), new PArg(7)]), new Apply(16,[new PArg(2), new PArg(7)]), new Apply(17,[new PArg(3), new PArg(7)])], 7:[new Apply(8,[]), new Apply(10,[]), new Apply(11,[]), new Apply(13,[]), new Apply(18,[]), new Apply(30,[new PArg(7)]), new Apply(31,[])]},[new CncFun("'lindef Item'",[9]), new CncFun("'lindef Item'",[0]), new CncFun("'lindef Kind'",[9, 9]), new CncFun("'lindef Kind'",[0]), new CncFun("'lindef Phrase'",[9]), new CncFun("'lindef Phrase'",[0]), new CncFun("'lindef Quality'",[9, 9, 9, 9]), new CncFun("'lindef Quality'",[0]), new CncFun("Boring",[39, 38, 36, 37]), new CncFun("Cheese",[23, 22]), new CncFun("Delicious",[21, 20, 18, 19]), new CncFun("Expensive",[17, 16, 14, 15]), new CncFun("Fish",[40, 41]), new CncFun("Fresh",[27, 26, 24, 25]), new CncFun("Is",[3]), new CncFun("Is",[4]), new CncFun("Is",[1]), new CncFun("Is",[2]), new CncFun("Italian",[31, 30, 28, 29]), new CncFun("Pizza",[42, 43]), new CncFun("QKind",[5, 7]), new CncFun("QKind",[6, 8]), new CncFun("That",[45]), new CncFun("That",[46]), new CncFun("These",[50]), new CncFun("These",[49]), new CncFun("This",[51]), new CncFun("This",[48]), new CncFun("Those",[44]), new CncFun("Those",[47]), new CncFun("Very",[32, 33, 34, 35]), new CncFun("Warm",[13, 12, 10, 11]), new CncFun("Wine",[53, 52])],[[new SymCat(0, 0)],[new SymCat(0, 0), new SymKS("sono"), new SymCat(1, 1)],[new SymCat(0, 0), new SymKS("sono"), new SymCat(1, 3)],[new SymCat(0, 0), new SymKS("è"), new SymCat(1, 0)],[new SymCat(0, 0), new SymKS("è"), new SymCat(1, 2)],[new SymCat(1, 0), new SymCat(0, 0)],[new SymCat(1, 0), new SymCat(0, 2)],[new SymCat(1, 1), new SymCat(0, 1)],[new SymCat(1, 1), new SymCat(0, 3)],[new SymLit(0, 0)],[new SymKS("calda")],[new SymKS("calde")],[new SymKS("caldi")],[Line truncated
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { deref } from 'ref'
|
||||||
|
import * as ref from 'ref'
|
||||||
|
import * as ffi from 'ffi'
|
||||||
|
|
||||||
|
const PgfDB = ref.types.int
|
||||||
|
const PgfDBPtr = ref.refType(PgfDB)
|
||||||
|
const PgfRevision = ref.types.int
|
||||||
|
const PgfRevisionPtr = ref.refType(PgfRevision)
|
||||||
|
const PgfExn = ref.types.int
|
||||||
|
const PgfExnPtr = ref.refType(PgfExn)
|
||||||
|
// const stringPtr = ref.refType(ref.types.CString)
|
||||||
|
|
||||||
|
const PGF = ffi.Library('libpgf', {
|
||||||
|
'pgf_read_pgf': [ PgfDBPtr, [ 'string', PgfRevisionPtr, PgfExnPtr ] ],
|
||||||
|
'pgf_write_pgf': [ 'void', [ 'string', PgfDBPtr, PgfRevisionPtr, PgfExnPtr ] ],
|
||||||
|
})
|
||||||
|
|
||||||
|
interface Pointer extends Buffer {
|
||||||
|
deref(): any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
db: Pointer,
|
||||||
|
revision: number
|
||||||
|
}
|
||||||
|
const state: State = {
|
||||||
|
db: ref.NULL_POINTER as Pointer,
|
||||||
|
revision: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
readPGF: function (path: string) {
|
||||||
|
const rev = ref.alloc(PgfRevision) as Pointer
|
||||||
|
const err = ref.alloc(PgfExn) as Pointer
|
||||||
|
const db = PGF.pgf_read_pgf(path, rev, err)
|
||||||
|
if (err.deref() === 0) {
|
||||||
|
state.db = db
|
||||||
|
state.revision = rev.deref()
|
||||||
|
console.log(`ok`)
|
||||||
|
} else {
|
||||||
|
console.error(`error ${err.deref()}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 201 B |
Generated
+204
@@ -0,0 +1,204 @@
|
|||||||
|
{
|
||||||
|
"name": "jspgf",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-consumer": {
|
||||||
|
"version": "0.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
|
||||||
|
"integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@cspotcode/source-map-support": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-consumer": "0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@tsconfig/node10": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@tsconfig/node12": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@tsconfig/node14": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@tsconfig/node16": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/ffi": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ffi/-/ffi-0.2.3.tgz",
|
||||||
|
"integrity": "sha512-DgtsF5c1Q+MKA8r2x889D6G9W3A1Kmq3LlDmbTWbusjTlU0kFDzr3Wz3z/oIIan8dRYO+udhav1LDZwOpbJHeQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/ref": "*",
|
||||||
|
"@types/ref-struct": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "16.10.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz",
|
||||||
|
"integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/ref": {
|
||||||
|
"version": "0.0.29",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ref/-/ref-0.0.29.tgz",
|
||||||
|
"integrity": "sha512-NAk1MKcjGAFEbf7ObSFOOm+HKZIr0145t5lrp84H1GBYDpsBDH9r6tTnS9sjTRJBRy8/BUvGiB/4+0Z/Nh4Hvw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/ref-struct": {
|
||||||
|
"version": "0.0.29",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ref-struct/-/ref-struct-0.0.29.tgz",
|
||||||
|
"integrity": "sha512-ZOiybExNDG++Rjw7qNAlP8Z9TGe4W1S7UvqHbCYzFMc2cVBhTuA29tzAkOrk3bqY0CdzbOvmU7A5X2VOjTpCkw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/ref": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acorn": {
|
||||||
|
"version": "8.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz",
|
||||||
|
"integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"acorn-walk": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"bindings": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",
|
||||||
|
"integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE="
|
||||||
|
},
|
||||||
|
"create-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"version": "2.6.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"ffi": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ffi/-/ffi-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-vkPA9Hf9CVuQ5HeMZykYvrZF2QNJ/iKGLkyDkisBnoOOFeFXZQhUPxBARPBIZMJVulvBI2R+jgofW03gyPpJcQ==",
|
||||||
|
"requires": {
|
||||||
|
"bindings": "~1.2.0",
|
||||||
|
"debug": "2",
|
||||||
|
"nan": "2",
|
||||||
|
"ref": "1",
|
||||||
|
"ref-struct": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||||
|
},
|
||||||
|
"nan": {
|
||||||
|
"version": "2.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
|
||||||
|
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
|
||||||
|
},
|
||||||
|
"ref": {
|
||||||
|
"version": "1.3.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/ref/-/ref-1.3.5.tgz",
|
||||||
|
"integrity": "sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==",
|
||||||
|
"requires": {
|
||||||
|
"bindings": "1",
|
||||||
|
"debug": "2",
|
||||||
|
"nan": "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ref-struct": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ref-struct/-/ref-struct-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-XV7mWtQc78Olxf60BYcmHkee3BM=",
|
||||||
|
"requires": {
|
||||||
|
"debug": "2",
|
||||||
|
"ref": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ts-node": {
|
||||||
|
"version": "10.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz",
|
||||||
|
"integrity": "sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-support": "0.6.1",
|
||||||
|
"@tsconfig/node10": "^1.0.7",
|
||||||
|
"@tsconfig/node12": "^1.0.7",
|
||||||
|
"@tsconfig/node14": "^1.0.0",
|
||||||
|
"@tsconfig/node16": "^1.0.2",
|
||||||
|
"acorn": "^8.4.1",
|
||||||
|
"acorn-walk": "^8.1.1",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"create-require": "^1.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "4.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz",
|
||||||
|
"integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "jspgf",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "JavaScript bindings to the Grammatical Frameworks's PGF runtime",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "npx tsc",
|
||||||
|
"test": "ts-node ./tests/basic.ts"
|
||||||
|
},
|
||||||
|
"author": "John J. Camilleri",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"ffi": "^2.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/ffi": "^0.2.3",
|
||||||
|
"ts-node": "^10.2.1",
|
||||||
|
"typescript": "^4.4.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 229 B |
@@ -1,252 +0,0 @@
|
|||||||
body {
|
|
||||||
font-family:arial,helvetica,sans-serif;
|
|
||||||
font-size:12px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#wrapper {
|
|
||||||
width:740px;
|
|
||||||
height:520px;
|
|
||||||
margin:auto 50px;
|
|
||||||
border:1px solid gray;
|
|
||||||
padding:10px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#absFrame {
|
|
||||||
width:250px;
|
|
||||||
height:250px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#conFrame {
|
|
||||||
width:436px;
|
|
||||||
height:250px;
|
|
||||||
margin-left:10px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
white-space: normal;
|
|
||||||
overflow:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#actFrame {
|
|
||||||
width:250px;
|
|
||||||
height:170px;
|
|
||||||
margin-top:10px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
overflow:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#refFrame {
|
|
||||||
width:436px;
|
|
||||||
height:170px;
|
|
||||||
margin-left:10px;
|
|
||||||
margin-top:10px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
overflow:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#messageFrame {
|
|
||||||
width:506px;
|
|
||||||
height:15px;
|
|
||||||
margin-top:10px;
|
|
||||||
margin-right:10px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
overflow:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#clipboardFrame {
|
|
||||||
width:180px;
|
|
||||||
height:15px;
|
|
||||||
margin-top:10px;
|
|
||||||
padding:10px;
|
|
||||||
border:1px solid gray;
|
|
||||||
float:left;
|
|
||||||
overflow:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tree {
|
|
||||||
left: -10px;
|
|
||||||
top: -10px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 10px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
position: relative;
|
|
||||||
list-style: none;
|
|
||||||
margin-left: 20px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.tree-menu {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.tree:link, a.tree:visited, a.tree:active {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.tree:hover {
|
|
||||||
color: blue;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: underline;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.treeSelected:link, a.treeSelected:visited, a.treeSelected:active {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.treeSelected:hover {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
text-decoration: underline;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.treeGray:link, a.treeGray:visited, a.treeGray:active {
|
|
||||||
color: silver;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.treeGray:hover {
|
|
||||||
color: silver;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-right:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.action, table.refinement, table.wrapper, table.tree, table.language {
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
border-style: none;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-spacing: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.selected {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.unavailable, tr.closed {
|
|
||||||
color: silver;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.unavailable:hover {
|
|
||||||
color: silver;
|
|
||||||
background-color: #3366CC;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.action, tr.refinement, tr.wrapper, tr.tree {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.action:hover, tr.refinement:hover, tr.wrapper:hover, tr.tree:hover {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.action {
|
|
||||||
width: 220px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.refinement, td.wrapper, td.tree {
|
|
||||||
width: 515px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.hotKey {
|
|
||||||
width: 30px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.language {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
margin: 1px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.language:hover {
|
|
||||||
color: blue;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: underline;
|
|
||||||
margin: 1px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.selected {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
margin: 1px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.selected:hover {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
text-decoration: underline;
|
|
||||||
margin: 1px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.normal {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
padding-left: 2px;
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.edit {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
border:2px inset;
|
|
||||||
padding-left: 2px;
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.selected {
|
|
||||||
color: white;
|
|
||||||
background-color: #3366CC;
|
|
||||||
text-decoration: none;
|
|
||||||
padding-left: 2px;
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import PGF from '../index'
|
||||||
|
|
||||||
|
PGF.readPGF('../haskell/tests/basic.pgf')
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
body {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dt {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl dd {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.fromLang dt {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.toLang {
|
|
||||||
border-width: 1px 0 0 0;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #c0c0c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.toLang dt {
|
|
||||||
color: #c0c0c0;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
width: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dl.toLang dd {
|
|
||||||
border-width: 0 0 1px 0;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #c0c0c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
list-style-type: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="translator.css" />
|
|
||||||
<script type="text/javascript" src="gflib.js"></script>
|
|
||||||
<script type="text/javascript" src="grammar.js"></script>
|
|
||||||
<script type="text/javascript" src="translator.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
/* CHANGE ME */
|
|
||||||
var grammar = Foods;
|
|
||||||
|
|
||||||
function updateTranslation () {
|
|
||||||
var input = document.getElementById('inputText').value;
|
|
||||||
var fromLang = document.getElementById('fromLang').value;
|
|
||||||
var toLang = document.getElementById('toLang').value;
|
|
||||||
var output = document.getElementById('output');
|
|
||||||
var translation = grammar.translate(input, fromLang, toLang);
|
|
||||||
removeChildren(output);
|
|
||||||
output.appendChild(formatTranslation(translation));
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateLangs () {
|
|
||||||
var f = document.getElementById('fromLang');
|
|
||||||
var t = document.getElementById('toLang');
|
|
||||||
for (var c in grammar.concretes) {
|
|
||||||
addOption(f, c, c);
|
|
||||||
addOption(t, c, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<title>Web-based GF Translator</title>
|
|
||||||
</head>
|
|
||||||
<body onload="populateLangs(grammar, 'fromLang', 'toLang')">
|
|
||||||
<form id="translate">
|
|
||||||
<p>
|
|
||||||
<input type="text" name="inputText" id="inputText" value="this cheese is warm" size="50" />
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
From: <select name="fromLang" id="fromLang" onchange=""><option value="">Any language</option></select>
|
|
||||||
To: <select name="toLang" id="toLang"><option value="">All languages</option></select>
|
|
||||||
<input type="button" value="Translate" onclick="updateTranslation()" />
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
<div id="output"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
function formatTranslation (outputs) {
|
|
||||||
var dl1 = document.createElement("dl");
|
|
||||||
dl1.className = "fromLang";
|
|
||||||
for (var fromLang in outputs) {
|
|
||||||
var ul = document.createElement("ul");
|
|
||||||
addDefinition(dl1, document.createTextNode(fromLang), ul);
|
|
||||||
for (var i in outputs[fromLang]) {
|
|
||||||
var dl2 = document.createElement("dl");
|
|
||||||
dl2.className = "toLang";
|
|
||||||
for (var toLang in outputs[fromLang][i]) {
|
|
||||||
addDefinition(dl2, document.createTextNode(toLang), document.createTextNode(outputs[fromLang][i][toLang]));
|
|
||||||
}
|
|
||||||
addItem(ul, dl2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dl1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DOM utilities for specific tags */
|
|
||||||
|
|
||||||
function addDefinition (dl, t, d) {
|
|
||||||
var dt = document.createElement("dt");
|
|
||||||
dt.appendChild(t);
|
|
||||||
dl.appendChild(dt);
|
|
||||||
var dd = document.createElement("dd");
|
|
||||||
dd.appendChild(d);
|
|
||||||
dl.appendChild(dd);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addItem (ul, i) {
|
|
||||||
var li = document.createElement("li");
|
|
||||||
li.appendChild(i);
|
|
||||||
ul.appendChild(li);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addOption (select, value, content) {
|
|
||||||
var option = document.createElement("option");
|
|
||||||
option.value = value;
|
|
||||||
option.appendChild(document.createTextNode(content));
|
|
||||||
select.appendChild(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* General DOM utilities */
|
|
||||||
|
|
||||||
/* Removes all the children of a node */
|
|
||||||
function removeChildren(node) {
|
|
||||||
while (node.hasChildNodes()) {
|
|
||||||
node.removeChild(node.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"rootDir": "./",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./dist",
|
||||||
|
"removeComments": false,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user