YooParse usually requires YooLex to function, but it doesn't have to, as long as
int yyLex ();is available.
.l(YooLex input) file, have the
%option noheader class="DefaultParse" ccfile="DefaultParse_lex.cc"One thing is very important that for both YooParse and YooLex, the default the C++ source file is
DefaultParse.ccif only the class option is set. They would overwrite each other generated source code. Thus,
ccfileis necessary to avoid this conflict. The
noheaderoption tells YooLex not to generate the C++ header file at all since the one generated by YooParse is needed.
.y(YooParse input) file, have a line which starts w/
%optionand enter configuration parameters. For example:
%option class="DefaultParse" ccfile="DefaultParse_parse.cc"For the above two steps, they both assumed the C++ header file is "
DefaultParse.hh". If one wishes to use a different header file for the
DefaultParseclass, both the
.lfile and the
.yfile need to have the following option:
%option hhfile="DefaultParse_header.hh"YooParse would generate the header file if it did not exist. One can edit this header file to add variables, functions, the constructor for the parser, etc. YooParse will not overwrite this file.
intdata type will usually work, provided that it is casted to the desired data type. Otherwise, one could specify a different data type:
std::auto_ptr<>cannot be used as _yyValue data type. The data type also must have a default constructor.
.yinput file, the C++ header file specified by the user would be created if it did not exist. Modify this header file to suit for the need.
bool yyParseError (int yychar);
yycharis the translated lookahead character. The function returns
yyParse (). Please read
yooparse.hhfor more details.