diff --git a/src/opm/parser/eclipse/Parser/Parser.cpp b/src/opm/parser/eclipse/Parser/Parser.cpp index 52bebfefa..3aebbf576 100644 --- a/src/opm/parser/eclipse/Parser/Parser.cpp +++ b/src/opm/parser/eclipse/Parser/Parser.cpp @@ -814,19 +814,8 @@ std::unique_ptr tryParseKeyword( ParserState& parserState, const Par if (rawKeyword->getSizeType() == Raw::UNKNOWN) rawKeyword->terminateKeyword(); - if (!rawKeyword->isFinished()) { - /* - It is not necessary to explicitly terminate code keywords, in that - case they will load all the content until EOF is reached. - */ - if (rawKeyword->getSizeType() == Raw::CODE) { - RawRecord record(string_view{ record_buffer.begin(), record_buffer.end() + 1}, true); - rawKeyword->addRecord(record); - return rawKeyword; - } - + if (!rawKeyword->isFinished()) throw std::invalid_argument("Keyword " + rawKeyword->getKeywordName() + " is not properly terminated"); - } } return rawKeyword; diff --git a/tests/parser/PYACTION.cpp b/tests/parser/PYACTION.cpp index 33de8f5ae..4174408ae 100644 --- a/tests/parser/PYACTION.cpp +++ b/tests/parser/PYACTION.cpp @@ -49,13 +49,6 @@ PYACTION Her comes an ignored comment const std::string deck_string2 = R"( SCHEDULE -PYACTION -)" + input_code; - - - const std::string deck_string3 = R"( -SCHEDULE - PYACTION -- Comment )" + input_code + "PYEND" + "\nGRID"; @@ -70,11 +63,6 @@ PYACTION -- Comment auto deck = parser.parseString(deck_string2); const auto& parsed_code = deck.getKeyword("PYACTION").getRecord(0).getItem("code").get(0); BOOST_CHECK_EQUAL(parsed_code, input_code); - } - { - auto deck = parser.parseString(deck_string3); - const auto& parsed_code = deck.getKeyword("PYACTION").getRecord(0).getItem("code").get(0); - BOOST_CHECK_EQUAL(parsed_code, input_code); BOOST_CHECK( deck.hasKeyword("GRID")); }