diff options
author | Debi King (Dessie) <dessie@lindenlab.com> | 2011-07-29 13:32:51 -0400 |
---|---|---|
committer | Debi King (Dessie) <dessie@lindenlab.com> | 2011-07-29 13:32:51 -0400 |
commit | fb9f092972c915ff77b3866dae302e3433b46224 (patch) | |
tree | 03d970b890a2cd6a4f10e5d90e01fe8ed66ce3b1 /indra/llmath/llcalcparser.cpp | |
parent | ad96a4ef4706ae39d259281dd993a52034946425 (diff) | |
parent | 0e3cea49aaba7fb9e4a75c4a76779ba9273549bf (diff) |
reconciled .hgtags
Diffstat (limited to 'indra/llmath/llcalcparser.cpp')
-rw-r--r-- | indra/llmath/llcalcparser.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/indra/llmath/llcalcparser.cpp b/indra/llmath/llcalcparser.cpp new file mode 100644 index 0000000000..fd55376fa9 --- /dev/null +++ b/indra/llmath/llcalcparser.cpp @@ -0,0 +1,46 @@ +/* + * LLCalcParser.cpp + * SecondLife + * + * Created by Aimee Walton on 28/09/2008. + * Copyright 2008 Aimee Walton. + * + */ + +#include "linden_common.h" + +#include "llcalcparser.h" +using namespace boost::spirit::classic; + +F32 LLCalcParser::lookup(const std::string::iterator& start, const std::string::iterator& end) const +{ + LLCalc::calc_map_t::iterator iter; + + std::string name(start, end); + + if (mConstants) + { + iter = mConstants->find(name); + if (iter != mConstants->end()) + { + return (*iter).second; + } + } + else + { + // This should never happen! + throw_(end, std::string("Missing constants table")); + } + + if (mVariables) + { + iter = mVariables->find(name); + if (iter != mVariables->end()) + { + return (*iter).second; + } + } + + throw_(end, std::string("Unknown symbol " + name)); + return 0.f; +} |