📄 flexdef.h
字号:
* caseins - if true (-i), generate a case-insensitive scanner * lex_compat - if true (-l), maximize compatibility with AT&T lex * do_yylineno - if true, generate code to maintain yylineno * useecs - if true (-Ce flag), use equivalence classes * fulltbl - if true (-Cf flag), don't compress the DFA state table * usemecs - if true (-Cm flag), use meta-equivalence classes * fullspd - if true (-F flag), use Jacobson method of table representation * gen_line_dirs - if true (i.e., no -L flag), generate #line directives * performance_report - if > 0 (i.e., -p flag), generate a report relating * to scanner performance; if > 1 (-p -p), report on minor performance * problems, too * backing_up_report - if true (i.e., -b flag), generate "lex.backup" file * listing backing-up states * C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class; * otherwise, a standard C scanner * long_align - if true (-Ca flag), favor long-word alignment. * use_read - if true (-f, -F, or -Cr) then use read() for scanner input; * otherwise, use fread(). * yytext_is_array - if true (i.e., %array directive), then declare * yytext as a array instead of a character pointer. Nice and inefficient. * do_yywrap - do yywrap() processing on EOF. If false, EOF treated as * "no more files". * csize - size of character set for the scanner we're generating; * 128 for 7-bit chars and 256 for 8-bit * yymore_used - if true, yymore() is used in input rules * reject - if true, generate back-up tables for REJECT macro * real_reject - if true, scanner really uses REJECT (as opposed to just * having "reject" set for variable trailing context) * continued_action - true if this rule's action is to "fall through" to * the next rule's action (i.e., the '|' action) * in_rule - true if we're inside an individual rule, false if not. * yymore_really_used - whether to treat yymore() as really used, regardless * of what we think based on references to it in the user's actions. * reject_really_used - same for REJECT */extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt;extern int interactive, caseins, lex_compat, do_yylineno;extern int useecs, fulltbl, usemecs, fullspd;extern int gen_line_dirs, performance_report, backing_up_report;extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap;extern int csize;extern int yymore_used, reject, real_reject, continued_action, in_rule;extern int yymore_really_used, reject_really_used;/* Variables used in the flex input routines: * datapos - characters on current output line * dataline - number of contiguous lines of data in current data * statement. Used to generate readable -f output * linenum - current input line number * out_linenum - current output line number * skelfile - the skeleton file * skel - compiled-in skeleton array * skel_ind - index into "skel" array, if skelfile is nil * yyin - input file * backing_up_file - file to summarize backing-up states to * infilename - name of input file * 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 * num_input_files - size of input_files array * program_name - name with which program was invoked * * action_array - array to hold the rule actions * action_size - size of action_array * defs1_offset - index where the user's section 1 definitions start * in action_array * prolog_offset - index where the prolog starts in action_array * action_offset - index where the non-prolog starts in action_array * action_index - index where the next action should go, with respect * to "action_array" */extern int datapos, dataline, linenum, out_linenum;extern FILE *skelfile, *yyin, *backing_up_file;extern const char *skel[];extern int skel_ind;extern char *infilename, *outfilename;extern int did_outfilename;extern char *prefix, *yyclass;extern int do_stdinit, use_stdout;extern char **input_files;extern int num_input_files;extern char *program_name;extern char *action_array;extern int action_size;extern int defs1_offset, prolog_offset, action_offset, action_index;/* Variables for stack of states having only one out-transition: * onestate - state number * onesym - transition symbol * onenext - target state * onedef - default base entry * onesp - stack pointer */extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;/* Variables for nfa machine data: * current_mns - current maximum on number of NFA states * num_rules - number of the last accepting state; also is number of * rules created so far * num_eof_rules - number of <<EOF>> rules * default_rule - number of the default rule * current_max_rules - current maximum number of rules * lastnfa - last nfa state number created * firstst - physically the first state of a fragment * lastst - last physical state of fragment * finalst - last logical state of fragment * transchar - transition character * trans1 - transition state * trans2 - 2nd transition state for epsilons * accptnum - accepting number * assoc_rule - rule associated with this NFA state (or 0 if none) * state_type - a STATE_xxx type identifying whether the state is part * of a normal rule, the leading state in a trailing context * rule (i.e., the state which marks the transition from * recognizing the text-to-be-matched to the beginning of * the trailing context), or a subsequent state in a trailing * context rule * rule_type - a RULE_xxx type identifying whether this a ho-hum * normal rule or one which has variable head & trailing * context * rule_linenum - line number associated with rule * rule_useful - true if we've determined that the rule can be matched */extern int current_mns, current_max_rules;extern int num_rules, num_eof_rules, default_rule, lastnfa;extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;extern int *accptnum, *assoc_rule, *state_type;extern int *rule_type, *rule_linenum, *rule_useful;/* Different types of states; values are useful as masks, as well, for * routines like check_trailing_context(). */#define STATE_NORMAL 0x1#define STATE_TRAILING_CONTEXT 0x2/* Global holding current type of state we're making. */extern int current_state_type;/* Different types of rules. */#define RULE_NORMAL 0#define RULE_VARIABLE 1/* True if the input rules include a rule with both variable-length head * and trailing context, false otherwise. */extern int variable_trailing_context_rules;/* Variables for protos: * numtemps - number of templates created * numprots - number of protos created * protprev - backlink to a more-recently used proto * protnext - forward link to a less-recently used proto * prottbl - base/def table entry for proto * protcomst - common state of proto * firstprot - number of the most recently used proto * lastprot - number of the least recently used proto * protsave contains the entire state array for protos */extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];/* Variables for managing equivalence classes: * numecs - number of equivalence classes * nextecm - forward link of Equivalence Class members * ecgroup - class number or backward link of EC members * nummecs - number of meta-equivalence classes (used to compress * templates) * tecfwd - forward link of meta-equivalence classes members * tecbck - backward link of MEC's *//* Reserve enough room in the equivalence class arrays so that we * can use the CSIZE'th element to hold equivalence class information * for the NUL character. Later we'll move this information into * the 0th element. */extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;/* Meta-equivalence classes are indexed starting at 1, so it's possible * that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1 * slots total (since the arrays are 0-based). nextecm[] and ecgroup[] * don't require the extra position since they're indexed from 1 .. CSIZE - 1. */extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];/* Variables for start conditions: * lastsc - last start condition created * current_max_scs - current limit on number of start conditions * scset - set of rules active in start condition * scbol - set of rules active only at the beginning of line in a s.c. * scxclu - true if start condition is exclusive * sceof - true if start condition has EOF rule * scname - start condition name */extern int lastsc, *scset, *scbol, *scxclu, *sceof;extern int current_max_scs;extern char **scname;/* Variables for dfa machine data: * current_max_dfa_size - current maximum number of NFA states in DFA * current_max_xpairs - current maximum number of non-template xtion pairs * current_max_template_xpairs - current maximum number of template pairs * current_max_dfas - current maximum number DFA states * lastdfa - last dfa state number created * nxt - state to enter upon reading character * chk - check value to see if "nxt" applies * tnxt - internal nxt table for templates * base - offset into "nxt" for given state * def - where to go if "chk" disallows "nxt" entry * nultrans - NUL transition for each state * NUL_ec - equivalence class of the NUL character * tblend - last "nxt/chk" table entry being used * firstfree - first empty entry in "nxt/chk" table * dss - nfa state set for each dfa * dfasiz - size of nfa state set for each dfa * dfaacc - accepting set for each dfa state (if using REJECT), or accepting * number, if not * accsiz - size of accepting set for each dfa state * dhash - dfa state hash value * numas - number of DFA accepting states created; note that this * is not necessarily the same value as num_rules, which is the analogous * value for the NFA * numsnpairs - number of state/nextstate transition pairs * jambase - position in base/def where the default jam table starts * jamstate - state number corresponding to "jam" state * end_of_buffer_state - end-of-buffer dfa state number */extern int current_max_dfa_size, current_max_xpairs;extern int current_max_template_xpairs, current_max_dfas;extern int lastdfa, *nxt, *chk, *tnxt;extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz;extern union dfaacc_union { int *dfaacc_set; int dfaacc_state; } *dfaacc;extern int *accsiz, *dhash, numas;extern int numsnpairs, jambase, jamstate;extern int end_of_buffer_state;/* Variables for ccl information: * lastccl - ccl index of the last created ccl * current_maxccls - current limit on the maximum number of unique ccl's * cclmap - maps a ccl index to its set pointer * ccllen - gives the length of a ccl * cclng - true for a given ccl if the ccl is negated * cclreuse - counts how many times a ccl is re-used * current_max_ccl_tbl_size - current limit on number of characters needed * to represent the unique ccl's * ccltbl - holds the characters in each ccl - indexed by cclmap */extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse;extern int current_maxccls, current_max_ccl_tbl_size;extern Char *ccltbl;/* Variables for miscellaneous information: * nmstr - last NAME scanned by the scanner * sectnum - section number currently being parsed * nummt - number of empty nxt/chk table entries * hshcol - number of hash collisions detected by snstods * dfaeql - number of times a newly created dfa was equal to an old one * numeps - number of epsilon NFA states created * eps2 - number of epsilon states which have 2 out-transitions * num_reallocs - number of times it was necessary to realloc() a group * of arrays * tmpuses - number of DFA states that chain to templates * totnst - total number of NFA states used to make DFA states * peakpairs - peak number of transition pairs we had to store internally * numuniq - number of unique transitions * numdup - number of duplicate transitions * hshsave - number of hash collisions saved by checking number of states * num_backing_up - number of DFA states requiring backing up * bol_needed - whether scanner needs beginning-of-line recognition */extern char nmstr[MAXLINE];extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;extern int num_backing_up, bol_needed;void *allocate_array PROTO((int, size_t));void *reallocate_array PROTO((void*, int, size_t));void *flex_alloc PROTO((size_t));void *flex_realloc PROTO((void*, size_t));void flex_free PROTO((void*));#define allocate_integer_array(size) \ (int *) allocate_array( size, sizeof( int ) )#define reallocate_integer_array(array,size) \ (int *) reallocate_array( (void *) array, size, sizeof( int ) )#define allocate_int_ptr_array(size) \ (int **) allocate_array( size, sizeof( int * ) )#define allocate_char_ptr_array(size) \ (char **) allocate_array( size, sizeof( char * ) )#define allocate_dfaacc_union(size) \ (union dfaacc_union *) \ allocate_array( size, sizeof( union dfaacc_union ) )#define reallocate_int_ptr_array(array,size) \ (int **) reallocate_array( (void *) array, size, sizeof( int * ) )#define reallocate_char_ptr_array(array,size) \ (char **) reallocate_array( (void *) array, size, sizeof( char * ) )#define reallocate_dfaacc_union(array, size) \ (union dfaacc_union *) \ reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) )#define allocate_character_array(size) \ (char *) allocate_array( size, sizeof( char ) )#define reallocate_character_array(array,size) \ (char *) reallocate_array( (void *) array, size, sizeof( char ) )#define allocate_Character_array(size) \ (Char *) allocate_array( size, sizeof( Char ) )#define reallocate_Character_array(array,size) \ (Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -