Do not display ELSE branch when empty in tree output.

Minor clean-up, fix some expected output.
This commit is contained in:
Pascal Obry
2010-09-01 07:51:47 +00:00
parent 56949f519c
commit edd36a06a3
6 changed files with 7 additions and 14 deletions

View File

@@ -165,7 +165,6 @@ Should be 0 : 0
[TEXT] Well a another one [@_VAR2_@]
[END_BLOCK]
[END_TABLE]
[ELSE]
[END_IF]
[TEXT]
[TABLE] TERMINATE_SECTIONS

View File

@@ -60,7 +60,6 @@
[IF] @_EXIST:MATDSIZE_@
[TEXT] @_TABLE_LINE_@
[TEXT] [@_MATDSIZE_@]
[ELSE]
[END_IF]
[END_BLOCK]
[END_TABLE]
@@ -81,7 +80,6 @@
[IF] @_EXIST:V6_@
[TEXT] >@_V5_@
[TEXT] >@_V6_@
[ELSE]
[END_IF]
[END_BLOCK]
[END_TABLE]

View File

@@ -6,5 +6,4 @@
[TEXT]
[IF] (@_TWO_@ > 0)
[TEXT] here
[ELSE]
[END_IF]

View File

@@ -84,12 +84,10 @@ include.tmplt
[TEXT]
[IF] (@_$2_@ = toto)
[TEXT] 5> @_$1_@
[ELSE]
[END_IF]
[TEXT]
[IF] ((@_WEB_NBSP:$2_@ = toto) or (@_WEB_NBSP:$1_@ = "xx yy"))
[TEXT] 6> @_$2_@
[ELSE]
[END_IF]
[TEXT]
[TABLE]
@@ -122,12 +120,10 @@ include.tmplt
[TEXT]
[IF] (@_$2_@ = toto)
[TEXT] 5> @_$1_@
[ELSE]
[END_IF]
[TEXT]
[IF] ((@_WEB_NBSP:$2_@ = toto) or (@_WEB_NBSP:$1_@ = "xx yy"))
[TEXT] 6> @_$2_@
[ELSE]
[END_IF]
[TEXT]
[TABLE]
@@ -160,12 +156,10 @@ include.tmplt
[TEXT]
[IF] (@_$2_@ = toto)
[TEXT] 5> @_$1_@
[ELSE]
[END_IF]
[TEXT]
[IF] ((@_WEB_NBSP:$2_@ = toto) or (@_WEB_NBSP:$1_@ = "xx yy"))
[TEXT] 6> @_$2_@
[ELSE]
[END_IF]
[TEXT]
[TABLE]

View File

@@ -67,7 +67,6 @@
[COMMON]
[IF] (@_MATDSIZE_@ /= )
[TEXT] @_TABLE_LINE_@> @_MATDSIZE_@
[ELSE]
[END_IF]
[END_BLOCK]
[END_TABLE]

View File

@@ -31,6 +31,8 @@ separate (Templates_Parser)
procedure Print_Tree (T : Tree; Level : Natural := 0) is
use type Expr.Tree;
procedure Print_Indent (L : Natural);
-- Output proper number of spaces for identation
@@ -93,9 +95,11 @@ begin
Expr.Print_Tree (T.Cond);
Text_IO.New_Line;
Print_Tree (T.N_True, Level + 1);
Print_Indent (Level);
Text_IO.Put_Line ("[ELSE]");
Print_Tree (T.N_False, Level + 1);
if T.N_False /= null then
Print_Indent (Level);
Text_IO.Put_Line ("[ELSE]");
Print_Tree (T.N_False, Level + 1);
end if;
Print_Indent (Level);
Text_IO.Put_Line ("[END_IF]");
Print_Tree (T.Next, Level);