mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
implemented return by rewriting interpreter result
This commit is contained in:
parent
4496875ba3
commit
dee73dea20
16 changed files with 191 additions and 239 deletions
114
lox.t/run.t
114
lox.t/run.t
|
|
@ -1,20 +1,7 @@
|
|||
$ for lox_file in *.lox **/*.lox; do
|
||||
> mlox $lox_file || echo $lox_file failed
|
||||
> done
|
||||
unexpected_character.lox failed
|
||||
string/unterminated.lox failed
|
||||
|
||||
|
||||
|
||||
file empty_file.lox
|
||||
$ mlox empty_file.lox
|
||||
|
||||
|
||||
file fib.lox
|
||||
$ mlox fib.lox
|
||||
9227465
|
||||
|
||||
|
||||
file precedence.lox
|
||||
$ mlox precedence.lox
|
||||
14
|
||||
|
|
@ -364,14 +351,6 @@ file continue/while.lox
|
|||
9
|
||||
|
||||
|
||||
file expressions/evaluate.lox
|
||||
$ mlox expressions/evaluate.lox
|
||||
|
||||
|
||||
file expressions/parse.lox
|
||||
$ mlox expressions/parse.lox
|
||||
|
||||
|
||||
file field/call_function_field.lox
|
||||
$ mlox field/call_function_field.lox
|
||||
|
||||
|
|
@ -476,7 +455,8 @@ $ mlox for/return_closure.lox
|
|||
|
||||
|
||||
file for/return_inside.lox
|
||||
$ mlox for/return_inside.lox
|
||||
$ mlox for/return_inside.lox
|
||||
i
|
||||
|
||||
|
||||
file for/scope.lox
|
||||
|
|
@ -510,7 +490,21 @@ file for/statement_initializer.lox
|
|||
|
||||
|
||||
file for/syntax.lox
|
||||
$ mlox for/syntax.lox
|
||||
$ mlox for/syntax.lox
|
||||
1
|
||||
2
|
||||
3
|
||||
0
|
||||
1
|
||||
2
|
||||
done
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
2
|
||||
0
|
||||
1
|
||||
|
||||
|
||||
file for/var_in_body.lox
|
||||
|
|
@ -538,8 +532,9 @@ file function/extra_arguments.lox
|
|||
|
||||
|
||||
file function/local_mutual_recursion.lox
|
||||
$ mlox function/local_mutual_recursion.lox
|
||||
|
||||
$ mlox function/local_mutual_recursion.lox
|
||||
RuntimeError at line 4, column 11: name "isOdd" is not defined
|
||||
[1]
|
||||
|
||||
file function/local_recursion.lox
|
||||
$ mlox function/local_recursion.lox
|
||||
|
|
@ -559,15 +554,27 @@ file function/missing_comma_in_parameters.lox
|
|||
|
||||
|
||||
file function/mutual_recursion.lox
|
||||
$ mlox function/mutual_recursion.lox
|
||||
$ mlox function/mutual_recursion.lox
|
||||
true
|
||||
true
|
||||
|
||||
|
||||
file function/nested_call_with_arguments.lox
|
||||
$ mlox function/nested_call_with_arguments.lox
|
||||
$ mlox function/nested_call_with_arguments.lox
|
||||
hello world
|
||||
|
||||
|
||||
file function/parameters.lox
|
||||
$ mlox function/parameters.lox
|
||||
$ mlox function/parameters.lox
|
||||
0
|
||||
1
|
||||
3
|
||||
6
|
||||
10
|
||||
15
|
||||
21
|
||||
28
|
||||
36
|
||||
|
||||
|
||||
file function/print.lox
|
||||
|
|
@ -577,7 +584,8 @@ file function/print.lox
|
|||
|
||||
|
||||
file function/recursion.lox
|
||||
$ mlox function/recursion.lox
|
||||
$ mlox function/recursion.lox
|
||||
21
|
||||
|
||||
|
||||
file function/too_many_arguments.lox
|
||||
|
|
@ -1079,23 +1087,29 @@ $ mlox regression/394.lox
|
|||
|
||||
|
||||
file return/after_else.lox
|
||||
$ mlox return/after_else.lox
|
||||
$ mlox return/after_else.lox
|
||||
ok
|
||||
|
||||
|
||||
file return/after_if.lox
|
||||
$ mlox return/after_if.lox
|
||||
$ mlox return/after_if.lox
|
||||
ok
|
||||
|
||||
|
||||
file return/after_while.lox
|
||||
$ mlox return/after_while.lox
|
||||
$ mlox return/after_while.lox
|
||||
ok
|
||||
|
||||
|
||||
file return/at_top_level.lox
|
||||
$ mlox return/at_top_level.lox
|
||||
|
||||
$ mlox return/at_top_level.lox
|
||||
found 1 ParserError:
|
||||
ParserError at line 1, column 0: Can use return only in functions
|
||||
[1]
|
||||
|
||||
file return/in_function.lox
|
||||
$ mlox return/in_function.lox
|
||||
$ mlox return/in_function.lox
|
||||
ok
|
||||
|
||||
|
||||
file return/in_method.lox
|
||||
|
|
@ -1103,31 +1117,8 @@ $ mlox return/in_method.lox
|
|||
|
||||
|
||||
file return/return_nil_if_no_value.lox
|
||||
$ mlox return/return_nil_if_no_value.lox
|
||||
|
||||
|
||||
file scanning/identifiers.lox
|
||||
$ mlox scanning/identifiers.lox
|
||||
|
||||
|
||||
file scanning/keywords.lox
|
||||
$ mlox scanning/keywords.lox
|
||||
|
||||
|
||||
file scanning/numbers.lox
|
||||
$ mlox scanning/numbers.lox
|
||||
|
||||
|
||||
file scanning/punctuators.lox
|
||||
$ mlox scanning/punctuators.lox
|
||||
|
||||
|
||||
file scanning/strings.lox
|
||||
$ mlox scanning/strings.lox
|
||||
|
||||
|
||||
file scanning/whitespace.lox
|
||||
$ mlox scanning/whitespace.lox
|
||||
$ mlox return/return_nil_if_no_value.lox
|
||||
nil
|
||||
|
||||
|
||||
file string/error_after_multiline.lox
|
||||
|
|
@ -1403,7 +1394,8 @@ $ mlox while/return_closure.lox
|
|||
|
||||
|
||||
file while/return_inside.lox
|
||||
$ mlox while/return_inside.lox
|
||||
$ mlox while/return_inside.lox
|
||||
i
|
||||
|
||||
|
||||
file while/syntax.lox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue