Skip to content

Commit

Permalink
CodeGen.m: Rewrite FlattenBlock and make it more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Oct 6, 2011
1 parent 25b122f commit a50298e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tools/CodeGen/CodeGen.m
Expand Up @@ -176,7 +176,10 @@

(* Code generation utilities; not specific to any language *)

FlattenBlock[b_] := Apply[StringJoin,Map[ToString,If[! AtomQ[b], Flatten[b, Infinity], b]]];
(* FlattenBlock *)
FlattenBlock[x_String] := x;
FlattenBlock[l_List] := StringJoin@@Map[FlattenBlock, l];
FlattenBlock[a_?AtomQ] := ToString[a];

indentBlock[block_] :=
StringDrop[" " <> StringReplace[FlattenBlock[block], {"\n" -> "\n "}],-2];
Expand Down

0 comments on commit a50298e

Please sign in to comment.