📄 itcl.puma
字号:
p := constructor (_, s, local_ident (gpos, _, iconstructor), ReverseTree (param_names (w2)), w2, b, epos, attr, noword (_)); w3 := noword (_); RETURN p; .s, (iconstructor), w2: word_c (next := w3:>word_c (next := w4: qual_word (qualification := local_text (texts := b: block (epos := epos))))), _ :- itcl := itcl + 1; p: constructor; p := constructor (_, s, local_ident (gpos, _, iconstructor), ReverseTree (param_names (w2)), w2, b, epos, attr, w3); w3 := noword (_); RETURN p; .s, (idestructor), w2: qual_word (qualification := local_text (texts := b: block (epos := epos))), _ :- itcl := itcl + 1; RETURN destructor (_, s, local_ident (gpos, _, idestructor), noword (_), noword (_), b, epos, attr); .... :- RETURN NIL; ./**************************************************************/FUNCTION Mblock_content (tPosition, tPosition, stmts) textb, e, stmt (next := nostmt (...), words := one_word (next := noword (...), ident := ident, pos := pos)) :- RETURN content (_, NoTree, b, local_ident (pos := pos, ident := ident)); .b, e, stmt (next := nostmt (...), words := qual_word (next := noword (...), qualification := q: qualification_c (...))) :- RETURN content (_, NoTree, b, q); .b, e, s :- RETURN block_content (_, NoTree, b, e, s); ./**************************************************************/FUNCTION make_qualification ([word_c, qualifications]) qualification_cone_word (ident := ident, pos := pos) :- RETURN local_ident (pos := pos, ident := ident); .qual_word (qualification := qualification) :- RETURN qualification; .qual_words (qualifications := qualifications) :- RETURN make_qualification (qualifications); .one_qualification (next := next: noqualification (...), qualification := qualification) :- RETURN make_qualification (qual_word (qualification := qualification)); .one_qualification (next := next) :- RETURN make_qualification (next); ./**************************************************************/FUNCTION param_names (word_c) wordsone_word (env := env, next := next: words, ident := ident, pos := pos) :- RETURN one_word (next := noword (_), ident := ident, pos := pos); .qual_word (qualification := local_text (texts := block (stmts := stmts))) :- RETURN param_names_2 (stmts, noword (_)); .qual_word (qualification := q: qualification_c (pos := pos)) :- RETURN one_word (pos := pos, ident := make_one_word (q), next := noword (_)); .qual_words (...) :- /* crazy: ignore it */ RETURN noword (_); ./**************************************************************/FUNCTION param_names_2 (stmts, words) wordsstmt (env := env, next := next: stmts, words := words), w :- RETURN param_names_2 (next, param_names_3 (words, w)); ._, w :- RETURN w; ./**************************************************************/FUNCTION param_names_3 (words, words) wordsone_word (env := env, next := next: words, ident := ident, pos := pos), w :- RETURN param_names_3 (next, one_word (next := w, ident := ident, pos := pos)); .qual_word (next := next, qualification := local_text (texts := block (stmts := stmt (env := env, words := words)))), w :- RETURN param_names_3 (next, param_names_4 (words, w)); .qual_word (next := next, qualification := q: qualification_c (pos := pos)), w :- RETURN param_names_3 (next, one_word (pos := pos, ident := make_one_word (q), next := w)); ._, w :- RETURN w; ./**************************************************************/FUNCTION param_names_4 (words, words) wordsone_word (env := env, next := next: words, ident := ident, pos := pos), w :- RETURN one_word (next := w, ident := ident, pos := pos); .qual_word (qualification := q: qualification_c (pos := pos)), w :- RETURN one_word (pos := pos, ident := make_one_word (q), next := w); ._, w :- RETURN w; ./**************************************************************/PROCEDURE get_end_pos ([words, texts, qualification_c, qualifications] => tPosition)one_word (ident := ident, pos := pos) => e :- e: tPosition; e := pos; e.Column := e.Column + StLength (GetStringRef (ident)) - 1; .qual_word (qualification := qualification) => e :- get_end_pos (qualification => e); .qual_words (qualifications := qualifications) => e :- get_end_pos (qualifications => e); .one_qualification (next := next: qualifications, qualification := qualification: qualification_c) => e :- get_end_pos (qualification => e); .text (next := next: text (...)) => e :- get_end_pos (next => e); .character (pos := pos) => e :- e: tPosition; e := pos; .ident (pos := pos, ident := ident) => e :- e: tPosition; e := pos; e.Column := e.Column + StLength (GetStringRef (ident)) - 1; .block (epos := epos) => e :- e: tPosition; e := epos; .content (qualification := qualification) => e :- get_end_pos (qualification => e); .block_content (epos := epos) => e :- e: tPosition; e := epos; .local_ident (pos := pos, ident := ident) => e :- e: tPosition; e := pos; e.Column := e.Column + StLength (GetStringRef (ident)) - 1; .global_ident (pos := pos, ident := ident) => e :- e: tPosition; e := pos; e.Column := e.Column + StLength (GetStringRef (ident)) - 1; .local_text (pos := pos, texts := texts) => e :- get_end_pos (texts => e); .global_text (pos := pos, texts := texts) => e :- get_end_pos (texts => e); .qualification (pos := pos, ident := ident) => e :- e: tPosition; e := pos; e.Column := e.Column + StLength (GetStringRef (ident)) - 1; .complex_qual (texts := texts) => e :- get_end_pos (texts => e); .subscription (qualification := qualification) => e :- get_end_pos (qualification => e); ./**************************************************************/PROCEDURE get_begin_pos (qualification_c => tPosition)qualification (qualification := qualification_c (pos := pos)) => pos :- .complex_qual (qualification := qualification (pos := pos)) => pos :- .qualification_c (pos := pos) => pos :- ./**************************************************************/PROCEDURE get_end_pos_2 (words => tPosition)w: word_c (next := noword (...)) => e :- get_end_pos (w => e); .word_c (next := next) => e :- get_end_pos_2 (next => e); ./**************************************************************/PREDICATE get_script (words => texts, tPosition)one_word (ident := ident, pos := pos, next := next) => s, e :- strncmp (GetCStr (ident), "-l", 2) == 0; get_script (next => s, e); .one_word (ident := ident, pos := pos, next := word_c (next := next)) => s, e :- strncmp (GetCStr (ident), "-e", 2) == 0; get_script (next => s, e); .one_word (ident := ident, pos := pos, next := next) => s, e :- strncmp (GetCStr (ident), "--", 2) == 0; get_script (next => s, e); .qual_word (qualification := local_text (texts := b: block (epos := epos))) :- => b, epos, ./**************************************************************/PROCEDURE itcl_info (words)one_word (ident := ident, env := env, next := one_word (ident := i2, pos := pos, next := next)) :- strncmp (GetCStr (ident), "-c", 2) == 0 || /* -class */ strncmp (GetCStr (ident), "-i", 2) == 0; /* -isa */ obj: objects; obj := Identify (i2, env); obj != NIL; use (obj, pos, PAF_REF_READ); itcl_info (next); .word_c (next := next) :- itcl_info (next); ./**************************************************************/FUNCTION get_env (qualification_c) envqualification (qualification := qualification) ;complex_qual (qualification := qualification) ;subscription (qualification := qualification) ;qualification :- RETURN get_env_2 (qualification); ./**************************************************************/FUNCTION get_env_2 (qualification_c) envlocal_ident (pos := pos, env := e, ident := ident) :- obj: objects; obj := Identify (ident, e); obj != NIL && Tree_IsType (obj->object.object, knamespace_c); use (obj, pos, PAF_REF_READ); RETURN obj->object.object->namespace_c.block->words.env; .local_ident (pos := pos, ident := ident) :- use_undef (ident, pos); RETURN NIL; .global_ident (pos := pos, ident := ident) :- obj: objects; obj := IdentifyGlobal (ident); obj != NIL && Tree_IsType (obj->object.object, knamespace_c); use (obj, pos, PAF_REF_READ); RETURN obj->object.object->namespace_c.block->words.env; .global_ident (pos := pos, ident := ident) :- use_undef (ident, pos); RETURN NIL; .qualification (pos := pos, qualification := qualification, ident := ident) :- env: envs; env := get_env_2 (qualification); env != NIL; obj: objects; obj := IdentifyMember (ident, env); obj != NIL && Tree_IsType (obj->object.object, knamespace_c); use (obj, pos, PAF_REF_READ); RETURN obj->object.object->namespace_c.block->words.env; .qualification (pos := pos, ident := ident) :- use_undef (ident, pos); RETURN NIL; .complex_qual (pos := pos, qualification := qualification, texts := texts) :- env: envs; env := get_env_2 (qualification); env != NIL; ident: tIdent; ident := make_one_word (texts); obj: objects; obj := IdentifyMember (ident, env); obj != NIL && Tree_IsType (obj->object.object, knamespace_c); use (obj, pos, PAF_REF_READ); RETURN obj->object.object->namespace_c.block->words.env; .subscription (pos := pos, qualification := qualification, index := index) :- RETURN get_env_2 (qualification); .local_text (pos := pos, env := env, texts := texts) :- RETURN NIL; .global_text (pos := pos, env := env, texts := texts) :- RETURN NIL; ._ :- RETURN NIL; ./**************************************************************/FUNCTION get_ident (qualification_c) tIdentqualification (ident := ident) :- RETURN ident; .complex_qual (texts := texts) :- RETURN make_one_word (texts); .subscription (qualification := qualification) :- RETURN get_ident (qualification); .local_ident (ident := ident) :- RETURN ident; .global_ident (ident := ident) :- RETURN ident; ._ :- RETURN NoIdent; ./**************************************************************/PROCEDURE add_qualifications (tIdent, word_c, attr: int)(iset), w2: word_c (next := noword (...)), _ :- /* set r */ add_qual (w2, PAF_REF_READ); .(iset), w2, _ :- /* set w x */ add_qual (w2, PAF_REF_WRITE); .(ivariable), w2: word_c (next := noword (...)), _ :- /* variable d */ add_variable_quals (w2, PAF_REF_READ, PAF_PUBLIC); .(ivariable), w2, _ :- /* variable w x */ add_variable_quals (w2, PAF_REF_WRITE, PAF_PUBLIC); .(icommon), w2: word_c (next := noword (...)), _ :- /* common d */ add_qual (w2, PAF_REF_READ); .(icommon), w2, _ :- /* common w x */ add_qual (w2, PAF_REF_WRITE); .(ipublic), w2: one_word (ident := ident, next := /* public */ w3: word_c (...)), _ :- add_qualifications (ident, w3, PAF_PUBLIC); .(iprotected), w2: one_word (ident := ident, next := /* protected */ w3: word_c (...)), _ :- add_qualifications (ident, w3, PAF_PROTECTED); .(iprivate), w2: one_word (ident := ident, next := /* private */ w3: word_c (...)), _ :- add_qualifications (ident, w3, PAF_PRIVATE); ./*(ilocal), w2: word_c (next := w3: word_c (...)), _ :- /* local c d /* add_qual (w3, PAF_REF_READ); .*/(iinherit), w2: word_c (...), _ :- /* inherit x ... */ inherit_var (w2); .(iappend), w2, _ :- /* append w */ add_qual (w2, PAF_REF_WRITE); .(ilappend), w2, _ :- /* lappend w */ add_qual (w2, PAF_REF_WRITE); .(iarray), w2: one_word (ident := (iset), next := /* array set w */ w3: word_c (...)), _ :- add_qual (w3, PAF_REF_WRITE); .(iarray), w2: word_c (next := w3: word_c (...)), _ :- /* array x r */ add_qual (w3, PAF_REF_READ); .(ibinary), w2: one_word (ident := (iscan), next := /* binary scan x x w ... */ w3: word_c (next := w4: word_c (next := w5: word_c (...)))), _ :- add_quals (w5, PAF_REF_WRITE); .(iscan), w2: word_c (next := /* scan x x w ... */ w3: word_c (next := w4: word_c (...))), _ :- add_quals (w4, PAF_REF_WRITE); .(iforeach), w2, _ :- /* foreach */ add_foreach_quals (w2); .(ivwait), w2, _ :- /* vwait r */ add_qual (w2, PAF_REF_READ); .(iincr), w2, _ :- /* incr w */ add_qual (w2, PAF_REF_WRITE); .(iparray), w2, _ :- /* parray r */ add_qual (w2, PAF_REF_READ); .(icatch), w2: word_c (next := w3: word_c (...)), _ :- /* catch x w */ add_qual (w3, PAF_REF_WRITE); .(igets), w2: word_c (next := w3: word_c (...)), _ :- /* gets x w */ add_qual (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -