Commit Graph

207 Commits

Author SHA1 Message Date
Andreas Lauser
382d449ebb also eat keywords containing lowercase letters
The Norne deck actually exhibits this atrocity in form of the
'fluxnum' keyword in the file 'INCLUDE/PETRO/FLUXNUM_0704.prop'.

I don't know if Eclipse cares about the case of the keywords, but
opm-parser currently does for sure. (If Eclipse turns out to be
case-insensitive, the easiest fix for us is to just make all keywords
ALL_UPPERCASE...)
2014-11-07 12:58:04 +01:00
Andreas Lauser
7955ea5dac ParserState: make it possible to detect if initialization went wrong
this is required to get meaningful error messages if the file
specified by INCLUDE does not exist.
2014-11-06 16:16:29 +01:00
Andreas Lauser
5bdb17f7c1 Parser: rename the internal parseStream() method to parseState()
there is still the public variant of Parser::parseStream() which
parses an arbitrary std::istream. the name of the state-taking variant
was just confusing, IMO...
2014-11-06 15:16:19 +01:00
Andreas Lauser
46ff1a0f41 unknown keywords: use the line number of the raw keyword instead of the current one of the ParserState
in this context, the line number of the parser state object is the
location where the keyword is finished, while it is much more useful
to get the line where the keyword starts...
2014-11-05 13:13:50 +01:00
Andreas Lauser
f8946b9e7e RawKeyword: rename tryParseKeyword() to isKeywordPrefix()
because the method never tried to *parse* the data as a keyword but always
returned whether the *calling* code should try to parse it...
2014-11-05 13:11:52 +01:00
Andreas Lauser
fbf6008da4 Parser: rename and split canParseKeyword to isRecognizedKeyword
which is more what the method does because the keyword can still
contain an error in its data which would make it non-parseable.

While at it, split the method into a "get keyword name from input
line" and "is a valid keyword name" part. (this will be needed later.)
2014-11-05 13:08:04 +01:00
Andreas Lauser
6eb3421f38 Handle quotes better
This allows to arbitrary characters like stars into strings. e.g.

MYKEYWORD
'123*456' 2*'Hello, World! (*)' /

is now a valid record with three strings while it threw an exception
before.

This patch works by transferring the removal of the quotes from the
RawDeck class to the readValueToken<T>() function which now has a
specialization for strings that deals with quotes. One small
complication is that the RawDeck needs to be adapted in order not to
split tokens in the middle of strings.

Finally, the StarToken class does not deal with the conversion from
string to the value type of the item anymore which allows it to become
a normal class instead of a template...
2014-11-05 13:05:22 +01:00
Andreas Lauser
ff90fe71c0 replace the deck-internal logging system by ParserLog 2014-10-07 15:39:14 +02:00
Andreas Lauser
f76113f2b1 DeckKeyword: retain the ParserKeyword object
this is useful because DeckKeywords can have almost arbitrary names
(which match a regular expression) which makes it hard to retrieve
additional information about the keyword after it has been created...
2014-10-07 14:22:47 +02:00
Andreas Lauser
38797ea534 DeckKeyword: retain the location of keywords
this is useful for log messages.
2014-10-07 14:22:47 +02:00
Andreas Lauser
f754bd9c45 fix some screw-up with internal vs deck names
Parser::hasKeyword() was called with deckNames but looked up the map
for internal names. This patch renames the method to hasDeckName(),
renames Parser::getKeyword() to Parser::getKeywordFromDeckName() and
adapts/extends the tests.
2014-07-01 17:07:43 +02:00
Andreas Lauser
fe638c2fc8 separate the internal keyword names and the deck names more clearly
so far, these two concepts were partially mingled in Opm::Parser...
2014-06-29 14:32:06 +02:00
Andreas Lauser
96904b00f4 allow keywords to match regular expressions as their deck name
the RE used is specified via the "deck_name_regex" in the JSON file of
the respective keyword. A deck name is assumed to match a given parser
internal keyword if the deck name is valid and if it is either in the
list specified by the "deck_names" entry or if it matches the regular
expression.

This functionality is useful to implement the well probes for the
tracers as well as replacing the current "wild card keyword"
implementation which only allows a star as a suffix.
2014-06-29 14:32:06 +02:00
Andreas Lauser
5f949c11c3 add support for parser keywords specifying to multiple deck keywords
Say hello to the complete set of well, region, field and group output
specifiers soon...
2014-06-13 13:17:03 +02:00
Andreas Lauser
d820a4d435 change construction of ParserKeyword objects to the factory paradigm
this makes it more explicit what the object is supposed to represent.
2014-06-11 15:08:58 +02:00
Andreas Lauser
0d92cd43b0 export possibility to parse an arbitrary std::istream
this has the potential to reduce the memory requirements of the parser
for opm-benchmarks considerably and is quite easy to add since
internally all parsing happend on istreams anyway...

