321-cl3

Download Document
Showing pages : 1 - 2 of 2
This preview has blurred sections. Sign up to view the full version! View Full Document
global_procedure Get_Tree ( alters ); /*! requires there exists x, y: string of character, t1: tree of character (#tree_as_text = x * y and x = PREFIX_DISPLAY (t1)) ensures #tree_as_text = PREFIX_DISPLAY (t) * tree_as_text !*/ { object Character x; t.Clear() object Character t2; if(tree-as-text.Length() > 0) { tree-as-text.Remove(0, x); if(x =='(') { if(tree-as-text.Length() > 0) { tree-as-text.Remove(0, x); if(x != '(' and ')') { t2[current] &= x; t.Add(0, t2); } } else if(x == '(') { if(tree-as-text.Length() > 0) { tree-as-text.Remove(0, x); if(x == ')') { if(tree-as-text.Length() > 0) { tree-as-text.Remove(0, x); if(x ! = '(' and ')') { t2[current] &= x;
Background image of page 1
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t.Add(0, t2); } } } } } else { t[current] &= x; } Get_Tree(tree-as-text, t2); t.Add(0, t2); } } global_procedure Put_Tree ( preserves Tree_Of_Character& t, alters Character_OStream& outs, preserves Integer indentation_factor ); /*! requires outs.is_open = true ensures outs.is_open = true and outs.ext_name = #outs.ext_name and outs.content = #outs.content * MULTILINE_DISPLAY (t, indentation_factor) !*/ { object Integer pos; outs << t[current] << '\n' << '\t'; while(pos < t.Number_Of_Children) { object Tree_Of_Character t2; t.Remove(pos, t2); Put_Tree(t2, outs, indentation_factor); t.Add(pos, t2); pos++; } }...
View Full Document