comp.lang.ada
 help / color / mirror / Atom feed
From: Manuel Collado <m.collado@fi.upm.es>
Subject: Re: ANNOUNCE: Avatox 1.0 is now available
Date: Mon, 11 Sep 2006 10:10:42 +0200
Date: 2006-09-11T10:10:42+02:00	[thread overview]
Message-ID: <45051a01@news.upm.es> (raw)
In-Reply-To: <a475a$45030e5e$41f0a638$9466@API-DIGITAL.COM>

Marc A. Criley escribi�:
> Manuel Collado wrote:
> 
>  > What puzzles me is that the XML structure (nesting) doesn't follows 
> the lexical Ada source structure. Example from avatox.adb --> 
> avatox.adb.xml:
>  >
>  > <A_CLAUSE ... startLine="29" endLine="29" startCol="1" endCol="29">
>  >   <A_WITH_CLAUSE ... startLine="29" endLine="29" startCol="1" 
> endCol="29"/>
>  >   <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" 
> endCol="28">
>  >     <A_SELECTED_COMPONENT ... startLine="29" endLine="29" 
> startCol="6" endCol="28"/>
>  >     <AN_EXPRESSION ... startLine="29" endLine="29" startCol="6" 
> endCol="19">
>  >       ....
>  >
>  > You can see that <A_WITH_CLAUSE> from (29,1) to (29,29) lexically 
> contains <AN_EXPRESSION> from (29,6) to (29,28). But the latest is not 
> nested inside the former. Instead, it appears as a sibling of it.
>  >
>  > The same for <A_SELECTED_COMPONENT> from (29,6) to (29,28) and 
> <AN_EXPRESSION> from (29,6) to (29,19).
>  >
>  > Is that the intended behaviour?
> 
> 
> Blame it on the Display_Source program which served as the progenitor of 
> Avatox :-)  

I'm not blaming anything. On the contrary, I'm warmly grateful of people 
that write useful utilities, like asis2xml or avatox, and make them 
publicly available!

> Here's what Display_Source generates for the corresponding 
> portion that you reference:
> 
> A_CLAUSE
>   A_WITH_CLAUSE
> ->AN_EXPRESSION
> ->  A_SELECTED_COMPONENT
> --->AN_EXPRESSION
> 
> Avatox really did little more to the output than wrap it with an XML 
> syntax.  It then added value by providing the position info and some 
> basic "meta-information", i.e, the "pedigree" of an XML element, for the 
> aid of post-processors.
> 
> My interest is what can happen when starting with the XML and processing 
> it, rather than trying to find the bestest XML representation of an Ada 
> program.  So I did minimal processing to get the XML, even if it means 
> there's redundant stuff in it.  So long as its consistent, well-ordered, 
> and complete (meaning all the clauses, comments, and position info), I'm 
> happy.

Well, I've quicky written my own utility (an xmlgawk script) to reorder the 
elements so the XML nesting does follow the lexical nesting. The following 
fragment from avatox.adb.xml:

<A_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" endCol="29">
    <A_WITH_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" 
endCol="29"/>
    <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" startCol="6" 
endCol="28">
       <A_SELECTED_COMPONENT pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="28"/>
       <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19">
          <A_SELECTED_COMPONENT pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19"/>
          <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="8">
             <AN_IDENTIFIER pedigree="asis" ident="Ada" startLine="29" 
endLine="29" startCol="6" endCol="8"/>
          </AN_EXPRESSION>
          <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="10" endCol="19">
             <AN_IDENTIFIER pedigree="asis" ident="Characters" 
startLine="29" endLine="29" startCol="10" endCol="19"/>
          </AN_EXPRESSION>
       </AN_EXPRESSION>
       <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="21" endCol="28">
          <AN_IDENTIFIER pedigree="asis" ident="Handling" startLine="29" 
endLine="29" startCol="21" endCol="28"/>
       </AN_EXPRESSION>
    </AN_EXPRESSION>
</A_CLAUSE>


becomes


<A_CLAUSE pedigree="asis" startLine="29" endLine="29" startCol="1" endCol="29">
     <A_WITH_CLAUSE pedigree="asis" startLine="29" endLine="29" 
startCol="1" endCol="29">
         <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="28">
             <A_SELECTED_COMPONENT pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="28">
                 <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="6" endCol="19">
                     <A_SELECTED_COMPONENT pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="19">
                         <AN_EXPRESSION pedigree="asis" startLine="29" 
endLine="29" startCol="6" endCol="8">
                             <AN_IDENTIFIER pedigree="asis" ident="Ada" 
startLine="29" endLine="29" startCol="6" endCol="8">
                             </AN_IDENTIFIER>
                         </AN_EXPRESSION>
                         <AN_EXPRESSION pedigree="asis" startLine="29" 
endLine="29" startCol="10" endCol="19">
                             <AN_IDENTIFIER pedigree="asis" 
ident="Characters" startLine="29" endLine="29" startCol="10" endCol="19">
                             </AN_IDENTIFIER>
                         </AN_EXPRESSION>
                     </A_SELECTED_COMPONENT>
                 </AN_EXPRESSION>
                 <AN_EXPRESSION pedigree="asis" startLine="29" endLine="29" 
startCol="21" endCol="28">
                     <AN_IDENTIFIER pedigree="asis" ident="Handling" 
startLine="29" endLine="29" startCol="21" endCol="28">
                     </AN_IDENTIFIER>
                 </AN_EXPRESSION>
             </A_SELECTED_COMPONENT>
         </AN_EXPRESSION>
     </A_WITH_CLAUSE>
</A_CLAUSE>


> 
> -- Marc A. Criley
> -- Mckae Technologies
> -- www.mckae.com
> -- DTraq - Avatox - XIA - XML EZ Out

-- 
Manuel Collado




      reply	other threads:[~2006-09-11  8:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-17  0:58 ANNOUNCE: Avatox 1.0 is now available Marc A. Criley
2006-08-17  2:10 ` Jeffrey Creem
2006-08-18  8:03 ` Pascal Obry
2006-08-18  8:04 ` Pascal Obry
2006-08-18  8:05 ` Pascal Obry
2006-08-21 20:59 ` Simon Wright
2006-08-24  0:41   ` Marc A. Criley
2006-08-24  6:03     ` Simon Wright
2006-08-25  1:15       ` Marc A. Criley
2006-09-06 23:29       ` Randy Brukardt
2006-09-07 20:46         ` Simon Wright
2006-09-08  2:40           ` Randy Brukardt
2006-09-08 13:40             ` Georg Bauhaus
2006-09-09  8:28               ` Manuel Collado
2006-09-09 12:21                 ` Simon Wright
2006-09-11  7:58                   ` Manuel Collado
2006-09-09 18:56                 ` Marc A. Criley
2006-09-11  8:10                   ` Manuel Collado [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox