mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Update calcEntry grammar to include copyright.
Include character class (wchar_t or char) as a template parameter in CocoParserErrors.
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
|
[copy]
|
||||||
/*---------------------------------*- C++ -*---------------------------------*\
|
/*---------------------------------*- C++ -*---------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,15 +28,19 @@ License
|
|||||||
Description
|
Description
|
||||||
An attributed Coco/R grammar to parse simple arithmetic expressions
|
An attributed Coco/R grammar to parse simple arithmetic expressions
|
||||||
|
|
||||||
|
Includes support for dictionary $variables and some scalar functions
|
||||||
|
(eg, sin, pow, ...)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
generated
|
generated
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
[/copy]
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
compile with:
|
compile with:
|
||||||
Coco \
|
Coco \
|
||||||
[-single] -frames $WM_THIRD_PARTY_DIR/coco-r \
|
[-single] -frames $WM_THIRD_PARTY_DIR/coco-r \
|
||||||
calcEntryParser.ATG
|
calcEntryParser.atg
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
@ -49,8 +54,6 @@ COMPILER calcEntry
|
|||||||
$namespace=Foam::functionEntries::calcEntryInternal
|
$namespace=Foam::functionEntries::calcEntryInternal
|
||||||
$eof=true // grammar handles eof itself
|
$eof=true // grammar handles eof itself
|
||||||
|
|
||||||
// Simple four function calculator for OpenFOAM dictionaries
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//- The parent dictionary
|
//- The parent dictionary
|
||||||
dictionary* dict_;
|
dictionary* dict_;
|
||||||
@ -125,9 +128,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
INITIALIZE
|
[initialize]
|
||||||
dict_ = 0;
|
dict_ = 0;
|
||||||
val = 0;
|
val = 0;
|
||||||
|
[/initialize]
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -45,7 +45,7 @@ namespace Foam
|
|||||||
Class CocoParserErrors Declaration
|
Class CocoParserErrors Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class BaseClass>
|
template<class BaseClass, class CharClass=wchar_t>
|
||||||
class CocoParserErrors
|
class CocoParserErrors
|
||||||
:
|
:
|
||||||
public BaseClass
|
public BaseClass
|
||||||
@ -90,14 +90,14 @@ public:
|
|||||||
// Error Handling
|
// Error Handling
|
||||||
|
|
||||||
//- Handle a general warning 'msg'
|
//- Handle a general warning 'msg'
|
||||||
virtual void Warning(const wchar_t* msg)
|
virtual void Warning(const CharClass* msg)
|
||||||
{
|
{
|
||||||
WarningIn(name_)
|
WarningIn(name_)
|
||||||
<< msg << endl;
|
<< msg << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Handle a general warning 'msg'
|
//- Handle a general warning 'msg'
|
||||||
virtual void Warning(int line, int col, const wchar_t* msg)
|
virtual void Warning(int line, int col, const CharClass* msg)
|
||||||
{
|
{
|
||||||
WarningIn(name_)
|
WarningIn(name_)
|
||||||
<<"line " << line << " col " << col << ": "
|
<<"line " << line << " col " << col << ": "
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Handle general error 'msg' (eg, a semantic error)
|
//- Handle general error 'msg' (eg, a semantic error)
|
||||||
virtual void Error(int line, int col, const wchar_t* msg)
|
virtual void Error(int line, int col, const CharClass* msg)
|
||||||
{
|
{
|
||||||
FatalErrorIn(name_)
|
FatalErrorIn(name_)
|
||||||
<< "line " << line << " col " << col <<": " << msg << endl
|
<< "line " << line << " col " << col <<": " << msg << endl
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Handle general error 'msg' (eg, a semantic error)
|
//- Handle general error 'msg' (eg, a semantic error)
|
||||||
virtual void Error(const wchar_t* msg)
|
virtual void Error(const CharClass* msg)
|
||||||
{
|
{
|
||||||
FatalErrorIn(name_)
|
FatalErrorIn(name_)
|
||||||
<< msg << endl
|
<< msg << endl
|
||||||
@ -121,7 +121,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Handle a general exception 'msg'
|
//- Handle a general exception 'msg'
|
||||||
virtual void Exception(const wchar_t* msg)
|
virtual void Exception(const CharClass* msg)
|
||||||
{
|
{
|
||||||
this->Error(msg);
|
this->Error(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,12 @@
|
|||||||
|
|
||||||
.SUFFIXES: .atg
|
.SUFFIXES: .atg
|
||||||
|
|
||||||
atgtoo = Coco -single -frames $(WM_THIRD_PARTY_DIR)/coco-cpp/src $$SOURCE -o $(OBJECTS_DIR) ; $(CC) $(c++FLAGS) -c $*.cpp -o $@
|
atgtoo = \
|
||||||
|
$(WM_THIRD_PARTY_DIR)/coco-cpp/platforms/$(WM_ARCH)/bin/coco-cpp \
|
||||||
|
-single \
|
||||||
|
-frames $(WM_THIRD_PARTY_DIR)/coco-cpp/platforms/share/coco-cpp \
|
||||||
|
$$SOURCE -o $(OBJECTS_DIR) ; \
|
||||||
|
$(CC) $(c++FLAGS) -c $*.cpp -o $@
|
||||||
|
|
||||||
.atg.dep:
|
.atg.dep:
|
||||||
$(MAKE_DEP)
|
$(MAKE_DEP)
|
||||||
|
|||||||
Reference in New Issue
Block a user