Commit Graph

58 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
7bc3c79301 PATHS keyword has global scope.
ECLIPSE resolves path aliases defined in an included file globally, i.e.
/
|> include.inc
|-- PATHS 'alias' 'path/to/dir'
|> main.data
|-- INCLUDE 'include.inc' /
| [...]
|-- INCLUDE '$alias/file.inc' /

will resolve as 'path/to/dir/file.inc'. This behaviour is now adopted by
opm-parser.
2016-02-22 10:16:12 +01:00
Jørgen Kvalsvik
78e1ab9db5 Parser stores keywords as unique_ptr
Removes shared_ptr< ParserKeyword > exchange in Parser interface and
replaces it with unique_ptr storage and raw pointers for return values.
This has some implications:

* addParserKeyword() no longer takes shared_ptr<>, but unique_ptr&&
  addParserKeyword has been modified to create unique_ptr instead of
  shared_ptr.

* generated-source/ParserKeyword* no longer use make_shared which had a
  -massive- impact on compile times, which are now more-or-less
  trivialised (on my machine: 7.5s -> 1s per file). This because the
  compiler no longer generates a bunch of forwarding make_shared
  instances of subclasses that are immediately thrown away, but rather
  uses an inline make_unique that instantiates the -parent- class
  unique_ptr.
2016-02-19 14:19:41 +01:00
Jørgen Kvalsvik
a187d58502 Removes unused function in ParserTests 2016-02-19 14:04:17 +01:00
Jørgen Kvalsvik
4b98943665 Replaces unecessary header includes with fwd decls
Every header is self-contained and includes only what it must to
function, relying on users include what they need in source files,
adopting a pay-what-you-use model (in particular for internal
dependencies).
2016-01-26 13:23:22 +01:00
Kjell W. Kongsvik
dc0cc45e89 Allowed parser keywords without items 2015-09-15 16:43:01 +02:00
Joakim Hove
3ee3c023e6 Handle quotes when stripping off comments. 2015-08-24 20:06:01 +02:00
Joakim Hove
1161e1098c Rewritten code generation:
With this commit the generation of built in keywords is completely
changed. The most important changes include:

  1) We have autogenerated a class for each keyword in the new
     ParserKeywords { ... } namespace.

  2) The autogenerated classes derive from ParserKeyword, and the
     default constructor will build of a fully initialized
     ParserKeyword instance, i.e. the keyword used to parse the EQUIL
     keyword can be instantiated as simple as:

         ParserKeywords::EQUIL kw;

  3) The generated keywords have built in static constants for keyword
     and item names, and item default values. That way it should be
     possible for the compiler to catch trivial errors like trying to
     access the keyword "PoRO"; also the the access to default values
     means that properties can be initialized without actually
     insantiating a DeckKeyword.

  4) Two new classes Generator/KeywordLoader and
     Generator/KeywordGenerator have been created, with the help of
     these classes the keyword generation code is significantly
     simplified.
2015-06-08 11:29:18 +02:00
Joakim Hove
875f591a1b Changed ParserKeyword to use vector of records 2015-02-20 00:21:32 +01:00
Andreas Lauser
ea38a25af4 remove all trailing white space
this is just the result of

```
find -iname "*.[ch]pp" | xargs sed -i "s/ *$//"
find opm/parser/share/keywords -type f |  xargs sed -i "s/ *$//"
```

