Commit Graph

37 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
a22196546a ParserItem no longer requires heap alloc
Redesign of ParserItem so that its sum type nature no longer mandates
indirection, but rather a tag check on all operations. Because of this,
ParserRecords can now store ParserItems directly, and iterators are no
longer iterators to pointers, but behave like normal vector iterators.
2016-11-07 12:24:38 +01: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
Robert K
05af9e32b7 remove warnings, that is:
sizeType --> p_sizeType since it shadows a member method
trailing ;
comparison of signed and unsigned int
2015-02-13 14:19:24 +01:00
Andreas Lauser
0262b333fd make items which do not have a default un-defaultable
this was a much more common problem than it seemed initially...
2014-12-18 11:43:52 +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
eccf3d4551 ParserItem: improve the equallity testing code and remove the defaultSet() method
but we still need the m_defaultSet member because NaN == NaN as well
as NaN != NaN...
2014-09-15 12:29:58 +02:00
Joakim Hove
bf35919c6f Default: Changed default handling in ParserItem
This is the first of several large commits changing several aspects of
the handling of defaults. The overall main purpose of these changes is
to protect against using non sensible values in the case the values have
not been sensibly specified in the deck. The changes in this commit
include:

 1. The "default default" values to be used when an item without an
    explicit default are defaulted are removed completely.

 2. If a ParserItem is queried for a default value when no default has
    been assigned it will raise an exception.
2014-09-03 10:37:00 +02:00
Joakim Hove
8b2981283f Default: Updates to ParserItem::equal()
1. The boolean flag m_defaultSet() is included in the actual
    comparison.

 2. The compare functions is implemented as a functions template.
2014-09-03 10:37:00 +02:00
Arne Morten Kvarving
670e8b692b changed: don't use parameter names that conflicts with member function names
quells warnings (with gcc 4.8)
2014-05-15 14:46:16 +02:00
Atgeirr Flø Rasmussen
e3d167048f Commented out unused function arguments. 2014-04-15 09:48:19 +02:00
Joakim Hove
f59fd25668 Added boolan flag scalar = true to DeckItem.
The purpose of this flag is to keep track of whether a keyword is
supposed to have only one element, i.e. scalar, or several. The
defaultApplied method only makes sense in the case of scalar items, this
method will now throw if it is called on a non-scalar item.
2014-04-11 13:42:22 +02:00
Atle Haugan
442d0fb7bf Added ParserFloatItem + some tests. More tests may be needed. 2014-02-18 11:02:38 +01:00
Atle Haugan
ddd4563f97 Renamed from 'help' to 'description' for ParserKeyword and ParserItem 2014-01-10 10:57:35 +01:00
Atle Haugan
3271156f9d First pull request candidate with help support 2014-01-09 13:33:32 +01:00
Joakim Hove
ac740276f0 Added virtual function push_backDimension() and getDimension() to parserItem. 2013-12-11 13:24:27 +01:00
Joakim Hove
dd53619e0f Added functions to query the dimensions on a ParserItem. 2013-12-10 17:34:52 +01:00
Joakim Hove
bb8b3ab240 Added ability to push_back() dimension strings to ParserItems; and then to query the
ParserItem -> ParserRecord -> ParserKeyword() structure whether it has dimension.
2013-12-09 21:12:27 +01:00
Kristian Flikka
13f30cb3ef Removed template for ParserItem for decoding default/repetetive tokens for String and Double 2013-10-16 14:57:01 +02:00
Joakim Hove
2d68ebe94c Merge remote-tracking branch 'upstream/master' into track-default 2013-10-15 14:24:42 +02:00
Joakim Hove
268119e1ce Removed unneceessary includes 2013-10-11 15:38:30 +02:00
Joakim Hove
d5b6e84f18 Fixed bug with string items with embedded space - using an ugly template specialization hack 2013-10-09 17:04:08 +02:00
Joakim Hove
3992a32efc Made sizeType : SINGLE default 2013-09-17 22:27:53 +02:00
Joakim Hove
f461ba6f07 Created code to create cpp representation of complete ParserKeyword 2013-09-13 22:23:12 +02:00
Joakim Hove
b10952bb4f Added typeid() based test in ParserItem::equal() 2013-09-13 10:15:42 +02:00
Joakim Hove
6d0ed41b29 Added property m_defaultSet to track if the default value has been explicitly set 2013-09-12 12:13:32 +02:00
Joakim Hove
5284b4ff89 Added equal() method for the ParserItem classes 2013-09-12 10:58:44 +02:00
Kristian Flikka
771167c02e Removed ParserXItem's scan with expected elements. Only SINGLE and ALL is now allowed 2013-08-23 14:35:47 +02:00
Joakim Hove
797125463c Added class wide default double value 2013-08-01 09:31:06 +02:00
Joakim Hove
8bc176d63e Added full(?) Parser configuration from json 2013-07-31 17:58:05 +02:00
Joakim Hove
6c582a4b82 Added JsonConfig constructor to ParserIntItem 2013-07-31 16:15:22 +02:00
Kristian Flikka
5fa04e5377 Added/implemented XStringItem for Parser and Deck, with tests. Added integration test for WWCT keyword. Moved DeckItem tests into type-specific files. Removed unused file. 2013-06-20 13:56:11 +02:00
Kristian Flikka
7998a84b81 Made the ParserIntItem's scan return DeckItem, and put a virtual scan in ParserItem. The ParserRecord now has a simple, but functioning parse method 2013-05-24 10:09:59 +02:00
Joakim Hove
3de7e988b7 Moved template code from header -> include file 2013-05-14 21:27:32 +02:00
Joakim Hove
f516cc6833 Added default value to Parser. Rewrote the ParserIntItem::scan() method to use homemade C-sscanf obscurity from h..l 2013-05-09 14:18:36 +02:00
Joakim Hove
c963c7d768 Changed to use only enum for ItemSize. FIXED -> SCALAR with value 1 2013-05-09 12:17:00 +02:00
Kristian Flikka
2088c3e96d Simple scan implementation in ParserIntItem added. DeckIntItem now support push_back 2013-05-08 14:31:20 +02:00
Kristian Flikka
2d6e6842d6 Changed ParserItem from template based to a base-inheritance based system. Corresponds to and creates DeckItem objects 2013-05-07 21:55:49 +02:00