%{ #define set_estado(x) BEGIN(_stack[_i]=x) #define push_to_stack(x) _stack[++_i]=YY_START; set_estado(x) #define pop_back set_estado(_stack[--_i]) #include #include #define MAX 1000 int _i=0; int j=0,i=0; int _stack[MAX]; int cont_not=1; int cont_pag=1; int cont_subtit3=0; int cont_link=1; int cont_lado=1; /* e1 - inicial e2 - pagina e5 - em e6 - nota e10 - subtit3 e11 - texto e12 - centrado e13 - realce_centrado e14 - realce e15 - italico e16 - lista e18 - parbox e21 - minipage e23 - centrado_realce e24 - centrado_italico e25 - realce_italico e26 - matematica e27 - mudar e28 - grande_asterisco e29 - aspas e30 - small e31 - displaymat e32 - lado e33 - mbox e34 - subtit4 */ %} PALAVRA [a-zA-Z&0-9\[\]]+ BLANK [ \t\n] PONTUACAO [:\.;',?!\-_=] TEXTO ({BLANK}*{PALAVRA}{BLANK}*{PONTUACAO}*{BLANK}*{PONTUACAO}*)+ NUMINT [0-9]+ NUMREAL {NUMINT}\.{NUMINT} BIBS (\\[a-z]+) %Start e1 e2 e3 e4 e5 e6 e7 sair e8 e9 e10 e11 e12 e13 e14 e15 e16 e17 e18 e19 e20 e21 e22 e23 e24 e25 e26 e27 e28 e29 e30 e31 e32 e33 e34 %% set_estado(e1); \\c{NUMINT} yyless(2); (\\novapagina)|(\\newpage) { switch(cont_pag){ case 29 : printf("\n\n"); default: printf("\n\n"); } cont_pag++; } \\mudar\{ {printf("\n\n[\n"); push_to_stack(e27);} \} {printf("]\n\n"); pop_back;} \\\\ {printf(" ");} \\mbox\{ push_to_stack(e33); \} pop_back; \ {printf(""); push_to_stack(e26);} \<\/matematica\> {printf(""); pop_back;} \{\\huge {printf("\n\n"); push_to_stack(e28);} \} {printf("\n\n"); pop_back;} \{\\em push_to_stack(e5); \} pop_back; ((\)|(\\notatx\{)) {printf("\n\n \n",cont_not, cont_not); cont_not++; push_to_stack(e6); } ((\)|(\})) { printf("\n\n\n"); pop_back;} \{\\small {printf("\n\n \n"); push_to_stack(e30);} \} {printf("\n\n\n"); pop_back;} \\lado\{ {printf("["); push_to_stack(e32);} \ ; ((\\notamk{BLANK}*\})|(\})) {printf("]"); pop_back;} \\begin\{minipage\}\{9cm\} ; \\end\{minipage\} ; \\begin\{flushright\} ; \\end\{flushright\} ; %%