Thanks very much Raul,
I did consider your solution's output, but preferred the sample I provided. 
(except that I mistakenly specified that body would be contained inside head). 
The reason being that A cell contains all of its children.  The inconsistency 
in my sample is just that if a cell has only one member (no children), then it 
can be raised to the top level.  The key difference between my spec and yours, 
is that the body node has 4 enclosed members, and # would reflect that.  Table 
has 1 member, and tr has 2.  I wanted the spec to let each cell know where it 
ends without looking at its neighbours.

with body indented at the same level as head, the spec I intend:
(0{t),< (1{t), (2{t) , <( 3{t) , (< ( (4{t) ,<5{t )) , (<(  6{t), ( < (7{t),< ( 
(8{t), 9 {t))),  10{t


I will study your solution, as it is probably very close to what I'm looking 
for.  Thanks again.

----- Original Message ----
From: Raul Miller <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Monday, April 2, 2007 5:51:07 PM
Subject: Re: [Jprogramming] Parsing Pythonish

On 4/2/07, Pascal Jasmin <[EMAIL PROTECTED]> wrote:
> test =: 0 : 0
> html
>  head
>  body
>   p stuff
>   p div='adiv'
>    more stuff
>   table
>    tr
>     td 1
>     td 2
>   p last stuff
> )
...
> Desired Output
...
> (0{t),<(1{t),<(2{t),<(3{t),(<((4{t),<5{t)),(<(6{t),(<(7{t),<((8{t),9{t))),10{t

I do not think that is what you want.  You can see some contradictory
behaviors if you contrast your output with
   3 :'<^:(i.&0 y='' '')<y';._2 test

For example, you have 'head' and 'body' boxed differently while
you have your table cell elements boxed the same way.

Anyways, I suspect what you want looks more like:
   (([:(,.+/\)' '~:{."1) <`(<@$:@:(}."1))@.(' '&[EMAIL PROTECTED]@{.)/.]) ];._2 
test

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to