📄 flexdef.h
字号:
* 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 a ho-hum * normal rule or one which has variable head & trailing * context * rule_linenum - line number associated with rule */extern int current_mns, num_rules, current_max_rules, lastnfa;extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;extern int *accptnum, *assoc_rule, *state_type, *rule_type, *rule_linenum;/* 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 * xlation - maps character codes to their translations, or nil if no %t table * num_xlations - number of different xlation values *//* 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];extern int *xlation;extern int num_xlations;/* 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 * actvsc - stack of active start conditions for the current rule */extern int lastsc, current_max_scs, *scset, *scbol, *scxclu, *sceof, *actvsc;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 (or accepting number, if * -r is not given) * 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, lasttemp, *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, current_maxccls, *cclmap, *ccllen, *cclng, cclreuse;extern int current_max_ccl_tbl_size;extern Char *ccltbl;/* variables for miscellaneous information: * starttime - real-time when we started * endtime - real-time when we ended * 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_backtracking - number of DFA states requiring back-tracking * bol_needed - whether scanner needs beginning-of-line recognition */extern char *starttime, *endtime, nmstr[MAXLINE];extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;extern int num_backtracking, bol_needed;void *allocate_array(), *reallocate_array();#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 ) )/* used to communicate between scanner and parser. The type should really * be YYSTYPE, but we can't easily get our hands on it. */extern int yylval;/* external functions that are cross-referenced among the flex source files *//* from file ccl.c */extern void ccladd PROTO((int, int)); /* Add a single character to a ccl */extern int cclinit PROTO(()); /* make an empty ccl */extern void cclnegate PROTO((int)); /* negate a ccl *//* list the members of a set of characters in CCL form */extern void list_character_set PROTO((FILE*, int[]));/* from file dfa.c *//* increase the maximum number of dfas */extern void increase_max_dfas PROTO(());extern void ntod PROTO(()); /* convert a ndfa to a dfa *//* from file ecs.c *//* convert character classes to set of equivalence classes */extern void ccl2ecl PROTO(());/* associate equivalence class numbers with class members */extern int cre8ecs PROTO((int[], int[], int));/* associate equivalence class numbers using %t table */extern int ecs_from_xlation PROTO((int[]));/* update equivalence classes based on character class transitions */extern void mkeccl PROTO((Char[], int, int[], int[], int, int));/* create equivalence class for single character */extern void mkechar PROTO((int, int[], int[]));/* from file gen.c */extern void make_tables PROTO(()); /* generate transition tables *//* from file main.c */extern void flexend PROTO((int));/* from file misc.c *//* write out the actions from the temporary file to lex.yy.c */extern void action_out PROTO(());/* true if a string is all lower case */extern int all_lower PROTO((register Char *));/* true if a string is all upper case */extern int all_upper PROTO((register Char *));/* bubble sort an integer array */extern void bubble PROTO((int [], int));/* shell sort a character array */extern void cshell PROTO((Char [], int, int));extern void dataend PROTO(()); /* finish up a block of data declarations *//* report an error message and terminate */extern void flexerror PROTO((char[]));/* report a fatal error message and terminate */extern void flexfatal PROTO((char[]));/* report an error message formatted with one integer argument */extern void lerrif PROTO((char[], int));/* report an error message formatted with one string argument */extern void lerrsf PROTO((char[], char[]));/* spit out a "# line" statement */extern void line_directive_out PROTO((FILE*));/* generate a data statment for a two-dimensional array */extern void mk2data PROTO((int));extern void mkdata PROTO((int)); /* generate a data statement *//* return the integer represented by a string of digits */extern int myctoi PROTO((Char []));/* write out one section of the skeleton file */extern void skelout PROTO(());/* output a yy_trans_info structure */extern void transition_struct_out PROTO((int, int));/* from file nfa.c *//* add an accepting state to a machine */extern void add_accept PROTO((int, int));/* make a given number of copies of a singleton machine */extern int copysingl PROTO((int, int));/* debugging routine to write out an nfa */extern void dumpnfa PROTO((int));/* finish up the processing for a rule */extern void finish_rule PROTO((int, int, int, int));/* connect two machines together */extern int link_machines PROTO((int, int));/* mark each "beginning" state in a machine as being a "normal" (i.e., * not trailing context associated) state */extern void mark_beginning_as_normal PROTO((register int));/* make a machine that branches to two machines */extern int mkbranch PROTO((int, int));extern int mkclos PROTO((int)); /* convert a machine into a closure */extern int mkopt PROTO((int)); /* make a machine optional *//* make a machine that matches either one of two machines */extern int mkor PROTO((int, int));/* convert a machine into a positive closure */extern int mkposcl PROTO((int));extern int mkrep PROTO((int, int, int)); /* make a replicated machine *//* create a state with a transition on a given symbol */extern int mkstate PROTO((int));extern void new_rule PROTO(()); /* initialize for a new rule *//* from file parse.y *//* write out a message formatted with one string, pinpointing its location */extern void format_pinpoint_message PROTO((char[], char[]));/* write out a message, pinpointing its location */extern void pinpoint_message PROTO((char[]));extern void synerr PROTO((char [])); /* report a syntax error */extern int yyparse PROTO(()); /* the YACC parser *//* from file scan.l */extern int flexscan PROTO(()); /* the Flex-generated scanner for flex *//* open the given file (if NULL, stdin) for scanning */extern void set_input_file PROTO((char*));extern int yywrap PROTO(()); /* wrapup a file in the lexical analyzer *//* from file sym.c *//* save the text of a character class */extern void cclinstal PROTO ((Char [], int));/* lookup the number associated with character class */extern int ccllookup PROTO((Char []));extern void ndinstal PROTO((char[], Char[])); /* install a name definition */extern void scinstal PROTO((char[], int)); /* make a start condition *//* lookup the number associated with a start condition */extern int sclookup PROTO((char[]));/* from file tblcmp.c *//* build table entries for dfa state */extern void bldtbl PROTO((int[], int, int, int, int));extern void cmptmps PROTO(()); /* compress template table entries */extern void inittbl PROTO(()); /* initialize transition tables */extern void mkdeftbl PROTO(()); /* make the default, "jam" table entries *//* create table entries for a state (or state fragment) which has * only one out-transition */extern void mk1tbl PROTO((int, int, int, int));/* place a state into full speed transition table */extern void place_state PROTO((int*, int, int));/* save states with only one out-transition to be processed later */extern void stack1 PROTO((int, int, int, int));/* from file yylex.c */extern int yylex PROTO(());/* The Unix kernel calls used here */extern int read PROTO((int, char*, int));extern int unlink PROTO((char*));extern int write PROTO((int, char*, int));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -