summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-01-23 22:05:10 +0000
committerMike Buland <eichlan@xagasoft.com>2009-01-23 22:05:10 +0000
commit4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350 (patch)
tree7cae4b392840ef12ca87dbe9cc1d07a04531f756
parentd4cf48613dd9b1338e174edbf4f47a7736bb2505 (diff)
downloadlibbu++-4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350.tar.gz
libbu++-4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350.tar.bz2
libbu++-4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350.tar.xz
libbu++-4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350.zip
I changed the ParseException in Formula to Bu::FormulaException. It actually
wasn't in a namespace, and it was a little too generic. I like the idea of putting all the parser exceptions under a new class called ParseException, but well do it a little later.
-rw-r--r--src/formula.cpp5
-rw-r--r--src/formula.h9
2 files changed, 8 insertions, 6 deletions
diff --git a/src/formula.cpp b/src/formula.cpp
index a7d9347..3f52cad 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -7,5 +7,8 @@
7 7
8#include "formula.h" 8#include "formula.h"
9 9
10subExceptionDef( ParseException ); 10namespace Bu
11{
12 subExceptionDef( FormulaException );
13}
11 14
diff --git a/src/formula.h b/src/formula.h
index 20ffa5b..1fe96f9 100644
--- a/src/formula.h
+++ b/src/formula.h
@@ -19,10 +19,9 @@
19#include "bu/hash.h" 19#include "bu/hash.h"
20#include "bu/fstring.h" 20#include "bu/fstring.h"
21 21
22subExceptionDecl( ParseException );
23
24namespace Bu 22namespace Bu
25{ 23{
24 subExceptionDecl( FormulaException );
26 /** 25 /**
27 * Implements a very simple formula parser that allows use of variables and 26 * Implements a very simple formula parser that allows use of variables and
28 * custom functions. This is based on a simple calculator-type parser that 27 * custom functions. This is based on a simple calculator-type parser that
@@ -262,7 +261,7 @@ namespace Bu
262 if( bDot == false ) 261 if( bDot == false )
263 bDot = true; 262 bDot = true;
264 else 263 else
265 throw ParseException( 264 throw FormulaException(
266 "Numbers cannot have more than one " 265 "Numbers cannot have more than one "
267 ". in them." 266 ". in them."
268 ); 267 );
@@ -317,7 +316,7 @@ namespace Bu
317 } 316 }
318 else 317 else
319 { 318 {
320 throw ParseException( 319 throw FormulaException(
321 "No variable or function named " 320 "No variable or function named "
322 "\"%s\" exists.", 321 "\"%s\" exists.",
323 tok 322 tok
@@ -417,7 +416,7 @@ namespace Bu
417 416
418 if( bCloseParen == true ) 417 if( bCloseParen == true )
419 { 418 {
420 throw ParseException( 419 throw FormulaException(
421 "Close-paren found without matching open-paren." 420 "Close-paren found without matching open-paren."
422 ); 421 );
423 } 422 }