1 /* START OF: rdc_delete_stmt_.incl.pl1 * * * * * * * * * * * * * * * * */ 2 3 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 4 /* */ 5 /* N^H__^Ha_^Hm_^He: rdc_delete_stmt_.incl.pl1 */ 6 /* */ 7 /* This include segment is used by compilers generated by the reduction_compiler. */ 8 /* It includes a procedure which deletes all of the tokens associated with the current */ 9 /* statement (i.e., the statement which contains the token identified by Pthis_token). */ 10 /* */ 11 /* S^H__^Ht_^Ha_^Ht_^Hu_^Hs */ 12 /* */ 13 /* 0) created by: G. C. Dixon in February, 1975. */ 14 /* */ 15 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 16 17 18 DELETE_STMT: procedure; 19 20 dcl (Plast, Pnext) ptr, /* ptr to (first, last) token to be deleted. */ 21 Ssearching bit(1) aligned; /* on if scan for first/last token continuing. */ 22 23 if Pthis_token = null then return; /* if input list exhausted, we can't do anything. */ 24 Pstmt = Pthis_token -> token.Pstmt; /* address the statement descriptor of "current" */ 25 if Pstmt = null then return; /* token, if it exists. */ 26 Plast = Pthis_token; /* start scanning with "current" token. */ 27 Ssearching = "1"b; /* set switch indicating search still continuing. */ 28 do while (Ssearching & Plast -> token.Plast ^= null); 29 if Plast -> token.Plast -> token.Pstmt = Pstmt then 30 Plast = Plast -> token.Plast; /* scan backward for 1st _^Hn_^Ho_^Hn-^H__^Hd_^He_^Hl_^He_^Ht_^He_^Hd token of stmt*/ 31 else Ssearching = "0"b; /* when found, stop searching. */ 32 end; /* Recall that 1st token of stmt (ie, token */ 33 /* pointed to by stmt.Pfirst_token) may have */ 34 /* been deleted. */ 35 Pnext = Pthis_token; /* start scanning forward with "current" token. */ 36 Ssearching = "1"b; 37 do while (Ssearching & Pnext -> token.Pnext ^= null); 38 if Pnext -> token.Pnext -> token.Pstmt = Pstmt then 39 Pnext = Pnext -> token.Pnext; /* scan forward for last _^Hn_^Ho_^Hn-^H__^Hd_^He_^Hl_^He_^Ht_^He_^Hd token of stmt*/ 40 else Ssearching = "0"b; /* when found, stop searching. */ 41 end; 42 if Pnext -> token.Pnext = null then /* if there is no next statement, and */ 43 if SPDL then /* if in PUSH DOWN LANGUAGE mode, and */ 44 if Plast -> token.Plast = null then /* if there are no more tokens before the */ 45 Ptoken, Pthis_token = null; /* "current" statement, then input exhausted. */ 46 else do; 47 Ptoken, Pthis_token = Plast -> token.Plast; 48 /* otherwise, make token preceding the "current"*/ 49 /* statement the "current" token. */ 50 token.Pnext = null; /* indicate that input list exhausted. Only the*/ 51 /* tokens before the new "current" token exist. */ 52 end; 53 else Ptoken, Pthis_token = null; /* not in PUSH DOWN LANGUAGE - input exhausted. */ 54 else do; 55 Ptoken, Pthis_token = Pnext -> token.Pnext; /* normally, token following "current" statement */ 56 /* becomes the "current" token. */ 57 token.Plast = Plast -> token.Plast; /* unthread the deleted tokens. */ 58 if Plast -> token.Plast ^= null then 59 Plast -> token.Plast -> token.Pnext = Ptoken; 60 end; 61 62 if Pnext -> token.Pnext = null then /* unthread statement descriptor from list. */ 63 Pnext = null; 64 else Pnext = Pnext -> token.Pnext -> token.Pstmt; 65 if Plast -> token.Plast = null then 66 Plast = null; 67 else Plast = Plast -> token.Plast -> token.Pstmt; 68 if Pnext ^= null then 69 Pnext -> stmt.Plast = Plast; 70 if Plast ^= null then 71 Plast -> stmt.Pnext = Pnext; 72 73 end DELETE_STMT; 74 75 /* END OF: rdc_delete_stmt_.incl.pl1 * * * * * * * * * * * * * * * * */