home
%{
/* create_word_list.lex
Leyendo una documento TXT, extrayendo y contando palabras
(c) Nando Quintana Hernández 2005
*/
#include <iostream> // cout
#include <map> // map
using namespace std;
typedef map<string, long, less<string> > MAP;
MAP corpus_word_counter;
%}
%option noyywrap
%option yylineno
%option c++
%option case-insensitive
%x EN_TITULO
%x EN_TEXTO
/* Definiciones Regulares */
word [a-záéíóúÁ?Í??]*
%%
. {}
{word} { BEGIN(EN_TITULO); }
<EN_TITULO>\n\n { BEGIN(EN_TEXTO); }
<EN_TITULO>. {}
<EN_TEXTO>{word} { corpus_word_counter[YYText()]++; }
<EN_TEXTO>. {}
%%
/*
main( int argc, char *argv[] )
{
yylex();
}
*/