1
function [txt,space]=format_txt(txt,instr,prettyprint,nextinstr)
3
// Scilab Project - V. Couvert
4
// Add EOL and returns spaces to have good indentation (called by tree2code)
6
// - txt: code to format
7
// - instr: instruction to evaluate as a possible EOL
8
// - prettyprint = %T -> code generated is formated %F -> code generated has same format as original code
9
// - nextinstr: next instruction after instr (format EOL between instructions)
12
// - space: indentation margin for control instructions
16
// Indentation and EOL in control clauses
18
if instr<>list("EOL") & prettyprint then
19
txt = cat_code(txt,"")
21
elseif instr<>list("EOL") then
26
// EOL between instructions
28
if prettyprint & instr<>list("EOL") & nextinstr<>list("EOL") then
29
txt = cat_code(txt,"")