forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LANGUAGE] Adds new exception to catch the use of
at
in level 16+ (h…
…edyorg#3831) **Description** Fixes issue hedyorg#3800 so now if a student attempts to use 'at random' in either a print statement or an expression or just by itself (fruit at random), an informative message will tell them to use 'list_name[random]' instead. **How to test** Added some test cases to test for "print fruits at random," "x = fruits at random," and "x is fruits at random" **Checklist** Done? Check if you have it all in place using this list:* - [ ] Contains one of the PR categories in the name - [ ] Describes changes in the format above - [ ] Links to an existing issue or discussion - [ ] Has a "How to test" section If you're unsure about any of these, don't hesitate to ask. We're here to help!
- Loading branch information
Showing
6 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
// adds list access with numbers and brackets | ||
command:+= change_list_item | ||
// TODO for tomorrow: this stills needs tests in level 16 for > and != | ||
command:+= change_list_item | ||
|
||
?comparison_arg: var_access | text_in_quotes | NUMBER | list_access | ||
|
||
?atom: NUMBER | _MINUS NUMBER | var_access | list_access | text_in_quotes | ||
list_access: var_access _LEFT_SQUARE_BRACKET (INT | random | var_access) _RIGHT_SQUARE_BRACKET | ||
change_list_item: var_access _LEFT_SQUARE_BRACKET (INT | var_access) _RIGHT_SQUARE_BRACKET _EQUALS (var_access | textwithoutspaces) | ||
assign_list: var (_IS | _EQUALS) _LEFT_SQUARE_BRACKET ((quoted_text | INT) (_COMMA (quoted_text | INT))*)? _RIGHT_SQUARE_BRACKET | ||
|
||
error_list_access_at: var_access _AT (INT | random) | ||
|
||
_print_argument: (_SPACE | quoted_text | list_access | error_list_access_at | expression | print_expression)* | ||
assign: var (_IS| _EQUALS) (list_access | error_list_access_at | atom | expression) | ||
error_print_no_quotes: _PRINT (textwithoutspaces | list_access | error_list_access_at | var_access) (_SPACE (textwithoutspaces | list_access | var_access))* -> error_print_nq | ||
sleep: _SLEEP (INT | list_access | error_list_access_at | var_access | expression)? | ||
turtle: _FORWARD ((NUMBER | list_access | error_list_access_at | textwithoutspaces | expression))? -> forward | _TURN ((NUMBER | list_access | error_list_access_at | textwithoutspaces | expression))? -> turn | _COLOR ((black | blue | brown | gray | green | orange | pink | purple | red | white | yellow | list_access | error_list_access_at | textwithoutspaces))? -> color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,6 +290,9 @@ msgstr "" | |
msgid "input" | ||
msgstr "" | ||
|
||
msgid "Invalid At Command" | ||
msgstr "" | ||
|
||
msgid "general" | ||
msgstr "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters