1 /* flex - tool to generate fast lexical analyzers */
4 * Copyright (c) 1990 The Regents of the University of California.
7 * This code is derived from software contributed to Berkeley by
10 * The United States Government has rights in this work pursuant
11 * to contract no. DE-AC03-76SF00098 between the United States
12 * Department of Energy and the University of California.
14 * Redistribution and use in source and binary forms with or without
15 * modification are permitted provided that: (1) source distributions retain
16 * this entire copyright notice and comment, and (2) distributions including
17 * binaries display the following acknowledgement: ``This product includes
18 * software developed by the University of California, Berkeley and its
19 * contributors'' in the documentation or other materials provided with the
20 * distribution and in all advertising materials mentioning features or use
21 * of this software. Neither the name of the University nor the names of
22 * its contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31 "@(#) Copyright (c) 1990 The Regents of the University of California.\n\
32 All rights reserved.\n";
41 static char flex_version
[] = FLEX_VERSION
;
44 /* declare functions that have forward references */
46 void flexinit
PROTO((int, char**));
47 void readin
PROTO((void));
48 void set_up_initial_allocations
PROTO((void));
50 #ifdef NEED_ARGV_FIXUP
51 extern void argv_fixup
PROTO((int *, char ***));
55 /* these globals are all defined and commented in flexdef.h */
56 int printstats
, syntaxerror
, eofseen
, ddebug
, trace
, nowarn
, spprdflt
;
57 int interactive
, caseins
, lex_compat
, do_yylineno
, useecs
, fulltbl
, usemecs
;
58 int fullspd
, gen_line_dirs
, performance_report
, backing_up_report
;
59 int C_plus_plus
, long_align
, use_read
, yytext_is_array
, do_yywrap
, csize
;
60 int yymore_used
, reject
, real_reject
, continued_action
, in_rule
;
61 int yymore_really_used
, reject_really_used
;
62 int datapos
, dataline
, linenum
, out_linenum
;
63 FILE *skelfile
= NULL
;
66 int action_size
, defs1_offset
, prolog_offset
, action_offset
, action_index
;
67 char *infilename
= NULL
, *outfilename
= NULL
;
69 char *prefix
, *yyclass
;
70 int do_stdinit
, use_stdout
;
71 int onestate
[ONE_STACK_SIZE
], onesym
[ONE_STACK_SIZE
];
72 int onenext
[ONE_STACK_SIZE
], onedef
[ONE_STACK_SIZE
], onesp
;
73 int current_mns
, current_max_rules
;
74 int num_rules
, num_eof_rules
, default_rule
, lastnfa
;
75 int *firstst
, *lastst
, *finalst
, *transchar
, *trans1
, *trans2
;
76 int *accptnum
, *assoc_rule
, *state_type
;
77 int *rule_type
, *rule_linenum
, *rule_useful
;
78 int current_state_type
;
79 int variable_trailing_context_rules
;
80 int numtemps
, numprots
, protprev
[MSP
], protnext
[MSP
], prottbl
[MSP
];
81 int protcomst
[MSP
], firstprot
, lastprot
, protsave
[PROT_SAVE_SIZE
];
82 int numecs
, nextecm
[CSIZE
+ 1], ecgroup
[CSIZE
+ 1], nummecs
, tecfwd
[CSIZE
+ 1];
83 int tecbck
[CSIZE
+ 1];
84 int lastsc
, *scset
, *scbol
, *scxclu
, *sceof
;
87 int current_max_dfa_size
, current_max_xpairs
;
88 int current_max_template_xpairs
, current_max_dfas
;
89 int lastdfa
, *nxt
, *chk
, *tnxt
;
90 int *base
, *def
, *nultrans
, NUL_ec
, tblend
, firstfree
, **dss
, *dfasiz
;
91 union dfaacc_union
*dfaacc
;
92 int *accsiz
, *dhash
, numas
;
93 int numsnpairs
, jambase
, jamstate
;
94 int lastccl
, *cclmap
, *ccllen
, *cclng
, cclreuse
;
95 int current_maxccls
, current_max_ccl_tbl_size
;
98 int sectnum
, nummt
, hshcol
, dfaeql
, numeps
, eps2
, num_reallocs
;
99 int tmpuses
, totnst
, peakpairs
, numuniq
, numdup
, hshsave
;
100 int num_backing_up
, bol_needed
;
101 FILE *backing_up_file
;
102 int end_of_buffer_state
;
106 /* Make sure program_name is initialized so we don't crash if writing
107 * out an error message before getting the program name from argv[0].
109 char *program_name
= "flex";
111 #ifndef SHORT_FILE_NAMES
112 static char *outfile_template
= "lex.%s.%s";
113 static char *backing_name
= "lex.backup";
115 static char *outfile_template
= "lex%s.%s";
116 static char *backing_name
= "lex.bck";
124 extern unsigned _stklen
= 16384;
127 static char outfile_path
[MAXLINE
];
128 static int outfile_created
= 0;
129 static char *skelname
= NULL
;
132 int main( argc
, argv
)
139 argc
= ccommand( &argv
);
141 #ifdef NEED_ARGV_FIXUP
142 argv_fixup( &argc
, &argv
);
145 flexinit( argc
, argv
);
151 for ( i
= 1; i
<= num_rules
; ++i
)
152 if ( ! rule_useful
[i
] && i
!= default_rule
)
153 line_warning( _( "rule cannot be matched" ),
156 if ( spprdflt
&& ! reject
&& rule_useful
[default_rule
] )
158 _( "-s option given but default rule can be matched" ),
159 rule_linenum
[default_rule
] );
161 /* Generate the C state transition tables from the DFA. */
164 /* Note, flexend does not return. It exits with its argument
169 return 0; /* keep compilers/lint happy */
173 /* check_options - check user-specified options */
182 flexerror( _( "Can't use -+ with -l option" ) );
184 if ( fulltbl
|| fullspd
)
185 flexerror( _( "Can't use -f or -F with -l option" ) );
187 /* Don't rely on detecting use of yymore() and REJECT,
188 * just assume they'll be used.
190 yymore_really_used
= reject_really_used
= true;
192 yytext_is_array
= true;
198 /* This should really be "maintain_backup_tables = true" */
199 reject_really_used
= true;
201 if ( csize
== unspecified
)
203 if ( (fulltbl
|| fullspd
) && ! useecs
)
204 csize
= DEFAULT_CSIZE
;
209 if ( interactive
== unspecified
)
211 if ( fulltbl
|| fullspd
)
217 if ( fulltbl
|| fullspd
)
221 _( "-Cf/-CF and -Cm don't make sense together" ) );
224 flexerror( _( "-Cf/-CF and -I are incompatible" ) );
228 _( "-Cf/-CF are incompatible with lex-compatibility mode" ) );
232 _( "-Cf/-CF and %option yylineno are incompatible" ) );
234 if ( fulltbl
&& fullspd
)
235 flexerror( _( "-Cf and -CF are mutually exclusive" ) );
238 if ( C_plus_plus
&& fullspd
)
239 flexerror( _( "Can't use -+ with -CF option" ) );
241 if ( C_plus_plus
&& yytext_is_array
)
243 warn( _( "%array incompatible with -+ option" ) );
244 yytext_is_array
= false;
248 { /* Set up doubly-linked equivalence classes. */
250 /* We loop all the way up to csize, since ecgroup[csize] is
251 * the position used for NUL characters.
255 for ( i
= 2; i
<= csize
; ++i
)
261 nextecm
[csize
] = NIL
;
266 /* Put everything in its own equivalence class. */
267 for ( i
= 1; i
<= csize
; ++i
)
270 nextecm
[i
] = BAD_SUBSCRIPT
; /* to catch errors */
278 if ( ! did_outfilename
)
287 sprintf( outfile_path
, outfile_template
,
290 outfilename
= outfile_path
;
293 prev_stdout
= freopen( outfilename
, "w", stdout
);
295 if ( prev_stdout
== NULL
)
296 lerrsf( _( "could not create %s" ), outfilename
);
301 if ( skelname
&& (skelfile
= fopen( skelname
, "r" )) == NULL
)
302 lerrsf( _( "can't open skeleton file %s" ), skelname
);
304 if ( strcmp( prefix
, "yy" ) )
306 #define GEN_PREFIX(name) out_str3( "#define yy%s %s%s\n", name, prefix, name )
308 GEN_PREFIX( "FlexLexer" );
311 GEN_PREFIX( "_create_buffer" );
312 GEN_PREFIX( "_delete_buffer" );
313 GEN_PREFIX( "_scan_buffer" );
314 GEN_PREFIX( "_scan_string" );
315 GEN_PREFIX( "_scan_bytes" );
316 GEN_PREFIX( "_flex_debug" );
317 GEN_PREFIX( "_init_buffer" );
318 GEN_PREFIX( "_flush_buffer" );
319 GEN_PREFIX( "_load_buffer_state" );
320 GEN_PREFIX( "_switch_to_buffer" );
322 GEN_PREFIX( "leng" );
325 GEN_PREFIX( "restart" );
326 GEN_PREFIX( "text" );
329 GEN_PREFIX( "lineno" );
333 GEN_PREFIX( "wrap" );
338 if ( did_outfilename
)
339 line_directive_out( stdout
, 0 );
345 /* flexend - terminate flex
348 * This routine does not return.
351 void flexend( exit_status
)
358 if ( skelfile
!= NULL
)
360 if ( ferror( skelfile
) )
361 lerrsf( _( "input error reading skeleton file %s" ),
364 else if ( fclose( skelfile
) )
365 lerrsf( _( "error closing skeleton file %s" ),
369 if ( exit_status
!= 0 && outfile_created
)
371 if ( ferror( stdout
) )
372 lerrsf( _( "error writing output file %s" ),
375 else if ( fclose( stdout
) )
376 lerrsf( _( "error closing output file %s" ),
379 else if ( unlink( outfilename
) )
380 lerrsf( _( "error deleting output file %s" ),
384 if ( backing_up_report
&& backing_up_file
)
386 if ( num_backing_up
== 0 )
387 fprintf( backing_up_file
, _( "No backing up.\n" ) );
388 else if ( fullspd
|| fulltbl
)
389 fprintf( backing_up_file
,
390 _( "%d backing up (non-accepting) states.\n" ),
393 fprintf( backing_up_file
,
394 _( "Compressed tables always back up.\n" ) );
396 if ( ferror( backing_up_file
) )
397 lerrsf( _( "error writing backup file %s" ),
400 else if ( fclose( backing_up_file
) )
401 lerrsf( _( "error closing backup file %s" ),
407 fprintf( stderr
, _( "%s version %s usage statistics:\n" ),
408 program_name
, flex_version
);
410 fprintf( stderr
, _( " scanner options: -" ) );
414 if ( backing_up_report
)
422 if ( performance_report
> 0 )
424 if ( performance_report
> 1 )
431 putc( 'v', stderr
); /* always true! */
434 if ( interactive
== false )
436 if ( interactive
== true )
438 if ( ! gen_line_dirs
)
443 if ( csize
== unspecified
)
444 /* We encountered an error fairly early on, so csize
445 * never got specified. Define it now, to prevent
446 * bogus table sizes being written out below.
455 fprintf( stderr
, " -C" );
470 if ( did_outfilename
)
471 fprintf( stderr
, " -o%s", outfilename
);
474 fprintf( stderr
, " -S%s", skelname
);
476 if ( strcmp( prefix
, "yy" ) )
477 fprintf( stderr
, " -P%s", prefix
);
479 putc( '\n', stderr
);
481 fprintf( stderr
, _( " %d/%d NFA states\n" ),
482 lastnfa
, current_mns
);
483 fprintf( stderr
, _( " %d/%d DFA states (%d words)\n" ),
484 lastdfa
, current_max_dfas
, totnst
);
485 fprintf( stderr
, _( " %d rules\n" ),
486 num_rules
+ num_eof_rules
- 1 /* - 1 for def. rule */ );
488 if ( num_backing_up
== 0 )
489 fprintf( stderr
, _( " No backing up\n" ) );
490 else if ( fullspd
|| fulltbl
)
492 _( " %d backing-up (non-accepting) states\n" ),
496 _( " Compressed tables always back-up\n" ) );
500 _( " Beginning-of-line patterns used\n" ) );
502 fprintf( stderr
, _( " %d/%d start conditions\n" ), lastsc
,
505 _( " %d epsilon states, %d double epsilon states\n" ),
509 fprintf( stderr
, _( " no character classes\n" ) );
512 _( " %d/%d character classes needed %d/%d words of storage, %d reused\n" ),
513 lastccl
, current_maxccls
,
514 cclmap
[lastccl
] + ccllen
[lastccl
],
515 current_max_ccl_tbl_size
, cclreuse
);
517 fprintf( stderr
, _( " %d state/nextstate pairs created\n" ),
519 fprintf( stderr
, _( " %d/%d unique/duplicate transitions\n" ),
524 tblsiz
= lastdfa
* numecs
;
525 fprintf( stderr
, _( " %d table entries\n" ), tblsiz
);
530 tblsiz
= 2 * (lastdfa
+ numtemps
) + 2 * tblend
;
533 _( " %d/%d base-def entries created\n" ),
534 lastdfa
+ numtemps
, current_max_dfas
);
536 _( " %d/%d (peak %d) nxt-chk entries created\n" ),
537 tblend
, current_max_xpairs
, peakpairs
);
539 _( " %d/%d (peak %d) template nxt-chk entries created\n" ),
541 current_max_template_xpairs
,
543 fprintf( stderr
, _( " %d empty table entries\n" ),
545 fprintf( stderr
, _( " %d protos created\n" ),
548 _( " %d templates created, %d uses\n" ),
554 tblsiz
= tblsiz
+ csize
;
556 _( " %d/%d equivalence classes created\n" ),
562 tblsiz
= tblsiz
+ numecs
;
564 _( " %d/%d meta-equivalence classes created\n" ),
569 _( " %d (%d saved) hash collisions, %d DFAs equal\n" ),
570 hshcol
, hshsave
, dfaeql
);
571 fprintf( stderr
, _( " %d sets of reallocations needed\n" ),
573 fprintf( stderr
, _( " %d total table entries needed\n" ),
581 /* flexinit - initialize flex */
583 void flexinit( argc
, argv
)
590 printstats
= syntaxerror
= trace
= spprdflt
= caseins
= false;
591 lex_compat
= C_plus_plus
= backing_up_report
= ddebug
= fulltbl
= false;
592 fullspd
= long_align
= nowarn
= yymore_used
= continued_action
= false;
593 do_yylineno
= yytext_is_array
= in_rule
= reject
= do_stdinit
= false;
594 yymore_really_used
= reject_really_used
= unspecified
;
595 interactive
= csize
= unspecified
;
596 do_yywrap
= gen_line_dirs
= usemecs
= useecs
= true;
597 performance_report
= 0;
601 use_read
= use_stdout
= false;
605 /* Initialize dynamic array for holding the rule actions. */
606 action_size
= 2048; /* default size of action array in bytes */
607 action_array
= allocate_character_array( action_size
);
608 defs1_offset
= prolog_offset
= action_offset
= action_index
= 0;
609 action_array
[0] = '\0';
611 program_name
= argv
[0];
613 if ( program_name
[0] != '\0' &&
614 program_name
[strlen( program_name
) - 1] == '+' )
618 for ( --argc
, ++argv
; argc
; --argc
, ++argv
)
622 if ( arg
[0] != '-' || arg
[1] == '\0' )
627 if ( ! strcmp( arg
, "--help" ) )
630 else if ( ! strcmp( arg
, "--version" ) )
633 else if ( ! strcmp( arg
, "--" ) )
634 { /* end of options */
641 for ( i
= 1; arg
[i
] != '\0'; ++i
)
653 backing_up_report
= true;
662 _( "-C flag must be given separately" ) );
672 for ( ++i
; arg
[i
] != '\0'; ++i
)
702 _( "unknown -C option '%c'" ),
714 useecs
= usemecs
= false;
715 use_read
= fulltbl
= true;
719 useecs
= usemecs
= false;
720 use_read
= fullspd
= true;
741 gen_line_dirs
= false;
745 /* Stupid do-nothing deprecated
753 _( "-o flag must be given separately" ) );
755 outfilename
= arg
+ i
+ 1;
762 _( "-P flag must be given separately" ) );
764 prefix
= arg
+ i
+ 1;
768 ++performance_report
;
774 _( "-S flag must be given separately" ) );
776 skelname
= arg
+ i
+ 1;
796 printf( _( "%s version %s\n" ),
797 program_name
, flex_version
);
814 _( "%s: unknown flag '%c'. For usage, try\n\t%s --help\n" ),
815 program_name
, (int) arg
[i
],
820 /* Used by -C, -S, -o, and -P flags in lieu of a "continue 2"
826 num_input_files
= argc
;
828 set_input_file( num_input_files
> 0 ? input_files
[0] : NULL
);
830 lastccl
= lastsc
= lastdfa
= lastnfa
= 0;
831 num_rules
= num_eof_rules
= default_rule
= 0;
832 numas
= numsnpairs
= tmpuses
= 0;
833 numecs
= numeps
= eps2
= num_reallocs
= hshcol
= dfaeql
= totnst
= 0;
834 numuniq
= numdup
= hshsave
= eofseen
= datapos
= dataline
= 0;
835 num_backing_up
= onesp
= numprots
= 0;
836 variable_trailing_context_rules
= bol_needed
= false;
838 out_linenum
= linenum
= sectnum
= 1;
841 /* Used in mkprot() so that the first proto goes in slot 1
842 * of the proto queue.
846 set_up_initial_allocations();
850 /* readin - read in the rules section of the input file(s) */
854 static char yy_stdinit
[] = "FILE *yyin = stdin, *yyout = stdout;";
855 static char yy_nostdinit
[] =
856 "FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;";
858 line_directive_out( (FILE *) 0, 1 );
862 pinpoint_message( _( "fatal parse error" ) );
869 if ( backing_up_report
)
871 backing_up_file
= fopen( backing_name
, "w" );
872 if ( backing_up_file
== NULL
)
874 _( "could not create backing-up info file %s" ),
879 backing_up_file
= NULL
;
881 if ( yymore_really_used
== true )
883 else if ( yymore_really_used
== false )
886 if ( reject_really_used
== true )
888 else if ( reject_really_used
== false )
891 if ( performance_report
> 0 )
896 _( "-l AT&T lex compatibility option entails a large performance penalty\n" ) );
898 _( " and may be the actual source of other reported performance penalties\n" ) );
901 else if ( do_yylineno
)
904 _( "%%option yylineno entails a large performance penalty\n" ) );
907 if ( performance_report
> 1 )
911 _( "-I (interactive) entails a minor performance penalty\n" ) );
915 _( "yymore() entails a minor performance penalty\n" ) );
920 _( "REJECT entails a large performance penalty\n" ) );
922 if ( variable_trailing_context_rules
)
924 _( "Variable trailing context rules entail a large performance penalty\n" ) );
930 if ( variable_trailing_context_rules
)
933 if ( (fulltbl
|| fullspd
) && reject
)
937 _( "REJECT cannot be used with -f or -F" ) );
938 else if ( do_yylineno
)
940 _( "%option yylineno cannot be used with -f or -F" ) );
943 _( "variable trailing context rules cannot be used with -f or -F" ) );
947 outn( "\n#define YY_USES_REJECT" );
951 outn( "\n#define yywrap() 1" );
952 outn( "#define YY_SKIP_YYWRAP" );
956 outn( "\n#define FLEX_DEBUG" );
959 outn( "typedef unsigned char YY_CHAR;" );
961 outn( "typedef char YY_CHAR;" );
965 outn( "#define yytext_ptr yytext" );
968 outn( "#define YY_INTERACTIVE" );
975 outn( "#ifdef VMS" );
976 outn( "#ifndef __VMS_POSIX" );
977 outn( yy_nostdinit
);
987 outn( yy_nostdinit
);
991 outn( "typedef yyconst struct yy_trans_info *yy_state_type;" );
992 else if ( ! C_plus_plus
)
993 outn( "typedef int yy_state_type;" );
996 outn( "\n#define FLEX_DEBUG" );
999 outn( "#define YY_FLEX_LEX_COMPAT" );
1001 if ( do_yylineno
&& ! C_plus_plus
)
1003 outn( "extern int yylineno;" );
1004 outn( "int yylineno = 1;" );
1009 outn( "\n#include <FlexLexer.h>" );
1013 outn( "int yyFlexLexer::yylex()" );
1016 "\tLexerError( \"yyFlexLexer::yylex invoked but %option yyclass used\" );" );
1017 outn( "\treturn 0;" );
1020 out_str( "\n#define YY_DECL int %s::yylex()\n",
1027 if ( yytext_is_array
)
1028 outn( "extern char yytext[];\n" );
1032 outn( "extern char *yytext;" );
1033 outn( "#define yytext_ptr yytext" );
1038 _( "%option yyclass only meaningful for C++ scanners" ) );
1042 numecs
= cre8ecs( nextecm
, ecgroup
, csize
);
1046 /* Now map the equivalence class for NUL to its expected place. */
1047 ecgroup
[0] = ecgroup
[csize
];
1048 NUL_ec
= ABS( ecgroup
[0] );
1055 /* set_up_initial_allocations - allocate memory for internal tables */
1057 void set_up_initial_allocations()
1059 current_mns
= INITIAL_MNS
;
1060 firstst
= allocate_integer_array( current_mns
);
1061 lastst
= allocate_integer_array( current_mns
);
1062 finalst
= allocate_integer_array( current_mns
);
1063 transchar
= allocate_integer_array( current_mns
);
1064 trans1
= allocate_integer_array( current_mns
);
1065 trans2
= allocate_integer_array( current_mns
);
1066 accptnum
= allocate_integer_array( current_mns
);
1067 assoc_rule
= allocate_integer_array( current_mns
);
1068 state_type
= allocate_integer_array( current_mns
);
1070 current_max_rules
= INITIAL_MAX_RULES
;
1071 rule_type
= allocate_integer_array( current_max_rules
);
1072 rule_linenum
= allocate_integer_array( current_max_rules
);
1073 rule_useful
= allocate_integer_array( current_max_rules
);
1075 current_max_scs
= INITIAL_MAX_SCS
;
1076 scset
= allocate_integer_array( current_max_scs
);
1077 scbol
= allocate_integer_array( current_max_scs
);
1078 scxclu
= allocate_integer_array( current_max_scs
);
1079 sceof
= allocate_integer_array( current_max_scs
);
1080 scname
= allocate_char_ptr_array( current_max_scs
);
1082 current_maxccls
= INITIAL_MAX_CCLS
;
1083 cclmap
= allocate_integer_array( current_maxccls
);
1084 ccllen
= allocate_integer_array( current_maxccls
);
1085 cclng
= allocate_integer_array( current_maxccls
);
1087 current_max_ccl_tbl_size
= INITIAL_MAX_CCL_TBL_SIZE
;
1088 ccltbl
= allocate_Character_array( current_max_ccl_tbl_size
);
1090 current_max_dfa_size
= INITIAL_MAX_DFA_SIZE
;
1092 current_max_xpairs
= INITIAL_MAX_XPAIRS
;
1093 nxt
= allocate_integer_array( current_max_xpairs
);
1094 chk
= allocate_integer_array( current_max_xpairs
);
1096 current_max_template_xpairs
= INITIAL_MAX_TEMPLATE_XPAIRS
;
1097 tnxt
= allocate_integer_array( current_max_template_xpairs
);
1099 current_max_dfas
= INITIAL_MAX_DFAS
;
1100 base
= allocate_integer_array( current_max_dfas
);
1101 def
= allocate_integer_array( current_max_dfas
);
1102 dfasiz
= allocate_integer_array( current_max_dfas
);
1103 accsiz
= allocate_integer_array( current_max_dfas
);
1104 dhash
= allocate_integer_array( current_max_dfas
);
1105 dss
= allocate_int_ptr_array( current_max_dfas
);
1106 dfaacc
= allocate_dfaacc_union( current_max_dfas
);
1108 nultrans
= (int *) 0;
1117 _( "%s [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n" ),
1119 fprintf( f
, _( "\t[--help --version] [file ...]\n" ) );
1121 fprintf( f
, _( "\t-b generate backing-up information to %s\n" ),
1123 fprintf( f
, _( "\t-c do-nothing POSIX option\n" ) );
1124 fprintf( f
, _( "\t-d turn on debug mode in generated scanner\n" ) );
1125 fprintf( f
, _( "\t-f generate fast, large scanner\n" ) );
1126 fprintf( f
, _( "\t-h produce this help message\n" ) );
1127 fprintf( f
, _( "\t-i generate case-insensitive scanner\n" ) );
1128 fprintf( f
, _( "\t-l maximal compatibility with original lex\n" ) );
1129 fprintf( f
, _( "\t-n do-nothing POSIX option\n" ) );
1130 fprintf( f
, _( "\t-p generate performance report to stderr\n" ) );
1132 _( "\t-s suppress default rule to ECHO unmatched text\n" ) );
1134 if ( ! did_outfilename
)
1136 sprintf( outfile_path
, outfile_template
,
1137 prefix
, C_plus_plus
? "cc" : "c" );
1138 outfilename
= outfile_path
;
1142 _( "\t-t write generated scanner on stdout instead of %s\n" ),
1146 _( "\t-v write summary of scanner statistics to f\n" ) );
1147 fprintf( f
, _( "\t-w do not generate warnings\n" ) );
1148 fprintf( f
, _( "\t-B generate batch scanner (opposite of -I)\n" ) );
1150 _( "\t-F use alternative fast scanner representation\n" ) );
1152 _( "\t-I generate interactive scanner (opposite of -B)\n" ) );
1153 fprintf( f
, _( "\t-L suppress #line directives in scanner\n" ) );
1154 fprintf( f
, _( "\t-T %s should run in trace mode\n" ), program_name
);
1155 fprintf( f
, _( "\t-V report %s version\n" ), program_name
);
1156 fprintf( f
, _( "\t-7 generate 7-bit scanner\n" ) );
1157 fprintf( f
, _( "\t-8 generate 8-bit scanner\n" ) );
1158 fprintf( f
, _( "\t-+ generate C++ scanner class\n" ) );
1159 fprintf( f
, _( "\t-? produce this help message\n" ) );
1161 _( "\t-C specify degree of table compression (default is -Cem):\n" ) );
1163 _( "\t\t-Ca trade off larger tables for better memory alignment\n" ) );
1164 fprintf( f
, _( "\t\t-Ce construct equivalence classes\n" ) );
1166 _( "\t\t-Cf do not compress scanner tables; use -f representation\n" ) );
1168 _( "\t\t-CF do not compress scanner tables; use -F representation\n" ) );
1169 fprintf( f
, _( "\t\t-Cm construct meta-equivalence classes\n" ) );
1171 _( "\t\t-Cr use read() instead of stdio for scanner input\n" ) );
1172 fprintf( f
, _( "\t-o specify output filename\n" ) );
1173 fprintf( f
, _( "\t-P specify scanner prefix other than \"yy\"\n" ) );
1174 fprintf( f
, _( "\t-S specify skeleton file\n" ) );
1175 fprintf( f
, _( "\t--help produce this help message\n" ) );
1176 fprintf( f
, _( "\t--version report %s version\n" ), program_name
);