so if it causes conflicts with other patches, the others should get
priority. The rationale behind this patch is that some people tell
their editor to remove white space which leads to larger than
necessary patches...
2014-12-08 16:34:28 +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
a4f55f5f8d JSON keyword definitions: make the "sections" item mandatory
the empty list can be used which means that the keyword may occur in
any section. (which is useful for e.g. section delimiters.)
2014-10-13 16:06:09 +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
09c5a24473 add GROUP_PROBE 2014-06-29 14:32:06 +02:00
Andreas Lauser
d4409dbae0 add BLOCK_PROBE 2014-06-29 14:32:06 +02:00
Andreas Lauser
49b48662ef change the TVDP keywords to use regular expressions instead of wildcards 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
Arne Morten Kvarving
3827ddca64 fixed: mark static symbols as such to quell warnings 2014-05-15 14:46:16 +02:00
Atgeirr Flø Rasmussen
79e4d51597 Renamed local variable to avoid shadowing. 2014-04-15 09:49:04 +02:00
Atle Haugan
ed17058ad3 Renamed FLOAT to DOUBLE in JSON files, tests and some code using the enum 2014-02-17 15:02:40 +01:00
Atle Haugan
c9cda9916f Code improvements based on code review feedback 2014-01-08 15:03:16 +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
76a9cbb0b8 Updated test to check a return value 2013-10-25 17:31:48 +02:00
Roland Kaufmann
781ef04a0e Compare size with unsigned int literal
Surprisingly, some compilers (notably GCC 4.6.3) will issue a warning
when comparing a literal which is clearly positive to an unsigned type,
when looking for a suitable instantiation in Boost. This is fixed by
making the literal unsigned too, so there's no doubt.
2013-10-22 23:39:49 +02:00
Joakim Hove
1cc16de2bd Added test for replace keyword functionality 2013-10-18 10:17:48 +02:00
Joakim Hove
b63244228d Added Parser::dropKeyword() 2013-10-09 08:22:43 +02:00
Joakim Hove
9986916ca7 Fixing parser tests 2013-09-17 17:45:42 +02:00
Joakim Hove
1ff18bb38a Removed constructor with one global JSON config file + addedd optional flag to include all built in keywords 2013-09-14 22:39:43 +02:00
Kristian Flikka
e55d52654d Added test to check that getKeyword throws when asked for non-existing keyword 2013-08-27 10:10:12 +02:00
Kristian Flikka
480d14934b Added test for a case with fully, partial and empty record body, defaults are added 2013-08-26 15:17:52 +02:00
Kristian Flikka
be882b6b27 Removed commented test 2013-08-23 12:18:38 +02:00
Joakim Hove
b630140316 Merged upstream/master 2013-08-23 09:30:23 +02:00
Joakim Hove
df031007db Added items: to all inline config strings 2013-08-23 00:20:07 +02:00
Joakim Hove
dfca913462 Added method to load keyword configurations from directory 2013-08-21 12:50:21 +02:00
Kristian Flikka
002ab45f77 Removed commented test 2013-08-21 08:51:00 +02:00
Kristian Flikka
89daeea561 Renamed newRawKeyword to createRawKeyword. Minor refactoring 2013-08-21 08:44:46 +02:00
Joakim Hove
47d29cc804 Added parser->size() and parser->loadKeywordFromFile() 2013-08-19 22:37:48 +02:00
Joakim Hove
a0a20425f6 Updated tests to reflect that RawDeck has been removed 2013-08-13 14:51:33 +02:00
Joakim Hove
946485e2b4 Added parsing support for sizeType OTHER 2013-08-06 16:28:12 +02:00
Joakim Hove
475b607faf Can now parse file with several WCONHIST keywords 2013-08-01 12:50:42 +02:00
Joakim Hove
75954575d5 Changed Deck::getKeyword() to take an additional inde argument 2013-08-01 10:57:25 +02:00
Joakim Hove
db60ee2b56 Removed setRecord() method ParserKeyword. Instead ParserRecord is created during ParserKeyword construction 2013-07-31 15:02:00 +02:00
Joakim Hove
b3d9fb51a0 Parser object can be constructed with config file as input argument 2013-07-31 11:30:21 +02:00
Joakim Hove
e0995814f6 More JSON integration in Parser and ParserKeyword 2013-07-30 14:10:07 +02:00
Kristian Flikka
31b3031c1a Removed class ParserKeywordSize, and accompanying tests. Put info into ParserKeyword. Changed tests to expose same constraints. 2013-06-24 14:08:53 +02:00
Kristian Flikka
951ce6ac4d Changed from using RawParserKeywords to equivalent functionality now in Parser and ParserKeywordSize 2013-06-21 15:34:45 +02:00
Kristian Flikka
01abb91959 Renamed ParserRecordSize to ParserKeywordSize, because it is more consistent with ParserItemSize 2013-06-21 10:23:24 +02:00
Kristian Flikka
d79745ce4f Changed some KEYWORD->Keyword instances, search and replace hickup 2013-06-20 15:40:45 +02:00
Kristian Flikka
f1660460dc Replaced all instances of KW with Keyword. We can afford it. 2013-06-20 15:30:37 +02:00