Moved CK_SyntaxError definition to the .h file. It's used in more

than one .cpp file.
This commit is contained in:
Harry Moffat 2004-07-02 16:48:13 +00:00
parent 7902138459
commit 7b9242121e
2 changed files with 20 additions and 14 deletions

View file

@ -6,7 +6,11 @@
// Copyright 2001 California Institute of Technology
//
// $Log$
// Revision 1.5 2004-05-13 17:45:05 dggoodwin
// Revision 1.6 2004-07-02 16:48:13 hkmoffa
// Moved CK_SyntaxError definition to the .h file. It's used in more
// than one .cpp file.
//
// Revision 1.5 2004/05/13 17:45:05 dggoodwin
// fixed bug in which a species name beginning with M was interpreted as a third body
//
// Revision 1.4 2004/05/13 16:58:33 dggoodwin
@ -43,15 +47,12 @@ namespace ckr {
}
/// Exception class for syntax errors.
class CK_SyntaxError : public CK_Exception {
public:
CK_SyntaxError(ostream& f, const string& s, int linenum = -1)
: m_out(f) {
m_msg += "Syntax error: " + s;
if (linenum > 0) m_msg += " (line " + int2s(linenum) + ")\n";
}
ostream& m_out;
};
CK_SyntaxError::CK_SyntaxError(ostream& f,
const string& s, int linenum)
: m_out(f) {
m_msg += "Syntax error: " + s;
if (linenum > 0) m_msg += " (line " + int2s(linenum) + ")\n";
}
static int parseGroupString(string str, vector<string>& esyms,
@ -271,7 +272,7 @@ namespace ckr {
const char undoCommentChar = '%';
// carriage return
const char char13 = char(13);
//const char char13 = char(13);
// linefeed
const char char10 = char(10);
@ -977,7 +978,7 @@ next:
else if ((mloc = sleft.find("+M"), mloc >= 0) ||
(mloc = sleft.find("+m"), mloc >= 0)) {
if (mloc == sleft.size()-2) {
if (mloc == static_cast<int>(sleft.size()) - 2) {
rxn.isThreeBodyRxn = true;
rxn.type = ThreeBody;
sleft = sleft.substr(0, mloc);
@ -1049,7 +1050,7 @@ next:
else if ((mloc = sright.find("+M"), mloc >= 0) ||
(mloc = sright.find("+m"), mloc >= 0)) {
if (mloc == sright.size()-2) {
if (mloc == static_cast<int>(sright.size()) - 2) {
if (rxn.type == Falloff)
throw CK_SyntaxError(*m_log,
"mismatched +M or (+M)", m_line);

View file

@ -36,7 +36,12 @@ namespace ckr {
//@}
/// Exception class for syntax errors.
class CK_SyntaxError : public CK_Exception {
public:
CK_SyntaxError(ostream& f, const string& s, int linenum = -1);
ostream& m_out;
};
/**
* Chemkin mechanism file parser. For internal use by class CKReader.