Hi, On Montag, 4. März 2013, 12:45:59 you wrote: > On Mon, 2013-03-04 at 11:37 +0100, Andreas Lauser wrote: > > Hm, okay. Seems like the eclipse files I have are too simplistic. But > > > > isn't there a (relatively) simple generic syntax for the file format? > > I'm afraid not. Some (most) keywords consist of (essentially) a single > data record, terminated by a '/' character. Some keywords have no > associated data. Other keywords have no terminator. Some keywords have > an arbitrary number of records (e.g., 'PVTO', 'WELSPECS' or 'COMPDAT') > and are terminated by a null record (line) consisting only of '/'. Add > to this that the number of data items in many records are generally > dependent upon descriptive metadata in the 'RUNSPEC' section and you end > up with a highly convoluted structure.
yeah, if you add semantics to it it is definitely convoluted. but I'm talking about the syntactic part of the parser... > There is really only one general statement you can make about the > structure of keywords and that is that the keyword string matches the > regular expression > > ^[A-Z][A-Z0-9]\{1,7\} > > Anything else is more or less special case treatment for each keyword. > Happily, many of the keywords in the 'GRID' section have the *same* > special case treatment, so there is at least *some* commonality in the > input file processing. That would make the syntactic part of parsing the files pretty simple: just check of a given line matches the regexp you've given; if it matches, start a new keyword, else add more parameters to the previous one... > > I assumption is that if you do not have to deal with seemingly simple > > > > stuff like comments, line continuation, include statements, etc in the > > code which adds sematics to the syntax, that code will be much easier > > to write and to understand... > > Maybe so, but *every* realistic .DATA file uses INCLUDE (possibly > multiple levels) and comments. that's my point: if you handle the INPUT keyword as well as comments and line continuation at the 'dumb' level, you don't need to deal with all of this on the 'smart' level. I don't know how eclipse handles the INPUT keyword, but if it uses a just minimally reasonable definition, it inserts the text of the specified file instead of the INPUT line, which should be pretty easy to implement... cheers Andreas -- Andreas Lauser Department of Hydromechanics and Modelling of Hydrosystems University of Stuttgart Pfaffenwaldring 61 D-70569 Stuttgart Phone: (+49) 711 685-64719 Fax: (+49) 711 685-60430 www.hydrosys.uni-stuttgart.de _______________________________________________ Opm mailing list Opm@opm-project.org http://www.opm-project.org/mailman/listinfo/opm