prolog-blockly 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/htmls/pl-element-blockly.html +58 -14
- data/lib/prolog/blockly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2844a64863dbc7b2ae9ed79348d67e4727b32853a9e8f7a2a981546abd5d462
|
4
|
+
data.tar.gz: 748de21db30187284247da28485c898b31f386e2de32ee968bf8e0176d8b2949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b70e5148ba641a39a3922e2f73b8463232c7508e5b6e04a8a4ac10b21fcff1f20ccda274542cbe9b20cb50100bb3570fda2735a47cdd2ab0b05fac5e6002a182
|
7
|
+
data.tar.gz: deb2c258e1e4a7613af5f5a46a37c3a99ea00f9eda6eb2774ea90c680363b6d3e674c4da3d0e4205d56cd89c06e293031d57700e67ee17bc9382db19d11ac07a
|
@@ -39,14 +39,17 @@ Example:
|
|
39
39
|
</category>
|
40
40
|
<category name="Comandos">
|
41
41
|
<block type="forall"></block>
|
42
|
+
<block type="not"></block>
|
42
43
|
</category>
|
43
|
-
<category name="Individuos
|
44
|
+
<category name="Individuos">
|
44
45
|
<block type="IndividuoSelector"></block>
|
46
|
+
</category>
|
47
|
+
<category name="Variables">
|
45
48
|
<block type="VariableSelector"></block>
|
46
49
|
</category>
|
47
|
-
<category name="Mis
|
50
|
+
<category name="Mis condiciones" custom="PROCEDURE_CALLS">
|
48
51
|
</category>
|
49
|
-
<category name="
|
52
|
+
<category name="Condiciones">
|
50
53
|
<block type="procedures_defnoreturn"></block>
|
51
54
|
</category>
|
52
55
|
<category name="Asignación">
|
@@ -4328,7 +4331,7 @@ Blockly.CUSTOM_COLORS.variable = Blockly.MUMUKI_COLORS.blue;
|
|
4328
4331
|
Blockly.CUSTOM_COLORS.parameter = Blockly.MUMUKI_COLORS.blue;
|
4329
4332
|
Blockly.CUSTOM_COLORS.primitiveFunction = Blockly.MUMUKI_COLORS.blue;
|
4330
4333
|
Blockly.CUSTOM_COLORS.function_call = Blockly.MUMUKI_COLORS.blue;
|
4331
|
-
|
4334
|
+
|
4332
4335
|
/**
|
4333
4336
|
* Create the svg representation of a block and render
|
4334
4337
|
* @name {!string} name of the parameter.
|
@@ -4847,7 +4850,7 @@ Blockly.Blocks.fact1 = {
|
|
4847
4850
|
type: "field_input",
|
4848
4851
|
name: 'Nombre',
|
4849
4852
|
text: 'Nombre'
|
4850
|
-
},
|
4853
|
+
},
|
4851
4854
|
{
|
4852
4855
|
type: 'input_value',
|
4853
4856
|
name: 'PrimerIndividuo'
|
@@ -4871,8 +4874,8 @@ Blockly.Blocks.fact2 = {
|
|
4871
4874
|
{
|
4872
4875
|
type: "field_input",
|
4873
4876
|
name: 'Nombre',
|
4874
|
-
text: 'Nombre'
|
4875
|
-
},
|
4877
|
+
text: 'Nombre'
|
4878
|
+
},
|
4876
4879
|
{
|
4877
4880
|
type: 'input_value',
|
4878
4881
|
name: 'PrimerIndividuo'
|
@@ -4901,7 +4904,7 @@ Blockly.Blocks.fact3 = {
|
|
4901
4904
|
type: "field_input",
|
4902
4905
|
name: 'Nombre',
|
4903
4906
|
text: 'Nombre'
|
4904
|
-
},
|
4907
|
+
},
|
4905
4908
|
{
|
4906
4909
|
type: 'input_value',
|
4907
4910
|
name: 'PrimerIndividuo'
|
@@ -4922,6 +4925,26 @@ Blockly.Blocks.fact3 = {
|
|
4922
4925
|
}
|
4923
4926
|
};
|
4924
4927
|
|
4928
|
+
Blockly.Blocks.not = {
|
4929
|
+
init: function () {
|
4930
|
+
this.jsonInit({
|
4931
|
+
message0: 'No %1',
|
4932
|
+
type: "Statement",
|
4933
|
+
previousStatement: "Statement",
|
4934
|
+
nextStatement: "Statement",
|
4935
|
+
args0: [
|
4936
|
+
{
|
4937
|
+
type: 'input_statement',
|
4938
|
+
name: 'PrimeraCondicion'
|
4939
|
+
}
|
4940
|
+
],
|
4941
|
+
colour: Blockly.CUSTOM_COLORS.Not || Blockly.CUSTOM_COLORS.primitiveCommand,
|
4942
|
+
tooltip: 'Niega la condición',
|
4943
|
+
inputsInline: true
|
4944
|
+
});
|
4945
|
+
}
|
4946
|
+
};
|
4947
|
+
|
4925
4948
|
Blockly.Blocks.forall = {
|
4926
4949
|
init: function () {
|
4927
4950
|
this.jsonInit({
|
@@ -5364,7 +5387,6 @@ Blockly.Blocks.variables_get = {
|
|
5364
5387
|
}
|
5365
5388
|
};
|
5366
5389
|
|
5367
|
-
Blockly.Blocks.not = createSingleParameterExpressionBlock('no','Bool');
|
5368
5390
|
Blockly.Blocks.siguiente = createSingleParameterExpressionBlock('siguiente','*');
|
5369
5391
|
Blockly.Blocks.previo = createSingleParameterExpressionBlock('previo','*');
|
5370
5392
|
Blockly.Blocks.opuesto = createSingleParameterExpressionBlock('opuesto','*');
|
@@ -5470,7 +5492,7 @@ function callGenerator(name, args = [], newLine, order) {
|
|
5470
5492
|
|
5471
5493
|
function uncapitalize(text) {
|
5472
5494
|
if(!text || typeof text !== "string") {
|
5473
|
-
return '';
|
5495
|
+
return '';
|
5474
5496
|
}
|
5475
5497
|
return text.charAt(0).toLowerCase() + text.substr(1);
|
5476
5498
|
}
|
@@ -5514,6 +5536,27 @@ function forallBlockCodeGenerator(procName, args, newLine) {
|
|
5514
5536
|
}
|
5515
5537
|
window.forallBlockCodeGenerator = forallBlockCodeGenerator;
|
5516
5538
|
|
5539
|
+
function notBlockCodeGenerator(procName, args, newLine) {
|
5540
|
+
return function (block) {
|
5541
|
+
var code = "\n" + procName + '(';
|
5542
|
+
var sep = '';
|
5543
|
+
debugger;
|
5544
|
+
args.forEach(function (arg) {
|
5545
|
+
var statementCode = Blockly.PrologLanguage.statementToCode(block, arg, false);
|
5546
|
+
if(statementCode.split("\n").length > 2) {
|
5547
|
+
code += sep + "(" + Blockly.PrologLanguage.statementToCode(block, arg, false).replace(/\n/g, "").replace(". ", ",") + ")";
|
5548
|
+
} else {
|
5549
|
+
code += sep + statementCode.replace("\n", "");
|
5550
|
+
}
|
5551
|
+
sep = ', ';
|
5552
|
+
});
|
5553
|
+
code += newLine ? ').\n' : ').';
|
5554
|
+
code = code.replace(/\.,/g, ',').replace(/\.\)/g, ')');
|
5555
|
+
return code;
|
5556
|
+
};
|
5557
|
+
// return callGenerator(procName, args, true);
|
5558
|
+
}
|
5559
|
+
window.forallBlockCodeGenerator = forallBlockCodeGenerator;
|
5517
5560
|
/**
|
5518
5561
|
* Retorna la funcion que genera el codigo para un bloque tipo function(arg1, arg2, ...)
|
5519
5562
|
*/
|
@@ -5751,6 +5794,7 @@ Blockly.PrologLanguage.fact1 = factBlockCodeGenerator('fact', ['PrimerIndividuo'
|
|
5751
5794
|
Blockly.PrologLanguage.fact2 = factBlockCodeGenerator('fact', ['PrimerIndividuo', 'SegundoIndividuo']);
|
5752
5795
|
Blockly.PrologLanguage.fact3 = factBlockCodeGenerator('fact', ['PrimerIndividuo', 'SegundoIndividuo', 'TercerIndividuo']);
|
5753
5796
|
Blockly.PrologLanguage.forall = forallBlockCodeGenerator('forall', ['PrimeraCondicion', 'SegundaCondicion']);
|
5797
|
+
Blockly.PrologLanguage.not = notBlockCodeGenerator('not', ['PrimeraCondicion']);
|
5754
5798
|
|
5755
5799
|
Blockly.PrologLanguage.ComandoCompletar = b => 'BOOM("El programa todavía no está completo")\n';
|
5756
5800
|
Blockly.PrologLanguage.ExpresionCompletar = b => ['boom("El programa todavía no está completo")',Blockly.PrologLanguage.ORDER_FUNCTION_CALL];
|
@@ -5809,7 +5853,6 @@ Blockly.PrologLanguage.OperadorLogico = function(block) {
|
|
5809
5853
|
return [code, order];
|
5810
5854
|
};
|
5811
5855
|
|
5812
|
-
Blockly.PrologLanguage.not = exprParamsBlockCodeGenerator('not',['VALUE']);
|
5813
5856
|
Blockly.PrologLanguage.siguiente = exprParamsBlockCodeGenerator('siguiente',['VALUE']);
|
5814
5857
|
Blockly.PrologLanguage.previo = exprParamsBlockCodeGenerator('previo',['VALUE']);
|
5815
5858
|
Blockly.PrologLanguage.opuesto = exprParamsBlockCodeGenerator('opuesto',['VALUE']);
|
@@ -5939,7 +5982,7 @@ Blockly.PrologLanguage.procedures_defnoreturn = function (block) {
|
|
5939
5982
|
var body2 = body_lines.split("\n").slice(1).join(",\n") + '.';
|
5940
5983
|
var body_final = body2.replace(/\.\./g, ".").replace(/\.,/g, ",");
|
5941
5984
|
|
5942
|
-
var code = name + '(' + makeParameterList(block) + ')' + ':- \n' + body_final + '\n';
|
5985
|
+
var code = name + '(' + makeParameterList(block) + ')' + ':- \n' + body_final + '\n';
|
5943
5986
|
|
5944
5987
|
code = Blockly.PrologLanguage.scrub_(block, code);
|
5945
5988
|
Blockly.PrologLanguage.definitions_[procName] = code;
|
@@ -5949,7 +5992,7 @@ Blockly.PrologLanguage.procedures_defnoreturn = function (block) {
|
|
5949
5992
|
|
5950
5993
|
Blockly.PrologLanguage.procedures_defnoreturn_nobody = function (block) {
|
5951
5994
|
var name = formatCallName(block.getFieldValue('NAME'),false);
|
5952
|
-
var code = name + '(' + makeParameterList(block) + ').';
|
5995
|
+
var code = name + '(' + makeParameterList(block) + ').';
|
5953
5996
|
code = Blockly.PrologLanguage.scrub_(block, code);
|
5954
5997
|
Blockly.PrologLanguage.definitions_[name] = code;
|
5955
5998
|
return null;
|
@@ -7054,4 +7097,5 @@ Blockly.ErrorInforming.CssContent = [
|
|
7054
7097
|
}
|
7055
7098
|
});
|
7056
7099
|
</script>
|
7057
|
-
</dom-module
|
7100
|
+
</dom-module>
|
7101
|
+
</body></html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prolog-blockly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|