@@ -76,15 +76,35 @@ defmodule Module.Types.Expr do
7676    do:  { empty_list ( ) ,  context } 
7777
7878  # [expr, ...] 
79-   # PENDING: here 
80-   def  of_expr ( list ,  _expected ,  expr ,  stack ,  context )  when  is_list ( list )  do 
79+   def  of_expr ( list ,  expected ,  expr ,  stack ,  context )  when  is_list ( list )  do 
8180    { prefix ,  suffix }  =  unpack_list ( list ,  [ ] ) 
82-     { prefix ,  context }  =  Enum . map_reduce ( prefix ,  context ,  & of_expr ( & 1 ,  @ pending ,  expr ,  stack ,  & 2 ) ) 
83-     { suffix ,  context }  =  of_expr ( suffix ,  @ pending ,  expr ,  stack ,  context ) 
8481
8582    if  stack . mode  ==  :traversal  do 
83+       { _ ,  context }  =  Enum . map_reduce ( prefix ,  context ,  & of_expr ( & 1 ,  term ( ) ,  expr ,  stack ,  & 2 ) ) 
84+       { _ ,  context }  =  of_expr ( suffix ,  term ( ) ,  expr ,  stack ,  context ) 
8685      { dynamic ( ) ,  context } 
8786    else 
87+       hd_type  = 
88+         case  list_hd ( expected )  do 
89+           { _ ,  type }  ->  type 
90+           _  ->  term ( ) 
91+         end 
92+ 
93+       { prefix ,  context }  =  Enum . map_reduce ( prefix ,  context ,  & of_expr ( & 1 ,  hd_type ,  expr ,  stack ,  & 2 ) ) 
94+ 
95+       { suffix ,  context }  = 
96+         if  suffix  ==  [ ]  do 
97+           { empty_list ( ) ,  context } 
98+         else 
99+           tl_type  = 
100+             case  list_tl ( expected )  do 
101+               { _ ,  type }  ->  type 
102+               _  ->  term ( ) 
103+             end 
104+ 
105+           of_expr ( suffix ,  tl_type ,  expr ,  stack ,  context ) 
106+         end 
107+ 
88108      { non_empty_list ( Enum . reduce ( prefix ,  & union / 2 ) ,  suffix ) ,  context } 
89109    end 
90110  end 
0 commit comments