diff --git a/src/opm/parser/eclipse/Parser/Parser.cpp b/src/opm/parser/eclipse/Parser/Parser.cpp index b3ffc9ad5..e6466348c 100644 --- a/src/opm/parser/eclipse/Parser/Parser.cpp +++ b/src/opm/parser/eclipse/Parser/Parser.cpp @@ -538,7 +538,24 @@ bool tryParseKeyword( ParserState& parserState, const Parser& parser ) { } } else { if (parserState.rawKeyword->getSizeType() == Raw::UNKNOWN) { - if( parser.isRecognizedKeyword( line ) ) { + /* + When we are spinning through a keyword of size type UNKNOWN it + is essential to recognize a string as the next keyword. The + line starting a new keyword can have arbitrary rubbish + following the keyword name - i.e. this is legitimate: + + PORO Here comes some random gibberish which should be ignored + 10000*0.15 / + + To ensure the keyword 'PORO' is recognized in the example + above we remove everything following the first space in the + line variable before we check if it is the start of a new + keyword. + */ + const std::string line_string = line.string(); + auto space_pos = line_string.find(' '); + const std::string candidate_name = line_string.substr(0, space_pos); + if( parser.isRecognizedKeyword( candidate_name ) ) { parserState.rawKeyword->finalizeUnknownSize(); parserState.nextKeyword = line; return true; diff --git a/tests/parser/data/integration_tests/VFPPROD/VFPPROD1 b/tests/parser/data/integration_tests/VFPPROD/VFPPROD1 index bee1b1df7..37df98d8f 100644 --- a/tests/parser/data/integration_tests/VFPPROD/VFPPROD1 +++ b/tests/parser/data/integration_tests/VFPPROD/VFPPROD1 @@ -2294,6 +2294,10 @@ VFPPROD 126.75 147.79 / +WLIFT FIELD 10:19 5 MAR 90 +'* ' 2000.00000 'OIL' 0 .50000000 1* / +/ + INCLUDE 'VFPPROD2' / diff --git a/tests/parser/data/integration_tests/VFPPROD/VFPPROD2 b/tests/parser/data/integration_tests/VFPPROD/VFPPROD2 index 0fd7c975a..c25d06a72 100644 --- a/tests/parser/data/integration_tests/VFPPROD/VFPPROD2 +++ b/tests/parser/data/integration_tests/VFPPROD/VFPPROD2 @@ -2293,3 +2293,9 @@ VFPPROD 101.80 104.11 107.44 109.47 117.02 126.75 147.79 / + +WLIFT FIELD 10:19 5 MAR 90 +'* ' 2000.00000 'OIL' 0 .50000000 1* / +/ + +