Skip to content

Commit

Permalink
add cycle statement to lex_body_statements in fixed form tokenizer (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
KGB99 authored Jul 11, 2024
1 parent 3c76586 commit bdc0210
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ RUN(NAME cycle_and_exit2 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran)
RUN(NAME cycle_and_exit3 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
RUN(NAME cycle_and_exit4 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
RUN(NAME cycle_and_exit5 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
RUN(NAME cycle_and_exit6 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)

RUN(NAME goto_01 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
RUN(NAME goto_02 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
Expand Down
16 changes: 16 additions & 0 deletions integration_tests/cycle_and_exit6.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
program cycles_stuck
implicit none

integer :: iiter, maxit
maxit = 5

do iiter = 1, maxit
if ( .true. ) then
cycle
print *, "inside loop"
end if
end do

print *, "End of program."

end
5 changes: 5 additions & 0 deletions src/lfortran/parser/fixedform_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,11 @@ struct FixedFormRecursiveDescent {
return true;
}

if (next_is(cur, "cycle")){
push_token_advance(cur, "cycle");
tokenize_line(cur);
}

if (l != -1) {
// Undo the label, as it will be handled later
undo_label(cur);
Expand Down

0 comments on commit bdc0210

Please sign in to comment.