Skip to content

Commit

Permalink
use blockly location as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
maveme committed Sep 14, 2020
1 parent 09e59f6 commit 32aea90
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/kogi/Compile.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ import kogi::BlocksCustomization;

import kogi::simplification::Util;

void createBlocklyApp(set[Production] productions, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|) {
void createBlocklyApp(set[Production] productions, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|, str blockly = "../../../../resources/blockly") {
blocks = renameDuplicatedBlocks(grammar2blocks(productions));
Toolbox tb = toolbox(createSections(blocks));
createJS(blocks, divName, toolboxName, targetPath);
createHTML(parseToolbox(tb), title, divName, targetPath);
createHTML(parseToolbox(tb), title, divName, targetPath, blockly);
}

void createBlocklyApp(type[&T<:Tree] grammar, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|)
= createBlocklyApp(getAllProductions(grammar), divName = divName, title = title, toolboxName = toolboxName, targetPath = targetPath);
void createBlocklyApp(type[&T<:Tree] grammar, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|, str blockly = "../../../../resources/blockly")
= createBlocklyApp(getAllProductions(grammar), divName = divName, title = title, toolboxName = toolboxName, targetPath = targetPath, blockly = blockly);

void createBlocklyApp(list[Block] blocks, Toolbox toolbox, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|) {
void createBlocklyApp(list[Block] blocks, Toolbox toolbox, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|, str blockly = "../../../../resources/blockly") {
createJS(blocks, divName, toolboxName, targetPath);
createHTML(parseToolbox(toolbox), title, divName, targetPath);
createHTML(parseToolbox(toolbox), title, divName, targetPath, blockly);
}

void createBlocklyApp(type[&T<:Tree] grammar, Toolbox tool, str divName = "kogiDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|) {
void createBlocklyApp(type[&T<:Tree] grammar, Toolbox tool, str divName = "kogiDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|, str blockly = "../../../../resources/blockly") {
initialBlocks = grammar2blocks(grammar);
Toolbox toolbox = updateBlocksDefinition(tool, initialBlocks);
createJS(getBlocks(toolbox), divName, toolboxName, targetPath);
createHTML(parseToolbox(toolbox), title, divName, targetPath);
createHTML(parseToolbox(toolbox), title, divName, targetPat, blockly);
}

// Work in progress. To have a different mechanism for creating blocks. One relies on the assumption that each production rule produces a single block, yet this is limited. So we also want to be able to produce one block from a nonterminal
void createBlocklyApp(map[Symbol, Production] grammar, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|) {
void createBlocklyApp(map[Symbol, Production] grammar, str divName = "blockDiv", str title = "Block Language", str toolboxName = "toolbox", loc targetPath = |project://kogi/src/kogi/demo/result|, str blockly = "../../../../resources/blockly") {

//non-terminals -> to a single block
// An example of this is when you have a non-terminal and all the productions are literals. Therefore, we produce a dropdown field
Expand All @@ -60,7 +60,7 @@ void createBlocklyApp(map[Symbol, Production] grammar, str divName = "blockDiv",
// Create the rest of the app
Toolbox tb = toolbox(createSections(blocks));
createJS(blocks, divName, toolboxName, targetPath);
createHTML(parseToolbox(tb), title, divName, targetPath);
createHTML(parseToolbox(tb), title, divName, targetPath, blockly);
// productions2 block
//grammar2Blocks();
}
Expand Down

0 comments on commit 32aea90

Please sign in to comment.