Files
openfoam/applications/test/dictionary/testPrimitiveEntry
Mark Olesen 2fde6c3ab0 ENH: improve handling of mismatched brackets, forgotten ';' (issue #762)
- flags the following type of problems:

  * mismatches:

        keyword  mismatch ( set of { brackets ) in the } entry;

  * underflow (too many closing brackets:

        keyword  too many ( set of ) brackets ) in ) entry;

- a missing semi-colon

        dict
        {
           keyword  entry with missing semi-colon
        }

  will be flagged as 'underflow', since it parses through the '}' but
  did not open with it.

Max monitoring depth is 60 levels of nesting, to avoid incurring any
memory allocation.
2018-04-25 09:55:00 +02:00

50 lines
1.4 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Test parsing of primitive entry
// Can pass through foamDictionary -expand for test
dict1
{
entry1 no brackets;
entry2 balanced ( set of { brackets } in the ) entry;
entry3a mismatch ( set of { brackets ) in the } entry;
entry3b mismatch ( set of { brackets } in the } entry;
// Runs on
// entry3c too many ( set of ) brackets ) in ) entry;
//entry4 missing closing ( set of { brackets } in entry;
}
dict2
{
entry1 no brackets;
entry2 no brackets but missing semi-colon
}
dict3
{
entry1 anything;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //