This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: parser question ...


On Tue, 14 Sep 2004 03:24:28 +0200
Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> wrote:

> Lars Segerlund wrote:
> >  I have a small question about the parser, specifically :
> > 
> > parse.c:277:      match ("use% ", gfc_match_use, ST_USE);
> > 
... snip ......
> 
> The mandatory space was added, because we didn't differentiate between
>    USEmod
> and
>    USE mod
> which of course was wrong (always assuming free-form source code, of course).
> But, as your example shows, this language extension breaks this assumption.
> What you have to do is either remove the "% " in the line you quoted, and have
> gfc_match_use do the right thing, taking care of both the space and the
> extension there, or add another matcher function, say gfc_match_use_intrinsic
> and then add a line in parser.c like this
>    match ("use , intrinsic", gfc_match_use_intrinsic, ST_USE_INTRINSIC)
> I don't know enough about this extension to know if the second solution would
> work, but I think it would be preferable, if possible, because this way the
> code dealing with this language extension could be kept separate from the
> stuff dealing with standard code.
> 
> - Tobi

 Ok, I think I'll go for the second approach, ( match ("use , intrinsic", bla bla bla ... ST_USE_INTRINSIC), since I just started off getting into the workings of the parser and the module code, so I agree, number two would be most appropriate ( after adding a flag ).

 What I'm currently working on is a separate parser for intrinsic modules, ( imodule.c ) which basicly uses some of the routines in module.c but of course doesn't read a .mod file but instead directly fixes things that show up. ( A bit unclear but you know what I mean with some luck, basicly it will be a hack to patch things up ). I also plan to separate the module specific code into im_ieee.c and im_c_bind.c which only gets used by the imodule.c file, does this sound ok ?

 / Lars Segerlund.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]