if (! (t->type == tok_identifier))
throw PARSE_ERROR (_("expected identifier"));
+ string gname = "__global_" + string(t->content);
+ string pname = "__private_" + detox_path(fname) + string(t->content);
+ string name = priv ? pname : gname;
+
for (unsigned i=0; i<globals.size(); i++)
- if (globals[i]->name == t->content)
+ {
+ if (globals[i]->name == name)
throw PARSE_ERROR (_("duplicate global name"));
-
- string name = "__global_" + string(t->content);
- if (priv)
- name = "__private_" + detox_path(fname) + string(t->content);
+ if ((globals[i]->name == gname) || (globals[i]->name == pname))
+ throw PARSE_ERROR (_("global versus private variable declaration conflict"));
+ }
vardecl* d = new vardecl;
d->name = name;
&& (t->content == "string" || t->content == "long")))
throw PARSE_ERROR (_("expected identifier"));
+ string gname = "__global_" + string(t->content);
+ string pname = "__private_" + detox_path(fname) + string(t->content);
+ string name = priv ? pname : gname;
+
for (unsigned i=0; i<functions.size(); i++)
- if (functions[i]->name == t->content)
+ {
+ if (functions[i]->name == name)
throw PARSE_ERROR (_("duplicate function name"));
-
- string name = "__global_" + string(t->content);
- if (priv)
- name = "__private_" + detox_path(fname) + string(t->content);
+ if ((functions[i]->name == gname) || (functions[i]->name == pname))
+ throw PARSE_ERROR (_("global versus private function declaration conflict"));
+ }
functiondecl *fd = new functiondecl ();
fd->name = name;