blockly 11.0.0-beta.4 → 11.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.js +22 -0
- package/blockly.min.js +572 -508
- package/blockly_compressed.js +494 -467
- package/blockly_compressed.js.map +1 -1
- package/blocks.js +22 -0
- package/blocks_compressed.js +29 -27
- package/blocks_compressed.js.map +1 -1
- package/browser.js +30 -0
- package/core/block.d.ts +3 -10
- package/core/block_dragger.d.ts +10 -10
- package/core/block_svg.d.ts +32 -5
- package/core/blockly.d.ts +38 -3
- package/core/clipboard.d.ts +19 -0
- package/core/{insertion_marker_previewer.d.ts → connection_previewers/insertion_marker_previewer.d.ts} +3 -3
- package/core/events/events_click.d.ts +1 -1
- package/core/field_angle.d.ts +208 -0
- package/core/field_colour.d.ts +243 -0
- package/core/field_dropdown.d.ts +0 -1
- package/core/field_image.d.ts +1 -1
- package/core/field_multilineinput.d.ts +182 -0
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +0 -2
- package/core/grid.d.ts +9 -9
- package/core/icons/comment_icon.d.ts +3 -3
- package/core/icons/icon.d.ts +6 -0
- package/core/icons/icon_types.d.ts +2 -2
- package/core/icons/mutator_icon.d.ts +16 -1
- package/core/icons/warning_icon.d.ts +1 -1
- package/core/inputs/input.d.ts +19 -10
- package/core/interfaces/i_has_bubble.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +0 -7
- package/core/interfaces/i_procedure_model.d.ts +0 -7
- package/core/options.d.ts +0 -1
- package/core/renderers/common/drawer.d.ts +7 -0
- package/core/renderers/measurables/icon.d.ts +5 -0
- package/core/renderers/minimalist/constants.d.ts +21 -0
- package/core/renderers/minimalist/drawer.d.ts +26 -0
- package/core/renderers/minimalist/info.d.ts +35 -0
- package/core/renderers/minimalist/minimalist.d.ts +12 -0
- package/core/renderers/minimalist/renderer.d.ts +48 -0
- package/core/serialization/procedures.d.ts +26 -28
- package/core/utils/dom.d.ts +9 -0
- package/core/utils/keycodes.d.ts +32 -32
- package/core/utils/size.d.ts +0 -10
- package/core/utils/string.d.ts +10 -0
- package/core/workspace_svg.d.ts +27 -0
- package/core-browser.js +26 -0
- package/core.js +26 -0
- package/dart.d.ts +24 -1
- package/dart.js +22 -0
- package/dart_compressed.js +68 -18
- package/dart_compressed.js.map +1 -1
- package/generators/dart/colour.d.ts +16 -0
- package/generators/dart/dart_generator.d.ts +17 -17
- package/generators/dart/text.d.ts +1 -0
- package/generators/javascript/colour.d.ts +16 -0
- package/generators/javascript/javascript_generator.d.ts +35 -34
- package/generators/javascript/text.d.ts +1 -0
- package/generators/lua/colour.d.ts +16 -0
- package/generators/lua/lua_generator.d.ts +10 -10
- package/generators/lua/text.d.ts +1 -0
- package/generators/php/colour.d.ts +16 -0
- package/generators/php/php_generator.d.ts +36 -36
- package/generators/php/text.d.ts +1 -0
- package/generators/python/colour.d.ts +16 -0
- package/generators/python/python_generator.d.ts +21 -20
- package/generators/python/text.d.ts +1 -0
- package/index.js +7 -19
- package/javascript.d.ts +41 -1
- package/javascript.js +23 -0
- package/javascript_compressed.js +49 -14
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +18 -1
- package/lua.js +22 -0
- package/lua_compressed.js +40 -18
- package/lua_compressed.js.map +1 -1
- package/msg/constants.d.ts +14 -0
- package/msg/msg.d.ts +440 -0
- package/msg/qqq.d.ts +14 -0
- package/msg/synonyms.d.ts +14 -0
- package/node.js +21 -0
- package/package.json +11 -45
- package/php.d.ts +43 -1
- package/php.js +22 -0
- package/php_compressed.js +43 -10
- package/php_compressed.js.map +1 -1
- package/python.d.ts +27 -1
- package/python.js +23 -0
- package/python_compressed.js +37 -18
- package/python_compressed.js.map +1 -1
- package/core/comments/comment_view.d.ts +0 -200
- package/core/comments/workspace_comment.d.ts +0 -94
- package/core/comments.d.ts +0 -8
- package/core/interfaces/i_comment_icon.d.ts +0 -17
- package/core-node.js +0 -31
- package/media/arrow-dropdown.svg +0 -1
- package/media/resize-handle.svg +0 -3
- package/msg/ce.d.ts +0 -8
- package/msg/dtp.d.ts +0 -8
- package/msg/hsb.d.ts +0 -8
- package/msg/tdd.d.ts +0 -8
package/python.d.ts
CHANGED
|
@@ -4,4 +4,30 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export enum Order {
|
|
8
|
+
ATOMIC = 0, // 0 "" ...
|
|
9
|
+
COLLECTION = 1, // tuples, lists, dictionaries
|
|
10
|
+
STRING_CONVERSION = 1, // `expression...`
|
|
11
|
+
MEMBER = 2.1, // . []
|
|
12
|
+
FUNCTION_CALL = 2.2, // ()
|
|
13
|
+
EXPONENTIATION = 3, // **
|
|
14
|
+
UNARY_SIGN = 4, // + -
|
|
15
|
+
BITWISE_NOT = 4, // ~
|
|
16
|
+
MULTIPLICATIVE = 5, // * / // %
|
|
17
|
+
ADDITIVE = 6, // + -
|
|
18
|
+
BITWISE_SHIFT = 7, // << >>
|
|
19
|
+
BITWISE_AND = 8, // &
|
|
20
|
+
BITWISE_XOR = 9, // ^
|
|
21
|
+
BITWISE_OR = 10, // |
|
|
22
|
+
RELATIONAL = 11, // in, not in, is, is not, >, >=, <>, !=, ==
|
|
23
|
+
LOGICAL_NOT = 12, // not
|
|
24
|
+
LOGICAL_AND = 13, // and
|
|
25
|
+
LOGICAL_OR = 14, // or
|
|
26
|
+
CONDITIONAL = 15, // if else
|
|
27
|
+
LAMBDA = 16, // lambda
|
|
28
|
+
NONE = 99, // (...)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare const pythonGenerator: any;
|
|
32
|
+
|
|
33
|
+
export {PythonGenerator} from './generators/python';
|
package/python.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
;(function(root, factory) {
|
|
3
|
+
if (typeof define === 'function' && define.amd) { // AMD
|
|
4
|
+
define(['./core', './python_compressed.js'], factory);
|
|
5
|
+
} else if (typeof exports === 'object') { // Node.js
|
|
6
|
+
module.exports = factory(require('./core'), require('./python_compressed.js'));
|
|
7
|
+
} else { // Browser
|
|
8
|
+
root.BlocklyPython = factory(root.Blockly, root.BlocklyPython);
|
|
9
|
+
}
|
|
10
|
+
}(this, function(Blockly, BlocklyPython) {
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright 2020 Google LLC
|
|
14
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Python generator module; just a wrapper for
|
|
19
|
+
* python_compressed.js.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
return BlocklyPython;
|
|
23
|
+
}));
|
package/python_compressed.js
CHANGED
|
@@ -12,10 +12,29 @@
|
|
|
12
12
|
}
|
|
13
13
|
}(this, function(__parent__) {
|
|
14
14
|
var $=__parent__.__namespace__;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var colour_picker$$module$build$src$generators$python$colour=function(a,b){return[b.quote_(a.getFieldValue("COLOUR")),Order$$module$build$src$generators$python$python_generator.ATOMIC]},colour_random$$module$build$src$generators$python$colour=function(a,b){b.definitions_.import_random="import random";return["'#%06x' % random.randint(0, 2**24 - 1)",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},colour_rgb$$module$build$src$generators$python$colour=function(a,b){const c=
|
|
16
|
+
b.provideFunction_("colour_rgb",`
|
|
17
|
+
def ${b.FUNCTION_NAME_PLACEHOLDER_}(r, g, b):
|
|
18
|
+
r = round(min(100, max(0, r)) * 2.55)
|
|
19
|
+
g = round(min(100, max(0, g)) * 2.55)
|
|
20
|
+
b = round(min(100, max(0, b)) * 2.55)
|
|
21
|
+
return '#%02x%02x%02x' % (r, g, b)
|
|
22
|
+
`),d=b.valueToCode(a,"RED",Order$$module$build$src$generators$python$python_generator.NONE)||0,e=b.valueToCode(a,"GREEN",Order$$module$build$src$generators$python$python_generator.NONE)||0;a=b.valueToCode(a,"BLUE",Order$$module$build$src$generators$python$python_generator.NONE)||0;return[c+"("+d+", "+e+", "+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},colour_blend$$module$build$src$generators$python$colour=function(a,b){const c=b.provideFunction_("colour_blend",
|
|
23
|
+
`
|
|
24
|
+
def ${b.FUNCTION_NAME_PLACEHOLDER_}(colour1, colour2, ratio):
|
|
25
|
+
r1, r2 = int(colour1[1:3], 16), int(colour2[1:3], 16)
|
|
26
|
+
g1, g2 = int(colour1[3:5], 16), int(colour2[3:5], 16)
|
|
27
|
+
b1, b2 = int(colour1[5:7], 16), int(colour2[5:7], 16)
|
|
28
|
+
ratio = min(1, max(0, ratio))
|
|
29
|
+
r = round(r1 * (1 - ratio) + r2 * ratio)
|
|
30
|
+
g = round(g1 * (1 - ratio) + g2 * ratio)
|
|
31
|
+
b = round(b1 * (1 - ratio) + b2 * ratio)
|
|
32
|
+
return '#%02x%02x%02x' % (r, g, b)
|
|
33
|
+
`),d=b.valueToCode(a,"COLOUR1",Order$$module$build$src$generators$python$python_generator.NONE)||"'#000000'",e=b.valueToCode(a,"COLOUR2",Order$$module$build$src$generators$python$python_generator.NONE)||"'#000000'";a=b.valueToCode(a,"RATIO",Order$$module$build$src$generators$python$python_generator.NONE)||0;return[c+"("+d+", "+e+", "+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_create_empty$$module$build$src$generators$python$lists=function(a,b){return["[]",
|
|
34
|
+
Order$$module$build$src$generators$python$python_generator.ATOMIC]},lists_create_with$$module$build$src$generators$python$lists=function(a,b){const c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$python$python_generator.NONE)||"None";return["["+c.join(", ")+"]",Order$$module$build$src$generators$python$python_generator.ATOMIC]},lists_repeat$$module$build$src$generators$python$lists=function(a,b){const c=b.valueToCode(a,"ITEM",Order$$module$build$src$generators$python$python_generator.NONE)||
|
|
35
|
+
"None";a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||"0";return["["+c+"] * "+a,Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},lists_length$$module$build$src$generators$python$lists=function(a,b){return["len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"[]")+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_isEmpty$$module$build$src$generators$python$lists=
|
|
36
|
+
function(a,b){return["not len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"[]")+")",Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT]},lists_indexOf$$module$build$src$generators$python$lists=function(a,b){const c=b.valueToCode(a,"FIND",Order$$module$build$src$generators$python$python_generator.NONE)||"[]",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''";let e=" -1",f="",g=" - 1";
|
|
37
|
+
a.workspace.options.oneBasedIndex&&(e=" 0",f=" + 1",g="");return[("FIRST"===a.getFieldValue("END")?b.provideFunction_("first_index",`
|
|
19
38
|
def ${b.FUNCTION_NAME_PLACEHOLDER_}(my_list, elem):
|
|
20
39
|
try: index = my_list.index(elem)${f}
|
|
21
40
|
except: index =${e}
|
|
@@ -148,18 +167,18 @@ def ${b.FUNCTION_NAME_PLACEHOLDER_}(numbers):
|
|
|
148
167
|
"0";return[c+" % "+a,Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},math_constrain$$module$build$src$generators$python$math=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"0",d=b.valueToCode(a,"LOW",Order$$module$build$src$generators$python$python_generator.NONE)||"0";a=b.valueToCode(a,"HIGH",Order$$module$build$src$generators$python$python_generator.NONE)||"float('inf')";return["min(max("+c+", "+d+"), "+
|
|
149
168
|
a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},math_random_int$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_random="import random";const c=b.valueToCode(a,"FROM",Order$$module$build$src$generators$python$python_generator.NONE)||"0";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$python$python_generator.NONE)||"0";return["random.randint("+c+", "+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},
|
|
150
169
|
math_random_float$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_random="import random";return["random.random()",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},math_atan2$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_math="import math";const c=b.valueToCode(a,"X",Order$$module$build$src$generators$python$python_generator.NONE)||"0";return["math.atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$python$python_generator.NONE)||
|
|
151
|
-
"0")+", "+c+") / math.pi * 180",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},procedures_defreturn$$module$build$src$generators$python$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(var f of e)e=f.name
|
|
170
|
+
"0")+", "+c+") / math.pi * 180",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},procedures_defreturn$$module$build$src$generators$python$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(var f of e)e=f.name,-1===a.getVars().indexOf(e)&&c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
|
|
152
171
|
d=c.length?b.INDENT+"global "+c.join(", ")+"\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&(f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let g=b.statementToCode(a,"STACK"),h=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$python$python_generator.NONE)||"",k="";g&&h&&(k=f);h?h=b.INDENT+
|
|
153
172
|
"return "+h+"\n":g||(g=b.PASS);const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="def "+c+"("+l.join(", ")+"):\n"+d+f+e+g+k+h;d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$python$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$python$python_generator.NONE)||"None";return[c+
|
|
154
173
|
"("+d.join(", ")+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$build$src$generators$python$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+"\n"},procedures_ifreturn$$module$build$src$generators$python$procedures=function(a,b){let c="if "+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$python$python_generator.NONE)||"False")+":\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,
|
|
155
|
-
a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"None",c+=b.INDENT+"return "+a+"\n"):c+=b.INDENT+"return\n";return c},text$$module$build$src$generators$python$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$python$python_generator.ATOMIC]},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")",Order$$module$build$src$generators$python$python_generator.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
[b.provideFunction_("text_random_letter",`
|
|
174
|
+
a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"None",c+=b.INDENT+"return "+a+"\n"):c+=b.INDENT+"return\n";return c},text$$module$build$src$generators$python$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$python$python_generator.ATOMIC]},text_multiline$$module$build$src$generators$python$text=function(a,b){a=b.multiline_quote_(a.getFieldValue("TEXT"));b=-1!==a.indexOf("+")?
|
|
175
|
+
Order$$module$build$src$generators$python$python_generator.ADDITIVE:Order$$module$build$src$generators$python$python_generator.ATOMIC;return[a,b]},text_join$$module$build$src$generators$python$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$python$python_generator.ATOMIC];case 1:return a=b.valueToCode(a,"ADD0",Order$$module$build$src$generators$python$python_generator.NONE)||"''",forceString$$module$build$src$generators$python$text(a);case 2:var c=b.valueToCode(a,
|
|
176
|
+
"ADD0",Order$$module$build$src$generators$python$python_generator.NONE)||"''";a=b.valueToCode(a,"ADD1",Order$$module$build$src$generators$python$python_generator.NONE)||"''";return[forceString$$module$build$src$generators$python$text(c)[0]+" + "+forceString$$module$build$src$generators$python$text(a)[0],Order$$module$build$src$generators$python$python_generator.ADDITIVE];default:c=[];for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$python$python_generator.NONE)||
|
|
177
|
+
"''";a=b.nameDB_.getDistinctName("x",$.NameType$$module$build$src$core$names.VARIABLE);return["''.join([str("+a+") for "+a+" in ["+c.join(", ")+"]])",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]}},text_append$$module$build$src$generators$python$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.NONE)||"''";return c+" = str("+c+") + "+forceString$$module$build$src$generators$python$text(a)[0]+
|
|
178
|
+
"\n"},text_length$$module$build$src$generators$python$text=function(a,b){return["len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_isEmpty$$module$build$src$generators$python$text=function(a,b){return["not len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")",Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT]},
|
|
179
|
+
text_indexOf$$module$build$src$generators$python$text=function(a,b){const c="FIRST"===a.getFieldValue("END")?"find":"rfind",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$python$python_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$python$python_generator.ADDITIVE]:[b,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},
|
|
180
|
+
text_charAt$$module$build$src$generators$python$text=function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE","RANDOM"===c?Order$$module$build$src$generators$python$python_generator.NONE:Order$$module$build$src$generators$python$python_generator.MEMBER)||"''";switch(c){case "FIRST":return[d+"[0]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "LAST":return[d+"[-1]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "FROM_START":return a=
|
|
181
|
+
b.getAdjustedInt(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "FROM_END":return a=b.getAdjustedInt(a,"AT",1,!0),[d+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "RANDOM":return b.definitions_.import_random="import random",[b.provideFunction_("text_random_letter",`
|
|
163
182
|
def ${b.FUNCTION_NAME_PLACEHOLDER_}(text):
|
|
164
183
|
x = int(random.random() * len(text))
|
|
165
184
|
return text[x]
|
|
@@ -183,9 +202,9 @@ Order$$module$build$src$generators$python$python_generator.MEMBER],[Order$$modul
|
|
|
183
202
|
Order$$module$build$src$generators$python$python_generator.LOGICAL_OR]];this.PASS="";this.isInitialized=!1;for(const b in Order$$module$build$src$generators$python$python_generator)a=Order$$module$build$src$generators$python$python_generator[b],"string"!==typeof a&&(this["ORDER_"+b]=a);this.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip")}init(a){super.init(a);
|
|
184
203
|
this.PASS=this.INDENT+"pass\n";this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$build$src$core$names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.allDeveloperVariables$$module$build$src$core$variables(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE)+" = None");a=$.allUsedVarModels$$module$build$src$core$variables(a);
|
|
185
204
|
for(c=0;c<a.length;c++)b.push(this.getVariableName(a[c].getId())+" = None");this.definitions_.variables=b.join("\n");this.isInitialized=!0}finish(a){const b=[],c=[];for(let d in this.definitions_){const e=this.definitions_[d];e.match(/^(from\s+\S+\s+)?import\s+\S+/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+"\n"}quote_(a){a=a.replace(/\\/g,
|
|
186
|
-
"\\\\").replace(/\n/g,"\\\n");let b="'"
|
|
205
|
+
"\\\\").replace(/\n/g,"\\\n");let b="'";-1!==a.indexOf("'")&&(-1===a.indexOf('"')?b='"':a=a.replace(/'/g,"\\'"));return b+a+b}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,b,c=!1){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d+=this.prefixLines(e+"\n","# "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&
|
|
187
206
|
(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"# "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjustedInt(a,b,c=0,d=!1){a.workspace.options.oneBasedIndex&&c--;const e=a.workspace.options.oneBasedIndex?"1":"0";a=this.valueToCode(a,b,c?Order$$module$build$src$generators$python$python_generator.ADDITIVE:Order$$module$build$src$generators$python$python_generator.NONE)||e;$.isNumber$$module$build$src$core$utils$string(a)?
|
|
188
|
-
(a=parseInt(a,10)+c,d&&(a=-a)):(a=0<c?"int("+a+" + "+c+")":0>c?"int("+a+" - "+-c+")":"int("+a+")",d&&(a="-"+a));return a}},module$build$src$generators$python$python_generator={};module$build$src$generators$python$python_generator.Order=Order$$module$build$src$generators$python$python_generator;module$build$src$generators$python$python_generator.PythonGenerator=PythonGenerator$$module$build$src$generators$python$python_generator;var module$build$src$generators$python$lists={};module$build$src$generators$python$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_create_with=lists_create_with$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$python$lists;
|
|
207
|
+
(a=parseInt(a,10)+c,d&&(a=-a)):(a=0<c?"int("+a+" + "+c+")":0>c?"int("+a+" - "+-c+")":"int("+a+")",d&&(a="-"+a));return a}},module$build$src$generators$python$python_generator={};module$build$src$generators$python$python_generator.Order=Order$$module$build$src$generators$python$python_generator;module$build$src$generators$python$python_generator.PythonGenerator=PythonGenerator$$module$build$src$generators$python$python_generator;var module$build$src$generators$python$colour={};module$build$src$generators$python$colour.colour_blend=colour_blend$$module$build$src$generators$python$colour;module$build$src$generators$python$colour.colour_picker=colour_picker$$module$build$src$generators$python$colour;module$build$src$generators$python$colour.colour_random=colour_random$$module$build$src$generators$python$colour;module$build$src$generators$python$colour.colour_rgb=colour_rgb$$module$build$src$generators$python$colour;var module$build$src$generators$python$lists={};module$build$src$generators$python$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_create_with=lists_create_with$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$python$lists;
|
|
189
208
|
module$build$src$generators$python$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_length=lists_length$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_repeat=lists_repeat$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_reverse=lists_reverse$$module$build$src$generators$python$lists;
|
|
190
209
|
module$build$src$generators$python$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_sort=lists_sort$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_split=lists_split$$module$build$src$generators$python$lists;var controls_ifelse$$module$build$src$generators$python$logic=controls_if$$module$build$src$generators$python$logic,module$build$src$generators$python$logic={};module$build$src$generators$python$logic.controls_if=controls_if$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.controls_ifelse=controls_if$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_boolean=logic_boolean$$module$build$src$generators$python$logic;
|
|
191
210
|
module$build$src$generators$python$logic.logic_compare=logic_compare$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_negate=logic_negate$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_null=logic_null$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_operation=logic_operation$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_ternary=logic_ternary$$module$build$src$generators$python$logic;var controls_repeat$$module$build$src$generators$python$loops=controls_repeat_ext$$module$build$src$generators$python$loops,module$build$src$generators$python$loops={};module$build$src$generators$python$loops.controls_flow_statements=controls_flow_statements$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_for=controls_for$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_forEach=controls_forEach$$module$build$src$generators$python$loops;
|
|
@@ -196,9 +215,9 @@ module$build$src$generators$python$math.math_round=math_single$$module$build$src
|
|
|
196
215
|
module$build$src$generators$python$procedures.procedures_defnoreturn=procedures_defreturn$$module$build$src$generators$python$procedures;module$build$src$generators$python$procedures.procedures_defreturn=procedures_defreturn$$module$build$src$generators$python$procedures;module$build$src$generators$python$procedures.procedures_ifreturn=procedures_ifreturn$$module$build$src$generators$python$procedures;var strRegExp$$module$build$src$generators$python$text=/^\s*'([^']|\\')*'\s*$/,forceString$$module$build$src$generators$python$text=function(a){return strRegExp$$module$build$src$generators$python$text.test(a)?[a,Order$$module$build$src$generators$python$python_generator.ATOMIC]:["str("+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_prompt$$module$build$src$generators$python$text=text_prompt_ext$$module$build$src$generators$python$text,module$build$src$generators$python$text=
|
|
197
216
|
{};module$build$src$generators$python$text.text=text$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_append=text_append$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_changeCase=text_changeCase$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_charAt=text_charAt$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_count=text_count$$module$build$src$generators$python$text;
|
|
198
217
|
module$build$src$generators$python$text.text_getSubstring=text_getSubstring$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_indexOf=text_indexOf$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_isEmpty=text_isEmpty$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_join=text_join$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_length=text_length$$module$build$src$generators$python$text;
|
|
199
|
-
module$build$src$generators$python$text.
|
|
200
|
-
module$build$src$generators$python$text.text_trim=text_trim$$module$build$src$generators$python$text;var module$build$src$generators$python$variables={};module$build$src$generators$python$variables.variables_get=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables.variables_set=variables_set$$module$build$src$generators$python$variables;var module$build$src$generators$python$variables_dynamic={};module$build$src$generators$python$variables_dynamic.variables_get_dynamic=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables_dynamic.variables_set_dynamic=variables_set$$module$build$src$generators$python$variables;var pythonGenerator$$module$build$src$generators$python=new PythonGenerator$$module$build$src$generators$python$python_generator;pythonGenerator$$module$build$src$generators$python.addReservedWords("math,random,Number");
|
|
201
|
-
var generators$$module$build$src$generators$python=Object.assign({},module$build$src$generators$python$lists,module$build$src$generators$python$logic,module$build$src$generators$python$loops,module$build$src$generators$python$math,module$build$src$generators$python$procedures,module$build$src$generators$python$text,module$build$src$generators$python$variables,module$build$src$generators$python$variables_dynamic);
|
|
218
|
+
module$build$src$generators$python$text.text_multiline=text_multiline$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_print=text_print$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_prompt=text_prompt_ext$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_prompt_ext=text_prompt_ext$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_replace=text_replace$$module$build$src$generators$python$text;
|
|
219
|
+
module$build$src$generators$python$text.text_reverse=text_reverse$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_trim=text_trim$$module$build$src$generators$python$text;var module$build$src$generators$python$variables={};module$build$src$generators$python$variables.variables_get=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables.variables_set=variables_set$$module$build$src$generators$python$variables;var module$build$src$generators$python$variables_dynamic={};module$build$src$generators$python$variables_dynamic.variables_get_dynamic=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables_dynamic.variables_set_dynamic=variables_set$$module$build$src$generators$python$variables;var pythonGenerator$$module$build$src$generators$python=new PythonGenerator$$module$build$src$generators$python$python_generator;pythonGenerator$$module$build$src$generators$python.addReservedWords("math,random,Number");
|
|
220
|
+
var generators$$module$build$src$generators$python=Object.assign({},module$build$src$generators$python$colour,module$build$src$generators$python$lists,module$build$src$generators$python$logic,module$build$src$generators$python$loops,module$build$src$generators$python$math,module$build$src$generators$python$procedures,module$build$src$generators$python$text,module$build$src$generators$python$variables,module$build$src$generators$python$variables_dynamic);
|
|
202
221
|
for(const a in generators$$module$build$src$generators$python)pythonGenerator$$module$build$src$generators$python.forBlock[a]=generators$$module$build$src$generators$python[a];var module$build$src$generators$python={};module$build$src$generators$python.Order=Order$$module$build$src$generators$python$python_generator;module$build$src$generators$python.PythonGenerator=PythonGenerator$$module$build$src$generators$python$python_generator;module$build$src$generators$python.pythonGenerator=pythonGenerator$$module$build$src$generators$python;
|
|
203
222
|
module$build$src$generators$python.__namespace__=$;
|
|
204
223
|
return module$build$src$generators$python;
|