Skip to content
Snippets Groups Projects
Verified Commit 61b7fc5e authored by Martin's avatar Martin
Browse files

fix subtle bug where a line was skipped after every block

parent 820a28b7
Branches JulioWithHashTable
No related tags found
No related merge requests found
......@@ -497,7 +497,6 @@ read_block() {
# Check if we can exit the block
if [ "$depth" -lt 0 ]; then
next_line # consume "end;"
interpreter_debug "Finished block section, consuming target '$pattern'"
return 0
elif [ "$depth" -le 0 ] && echo "$block_line" | grep "$pattern" >/dev/null; then
# Don't consume custom targets
......@@ -553,6 +552,7 @@ interpret() {
while test_predicate "$predicate"; do
call_self "$path"
done
interpret && return
;;
"if "*)
path="$(get_block_name "if")"
......@@ -582,11 +582,13 @@ interpret() {
done
# Delete last generated executable if it's blank
[ -z "$(cat "$path")" ] && rm "$path"
interpret && return
;;
"function "*)
name="$(echo "$line" | trim_line | sed 's/function \(.*\) do/\1/')"
[ -z "$name" ] && interpreter_die "Invalid function name '$name'"
read_block > "$FULL_PATH/$name.$EXTENSION"
interpret && return
;;
"set "*)
set_var "$(echo "$line" | nth_arg 2)" "$(evaluate_format "$(echo "$line" | nth_arg 3-)")"
......@@ -614,7 +616,7 @@ interpret() {
# Start
if [ "$TIME_EXECUTION" -eq 0 ]; then
interpret
debug "Done"
interpreter_debug "Done"
else
start="$(get_millis)"
interpret
......
clear X;
incr X;
incr X;
incr X;
while X not 0 do;
decr X;
end;
debug X;
\ No newline at end of file
clear X;
incr X;
incr X;
clear Y;
incr Y;
incr Y;
incr Y;
clear Z;
while X not 0 do;
clear W;
while Y not 0 do;
incr Z;
incr W;
decr Y;
end;
while W not 0 do;
incr Y;
decr W;
end;
decr X;
end;
debug X;
debug Y;
debug Z;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment