Skip to content

Commit

Permalink
Merge pull request #39 from JMU-CS/dev
Browse files Browse the repository at this point in the history
Bug fixes from first sync session
  • Loading branch information
ChrisMayfield authored Aug 8, 2024
2 parents f4917a8 + 43985cf commit 2f67dfc
Show file tree
Hide file tree
Showing 15 changed files with 855 additions and 820 deletions.
84 changes: 84 additions & 0 deletions archive/StringFunc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* blocks2tree.js */

praxlyGenerator['praxly_StringFunc_block'] = (block) => {
const expression = block.getInputTargetBlock('EXPRESSION');
var procedureName = block.getFieldValue('FUNCTYPE');
var args = block.getInputTargetBlock('PARAMS');
var argschildren = args.getChildren(true);
var argsList = [];
argschildren.forEach(element => {
argsList.push(praxlyGenerator[element.type](element));
});
return customizeMaybe(block, {
blockID: block.id,
type: NODETYPES.SPECIAL_STRING_FUNCCALL,
left: praxlyGenerator[expression.type](expression),
right: {
name: procedureName,
args: argsList,
type: NODETYPES.FUNCCALL
}
});
}

/* newBlocks.js */

a = [
{ // text 1
"type": "praxly_StringFunc_block",
"message0": "%1.%2(%3)",
"args0": [
{
"type": "input_value",
"name": "EXPRESSION"
},
{
"type": "field_dropdown",
"name": "FUNCTYPE",
"options": [
["charAt", StringFuncs.CHARAT],
["contains", StringFuncs.CONTAINS],
['indexOf', StringFuncs.INDEXOF],
["length", StringFuncs.LENGTH],
["substring", StringFuncs.SUBSTRING],
["toLowerCase", StringFuncs.TOLOWERCSE],
["toUpperCase", StringFuncs.TOUPPERCASE],
]
},
{
"type": "input_value",
"name": "PARAMS",
"text": "params"
},
],
"inputsInline": true,
"output": null,
"style": 'other_blocks',
"tooltip": "String methods:\ncharAt(i) - Returns the character at index i\ncontains(s) - Returns true if s is a substring\nindexOf(s) - Returns the first index of substring s, or -1 if not found\nlength() - Returns the length of the string\nsubstring(i, j) - Extracts characters from index i up to but not including index j\ntoLowerCase() - Converts the string to all lowercase\ntoUpperCase() - Converts the string to all uppercase",
"helpUrl": ""
},
]

/* toolbox.js */

b = [
{
'kind': 'block',
'type': 'praxly_StringFunc_block',
'inputs': {
'EXPRESSION': {
'shadow': {
'type': 'praxly_literal_block',
'fields': {
'LITERAL': '\"hello, world\"',
}
},
},
'PARAMS': {
'block': {
'type': 'praxly_parameter_block',
}
}
}
},
]
File renamed without changes.
74 changes: 74 additions & 0 deletions archive/oldBlocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{ // not used
"type": "praxly_null_block",
"message0": "null",
"inputsInline": true,
"output": null,
"style": 'expression_blocks',
"tooltip": "",
"helpUrl": ""
},

{ // not used
"type": "praxly_class_block",
"message0": "class %1 %2 end class",
"args0": [
{
"type": "input_dummy"
},
{
"type": "input_statement",
"name": "class"
}
],
"inputsInline": true,
"previousStatement": null,
"nextStatement": null,
"style": "class_blocks",
"tooltip": "",
"helpUrl": ""
},

{ // not used
"type": "praxly_String_block",
"message0": "\"%1\"",
"args0": [
{
"type": "field_input",
"name": "LITERAL",
"text": "String"
}
],
"output": null,
"style": 'expression_blocks',
"tooltip": "",
"helpUrl": ""
},

{ // not used
"type": "custom_operation_block",
"message0": "Custom Operation %1 %2",
"args0": [
{
"type": "input_value",
"name": "input1",
"check": "Number",
"align": "RIGHT",
"defaultType": "math_number",
"defaultValue": 5
},
{
"type": "input_value",
"name": "input2",
"check": "Number",
"align": "RIGHT",
"defaultType": "math_number",
"defaultValue": 10
}
],
"output": "Number",
"colour": 230,
"tooltip": "Perform custom operation",
"helpUrl": ""
}
]
8 changes: 4 additions & 4 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ <h3>Example Programs</h2>
<table id="Variable-table-outer">
<thead>
<tr>
<td>Variable Name</td>
<td>Type</td>
<td>Value</td>
<td>Scope</td>
<th>Variable</th>
<th>Type</th>
<th>Value</th>
<th>Scope</th>
</tr>
</thead>
<tbody id="Variable-table"></tbody>
Expand Down
8 changes: 8 additions & 0 deletions public/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -980,3 +980,11 @@ body:not(.embed)>#embed-toolbar {
z-index: 3;
background-color: rgba(0, 255, 0, 0.2);
}

.return-step {
position: absolute;
/* The active line highlight has a z-index of 2. This marker must appear
* above that. */
z-index: 3;
background-color: rgba(255, 255, 255, 0.5);
}
Loading

0 comments on commit 2f67dfc

Please sign in to comment.