The parser integration test has been extended to test the new method
as well as `parseString()` which was omitted previously. (I wonder who
introduced this without changing the test. ;)
2014-05-20 12:12:12 +02:00
Andreas Lauser
0ca3a30697 make sure that the file we are attempting to parse actually exists
before that case was identical to an empty data file...
2014-04-15 13:52:08 +02:00
Joakim Hove
5becf79dd1 The ParserKeyword->parse() method will throw if the raw input argument is not finished.
Requires several changes to assure that the rawkeyword instances are
marked as finished before reacing the ParserKeyword->parse method.
2014-04-11 13:42:22 +02:00
Atle Haugan
c81fe99fec Fixed definition for PATHS keyword + improved unit test for same 2014-02-26 15:03:04 +01:00
Atle Haugan
e4a404023c Removed some logging output from Parser 2014-02-21 13:14:11 +01:00
Atle Haugan
9ac0401af5 Support for PATHS keyword - first take 2014-02-21 12:56:20 +01:00
Atle Haugan
cd3d4f9337 First cut: TITLE keyword now being parsed correctly. 2014-01-28 10:01:11 +01:00
Atle Haugan
51ac683ef2 OPM-17: Fixed bug in END[INC] logic. 2014-01-24 13:16:37 +01:00
Atle Haugan
ef11a2331f OPM-17: First attempt to handle END and ENDINC keywords 2014-01-24 10:01:17 +01:00
Andreas Lauser
9a09fa29af rename Parser::parse to Parser::parseFile and add Parser::parseData
Parser::parseData is quite useful for unit tests to prevent them
spilling files to everything. Also, what was formerly
Parser::parseFile has been renamed to Parser::parseStream and slightly
modified to not be specific for std::ifstream.
2014-01-10 14:51:56 +01:00
Atle Haugan
308cfda3c5 Improved some type usage based on code review feedback 2014-01-10 08:53:19 +01:00
Atle Haugan
f9d06da6db Removed even more green code 2014-01-08 11:16:30 +01:00
Atle Haugan
e3f752f38b Removed some green code 2014-01-08 11:12:52 +01:00
Atle Haugan
25eb08aa52 After code review with Kristian and Joakim 2014-01-08 10:49:21 +01:00
Atle Haugan
73dfc77aab Some more adjustments 2014-01-08 10:49:20 +01:00
Atle Haugan
67ab48eee0 First running version of the KeyWordDescriber class. Some cleanup and refactoring required. 2014-01-08 10:49:20 +01:00
Atle Haugan
72545992e1 First running version of the KeyWordDescriber class. Some cleanup and refactoring required. 2014-01-08 10:49:20 +01:00
Joakim Hove
65c9882b53 Added dimensions to WCONHIST & WCONPROD. 2013-12-16 00:02:47 +01:00
Joakim Hove
de16ff8da1 Added methods applyUnitsToDeck() which push units onto the deck. 2013-12-14 10:28:49 +01:00
Kristian Flikka
a750fd422d Added constructor, moved ParserState struct to cpp file 2013-12-06 15:27:05 +01:00
Kristian Flikka
78337c7bda Added a ParserState struct, to encapsulate the temporary state of the parsing process 2013-12-06 14:18:05 +01:00
Joakim Hove
24e233a53c Support for parsing keywords with unknown size. 2013-12-05 08:26:29 +01:00
Kristian Flikka
ce692159c9 Trimming right side of each read line, to avoid line ending problems.
Removed C style parsing of numbers, using boost::lexical_cast instead.
2013-12-03 10:15:22 +01:00
Joakim Hove
6021d03548 Removed debug message on stdout 2013-12-02 09:31:19 +01:00
Joakim Hove
abd0905171 Changed parser to support parsing of keywords with wildcard like
"TVDP*". An importtant change is that we now query the parser
canParseKeyword() instead of hasKeyword().
2013-12-01 09:28:14 +01:00
Joakim Hove
f303c09690 Parser->addKeyword() will erase first; NOW the ReplaceKeyword works 2013-10-24 09:37:14 +02:00
Joakim Hove
803304d5f8 Deck->keywordContainer will set deckIndex of DeckKeyword when inserting: Have relaxed const properties of DeckKeyword 2013-10-22 11:42:15 +02:00
Joakim Hove
2ac8bc55a5 Merge pull request #30 from joakim-hove/data-with-space
Data with space
2013-10-15 05:23:11 -07:00
Joakim Hove
b63244228d Added Parser::dropKeyword() 2013-10-09 08:22:43 +02:00
Joakim Hove
253d8bec0f Minor minor 2013-10-08 17:03:46 +02:00
Joakim Hove
6dce82c5a5 Added action: THROW_EXCEPTION 2013-10-08 16:54:41 +02:00
Joakim Hove
8e550b7f32 Added warnings in Deck for keywords of type IGNORE_WARNING and unrecognized keywords 2013-10-08 16:19:18 +02:00
Joakim Hove
f3a38425cb Added warning capabilities to the Deck 2013-10-08 16:02:16 +02:00
Joakim Hove
997d53ea99 Merge branch 'store-file-and-line' into keyword-status 2013-10-08 15:28:21 +02:00
Joakim Hove
f0770f47fb Added filename and line nr to RawRecord 2013-10-08 15:23:45 +02:00