Commit Graph

510 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
83555a52a1 Minor restructuring in Parser::getKeyword* 2016-05-03 09:15:46 +02:00
Jørgen Kvalsvik
58489ca571 Restructured control flow of ParserKeyword::equal 2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
48e741efb6 ParserKeyword::parse restructure control flow
Reduce the number of concurrent branches and remove a seemingly
redundant check.
2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
3f3cb8c313 validDeckName uses all_of
Favours std::algorithm over hand-written loop.
2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
76336e2047 getDeckName without boost; uses range copy
Deprecates boost::trim in ParserKeyword and replaces it with range
search and copy.
2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
d385275c5b Reformulated validInternalName with iterators 2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
6780202352 Simplify hasDimension 2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
fb8e8b09c1 Parser::applyUnitsToDeck restructured control flow 2016-05-03 09:15:45 +02:00
Jørgen Kvalsvik
cb8e21de01 Restructure createRawKeyword.
Restructures createRawKeyword to use multiple return statements over
if-else and updating variables, reducing indentation to have fewer
contemporary branches.
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
bdce26480a createRawKeyword return on unmet preconditions
Changes the control flow of Parser::createRawKeyword to return on
failing to meet preconditions, rather than if-else block. Reduces
indentation and concurrent code paths.
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
1330bfc681 parseState use return over break for control flow
Makes the actual effects of the various condtions more clear by
emphasising the return of the function rather than some possible action
after the loop.
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
28f297f854 Reduce indentation in parseState
Restructures the per-iteration check of whether or not to continue
parsing to happen first and be an early-break, instead of this flow
being handled by if-else.
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
86a5a89429 ParseState early abort over if-else
A small syntactic change that reduces indentation by a level. Checks the
preconditions first and throws if they aren't met (i.e. stream is
broken).
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
033223720a trim_right replaced by trim
Augment trim_right with the dual trim_left and their composition trim
which strips all spaces from either side before the RawKeyword stage
starts.
2016-05-03 09:15:23 +02:00
Jørgen Kvalsvik
4b4d2c02c0 Reimplementation of stripComments
The implementation has been rewritten to use iterators and renamed for
internal use. The public static function still exists for testability
and easy verification, but should be considered an internal part of the
parser.
2016-05-03 09:15:22 +02:00
Kjell W. Kongsvik
b3b8cebeff Simplified deck filename handling. Only set filename if successfully opened 2016-04-28 15:42:07 +02:00
Kjell W. Kongsvik
5fb3a6fc53 Add dataFile to Deck if loaded from file
If loaded from string keep empty
2016-04-28 13:45:08 +02:00
Kjell W. Kongsvik
1640ad0826 Removed meaningless "path" paramater in tests
This parameter will be used in a more meaningful way
2016-04-28 13:45:08 +02:00
Joakim Hove
37381af2d6 Merge pull request #772 from qilicun/remove-OpmLog
Remove OpmLog usages in Parser folder.
2016-04-26 07:51:30 +02:00
Jørgen Kvalsvik
92f7ed163c Use swap for addParserKeyword over move-assign
Using move assign triggered some invalid read/write during
construction/destruction.
2016-04-25 14:51:02 +02:00
Liu Ming
59c6569a78 Make mutable MessageContainer member, recover the const qualifier for deck. 2016-04-25 16:25:15 +08:00
Liu Ming
a4640b55bc use MessageContainer instead of OpmLog. 2016-04-22 16:51:35 +08:00
Liu Ming
180ff7336a remove unused OpmLog headers. 2016-04-22 16:30:07 +08:00
Arne Morten Kvarving
5f197da8c7 changed: do not prototype boost::filesystem::path
this breaks with g++ 4.8 used in redhat builds.

