Removed handling of single-quoted strings.

This commit is contained in:
Mark Olesen
2009-01-23 15:17:01 +01:00
parent 42c04b8505
commit ce14f243c6
12 changed files with 23 additions and 29 deletions

View File

@ -15,21 +15,21 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputMode merge #inputMode merge
'.*' parentValue1; ".*" parentValue1;
'[n-z].*' parentValue2; "[n-z].*" parentValue2;
'f.*' parentValue3; "f.*" parentValue3;
keyX parentValue4; keyX parentValue4;
keyY parentValue5; keyY parentValue5;
'(.*)Dict' "(.*)Dict"
{ {
foo subdictValue0; foo subdictValue0;
bar $f.*; // should this really match 'foo'? bar $f.*; // should this really match 'foo'?
// result is dependent on insert order! // result is dependent on insert order!
'a.*c' subdictValue3; "a.*c" subdictValue3;
'ab.*' subdictValue2; "ab.*" subdictValue2;
'a.*' subdictValue1; "a.*" subdictValue1;
abcd \1; abcd \1;
} }

View File

@ -82,7 +82,7 @@ topoSetSources
// Cells in cell zone // Cells in cell zone
zoneToCell zoneToCell
{ {
name '.*Zone'; // Name of cellZone, regular expressions allowed name ".*Zone"; // Name of cellZone, regular expressions allowed
} }
// values of field within certain range // values of field within certain range

View File

@ -56,13 +56,13 @@ topoSetSources
// All faces of patch // All faces of patch
patchToFace patchToFace
{ {
name '.*Wall'; // Name of patch, regular expressions allowed name ".*Wall"; // Name of patch, regular expressions allowed
} }
// All faces of faceZone // All faces of faceZone
zoneToFace zoneToFace
{ {
name '.*Zone1'; // Name of faceZone, regular expressions allowed name ".*Zone1"; // Name of faceZone, regular expressions allowed
} }
// Faces with face centre within box // Faces with face centre within box

View File

@ -60,7 +60,7 @@ topoSetSources
// All points in pointzone // All points in pointzone
zoneToPoint zoneToPoint
{ {
name '.*Zone'; // name of pointZone, regular expressions allowed name ".*Zone"; // name of pointZone, regular expressions allowed
} }
// Select based on surface // Select based on surface

View File

@ -48,7 +48,7 @@ void Foam::Ostream::decrIndent()
// Write keyType // Write keyType
// write regular expression as single-quoted string // write regular expression as quoted string
// write plain word as word (unquoted) // write plain word as word (unquoted)
Foam::Ostream& Foam::Ostream::write(const keyType& kw) Foam::Ostream& Foam::Ostream::write(const keyType& kw)
{ {

View File

@ -115,7 +115,7 @@ public:
//- Write string //- Write string
virtual Ostream& write(const string&) = 0; virtual Ostream& write(const string&) = 0;
//- Write std::string surrounded by single quotes. //- Write std::string surrounded by quotes.
// Optional write without quotes. // Optional write without quotes.
virtual Ostream& writeQuoted virtual Ostream& writeQuoted
( (

View File

@ -136,7 +136,7 @@ public:
//- Write string //- Write string
Ostream& write(const string&); Ostream& write(const string&);
//- Write std::string surrounded by single quotes. //- Write std::string surrounded by quotes.
// Optional write without quotes. // Optional write without quotes.
Ostream& writeQuoted Ostream& writeQuoted
( (

View File

@ -152,9 +152,8 @@ Foam::Istream& Foam::ISstream::read(token& t)
return *this; return *this;
} }
// Strings: enclosed by single or double quotes. // Strings: enclosed by double quotes.
case token::BEGIN_STRING : case token::BEGIN_STRING :
case token::BEGIN_QSTRING :
{ {
putback(c); putback(c);
string* sPtr = new string; string* sPtr = new string;
@ -369,11 +368,8 @@ Foam::Istream& Foam::ISstream::read(string& str)
char endTok = token::END_STRING; char endTok = token::END_STRING;
if (c == token::BEGIN_QSTRING) // Note, we could also handle single-quoted strings here (if desired)
{ if (c != token::BEGIN_STRING)
endTok = token::END_QSTRING;
}
else if (c != token::BEGIN_STRING)
{ {
buf[0] = '\0'; buf[0] = '\0';

View File

@ -118,7 +118,7 @@ Foam::Ostream& Foam::OSstream::writeQuoted
{ {
if (quoted) if (quoted)
{ {
os_ << token::BEGIN_QSTRING; os_ << token::BEGIN_STRING;
register int backslash = 0; register int backslash = 0;
for for
@ -141,7 +141,7 @@ Foam::Ostream& Foam::OSstream::writeQuoted
lineNumber_++; lineNumber_++;
backslash++; // backslash escape for newline backslash++; // backslash escape for newline
} }
else if (c == token::END_QSTRING) else if (c == token::END_STRING)
{ {
backslash++; // backslash escape for quote backslash++; // backslash escape for quote
} }
@ -158,7 +158,7 @@ Foam::Ostream& Foam::OSstream::writeQuoted
// silently drop any trailing backslashes // silently drop any trailing backslashes
// they would otherwise appear like an escaped end-quote // they would otherwise appear like an escaped end-quote
os_ << token::END_QSTRING; os_ << token::END_STRING;
} }
else else
{ {

View File

@ -141,7 +141,7 @@ public:
// double-quote. // double-quote.
virtual Ostream& write(const string&); virtual Ostream& write(const string&);
//- Write std::string surrounded by single quotes. //- Write std::string surrounded by quotes.
// Optional write without quotes. // Optional write without quotes.
virtual Ostream& writeQuoted virtual Ostream& writeQuoted
( (

View File

@ -114,8 +114,8 @@ public:
//- Write string //- Write string
virtual Ostream& write(const string&); virtual Ostream& write(const string&);
//- Write std::string //- Write std::string surrounded by quotes.
// Specify if string should be single quoted or remain unquoted. // Optional write without quotes.
virtual Ostream& writeQuoted virtual Ostream& writeQuoted
( (
const std::string&, const std::string&,

View File

@ -109,8 +109,6 @@ public:
BEGIN_STRING = '"', BEGIN_STRING = '"',
END_STRING = BEGIN_STRING, END_STRING = BEGIN_STRING,
BEGIN_QSTRING = '\'',
END_QSTRING = BEGIN_QSTRING,
ASSIGN = '=', ASSIGN = '=',
ADD = '+', ADD = '+',