📄 tree.c
字号:
yyTraverseTreeTD (yyt->block_content.stmts);yyt = yyt->block_content.next; break;case klocal_text:yyt = yyt->local_text.texts; break;case kglobal_text:yyt = yyt->global_text.texts; break;case kqualification:yyt = yyt->qualification.qualification; break;case kcomplex_qual:yyTraverseTreeTD (yyt->complex_qual.qualification);yyt = yyt->complex_qual.texts; break;case ksubscription:yyTraverseTreeTD (yyt->subscription.qualification);yyt = yyt->subscription.index; break;case kenv:yyTraverseTreeTD (yyt->env.objects);yyt = yyt->env.env; break;case kenv2:yyTraverseTreeTD (yyt->env2.env1);yyt = yyt->env2.env2; break;case kobject:yyt = yyt->object.next; break; default: return; } }}void TraverseTreeTD#if defined __STDC__ | defined __cplusplus (tTree yyt, Tree_tProcTree yyyProc)#else (yyt, yyyProc) tTree yyt; Tree_tProcTree yyyProc;#endif{ yyMark (yyt); yyProc = yyyProc; yyTraverseTreeTD (yyt);}tTree ReverseTree#if defined __STDC__ | defined __cplusplus (tTree yyOld)#else (yyOld) tTree yyOld;#endif{ register tTree yyNew, yyNext, yyTail; yyNew = yyOld; yyTail = yyOld; for (;;) { switch (yyOld->Kind) {case kstmt_c: yyNext = yyOld->stmt_c.next; yyOld->stmt_c.next = yyNew; break;case kstmt: yyNext = yyOld->stmt.next; yyOld->stmt.next = yyNew; break;case kproc_c: yyNext = yyOld->proc_c.next; yyOld->proc_c.next = yyNew; break;case kproc: yyNext = yyOld->proc.next; yyOld->proc.next = yyNew; break;case kmethod: yyNext = yyOld->method.next; yyOld->method.next = yyNew; break;case kbody: yyNext = yyOld->body.next; yyOld->body.next = yyNew; break;case kconfigbody: yyNext = yyOld->configbody.next; yyOld->configbody.next = yyNew; break;case kconstructor: yyNext = yyOld->constructor.next; yyOld->constructor.next = yyNew; break;case kdestructor: yyNext = yyOld->destructor.next; yyOld->destructor.next = yyNew; break;case knamespace_c: yyNext = yyOld->namespace_c.next; yyOld->namespace_c.next = yyNew; break;case knamespace: yyNext = yyOld->namespace.next; yyOld->namespace.next = yyNew; break;case kclass: yyNext = yyOld->class.next; yyOld->class.next = yyNew; break;case kitcl_class: yyNext = yyOld->itcl_class.next; yyOld->itcl_class.next = yyNew; break;case kword_c: yyNext = yyOld->word_c.next; yyOld->word_c.next = yyNew; break;case kone_word: yyNext = yyOld->one_word.next; yyOld->one_word.next = yyNew; break;case kobj_word: yyNext = yyOld->obj_word.next; yyOld->obj_word.next = yyNew; break;case kqual_word: yyNext = yyOld->qual_word.next; yyOld->qual_word.next = yyNew; break;case kqual_words: yyNext = yyOld->qual_words.next; yyOld->qual_words.next = yyNew; break;case kone_qualification: yyNext = yyOld->one_qualification.next; yyOld->one_qualification.next = yyNew; break;case ktext: yyNext = yyOld->text.next; yyOld->text.next = yyNew; break;case kcharacter: yyNext = yyOld->character.next; yyOld->character.next = yyNew; break;case kident: yyNext = yyOld->ident.next; yyOld->ident.next = yyNew; break;case kblock: yyNext = yyOld->block.next; yyOld->block.next = yyNew; break;case kcontent: yyNext = yyOld->content.next; yyOld->content.next = yyNew; break;case kblock_content: yyNext = yyOld->block_content.next; yyOld->block_content.next = yyNew; break;case kenv2: yyNext = yyOld->env2.env2; yyOld->env2.env2 = yyNew; break;case kobject: yyNext = yyOld->object.next; yyOld->object.next = yyNew; break; default: goto yyExit; } yyNew = yyOld; yyOld = yyNext; }yyExit: switch (yyTail->Kind) {case kstmt_c: yyTail->stmt_c.next = yyOld; break;case kstmt: yyTail->stmt.next = yyOld; break;case kproc_c: yyTail->proc_c.next = yyOld; break;case kproc: yyTail->proc.next = yyOld; break;case kmethod: yyTail->method.next = yyOld; break;case kbody: yyTail->body.next = yyOld; break;case kconfigbody: yyTail->configbody.next = yyOld; break;case kconstructor: yyTail->constructor.next = yyOld; break;case kdestructor: yyTail->destructor.next = yyOld; break;case knamespace_c: yyTail->namespace_c.next = yyOld; break;case knamespace: yyTail->namespace.next = yyOld; break;case kclass: yyTail->class.next = yyOld; break;case kitcl_class: yyTail->itcl_class.next = yyOld; break;case kword_c: yyTail->word_c.next = yyOld; break;case kone_word: yyTail->one_word.next = yyOld; break;case kobj_word: yyTail->obj_word.next = yyOld; break;case kqual_word: yyTail->qual_word.next = yyOld; break;case kqual_words: yyTail->qual_words.next = yyOld; break;case kone_qualification: yyTail->one_qualification.next = yyOld; break;case ktext: yyTail->text.next = yyOld; break;case kcharacter: yyTail->character.next = yyOld; break;case kident: yyTail->ident.next = yyOld; break;case kblock: yyTail->block.next = yyOld; break;case kcontent: yyTail->content.next = yyOld; break;case kblock_content: yyTail->block_content.next = yyOld; break;case kenv2: yyTail->env2.env2 = yyOld; break;case kobject: yyTail->object.next = yyOld; break; default: ; } return yyNew;}void ForallTree#if defined __STDC__ | defined __cplusplus (tTree yyt, Tree_tProcTree yyProc)#else (yyt, yyProc) tTree yyt; Tree_tProcTree yyProc;#endif{ for (;;) { tTree yyyt; if ((yyyt = yyt) == NoTree) return; switch (yyt->Kind) {case kstmt_c: yyt = yyt->stmt_c.next; break;case kstmt: yyt = yyt->stmt.next; break;case kproc_c: yyt = yyt->proc_c.next; break;case kproc: yyt = yyt->proc.next; break;case kmethod: yyt = yyt->method.next; break;case kbody: yyt = yyt->body.next; break;case kconfigbody: yyt = yyt->configbody.next; break;case kconstructor: yyt = yyt->constructor.next; break;case kdestructor: yyt = yyt->destructor.next; break;case knamespace_c: yyt = yyt->namespace_c.next; break;case knamespace: yyt = yyt->namespace.next; break;case kclass: yyt = yyt->class.next; break;case kitcl_class: yyt = yyt->itcl_class.next; break;case kword_c: yyt = yyt->word_c.next; break;case kone_word: yyt = yyt->one_word.next; break;case kobj_word: yyt = yyt->obj_word.next; break;case kqual_word: yyt = yyt->qual_word.next; break;case kqual_words: yyt = yyt->qual_words.next; break;case kone_qualification: yyt = yyt->one_qualification.next; break;case ktext: yyt = yyt->text.next; break;case kcharacter: yyt = yyt->character.next; break;case kident: yyt = yyt->ident.next; break;case kblock: yyt = yyt->block.next; break;case kcontent: yyt = yyt->content.next; break;case kblock_content: yyt = yyt->block_content.next; break;case kenv2: yyt = yyt->env2.env2; break;case kobject: yyt = yyt->object.next; break; default: return; } yyProc (yyyt); }}static rbool yyResult;static void yyCheckTree ARGS ((tTree yyt));rbool CheckTree#if defined __STDC__ | defined __cplusplus (tTree yyt)#else (yyt) tTree yyt;#endif{ yyMark (yyt); yyResult = rtrue; yyCheckTree (yyt); return yyResult;}static void yyCheckChild2#if defined __STDC__ | defined __cplusplus (tTree yyParent, tTree yyyChild, Tree_tKind yyType, char * yySelector)#else (yyParent, yyyChild, yyType, yySelector) tTree yyParent, yyyChild; Tree_tKind yyType; char * yySelector;#endif{ if (! Tree_IsType (yyyChild, yyType)) { yyResult = rfalse; (void) fputs ("CheckTree: parent = ", stderr); WriteTreeNode (stderr, yyParent); (void) fprintf (stderr, "\nselector: %s child = ", yySelector); WriteTreeNode (stderr, yyyChild); (void) fputc ('\n', stderr); }}static void yyCheckChild#if defined __STDC__ | defined __cplusplus (tTree yyParent, tTree yyyChild, Tree_tKind yyType, char * yySelector)#else (yyParent, yyyChild, yyType, yySelector) tTree yyParent, yyyChild; Tree_tKind yyType; char * yySelector;#endif{ yyCheckChild2 (yyParent, yyyChild, yyType, yySelector); yyCheckTree (yyyChild);}static void yyCheckTree#if defined __STDC__ | defined __cplusplus (tTree yyt)#else (yyt) tTree yyt;#endif{ for (;;) { if (yyt == NoTree) { yyResult = rfalse; return; } if (yyt->yyHead.yyMark == 0) return; yyt->yyHead.yyMark = 0; switch (yyt->Kind) {case kprogram:yyCheckChild2 (yyt, yyt->program.stmts,kstmts, "stmts");yyt = yyt->program.stmts; break;case kstmt_c:yyCheckChild2 (yyt, yyt->stmt_c.next,kstmts, "next");yyt = yyt->stmt_c.next; break;case kstmt:yyCheckChild (yyt, yyt->stmt.words,kwords, "words");yyCheckChild2 (yyt, yyt->stmt.next,kstmts, "next");yyt = yyt->stmt.next; break;case kproc_c:yyCheckChild (yyt, yyt->proc_c.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->proc_c.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->proc_c.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->proc_c.block,ktexts, "block");yyCheckChild2 (yyt, yyt->proc_c.next,kstmts, "next");yyt = yyt->proc_c.next; break;case kproc:yyCheckChild (yyt, yyt->proc.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->proc.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->proc.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->proc.block,ktexts, "block");yyCheckChild2 (yyt, yyt->proc.next,kstmts, "next");yyt = yyt->proc.next; break;case kmethod:yyCheckChild (yyt, yyt->method.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->method.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->method.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->method.block,ktexts, "block");yyCheckChild2 (yyt, yyt->method.next,kstmts, "next");yyt = yyt->method.next; break;case kbody:yyCheckChild (yyt, yyt->body.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->body.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->body.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->body.block,ktexts, "block");yyCheckChild2 (yyt, yyt->body.next,kstmts, "next");yyt = yyt->body.next; break;case kconfigbody:yyCheckChild (yyt, yyt->configbody.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->configbody.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->configbody.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->configbody.block,ktexts, "block");yyCheckChild2 (yyt, yyt->configbody.next,kstmts, "next");yyt = yyt->configbody.next; break;case kconstructor:yyCheckChild (yyt, yyt->constructor.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->constructor.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->constructor.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->constructor.block,ktexts, "block");yyCheckChild (yyt, yyt->constructor.init,kwords, "init");yyCheckChild2 (yyt, yyt->constructor.next,kstmts, "next");yyt = yyt->constructor.next; break;case kdestructor:yyCheckChild (yyt, yyt->destructor.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->destructor.param_names,kwords, "param_names");yyCheckChild (yyt, yyt->destructor.parameter,kwords, "parameter");yyCheckChild (yyt, yyt->destructor.block,ktexts, "block");yyCheckChild2 (yyt, yyt->destructor.next,kstmts, "next");yyt = yyt->destructor.next; break;case knamespace_c:yyCheckChild (yyt, yyt->namespace_c.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->namespace_c.block,ktexts, "block");yyCheckChild2 (yyt, yyt->namespace_c.next,kstmts, "next");yyt = yyt->namespace_c.next; break;case knamespace:yyCheckChild (yyt, yyt->namespace.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->namespace.block,ktexts, "block");yyCheckChild2 (yyt, yyt->namespace.next,kstmts, "next");yyt = yyt->namespace.next; break;case kclass:yyCheckChild (yyt, yyt->class.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->class.block,ktexts, "block");yyCheckChild2 (yyt, yyt->class.next,kstmts, "next");yyt = yyt->class.next; break;case kitcl_class:yyCheckChild (yyt, yyt->itcl_class.qualification,kqualification_c, "qualification");yyCheckChild (yyt, yyt->itcl_class.block,ktexts, "block");yyCheckChild2 (yyt, yyt->itcl_class.next,kstmts, "next");yyt = yyt->itcl_class.next; break;case kword_c:yyCheckChild2 (yyt, yyt->word_c.next,kwords, "next");yyt = yyt->word_c.next; break;case kone_word:yyCheckChild2 (yyt, yyt->one_word.next,kwords, "next");yyt = yyt->one_word.next; break;case kobj_word:yyCheckChild2 (yyt, yyt->obj_word.next,kwords, "next");yyt = yyt->obj_word.next; break;case kqual_word:yyCheckChild (yyt, yyt->qual_word.qualification,kqualification_c, "qualification");yyCheckChild2 (yyt, yyt->qual_word.next,kwords, "next");yyt = yyt->qual_word.next; break;case kqual_words:yyCheckChild (yyt, yyt->qual_words.qualifications,kqualifications, "qualifications");yyCheckChild2 (yyt, yyt->qual_words.next,kwords, "next");yyt = yyt->qual_words.next; break;case kone_qualification:yyCheckChild (yyt, yyt->one_qualification.qualification,kqualification_c, "qualification");yyCheckChild2 (yyt, yyt->one_qualification.next,kqualifications, "next");yyt = yyt->one_qualification.next; break;case ktext:yyCheckChild2 (yyt, yyt->text.next,ktexts, "next");yyt = yyt->text.next; break;case kcharacter:yyCheckChild2 (yyt, yyt->character.next,ktexts, "next");yyt = yyt->character.next; break;case kident:yyCheckChild2 (yyt, yyt->ident.next,ktexts, "next");yyt = yyt->ident.next; break;case kblock:yyCheckChild (yyt, yyt->block.stmts,kstmts, "stmts");yyCheckChild2 (yyt, yyt->block.next,ktexts, "next");yyt = yyt->block.next; break;case kcontent:yyCheckChild (yyt, yyt->content.qualification,kqualification_c, "qualification");yyCheckChild2 (yyt, yyt->content.next,ktexts, "next");yyt = yyt->content.next; break;case kblock_content:yyCheckChild (yyt, yyt->block_content.stmts,kstmts, "stmts");yyCheckChild2 (yyt, yyt->block_content.next,ktexts, "next");yyt = yyt->block_content.next; break;case klocal_text:yyCheckChild2 (yyt, yyt->local_text.texts,ktexts, "texts");yyt = yyt->local_text.texts; break;case kglobal_text:yyCheckChild2 (yyt, yyt->global_text.texts,ktexts, "texts");yyt = yyt->global_text.texts; break;case kqualification:yyCheckChild2 (yyt, yyt->qualification.qualification,kqualification_c, "qualification");yyt = yyt->qualification.qualification; break;case kcomplex_qual:yyCheckChild (yyt, yyt->complex_qual.qualification,kqualification_c, "qualification");yyCheckChild2 (yyt, yyt->complex_qual.texts,ktexts, "texts");yyt = yyt->complex_qual.texts; break;case ksubscription:yyCheckChild (yyt, yyt->subscription.qualification,kqualification_c, "qualification");yyCheckChild2 (yyt, yyt->subscription.index,kqualification_c, "index");yyt = yyt->subscription.index; break;case kenv:yyCheckChild (yyt, yyt->env.objects,kobjects, "objects");yyCheckChild2 (yyt, yyt->env.env,kenvs, "env");yyt = yyt->env.env; break;case kenv2:yyCheckChild (yyt, yyt->env2.env1,kenvs, "env1");yyCheckChild2 (yyt, yyt->env2.env2,kenvs, "env2");yyt = yyt->env2.env2; break;case kobject:yyCheckChild2 (yyt, yyt->object.next,kobjects, "next");yyt = yyt->object.next; break; default: return; } }}#ifdef __cplusplusextern "C" {#include "Position.h"};#else#include "Position.h"#endifstatic long yyLine, yyCurLine;static tTree yyTheTree, yyNode;static void (* yySearch3) ARGS ((tTree yyt, tPosition yyp));static void yySearch4#if defined __STDC__ | defined __cplusplus (tTree yyt, tPosition yyp)#else (yyt, yyp) tTree yyt; tPosition yyp;#endif{ if ((unsigned short) yyLine <= yyp.Line && yyp.Line < (unsigned short) yyCurLine) { yyNode = yyt; yyCurLine = yyp.Line; }}static void yySearch2#if defined __STDC__ | defined __cplusplus (tTree yyt)#else (yyt) tTree yyt;#endif{ switch (yyt->Kind) {case kproc_c:yySearch3 (yyt, yyt->proc_c.epos);break;case kproc:yySearch3 (yyt, yyt->proc.epos);break;case kmethod:yySearch3 (yyt, yyt->method.epos);break;case kbody:yySearch3 (yyt, yyt->body.epos);break;case kconfigbody:yySearch3 (yyt, yyt->configbody.epos);break;case kconstructor:yySearch3 (yyt, yyt->constructor.epos);break;case kdestructor:yySearch3 (yyt, yyt->destruct
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -