comp.lang.ada
 help / color / mirror / Atom feed
* GNAT ASIS & pragmas
@ 2018-06-08  8:25 Simon Wright
  2018-06-08 14:58 ` Simon Wright
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Wright @ 2018-06-08  8:25 UTC (permalink / raw)


In ASIS2XML[1] and gnat2xml, I see that the repreentation of pragmas
in GNAT ASIS doesn't follow the ARM syntax (2.8(2))[2],

   pragma ::= 
      pragma identifier [(pragma_argument_association
                          {, pragma_argument_association})];

Instead, I see for example

ASIS2XML:
      <restrictions_pragma>Restrictions
      <pragma_argument_association>
        <identifier>No_Exception_Propagation</identifier>
      </pragma_argument_association></restrictions_pragma>

gnat2xml:
      <restrictions_pragma pragma_name="Restrictions">
         <sloc line="1" col="1" endline="1" endcol="47"/>
         <pragma_argument_associations_ql>
            <pragma_argument_association>
               <sloc line="1" col="22" endline="1" endcol="45"/>
               <formal_parameter_q>
                  <not_an_element>
                     <sloc line="1" col="1" endline="0" endcol="0"/>
                  </not_an_element>
               </formal_parameter_q>
               <actual_parameter_q>
                  <identifier ref_name="No_Exception_Propagation" ref="null" type="null">
                     <sloc line="1" col="22" endline="1" endcol="45"/>
                  </identifier>
               </actual_parameter_q>
            </pragma_argument_association>
         </pragma_argument_associations_ql>
      </restrictions_pragma>

(gosh!)

I'd like to change this (well, the one I have control over, ASIS2XML) to
something more natural and that corresponds better to the ARM, e.g.

   <pragma kind='restrictions' name='Restrictions'>
      <pragma_argument_association>
        <identifier>No_Exception_Propagation</identifier>
      </pragma_argument_association>
   </pragma>

(the difference between kind & name being that name is as in the source,
whereas kind is lower-cased).

[1] https://sourceforge.net/projects/asis2xml
[2] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-2-8.html#p2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GNAT ASIS & pragmas
  2018-06-08  8:25 GNAT ASIS & pragmas Simon Wright
@ 2018-06-08 14:58 ` Simon Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Wright @ 2018-06-08 14:58 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> In ASIS2XML[1] and gnat2xml, I see that the repreentation of pragmas
> in GNAT ASIS doesn't follow the ARM syntax (2.8(2))[2],
>
>    pragma ::= 
>       pragma identifier [(pragma_argument_association
>                           {, pragma_argument_association})];
>
> Instead, I see for example
>
> ASIS2XML:
>       <restrictions_pragma>Restrictions
>       <pragma_argument_association>
>         <identifier>No_Exception_Propagation</identifier>
>       </pragma_argument_association></restrictions_pragma>

I should add, I can quite see the reason for ASIS to distinguish all the
different kinds of pragma, but the thinking behind ASIS2XML is to make
it possible to use XML tools to analyse source code without knowing the
fine details of ASIS, and retaining distinctions like this necessary for
(at any rate, made in) ASIS won't help.

Current thoughts on a suitable output:

      <pragma kind="restrictions">
        <identifier>RestriCtions</identifier>
        <pragma_argument_association>
          <identifier>No_Exception_Propagation</identifier>
        </pragma_argument_association>
      </pragma>

(note the weird casing in the pragma identifier, from the source).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-08 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08  8:25 GNAT ASIS & pragmas Simon Wright
2018-06-08 14:58 ` Simon Wright

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