mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-10-25 09:13:18 -06:00
Updated JS editor to the latest version from Moises.
This commit is contained in:
1 parent
f7bbf6b27b
commit
2064371ff2
6 files changed
+346
-336
No files matched your search
+17
-17
@@ -1,17 +1,17 @@
|
||||
<!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', Food)" onkeydown="hotKeys(event)">
|
||||
<div id="editor">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!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', Restaurant)" onkeydown="hotKeys(event)">
|
||||
<div id="editor">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +1 @@
|
||||
var Editor = new GFGrammar(new GFAbstract("Sentence",{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"), This: new Type([], "Determiner"), Tree: new Type([], "Noun"), Undo: new Type([], "Verb"), Wrap: new Type([], "Verb"), Wrapper: new Type([], "Noun")}),{EditorEng: new GFConcrete({Available: function(cs){return new Arr(new Suffix("available", new Arr(new Str(""), new Str("r"), new Str("st"), new Str("ly"))));}, Bulgarian: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_4", cs), Editor.concretes["EditorEng"].rule("_4", cs)));}, Command: function(cs){return new Arr(new Seq(Editor.concretes["EditorEng"].rule("_8", cs),(new Arr(new Arr(new Seq(Editor.concretes["EditorEng"].rule("_12", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs)), new Seq(Editor.concretes["EditorEng"].rule("_20", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs)), new Seq(Editor.concretes["EditorEng"].rule("_23", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs))), new Arr(new Seq(Editor.concretes["EditorEng"].rule("_27", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs)), new Seq(Editor.concretes["EditorEng"].rule("_30", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs)), new Seq(Editor.concretes["EditorEng"].rule("_33", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_17", cs))))).sel(Editor.concretes["EditorEng"].rule("_38", cs)).sel(Editor.concretes["EditorEng"].rule("_40", cs))));}, CommandAdj: function(cs){return new Arr(new Seq(Editor.concretes["EditorEng"].rule("_8", cs),(new Arr(new Arr(new Seq(Editor.concretes["EditorEng"].rule("_12", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs)), new Seq(Editor.concretes["EditorEng"].rule("_20", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs)), new Seq(Editor.concretes["EditorEng"].rule("_23", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs))), new Arr(new Seq(Editor.concretes["EditorEng"].rule("_27", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs)), new Seq(Editor.concretes["EditorEng"].rule("_30", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs)), new Seq(Editor.concretes["EditorEng"].rule("_33", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_53", cs))))).sel(Editor.concretes["EditorEng"].rule("_38", cs)).sel(Editor.concretes["EditorEng"].rule("_40", cs))));}, Copy: function(cs){return new Arr(new Int(1), new Suffix("Cop", new Arr(new Str("y"), new Str("ies"), new Str("ied"), new Str("ying"))));}, Cut: function(cs){return new Arr(new Int(1), new Suffix("Cut", Editor.concretes["EditorEng"].rule("_70", cs)));}, Danish: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_73", cs), Editor.concretes["EditorEng"].rule("_73", cs)));}, DefPlDet: function(cs){return new Arr(new Int(1), new Str("the"));}, DefSgDet: function(cs){return new Arr(new Int(0), new Str("the"));}, Delete: function(cs){return new Arr(new Int(1), new Suffix("Delet", Editor.concretes["EditorEng"].rule("_78", cs)));}, English: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule(Line truncated
|
||||
var Editor = new GFGrammar(new GFAbstract("Sentence",{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({coding: "utf8"},{Available: function(cs){return new Arr(new Suffix("available", new Arr(new Str(""), new Str("r"), new Str("st"), new Str("ly"))));}, Bulgarian: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_4", cs), Editor.concretes["EditorEng"].rule("_4", cs)), new Int(0));}, Command: function(cs){return new Arr(new Seq(Editor.concretes["EditorEng"].rule("_8", cs), Editor.concretes["EditorEng"].rule("_11", cs), Editor.concretes["EditorEng"].rule("_14", cs), Editor.concretes["EditorEng"].rule("_18", cs)));}, CommandAdj: function(cs){return new Arr(new Seq(Editor.concretes["EditorEng"].rule("_8", cs), Editor.concretes["EditorEng"].rule("_11", cs),(new Arr(Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs), Editor.concretes["EditorEng"].rule("_13", cs))).sel(Editor.concretes["EditorEng"].rule("_22", cs).sel(cs[3].sel(new Int(1)))), cs[3].sel(new Int(0)).sel(new Int(0)).sel(new Int(1)), Editor.concretes["EditorEng"].rule("_18", cs)));}, Copy: function(cs){return new Arr(new Suffix("Cop", new Arr(new Str("y"), new Str("ies"), new Str("ied"), new Str("ying"))), new Int(1));}, Cut: function(cs){return new Arr(new Suffix("Cut", Editor.concretes["EditorEng"].rule("_34", cs)), new Int(1));}, Danish: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_37", cs), Editor.concretes["EditorEng"].rule("_37", cs)), new Int(0));}, DefPlDet: function(cs){return Editor.concretes["EditorEng"].rule("_43", cs);}, DefSgDet: function(cs){return Editor.concretes["EditorEng"].rule("_43", cs);}, Delete: function(cs){return new Arr(new Suffix("Delet", Editor.concretes["EditorEng"].rule("_44", cs)), new Int(1));}, English: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_47", cs), Editor.concretes["EditorEng"].rule("_47", cs)), new Int(0));}, Enter: function(cs){return new Arr(new Suffix("Enter", Editor.concretes["EditorEng"].rule("_34", cs)), new Int(1));}, ErrorMessage: function(cs){return new Arr(new Seq(new Str("there"),(new Arr(new Seq(new Str("am"), new Str("not")), new Str("aren't"), new Str("aren't"), new Str("aren't"), new Str("isn't"), new Str("isn't"), new Str("isn't"), new Str("aren't"))).sel(Editor.concretes["EditorEng"].rule("_59", cs)), Editor.concretes["EditorEng"].rule("_62", cs), Editor.concretes["EditorEng"].rule("_62", cs), Editor.concretes["EditorEng"].rule("_62", cs),(new Arr(Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs), Editor.concretes["EditorEng"].rule("_67", cs))).sel(Editor.concretes["EditorEng"].rule("_59", cs))));}, Finnish: function(cs){return new Arr(new Arr(Editor.concretes["EditorEng"].rule("_72", cs), Editor.concretes["EditorEng"].rule("_72", cs)), new Int(0));}, Float_N: function(cs){return new Arr(new Arr(new SLine truncated
|
||||
+82
-67
@@ -6,9 +6,11 @@ expColImg[0] = new Image(12,12);
|
||||
expColImg[0].src = "minus.png";
|
||||
expColImg[1] = new Image(12,12);
|
||||
expColImg[1].src = "plus.png";
|
||||
|
||||
// Grammars
|
||||
var grammar = undefined;
|
||||
expColImg[2] = new Image(12,12);
|
||||
expColImg[2].src = "empty.png";
|
||||
|
||||
// Grammars
|
||||
var grammar = undefined;
|
||||
var editorGrammar = Editor;
|
||||
|
||||
var selectedLanguage = "EditorEng";
|
||||
@@ -47,7 +49,6 @@ keys ["27"] = function() { clickEsc(); };
|
||||
|
||||
function state(selectedNode, tree, collapseBuffer) {
|
||||
this.selectedNode = selectedNode;
|
||||
// this.tree = myAbstract.copyTree(tree);
|
||||
this.tree = grammar.abstract.copyTree(tree);
|
||||
this.collapseBuffer = collapseBuffer;
|
||||
return this;
|
||||
@@ -70,10 +71,15 @@ treeNode.prototype.hasChildren = function() {
|
||||
return this.children.length;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ----------------------------- GUI functions ----------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Creates an instance of the editor and stores it in the given HTML container.
|
||||
// Previous content is destroyed.
|
||||
function mkEditor(container, myGrammar) {
|
||||
grammar = myGrammar;
|
||||
function mkEditor(container, myGrammar) {
|
||||
grammar = myGrammar;
|
||||
myTree = treeFromAbstract(grammar.abstract.annotate(abstractTree, grammar.abstract.startcat), "0");
|
||||
var holder = document.getElementById(container);
|
||||
holder.innerHTML = "<div id='wrapper'><div id='absFrame'></div><div id='conFrame'></div><div id='actFrame'></div><div id='refFrame'></div><div id='messageFrame'></div><div id='clipboardFrame'></div></div>";
|
||||
@@ -370,18 +376,17 @@ function nodeClick(name) {
|
||||
function showLanguages() {
|
||||
var languages = new Array();
|
||||
languages.push("<table class='language' id='languagesTable'>",
|
||||
"<tr id='langs' class='language'>",
|
||||
"<tr id='langs' class='language'>",
|
||||
"<td class='language' id='EditorDan' title='Label Bulgarian' onclick='clickLanguage(\"\")'>Bulgarian</td>",
|
||||
"<td class='language' id='EditorDan' title='Label Danish' onclick='clickLanguage(\"\")'>Danish</td>",
|
||||
"<td class='language' id='EditorEng' title='Label English' onclick='clickLanguage(\"EditorEng\")'>English</td>",
|
||||
"<td class='language' id='EditorFin' title='Label Finnish' onclick='clickLanguage(\"\")'>Finnish</td>",
|
||||
"<td class='language' id='EditorFre' title='Label French' onclick='clickLanguage(\"\")'>French</td>",
|
||||
"<td class='language' id='EditorFre' title='Label French' onclick='clickLanguage(\"EditorFre\")'>French</td>",
|
||||
"<td class='language' id='EditorGer' title='Label German' onclick='clickLanguage(\"\")'>German</td>",
|
||||
"<td class='language' id='EditorIta' title='Label Italian' onclick='clickLanguage(\"\")'>Italian</td>",
|
||||
"<td class='language' id='EditorNor' title='Label Norwegian' onclick='clickLanguage(\"\")'>Norwegian</td>",
|
||||
"<td class='language' id='EditorRus' title='Label Russian' onclick='clickLanguage(\"\")'>Russian</td>",
|
||||
// "<td class='language' id='EditorSpa' title='Label Spanish' onclick='clickLanguage(\"EditorSpa\")'>Spanish</td>",
|
||||
"<td class='language' id='EditorSpa' title='Label Spanish' onclick='clickLanguage(\"\")'>Spanish</td>",
|
||||
"<td class='language' id='EditorSpa' title='Label Spanish' onclick='clickLanguage(\"EditorSpa\")'>Spanish</td>",
|
||||
"<td class='language' id='EditorSwe' title='Label Swedish' onclick='clickLanguage(\"EditorSwe\")'>Swedish</td></tr>",
|
||||
"</table>");
|
||||
return languages.join("");
|
||||
@@ -406,6 +411,7 @@ function applyLanguage() {
|
||||
for (var i = 0, j = langsToLinearize.length; i < j; i++) {
|
||||
var absStr = langsToLinearize[i].getAttribute("title");
|
||||
var lin = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree(absStr, editorGrammar.abstract.startcat));
|
||||
lin = lin.substring(0,1).toUpperCase().concat(lin.substring(1))
|
||||
if (!langsToLinearize[i].firstChild) {
|
||||
var txt = document.createTextNode(lin);
|
||||
langsToLinearize[i].appendChild(txt);
|
||||
@@ -416,9 +422,10 @@ function applyLanguage() {
|
||||
}
|
||||
var actionsToLinearize = document.getElementById("actionsTable").getElementsByTagName("td");
|
||||
for (var i = 0, j = actionsToLinearize.length; i < j; i++) {
|
||||
if (actionsToLinearize[i].getAttribute("class") == "action") {
|
||||
if (actionsToLinearize[i].className == "action") {
|
||||
var absStr = actionsToLinearize[i].getAttribute("title");
|
||||
var lin = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree(absStr, editorGrammar.abstract.startcat));
|
||||
lin = lin.substring(0,1).toUpperCase().concat(lin.substring(1))
|
||||
if (!actionsToLinearize[i].firstChild) {
|
||||
var txt = document.createTextNode(lin);
|
||||
actionsToLinearize[i].appendChild(txt);
|
||||
@@ -430,23 +437,28 @@ function applyLanguage() {
|
||||
}
|
||||
var messageToLinearize = document.getElementById("refgenRefRandom");
|
||||
if (messageToLinearize) {
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("RandomlyCommand Select IndefSgDet Refinement", editorGrammar.abstract.startcat));
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("RandomlyCommand Select IndefSgDet Refinement", editorGrammar.abstract.startcat));
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = msg.substring(0,1).toUpperCase().concat(msg.substring(1));
|
||||
}
|
||||
var messageToLinearize = document.getElementById("nextRefsNext");
|
||||
if (messageToLinearize) {
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Next Page", editorGrammar.abstract.startcat));
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Next Page", editorGrammar.abstract.startcat));
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = msg.substring(0,1).toUpperCase().concat(msg.substring(1));
|
||||
}
|
||||
messageToLinearize = document.getElementById("nextRefsPrevious");
|
||||
if (messageToLinearize) {
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Previous Page", editorGrammar.abstract.startcat));
|
||||
if (messageToLinearize) {
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Previous Page", editorGrammar.abstract.startcat));
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = msg.substring(0,1).toUpperCase().concat(msg.substring(1));
|
||||
}
|
||||
var messageToLinearize = document.getElementById("nextWrapsNext");
|
||||
if (messageToLinearize) {
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Next Page", editorGrammar.abstract.startcat));
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Next Page", editorGrammar.abstract.startcat));
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = msg.substring(0,1).toUpperCase().concat(msg.substring(1));
|
||||
}
|
||||
messageToLinearize = document.getElementById("nextWrapsPrevious");
|
||||
if (messageToLinearize) {
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Previous Page", editorGrammar.abstract.startcat));
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("CommandAdj Show DefSgDet Previous Page", editorGrammar.abstract.startcat));
|
||||
messageToLinearize.firstChild.firstChild.nodeValue = msg.substring(0,1).toUpperCase().concat(msg.substring(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,12 +485,12 @@ function showActions(caption) {
|
||||
actions.push(createAction("Delete", "unavailable", "SingleWordCommand Delete", "D"));
|
||||
actions.push(createAction("Refine", "action", "SingleWordCommand Refine", "R"));
|
||||
actions.push(createAction("Replace", "unavailable", "SingleWordCommand Replace", "E"));
|
||||
actions.push(createAction("Wrap", "unavailable", "SingleWordCommand Wrap", "W"));
|
||||
for (var i in grammar.concretes) {
|
||||
actions.push(createAction("Wrap", "unavailable", "SingleWordCommand Wrap", "W"));
|
||||
for (var i in grammar.concretes) {
|
||||
if (grammar.concretes[i].parser) {
|
||||
actions.push(createAction("Parse", "action", "Command Parse IndefSgDet String_N", "P"));
|
||||
} else { actions.push(createAction("Parse", "unavailable", "Command Parse IndefSgDet String_N", "P")); }
|
||||
break;
|
||||
actions.push(createAction("Parse", "action", "Command Parse IndefSgDet String_N", "P"));
|
||||
} else { actions.push(createAction("Parse", "unavailable", "Command Parse IndefSgDet String_N", "P")); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (node.caption) {
|
||||
@@ -529,18 +541,21 @@ function clickRefine(actName) {
|
||||
switch(node.type)
|
||||
{
|
||||
case "String":
|
||||
newType = prompt(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet String_N", editorGrammar.abstract.startcat)),'String');
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet String_N", editorGrammar.abstract.startcat));
|
||||
newType = prompt(msg.substring(0,1).toUpperCase().concat(msg.substring(1)),'String');
|
||||
if (!newType) { newType = "AutoString"; }
|
||||
break;
|
||||
case "Int":
|
||||
while (isNaN(newType) || (newType && newType.indexOf(".") != -1)) {
|
||||
newType = prompt(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet Integer_N", editorGrammar.abstract.startcat)),'Int');
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet Integer_N", editorGrammar.abstract.startcat));
|
||||
newType = prompt(msg.substring(0,1).toUpperCase().concat(msg.substring(1)),'Int');
|
||||
}
|
||||
if (!newType) { newType = "8"; }
|
||||
break;
|
||||
case "Float":
|
||||
while (isNaN(newType)) {
|
||||
newType = prompt(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet Float_N", editorGrammar.abstract.startcat)),'Float');
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet Float_N", editorGrammar.abstract.startcat));
|
||||
newType = prompt(msg.substring(0,1).toUpperCase().concat(msg.substring(1)),'Float');
|
||||
}
|
||||
if (!newType) { newType = "8.0"; }
|
||||
if (newType.indexOf(".") == -1) { newType += ".0"; }
|
||||
@@ -553,7 +568,7 @@ function clickRefine(actName) {
|
||||
}
|
||||
if (!grammar.abstract.types[newTypeCat]) {
|
||||
grammar.abstract.addType(newTypeCat, [], node.type);
|
||||
for (var i in grammar.concretes) {
|
||||
for (var i in grammar.concretes) {
|
||||
grammar.concretes[i].addRule(newTypeCat, function(cs){ return new Arr(new Str(newType));});
|
||||
}
|
||||
}
|
||||
@@ -593,7 +608,6 @@ function pushUndoClearRedo() {
|
||||
|
||||
// Gets the refinements to display
|
||||
function showRefinements(nodeName) {
|
||||
// var refs = getAvailableRefinements(nodeName);
|
||||
var refs = getAvailableRefinements(nodeName, abstractTree, grammar);
|
||||
var rowsPerPage = 9;
|
||||
var pages = Math.floor(refs.length / rowsPerPage);
|
||||
@@ -623,7 +637,7 @@ function showRefinements(nodeName) {
|
||||
refinements.push("</table>");
|
||||
return refinements.join("");
|
||||
}
|
||||
|
||||
|
||||
// Creates an HTML representation of a Refinement/Wrap
|
||||
function ref_wrapToHtml(funct, name, className, arg, hotKeyPos, caption) {
|
||||
var ref_wrapHtml = new Array();
|
||||
@@ -755,7 +769,7 @@ function selectNextMeta() {
|
||||
nodeClick(pathToNextMeta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Expands the ascendants of a given node
|
||||
function expandAscendants(nodeName) {
|
||||
var nodePath = nodeName.split("-");
|
||||
@@ -780,7 +794,7 @@ function clickPaste(actName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When the "Delete" action is selected, deletes the selected node
|
||||
function clickDelete(actName) {
|
||||
if (document.getElementById(actName).className == "action") {
|
||||
@@ -794,7 +808,7 @@ function clickDelete(actName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When the "Replace" action is selected, replaces the selected node with another refinement
|
||||
function clickReplace(actName) {
|
||||
if (document.getElementById(actName).className == "action") {
|
||||
@@ -822,7 +836,8 @@ function clickWrap(actName) {
|
||||
var wrappers = showWrappers(node.caption);
|
||||
document.getElementById("refFrame").innerHTML = wrappers;
|
||||
if (wrappers.length <= 31) {
|
||||
alert(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("ErrorMessage Available Wrapper", editorGrammar.abstract.startcat)));
|
||||
var lin = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("ErrorMessage Available Wrapper", editorGrammar.abstract.startcat));
|
||||
alert(lin.substring(0,1).toUpperCase().concat(lin.substring(1)));
|
||||
document.getElementById("actFrame").innerHTML = showActions();
|
||||
nodeClick(selectedNode);
|
||||
}
|
||||
@@ -834,7 +849,6 @@ function clickWrap(actName) {
|
||||
function showWrappers(nodeCaption) {
|
||||
var nodeType = grammar.abstract.types[nodeCaption].cat;
|
||||
var rowsPerPage = 10;
|
||||
// var availWrappers = getAvailableWrappers(nodeType);
|
||||
var availWrappers = getAvailableWrappers(nodeType, grammar, selectedNode);
|
||||
var pages = Math.floor(availWrappers.length / rowsPerPage);
|
||||
var upperLimit;
|
||||
@@ -860,7 +874,7 @@ function showWrappers(nodeCaption) {
|
||||
wrappers.push("</table>");
|
||||
return wrappers.join("");
|
||||
}
|
||||
|
||||
|
||||
// Creates the function to be used by a "numeric" hot key
|
||||
function mkWrapHotKey(wrapName, argPos) {
|
||||
return function() { if (document.getElementById("wrap" + wrapName)) { wrapClick(wrapName, argPos); } }
|
||||
@@ -876,15 +890,16 @@ function mkWrapNextRefsHotKey(wrapName) {
|
||||
function clickParse(actName) {
|
||||
if (document.getElementById(actName).className == "action") {
|
||||
highlightSelectedAction(actName);
|
||||
var node = getNode(selectedNode, myTree);
|
||||
var node = getNode(selectedNode, myTree);
|
||||
if (selectedNode) {
|
||||
refPageCounter = 0;
|
||||
parseTrees = undefined;
|
||||
var string = prompt(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet String_N", editorGrammar.abstract.startcat)),'String');
|
||||
if (string || string == "") {
|
||||
for (var i in grammar.concretes) {
|
||||
var msg = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("Command Enter IndefSgDet String_N", editorGrammar.abstract.startcat));
|
||||
var string = prompt(msg.substring(0,1).toUpperCase().concat(msg.substring(1)),'String');
|
||||
if (string || string == "") {
|
||||
for (var i in grammar.concretes) {
|
||||
parseTrees = grammar.concretes[i].parser.parseString(string, node.cat);
|
||||
if (parseTrees.length == 1) {
|
||||
if (parseTrees.length == 1) {
|
||||
pushUndoClearRedo();
|
||||
abstractTree = insertNode(abstractTree, selectedNode, "0", grammar.abstract.copyTree(grammar.abstract.handleLiterals(parseTrees[0], node.cat)));
|
||||
document.getElementById("actFrame").innerHTML = showActions();
|
||||
@@ -895,10 +910,11 @@ function clickParse(actName) {
|
||||
} else if (parseTrees.length > 1) {
|
||||
document.getElementById("refFrame").innerHTML = showTrees();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { nodeClick(selectedNode); return false; }
|
||||
alert(editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("ErrorMessage Available Tree", editorGrammar.abstract.startcat)));
|
||||
var lin = editorGrammar.concretes[selectedLanguage].linearize(editorGrammar.abstract.parseTree("ErrorMessage Available Tree", editorGrammar.abstract.startcat));
|
||||
alert(lin.substring(0,1).toUpperCase().concat(lin.substring(1)));
|
||||
}
|
||||
nodeClick(selectedNode);
|
||||
}
|
||||
@@ -965,7 +981,7 @@ function clickRandomNode(actName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When the "RandomTree" action is selected, refines the tree at random
|
||||
function clickRandomTree(actName) {
|
||||
if (document.getElementById(actName).className == "action") {
|
||||
@@ -980,7 +996,6 @@ function clickRandomTree(actName) {
|
||||
function refClick(refName) {
|
||||
if (selectedNode) {
|
||||
if (refName == "genRefRandom") {
|
||||
// var refs = getAvailableRefinements(selectedNode);
|
||||
var refs = getAvailableRefinements(selectedNode, abstractTree, grammar);
|
||||
refName = refs[Math.floor(refs.length * Math.random())];
|
||||
}
|
||||
@@ -991,7 +1006,7 @@ function refClick(refName) {
|
||||
concludeAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Creates a tree from an abstract tree
|
||||
function treeFromAbstract(abstractNode, name) {
|
||||
var node = new treeNode(name, abstractNode.name);
|
||||
@@ -1040,7 +1055,7 @@ function wrapClick(wrapName, argPos) {
|
||||
|
||||
// Wraps a refinement around a node
|
||||
function treeClick(i) {
|
||||
if (selectedNode) {
|
||||
if (selectedNode) {
|
||||
pushUndoClearRedo();
|
||||
var node = getNode(selectedNode, myTree);
|
||||
var tempNode = grammar.abstract.copyTree(grammar.abstract.handleLiterals(parseTrees[i], node.cat));
|
||||
@@ -1090,11 +1105,11 @@ function nextTreesClick(treeName) {
|
||||
clearHotKeys();
|
||||
document.getElementById("refFrame").innerHTML = showTrees();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ---------- GUI independent functions to handle syntax editing ---------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ---------- GUI independent functions to handle syntax editing ---------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
// Gets the node rooted at the indicated path (route) in the tree absNode
|
||||
function getNodeFromAbstract(absNode, route, currRoute) {
|
||||
if (route == currRoute) {
|
||||
@@ -1107,7 +1122,7 @@ function getNodeFromAbstract(absNode, route, currRoute) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Gets the first metavariable from the abstract tree rooted at the path route
|
||||
function getNextMetaFromAbstract(node, route) {
|
||||
if (node.isMeta()) { return route; }
|
||||
@@ -1116,7 +1131,7 @@ function getNextMetaFromAbstract(node, route) {
|
||||
if (found) { return found; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Inserts the node into the abstract tree absNode at the path route
|
||||
function insertNode(absNode, route, currRoute, node) {
|
||||
if (route == currRoute) {
|
||||
@@ -1129,7 +1144,7 @@ function insertNode(absNode, route, currRoute, node) {
|
||||
return absNode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Deletes the node rooted at the path route from the abstract tree absNode
|
||||
function deleteNode(absNode, route, currRoute) {
|
||||
if (route == currRoute) {
|
||||
@@ -1142,8 +1157,8 @@ function deleteNode(absNode, route, currRoute) {
|
||||
return absNode;
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the available refinements for the node nodeName, which is in the tree
|
||||
|
||||
// Gets the available refinements for the node nodeName, which is in the tree
|
||||
// abstractTree, from those found in the grammar.
|
||||
function getAvailableRefinements(nodeName, abstractTree, grammar) {
|
||||
var node = getNodeFromAbstract(abstractTree, nodeName, "0");
|
||||
@@ -1156,8 +1171,8 @@ function getAvailableRefinements(nodeName, abstractTree, grammar) {
|
||||
}
|
||||
return refinements;
|
||||
}
|
||||
|
||||
// It refines the node rooted at the path route in the abstract tree absNode
|
||||
|
||||
// It refines the node rooted at the path route in the abstract tree absNode
|
||||
// with the refinement refName. Returns the refined abstract tree.
|
||||
function refineAbstractTree(absNode, route, currRoute, refName) {
|
||||
if (route == currRoute && absNode.isMeta()) {
|
||||
@@ -1170,17 +1185,17 @@ function refineAbstractTree(absNode, route, currRoute, refName) {
|
||||
return absNode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Creates a node of type refName object with the appropriate number of arguments
|
||||
function createRefinement(refName) {
|
||||
var newRef = new Fun(refName);
|
||||
var newRef = new Fun(refName);
|
||||
for (var i = 0, j = grammar.abstract.types[refName].args.length; i < j; i++) {
|
||||
newRef.setArg(i, new Fun("?"));
|
||||
}
|
||||
return newRef;
|
||||
}
|
||||
|
||||
// Gets the available wrappers for a node of type nodeType found in the grammar
|
||||
|
||||
// Gets the available wrappers for a node of type nodeType found in the grammar
|
||||
function getAvailableWrappers(nodeType, grammar, top) {
|
||||
var wrappers = new Array();
|
||||
for (var fun in grammar.abstract.types) {
|
||||
@@ -1200,11 +1215,11 @@ function getAvailableWrappers(nodeType, grammar, top) {
|
||||
}
|
||||
return wrappers;
|
||||
}
|
||||
|
||||
// Instantiates metavariables found in the tree abstractTree with refinements
|
||||
|
||||
// Instantiates metavariables found in the tree abstractTree with refinements
|
||||
// selected at random from those found in the grammar
|
||||
function fillSubTree(abstractTree, grammar) {
|
||||
while (!abstractTree.isComplete()) {
|
||||
function fillSubTree(abstractTree, grammar) {
|
||||
while (!abstractTree.isComplete()) {
|
||||
var nodeToRefine = getNextMetaFromAbstract(abstractTree, "0");
|
||||
if (nodeToRefine) {
|
||||
var refs = getAvailableRefinements(nodeToRefine, abstractTree, grammar);
|
||||
@@ -1247,6 +1262,6 @@ function fillSubTree(abstractTree, grammar) {
|
||||
abstractTree = grammar.abstract.annotate(abstractTree, grammar.abstract.startcat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return abstractTree;
|
||||
}
|
||||
}
|
||||
+4
-16
@@ -187,12 +187,6 @@ Int.prototype.setTag = function(tag) { if (!this.tag) { this.tag = tag; } };
|
||||
|
||||
/* Type annotation */
|
||||
|
||||
/*
|
||||
function Abstract(startcat) {
|
||||
this.types = new Array();
|
||||
this.startcat = startcat;
|
||||
}
|
||||
*/
|
||||
function GFAbstract(startcat, types) {
|
||||
this.startcat = startcat;
|
||||
this.types = types;
|
||||
@@ -275,15 +269,9 @@ function Type(args, cat) {
|
||||
}
|
||||
|
||||
/* Linearization */
|
||||
/*
|
||||
function Concrete(abstr) {
|
||||
this.abstr = abstr;
|
||||
this.rules = new Array();
|
||||
this.parser = undefined;
|
||||
}
|
||||
*/
|
||||
|
||||
function GFConcrete(flags, rules, parser) {
|
||||
this.flags = flags;
|
||||
this.flags = flags;
|
||||
this.rules = rules;
|
||||
if (parser) {
|
||||
this.parser = parser;
|
||||
@@ -761,7 +749,7 @@ function rangeConcatLin (lin1, lin2) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Performs range concatenation on a linarization row
|
||||
// Performs range concatenation on a linearization row
|
||||
function rangeConcatLins (lins) {
|
||||
var newLins = new Array();
|
||||
newLins.push(lins.shift());
|
||||
@@ -779,7 +767,7 @@ function rangeConcatLins (lins) {
|
||||
return newLins;
|
||||
}
|
||||
|
||||
// Performs range restriction on an element of a linarization row
|
||||
// Performs range restriction on an element of a linearization row
|
||||
// while keeping track of the tokens that have been used
|
||||
function rangeRestLinTerm(tokens, lin, rangesNotConsumed) {
|
||||
if (lin.id == "argProj") { return new Array(lin); }
|
||||
|
||||
@@ -1 +1 @@
|
||||
var Food = 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"), QKind: new Type(["Quality", "Kind"], "Kind"), That: new Type(["Kind"], "Item"), This: new Type(["Kind"], "Item"), Very: new Type(["Quality"], "Quality"), Warm: new Type([], "Quality"), Wine: new Type([], "Kind")}),{FoodEng: new GFConcrete({coding: "latin1"},{Boring: function(cs){return new Arr(new Str("boring"));}, Cheese: function(cs){return new Arr(new Str("cheese"));}, Delicious: function(cs){return new Arr(new Str("delicious"));}, Expensive: function(cs){return new Arr(new Str("expensive"));}, Fish: function(cs){return new Arr(new Str("fish"));}, Fresh: function(cs){return new Arr(new Str("fresh"));}, Is: function(cs){return new Arr(new Seq(Food.concretes["FoodEng"].rule("_6", cs), new Str("is"), Food.concretes["FoodEng"].rule("_7", cs)));}, Italian: function(cs){return new Arr(new Str("Italian"));}, QKind: function(cs){return new Arr(new Seq(Food.concretes["FoodEng"].rule("_6", cs), Food.concretes["FoodEng"].rule("_7", cs)));}, That: function(cs){return new Arr(new Seq(new Str("that"), Food.concretes["FoodEng"].rule("_6", cs)));}, This: function(cs){return new Arr(new Seq(new Str("this"), Food.concretes["FoodEng"].rule("_6", cs)));}, Very: function(cs){return new Arr(new Seq(new Str("very"), Food.concretes["FoodEng"].rule("_6", cs)));}, Warm: function(cs){return new Arr(new Str("warm"));}, Wine: function(cs){return new Arr(new Str("wine"));}, _21: function(cs){return new Arr(cs[0]);}, _6: function(cs){return cs[0].sel(new Int(0));}, _7: function(cs){return cs[1].sel(new Int(0));}, Item: function(cs){return Food.concretes["FoodEng"].rule("_21", cs);}, Kind: function(cs){return Food.concretes["FoodEng"].rule("_21", cs);}, Phrase: function(cs){return Food.concretes["FoodEng"].rule("_21", cs);}, Quality: function(cs){return Food.concretes["FoodEng"].rule("_21", cs);}, "Int": function(cs){return new Arr(cs[0]);}, "Float": function(cs){return new Arr(cs[0]);}, "String": function(cs){return new Arr(cs[0]);}}, new Parser("Phrase",[new Rule(2, new FunApp("Wine",[]),[],[[new Terminal("wine")]]), new Rule(1, new FunApp("Warm",[]),[],[[new Terminal("warm")]]), new Rule(1, new FunApp("Very",[new Arg(0)]),[1],[[new Terminal("very"), new ArgProj(0, 0)]]), new Rule(4, new FunApp("This",[new Arg(0)]),[2],[[new Terminal("this"), new ArgProj(0, 0)]]), new Rule(4, new FunApp("That",[new Arg(0)]),[2],[[new Terminal("that"), new ArgProj(0, 0)]]), new Rule(2, new FunApp("QKind",[new Arg(0), new Arg(1)]),[1, 2],[[new ArgProj(0, 0), new ArgProj(1, 0)]]), new Rule(1, new FunApp("Italian",[]),[],[[new Terminal("Italian")]]), new Rule(3, new FunApp("Is",[new Arg(0), new Arg(1)]),[4, 1],[[new ArgProj(0, 0), new Terminal("is"), new ArgProj(1, 0)]]), new Rule(1, new FunApp("Fresh",[]),[],[[new Terminal("fresh")]]), new Rule(2, new FunApp("Fish",[]),[],[[new Terminal("fish")]]), new Rule(1, new FunApp("Expensive",[]),[],[[new Terminal("expensive")]]), new Rule(1, new FunApp("Delicious",[]),[],[[new Terminal("delicious")]]), new Rule(2, new FunApp("Cheese",[]),[],[[new Terminal("cheese")]]), new Rule(1, new FunApp("Boring",[]),[],[[new Terminal("boring")]])],{Float:[-3], Int:[-2], Item:[4], Kind:[2], Phrase:[3], Quality:[1], String:[-1], _Var:[-4]})), FoodIta: new GFConcrete({coding: "latin1"},{Boring: function(cs){return new Arr(new Str("noioso"));}, Cheese: function(cs){return new Arr(new Str("formaggio"));}, Delicious: function(cs){return new Arr(new Str("delizioso"));}, Expensive: function(cs){return new Arr(new Str("caro"));}, Fish: function(cs){return new Arr(new Str("pesce"));}, Fresh: function(cs){return new Arr(new Str("fresco"));}, Is: function(cs){return new Arr(new Seq(Food.concretes["FoodIta"].rule("_6", cs), new Str("è"), Food.concretes["FoodIta"].rule("_7", cs)));}, Italian: function(cs){return new Arr(new Str("italiano"));}, QKind: function(cs){return new Arr(new Seq(Food.concretes["FoodIta"].rule("_7", cs), Food.concretes["FoodIta"].rule("_6", cs)));}, That: function(cs){return new Arr(new Seq(new Str("quello"), Food.concretes["FoodIta"].rule("_6", cs)));}, This: function(cs){return new Arr(new Seq(new Str("questo"), Food.concretes["FoodIta"].rule("_6", cs)));}, Very: function(cs){return new Arr(new Seq(new Str("molto"), Food.concretes["FoodIta"].rule("_6", cs)));}, Warm: function(cs){return new Arr(new Str("caldo"));}, Wine: function(cs){return new Arr(new Str("vino"));}, _21: function(cs){return new Arr(cs[0]);}, _6: function(cs){return cs[0].sel(new Int(0));}, _7: function(cs){return cs[1].sel(new Int(0));}, Item: function(cs){return Food.concretes["FoodIta"].rule("_21", cs);}, Kind: function(cs){return Food.concretes["FoodIta"].rule("_21", cs);}, Phrase: function(cs){return Food.concretes["FoodLine truncated
|
||||
var Restaurant = new GFGrammar(new GFAbstract("Paragraph",{A_List_Of_Adjectives: new Type(["ListQual"], "Quality"), Adj_Comma_List_Of_Adjs: new Type(["Quality", "ListQual"], "ListQual"), Adjective_And_Adjective: new Type(["Quality", "Quality"], "ListQual"), Attentive: new Type([], "Quality"), Authentic: new Type([], "Quality"), Awful: new Type([], "Quality"), Bad: new Type([], "Quality"), Boring: new Type([], "Quality"), Certainly: new Type([], "Adverb"), Cheap: new Type([], "Quality"), Chinese: new Type([], "Quality"), Clean: new Type([], "Quality"), Completely: new Type([], "Adverb"), Conditional_Tense: new Type([], "STense"), Courteous: new Type([], "Quality"), Delicious: new Type([], "Quality"), Dirty: new Type([], "Quality"), Disgusting: new Type([], "Quality"), Diverse: new Type([], "Quality"), Efficient: new Type([], "Quality"), Empty_Sentence: new Type([], "Paragraph"), Excellent: new Type([], "Quality"), Expensive: new Type([], "Quality"), Fatty: new Type([], "Quality"), French: new Type([], "Quality"), Fresh: new Type([], "Quality"), Friendly: new Type([], "Quality"), Good: new Type([], "Quality"), Great: new Type([], "Quality"), Hardly: new Type([], "Adverb"), Helpful: new Type([], "Quality"), Honestly: new Type([], "Adverb"), Horrible: new Type([], "Quality"), I_Do_Not_Recommend: new Type(["Adverb", "Item"], "Phrase"), I_Recommend: new Type(["Adverb", "Item"], "Phrase"), Impersonal: new Type([], "Quality"), Inefficient: new Type([], "Quality"), Italian: new Type([], "Quality"), Japanese: new Type([], "Quality"), Mexican: new Type([], "Quality"), Nice: new Type([], "Quality"), NoAdverb: new Type([], "Adverb"), Personal: new Type([], "Quality"), Present_Tense: new Type([], "STense"), Prompt: new Type([], "Quality"), Really: new Type([], "Adverb"), Reluctantly: new Type([], "Adverb"), Rude: new Type([], "Quality"), Sentence: new Type(["Phrase", "Paragraph"], "Paragraph"), Slow: new Type([], "Quality"), Strongly: new Type([], "Adverb"), Tasteless: new Type([], "Quality"), Thai: new Type([], "Quality"), The_Cheese: new Type([], "Item"), The_Cheeses: new Type([], "Item"), The_Desserts: new Type([], "Item"), The_Dishes: new Type([], "Item"), The_Drinks: new Type([], "Item"), The_Fish: new Type([], "Item"), The_Food: new Type([], "Item"), The_Item_Is: new Type(["Item", "Quality"], "Phrase"), The_Item_Is_Not: new Type(["Item", "Quality"], "Phrase"), The_Pizza: new Type([], "Item"), The_Restaurant: new Type([], "Item"), The_Staff: new Type([], "Item"), The_Wine: new Type([], "Item"), The_Wines: new Type([], "Item"), UnAttentive: new Type([], "Quality"), Very_Adjective: new Type(["Quality"], "Quality"), Warm: new Type([], "Quality")}),{RestaurantEng: new GFConcrete({coding: "utf8"},{A_List_Of_Adjectives: function(cs){return new Arr(new Arr(new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(0)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(0))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(1)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(1))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(2)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(2))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(3)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(3))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(4)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(4))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(5)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(5))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(6)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(6))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_0", cs).sel(new Int(7)), new Str("and"), Restaurant.concretes["RestaurantEng"].rule("_2", cs).sel(new Int(7)))), Restaurant.concretes["RestaurantEng"].rule("_27", cs));}, Adj_Comma_List_Of_Adjs: function(cs){return new Arr((new Arr(Restaurant.concretes["RestaurantEng"].rule("_29", cs), new Int(1))).sel(Restaurant.concretes["RestaurantEng"].rule("_0", cs)), new Arr(new Seq(Restaurant.concretes["RestaurantEng"].rule("_32", cs), new Str(","), Restaurant.concretes["RestaurantEng"].rule("_33", cs).sel(new Int(0))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_36", cs), new Str(","), Restaurant.concretes["RestaurantEng"].rule("_33", cs).sel(new Int(1))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_39", cs), new Str(","), Restaurant.concretes["RestaurantEng"].rule("_33", cs).sel(new Int(2))), new Seq(Restaurant.concretes["RestaurantEng"].rule("_42", cs), new Str(","), Restaurant.concretes["RestaurantEng"].rule("_33", cs).sel(new Int(3))), new Seq(Restaurant.concretes["RestaurLine truncated
|
||||
+241
-234
@@ -1,234 +1,241 @@
|
||||
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;
|
||||
width: 230px;
|
||||
height: 250px;
|
||||
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;
|
||||
}
|
||||
|
||||
td.language:hover {
|
||||
color: blue;
|
||||
background-color: white;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
td.selected {
|
||||
color: white;
|
||||
background-color: #3366CC;
|
||||
}
|
||||
|
||||
td.selected:hover {
|
||||
color: white;
|
||||
background-color: #3366CC;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 40px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
span.normal {
|
||||
color: black;
|
||||
background-color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
span.selected {
|
||||
color: white;
|
||||
background-color: #3366CC;
|
||||
text-decoration: none;
|
||||
}
|
||||
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;
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
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;
|
||||
}
|
||||
|
||||
span.selected {
|
||||
color: white;
|
||||
background-color: #3366CC;
|
||||
text-decoration: none;
|
||||
}
|
||||
Reference in new issue
Block a user