mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improvements for token methods
- direct check of punctuation.
For example,
while (!tok.isPunctuation(token::BEGIN_LIST)) ..
instead of
while (!(tok.isPunctuation() && tok.pToken() == token::BEGIN_LIST)) ..
Using direct comparison (tok != token::BEGIN_LIST) can be fragile
when comparing int values:
int c = readChar(is);
while (tok != c) .. // Danger, uses LABEL comparison!
- direct check of word.
For example,
if (tok.isWord("uniform")) ..
instead of
if (tok.isWord() && tok.wordToken() == "uniform") ..
- make token lineNumber() a setter method
ENH: adjust internal compound method empty() -> moved()
- support named compound tokens
STYLE: setter method for stream indentation
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,10 +51,7 @@ namespace Foam
|
||||
return
|
||||
(
|
||||
// Token 1 = ':' separator
|
||||
(
|
||||
getToken(is, tok)
|
||||
&& tok.isPunctuation() && tok.pToken() == token::COLON
|
||||
)
|
||||
(getToken(is, tok) && tok.isPunctuation(token::COLON))
|
||||
|
||||
// Token 2 is the value
|
||||
&& getToken(is, tok)
|
||||
@ -441,8 +438,7 @@ Foam::label Foam::vtk::seriesWriter::load
|
||||
if
|
||||
(
|
||||
getValueToken(is, tok)
|
||||
&& tok.isPunctuation()
|
||||
&& tok.pToken() == token::BEGIN_SQR
|
||||
&& tok.isPunctuation(token::BEGIN_SQR)
|
||||
)
|
||||
{
|
||||
state = parse::FILES_ARRAY;
|
||||
|
||||
Reference in New Issue
Block a user