From 4ab0993d037c9ad84b3fcaf2ec8fb3d905fc7350 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 23 Jan 2009 22:05:10 +0000 Subject: 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. --- src/formula.cpp | 5 ++++- src/formula.h | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') 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 @@ #include "formula.h" -subExceptionDef( ParseException ); +namespace Bu +{ + subExceptionDef( FormulaException ); +} 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 @@ #include "bu/hash.h" #include "bu/fstring.h" -subExceptionDecl( ParseException ); - namespace Bu { + subExceptionDecl( FormulaException ); /** * Implements a very simple formula parser that allows use of variables and * custom functions. This is based on a simple calculator-type parser that @@ -262,7 +261,7 @@ namespace Bu if( bDot == false ) bDot = true; else - throw ParseException( + throw FormulaException( "Numbers cannot have more than one " ". in them." ); @@ -317,7 +316,7 @@ namespace Bu } else { - throw ParseException( + throw FormulaException( "No variable or function named " "\"%s\" exists.", tok @@ -417,7 +416,7 @@ namespace Bu if( bCloseParen == true ) { - throw ParseException( + throw FormulaException( "Close-paren found without matching open-paren." ); } -- cgit v1.2.3