forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel18-Additions.lark
15 lines (11 loc) · 1.19 KB
/
level18-Additions.lark
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// adds round brackets in print() and range(), and changes ask to input
command: += input | input_empty_brackets | print_empty_brackets -= ask | error_ask_no_quotes | error_print_no_quotes >> assign | call
_if_less_command: -= ask | error_ask_no_quotes | error_print_no_quotes
print: _PRINT (_LEFT_BRACKET (quoted_text | list_access | print_expression) (_COMMA (quoted_text | list_access | print_expression))* _RIGHT_BRACKET)?
print_empty_brackets: _PRINT _LEFT_BRACKET _RIGHT_BRACKET
input_empty_brackets: var (_IS | _EQUALS ) _INPUT (_LEFT_BRACKET _RIGHT_BRACKET)
input: var (_IS | _EQUALS) _INPUT (_LEFT_BRACKET ((quoted_text | list_access | print_expression) (_COMMA (quoted_text | list_access | print_expression))*) _RIGHT_BRACKET)?
for_loop: _FOR var _IN _RANGE _LEFT_BRACKET (POSITIVE_NUMBER | var_access) _COMMA (NUMBER | var_access) (_COMMA (POSITIVE_NUMBER | var_access))? _RIGHT_BRACKET _COLON _EOL (_SPACE command) (_EOL _SPACE command)* _EOL? _END_BLOCK
?print_expression: NUMBER | expression | var_access
define: _DEF function_name _LEFT_BRACKET (arguments)? _RIGHT_BRACKET _COLON _EOL _SPACE command (_EOL _SPACE command)* _EOL? _END_BLOCK
call: function_name _LEFT_BRACKET (arguments)? _RIGHT_BRACKET