/usr/include/boost148/boost/filesystem/v3/path.hpp:710:24 error: 'path'
is already declared in this scope.
2016-04-18 09:45:47 +02:00
Joakim Hove
001e2a7ad0 Merge pull request #759 from pgdr/prop-test-lean-grid
Testing Eclipse3DProperties API
2016-04-13 14:44:31 +02:00
Atgeirr Flø Rasmussen
0104055076 Suppress Boost warnings. 2016-04-13 13:04:33 +02:00
Pål Grønås Drange
4e97aab8aa Testing Eclipse3DProperties API
* Added Eclipse3DPropertiesTests
* Refactored tests to use Eclipse3DProperties instead of EclipseState
* Added unsigned literal to MessageContainerTest
2016-04-13 12:44:07 +02:00
Joakim Hove
9c6a120414 Merge pull request #757 from qilicun/append-messagecontainer
Add appendMessages() function.
2016-04-13 09:57:27 +02:00
Liu Ming
c782068baf add size() function. 2016-04-13 15:07:12 +08:00
Liu Ming
0954e5349c delete blank line. 2016-04-13 14:15:28 +08:00
Liu Ming
920c2cb87f some improvements. 2016-04-13 14:04:41 +08:00
Liu Ming
72dd934c71 add test for appendMessages function. 2016-04-13 14:04:21 +08:00
Liu Ming
9ca9c8ce1d Add appendMessages() function. 2016-04-13 12:06:37 +08:00
Joakim Hove
49a1c17eb8 Removed signed / unsigned comparison warning. 2016-04-12 13:59:02 +02:00
Joakim Hove
0d0fc43e50 Merge pull request #750 from jokva/remove-possible-undefined-const-cast
Remove possible undefined const cast
2016-04-08 12:52:38 +02:00
Joakim Hove
4d84da2b9d Merge pull request #748 from jokva/message-container-internal-detail
Remove MessageContainer from ParseContext + storage type change
2016-04-06 17:15:06 +02:00
Jørgen Kvalsvik
135f405e93 InitUnitSystem private; constness managed by .get
The const_cast in Deck::get*UnitSystem are potentially undefined
behaviour under a series of (plausible) conditions, and are deprecated
in favour of mutable members. Removes initUnitSystem from the public
interface, as the initialisation is handled on the first getUnitSystem
anyway, cleaning up the Deck interface slightly.

Adds proper constness to the use of unit systems that don't actually
modify the internal state in any way.
2016-04-06 15:09:32 +02:00
Jørgen Kvalsvik
0d24ac2d4a Store Location::lineno as size_t
By storing it as size_t we explicitly disallow negative line numbers,
and keep 0 as an error/empty/undefined location.

A small problem with this is that MessageContainer.error and friends
still accept negative numbers (often without warning) via size_t
implicit conversion and wrap-around.
2016-04-06 11:41:22 +02:00
Jørgen Kvalsvik
3efa5fb90c ParseContext::handleError returns messagetypë́
For more transactional behaviour and to support MessageContainer in
favour of opm-log, this method now returns an enum describing how the
error should be handled, rather than throwing or no-oping. Throwing is
preserved if ParseContext is configured to do so.
2016-04-06 10:39:06 +02:00
Jørgen Kvalsvik
f3bef79562 MessageContainer::const_iterator bound
While the implementation is a simple alias to
std::vector<Message>::const_iterator, it enablese generic lookup of the
iterator type at compile time, and enables us to effortlessly change the
underlying implementation later.
2016-04-06 10:38:19 +02:00
Jørgen Kvalsvik
eb610453b4 MessageContainer::add support
Some phenomenons can be configured as error, warning or debug output,
and is not necessarily known in advanced by the entity adding a message.
To facilite adding a message with runtime-defined warning level, the add
method is supported.
2016-04-06 10:38:18 +02:00
Jørgen Kvalsvik
6c8487ea07 Message::location uses automatic members
By supporting operator bool() we get the same existence checking
capabilities as the unique_ptr implementations, without the hurdles of
non-copyability and manual heap allocation.
2016-04-06 10:38:13 +02:00
Joakim Hove
bdb1313f41 RawKeyword getRecord( int ) -> getFirstRecord()
The general loop through all raw records should be based on the iterator
interface of the RawKeyword, but to resolve INCLUDE statements we have
implemented a special case method to get the first record.
2016-04-04 16:21:52 +02:00
Jørgen Kvalsvik
427baebe58 MessageContainer include guard corrected 2016-04-04 11:52:20 +02:00
Joakim Hove
51ce94cd62 Use range based for when iterating over RawRecords 2016-04-03 22:01:13 +02:00
chflo
82bef27b8f Support symlink 2016-04-01 15:36:38 +02:00
chflo
8ee79e7be6 Support symlinks: Added test 2016-04-01 14:28:26 +02:00
Jørgen Kvalsvik
046afdd3be RawKeyword iterator support
Since RawRecords now has automatic storage, managed by std::list,
offering iterators is feasible. The random access
RawKeyword::getRecord's real use was accessing the records in order,
which now is handled via iterators.
2016-03-30 12:47:33 +02:00
Joakim Hove
b778beb507 Renamed enum symbols 2016-03-29 14:18:03 +02:00
Liu Ming
bf361cce86 add member and functions. 2016-03-29 15:19:43 +08:00