-
Notifications
You must be signed in to change notification settings - Fork 10
Design Decisions
Majeed Kazemitabaar edited this page Jun 4, 2021
·
9 revisions
- Left/Right: will move to the closest editable character/code-construct. moves into text-editable code-constructs.
- Up/Down: will work similar to clicking on the position above or below the current position.
- Selectables: will only select holes and nothing else will be selected. Selection will be done through another mechanism discussed later.
- Editable code-constructs: will move the cursor to the clicked position.
- Non-editable code-constructs: if clicked on the first half of the code-construct, will go to the beginning, o.w. to the end of it.
-
Main code-constructs:
for,if,else,elif, andwhilewill be added simply by clicking -
Expressions:
--- + ---,--- and ---,--- >= --- - Working with variables:
- Working with lists:
- Function/Method calls:
- The toolbox can also be aware of the user's focus (in the AST) and disable completely invalid buttons (e.g. disabling the for loop button when the user is inside the condition of an if statement)
When filling in expressions, sometimes the user might start with an incorrect type (e.g. a number in a condition). In these cases, the system will automatically move into draft mode, becoming yellow but allowing the user to finalize their edit so that the final expression would evaluate into the required type.
With the help of the suggestion system the user is able to add code-constructs, call functions, create variables, fill-in expressions and more. This will also ensure that no incorrect characters are inputted.
Based on where the user is, we will be able to suggest different statements, expressions and etc.:
- code constructs:
if,for,while,def, andclass(if validated,elseandelifcould be possible options) - variable definition (e.g.
player_name = ---) - calling functions that do not return anything and do not update the state of anything (note that we can call other functions that return things, but we have to give a warning to the user and let them know that the returned value is not being used)
- a
returnstatement (e.g.return ---) - accessing a variable to:
-- reassign its value (such as
points = 0orpoints[player] = 0) -- update its value (using the+=,-=,*=,/=operators) -- calling a method on it (such asplayers.append(---))
- Literals
-- Numbers (integers and floating points, validated by:
'^(([0-9]*)|(([0-9]*)\\.([0-9]*)))$') -- String (almost anything except new line characters and the double quote character itself, validated by:'^([^\\r\\n\\"]*)$') -- Boolean (TrueandFalsewhich need to be typed exactly like that.) - Accessing identifiers:
-- variables (e.g.
print(---)=>print(player_name)) -- member of a list (e.g.print(---)=>print(players[player_id])) - lists
- function calls that return something (e.g.
range()andlen()) - unary operators (
+and-) - binary operators after an existing left operand/expression (e.g.
... + b)
- visual indicators in empty lists, or empty function definitions to let the user know that they can add more items to the list, or more arguments