The code after how letting Yylex moves

  • Time:
  • Click:125
  • source:LENA CNC Machining
A paragraph of code that uses Lex to write is below, %% .

* Printf(" Hellon " ) ;quit Exit(0);%%main(){Yylex(); Printf(" Byen " ) below the circumstance that;} is compiling flow of the following file without thoroughly clear Lex, does if where,the Printf() after Yylex() letting when the program ends print a result? We carry out the executable document that compiles to be able to discover if it is direct that we just use Ctrl+c or Quit quits a program the program is quited in current position, the Printf from the back can be carried out far from. Solve this little problem, I use a kind of indirect method below came true it: %{#include<setjmp.

H>#include<signal.

H>jmp_buf Position;%}%% Quit Longjmp(position, 1); .

* Printf(" Hellon " ) ;%%main(){Extern Int Function(); If(setjmp(position)==1) Goto Quit; Signal(SIGINT, function); Yylex();quit: Printf(" Byen " ) ; Exit(0);}function(){Longjmp(position, 1);} above code is debugged below AIX through CNC Milling