Merge pull request #644 from joakim-hove/vfp-parse-error

Vfp parse error
This commit is contained in:
Joakim Hove 2019-02-19 16:22:55 +01:00 committed by GitHub
commit 10a225785e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -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;

View File

@ -2294,6 +2294,10 @@ VFPPROD
126.75 147.79
/
WLIFT FIELD 10:19 5 MAR 90
'* ' 2000.00000 'OIL' 0 .50000000 1* /
/
INCLUDE
'VFPPROD2' /

View File

@ -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* /
/