This question about Flex gives an example of a nonblock do-loop in fortran:
DO 20 I=1, N ! line 1
DO 20 J=1, N ! line 2
! more codes
20 CONTINUE ! line 4
As the question elaborates, on line 4 the label 20 serves as the end of both the inner and outer DO
loop. Ideally a Jflex program parsing this will output two ENDDO
terminals when it sees the last 20.
I've tried the method detailed in the answer to the above function, but Jflex doesn't appear to insert code after the %%
sign into the yylex
function like Flex does according to that answer.
How can something like this be implemented in Jflex? More generally, how can Jflex return two terminals from one action?