Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.80 KB | None | 0 0
  1. #include "avl.h"
  2. void removeNewlineNTrim (char *);
  3. int cont = 0;
  4. AVL cidades, paises, orgs, pessoas;
  5. %}
  6. %%
  7.     BEGIN 0;
  8. SUBTYPE=\"(?i:city)\"\>             {BEGIN cidade;}
  9. SUBTYPE=\"(?i:country)\"\>          {BEGIN pais;}
  10. TYPE=\"(?i:person)\"\>              {BEGIN pessoa;}
  11. TYPE=\"(?i:organization)\"\>            {BEGIN organizacao;}
  12. <cidade,pais,organizacao,pessoa>\<\/ENAMEX\>    {BEGIN 0;}
  13.  
  14. <cidade>[^\<]+                  { removeNewlineNTrim(yytext);
  15.                           cidades = insere_avl (cidades,yytext);
  16.                         }
  17. <pais>[^\<]+                    { removeNewlineNTrim(yytext);
  18.                           paises = insere_avl (paises, yytext);
  19.                         }
  20. <organizacao>[^\<]+             { removeNewlineNTrim(yytext);
  21.                               orgs = insere_avl (orgs, yytext);
  22.                         }
  23. <pessoa>[^\<]+                  { removeNewlineNTrim(yytext);
  24.                           pessoas = insere_avl (pessoas, yytext);
  25.                         }
  26. <*>.|\n                     ;
  27.  
  28. %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement