Public Member Functions | Public Attributes | List of all members
moot::mootNgramsCompiler Class Reference

N-gram parameter-file compiler. More...

Inheritance diagram for moot::mootNgramsCompiler:
Inheritance graph
[legend]
Collaboration diagram for moot::mootNgramsCompiler:
Collaboration graph
[legend]

Public Member Functions

 mootNgramsCompiler ()
 
virtual ~mootNgramsCompiler ()
 
mootNgramsparse_from_file (FILE *file, const char *filename=__null)
 
mootNgramsparse_from_string (const char *string, const char *srcname=__null)
 
void select_streams (FILE *in, FILE *out, const char *my_srcname=__null)
 
void select_string (const char *in, const char *my_srcname=__null)
 
virtual int yylex ()
 
mootNgramsparse_ngrams ()
 
virtual void yyerror (const char *msg)
 
virtual void yywarn (const char *msg)
 
- Public Member Functions inherited from mootNgramsParser
int yyparse (void)
 
 mootNgramsParser ()
 
virtual ~mootNgramsParser (void)
 
virtual void yycarp (const char *fmt,...)
 

Public Attributes

mootNgramsLexer theLexer
 
const char * objname
 
const char * srcname
 
- Public Attributes inherited from mootNgramsParser
yy_mootNgramsParser_stype yylval
 
mootNgramsParserLType yylloc
 
int yynerrs
 
int yychar
 
int yydebug
 
moot::mootNgramsngrams
 
std::set< moot::mootTagString > * alltags
 
moot::mootNgrams::Ngram prevngram
 
moot::mootNgrams::Ngram curngram
 

Additional Inherited Members

- Static Public Attributes inherited from mootNgramsParser
static const int TAG
 
static const int COUNT
 
static const int TAB
 
static const int NEWLINE
 

Detailed Description

mootNgramsCompiler compiles n-gram parameter files into internal frequency tables, using a lexer/parser pair generated by Alain Coetmeur's flex++ and bison++ programs.

Constructor & Destructor Documentation

◆ mootNgramsCompiler()

moot::mootNgramsCompiler::mootNgramsCompiler ( )
inline

Default constructor

◆ ~mootNgramsCompiler()

virtual moot::mootNgramsCompiler::~mootNgramsCompiler ( )
inlinevirtual

Default destructor

Member Function Documentation

◆ parse_from_file()

mootNgrams* moot::mootNgramsCompiler::parse_from_file ( FILE *  file,
const char *  filename = __null 
)
inline

parse n-gram parameters from a C-stream. Returns NULL on error.

References parse_ngrams(), and select_streams().

◆ parse_from_string()

mootNgrams* moot::mootNgramsCompiler::parse_from_string ( const char *  string,
const char *  srcname = __null 
)
inline

parse one regular expression from a C-string. Returns NULL on error.

References parse_ngrams(), and select_string().

◆ select_streams()

void moot::mootNgramsCompiler::select_streams ( FILE *  in,
FILE *  out,
const char *  my_srcname = __null 
)
inline

low-level input selection: input from a C-stream.

References moot::GenericLexer::select_streams().

Referenced by parse_from_file().

◆ select_string()

void moot::mootNgramsCompiler::select_string ( const char *  in,
const char *  my_srcname = __null 
)
inline

low-level input selection: input from a C-string. WARNING: do NOT free the string 'in' until parsing has finished!

References parse_ngrams(), moot::GenericLexer::select_string(), yyerror(), yylex(), and yywarn().

Referenced by parse_from_string().

◆ yylex()

virtual int moot::mootNgramsCompiler::yylex ( )
virtual

Implements mootNgramsParser.

Referenced by select_string().

◆ parse_ngrams()

mootNgrams* moot::mootNgramsCompiler::parse_ngrams ( )

low-level parsing method: parse all remaining n-grams from the currently selected input source.

Referenced by parse_from_file(), parse_from_string(), and select_string().

◆ yyerror()

virtual void moot::mootNgramsCompiler::yyerror ( const char *  msg)
virtual

yyerror: report parse errors.

Reimplemented from mootNgramsParser.

Referenced by select_string().

◆ yywarn()

virtual void moot::mootNgramsCompiler::yywarn ( const char *  msg)
virtual

yywarn: report parse warnings.

Reimplemented from mootNgramsParser.

Referenced by select_string().

Member Data Documentation

◆ theLexer

mootNgramsLexer moot::mootNgramsCompiler::theLexer

flex++ lexer object

◆ objname

const char* moot::mootNgramsCompiler::objname

objname: name to use for object when reporting errors – default: "mootNgramsCompiler" Warning: no copying is performed on this string; you must alloc&free it yourself!

◆ srcname

const char* moot::mootNgramsCompiler::srcname

srcname: name to use for current file when reporting errors – default: "(unknown)" Warning: no copying is performed on this string; you must alloc&free it yourself!


The documentation for this class was generated from the following file: