added parser_scope global, added local assignments and local declarations to parser, reworked Scope class to use get(), putLocal(), and putGlobal() methods
git-svn-id: svn://anubis/fart/branches/scene-file-scripting@329 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
e2569c0a54
commit
7014605fe3
6 files changed
+100
-8
No files matched your search
+20
-2
@@ -23,7 +23,7 @@ class Scope
|
||||
}
|
||||
return false;
|
||||
}
|
||||
double & operator[](const std::string & key)
|
||||
double get(const std::string & key)
|
||||
{
|
||||
for (m_list_type::reverse_iterator it = m_list.rbegin();
|
||||
it != m_list.rend();
|
||||
@@ -34,7 +34,25 @@ class Scope
|
||||
return (*it)[key];
|
||||
}
|
||||
}
|
||||
return (*m_list.rbegin())[key];
|
||||
return 0.0;
|
||||
}
|
||||
void putLocal(const std::string & key, double val)
|
||||
{
|
||||
(*m_list.rbegin())[key] = val;
|
||||
}
|
||||
void putGlobal(const std::string & key, double val)
|
||||
{
|
||||
for (m_list_type::reverse_iterator it = m_list.rbegin();
|
||||
it != m_list.rend();
|
||||
it++)
|
||||
{
|
||||
if (it->find(key) != it->end())
|
||||
{
|
||||
(*it)[key] = val;
|
||||
return;
|
||||
}
|
||||
}
|
||||
putLocal(key, val);
|
||||
}
|
||||
void push()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user