* outfilename - name of output file
* did_outfilename - whether outfilename was explicitly set
* prefix - the prefix used for externally visible names ("yy" by default)
+ * yyclass - yyFlexLexer subclass to use for YY_DECL
* do_stdinit - whether to initialize yyin/yyout to stdin/stdout
* use_stdout - the -t flag
* input_files - array holding names of input files
extern int skel_ind;
extern char *infilename, *outfilename;
extern int did_outfilename;
-extern char *prefix;
+extern char *prefix, *yyclass;
extern int do_stdinit, use_stdout;
extern char **input_files;
extern int num_input_files;
int action_size, defs1_offset, prolog_offset, action_offset, action_index;
char *infilename = NULL, *outfilename = NULL;
int did_outfilename;
-char *prefix;
+char *prefix, *yyclass;
int do_stdinit, use_stdout;
int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
performance_report = 0;
did_outfilename = 0;
prefix = "yy";
+ yyclass = 0;
use_read = use_stdout = false;
sawcmpflag = false;
}
if ( C_plus_plus )
+ {
outn( "\n#include <FlexLexer.h>" );
+ if ( yyclass )
+ {
+ outn( "int yyFlexLexer::yylex()" );
+ outn( "\t{" );
+ outn(
+"\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );" );
+ outn( "\t}" );
+
+ out_str( "\n#define YY_DECL int %s::yylex()\n",
+ yyclass );
+ }
+ }
+
else
{
if ( yytext_is_array )
outn( "extern char *yytext;" );
outn( "#define yytext_ptr yytext" );
}
+
+ if ( yyclass )
+ flexerror(
+ _( "%option yyclass only meaningful for C++ scanners" ) );
}
if ( useecs )
outfile return OPT_OUTFILE;
prefix return OPT_PREFIX;
+ yyclass return OPT_YYCLASS;
\"[^"\n]*\" {
strcpy( nmstr, yytext + 1 );