blob: df2bc09955683738a1dcc1c7aed8e6e4761bc74c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*
* LLCalcParser.cpp
* SecondLife
*
* Created by Aimee Walton on 28/09/2008.
* Copyright 2008 Aimee Walton.
*
*/
#include "linden_common.h"
#include "llcalcparser.h"
#include <boost/version.hpp>
#if BOOST_VERSION >= 103600
using namespace boost::spirit::classic;
#else
using namespace boost::spirit;
#endif
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;
}
|