mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
49
applications/test/dictionary/testPrimitiveEntry
Normal file
49
applications/test/dictionary/testPrimitiveEntry
Normal file
@ -0,0 +1,49 @@
|
||||
/*--------------------------------*- 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;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Reference in New Issue
Block a user