Skip to content
Snippets Groups Projects
Commit abe91a64 authored by Patrick Dular's avatar Patrick Dular
Browse files

Struct type: size of scope

parent 8ef6dd06
Branches
Tags
No related merge requests found
This diff is collapsed.
...@@ -2216,7 +2216,7 @@ Transform : ...@@ -2216,7 +2216,7 @@ Transform :
} }
$$ = $8; $$ = $8;
} }
| String__Index '{' MultipleShape '}' | tSTRING '{' MultipleShape '}'
{ {
$$ = List_Create(3, 3, sizeof(Shape)); $$ = List_Create(3, 3, sizeof(Shape));
std::string action($1); std::string action($1);
...@@ -4676,6 +4676,19 @@ FExpr_Single : ...@@ -4676,6 +4676,19 @@ FExpr_Single :
} }
Free($2); Free($2);
} }
| '#' String__Index tSCOPE
{
std::string struct_namespace($2);
$$ = (double)nameSpaces[struct_namespace].size();
Free($2);
}
| '#' tSCOPE
{
std::string struct_namespace(std::string(""));
$$ = (double)nameSpaces[struct_namespace].size();
}
| String__Index NumericIncrement | String__Index NumericIncrement
{ {
if(!gmsh_yysymbols.count($1)){ if(!gmsh_yysymbols.count($1)){
...@@ -4748,7 +4761,7 @@ FExpr_Single : ...@@ -4748,7 +4761,7 @@ FExpr_Single :
//+++ ... extention to structures //+++ ... extention to structures
// PD: TO FIX (to avoid shift/reduce conflict) // PD: TO FIX (to avoid shift/reduce conflict)
// | Struct_FullName '.' tSTRING//_Member_Float // | Struct_FullName '.' tSTRING_Member_Float
| String__Index '.' tSTRING_Member_Float | String__Index '.' tSTRING_Member_Float
{ {
$$ = treat_Struct_FullName_dot_tSTRING_Float(NULL, $1, $3); $$ = treat_Struct_FullName_dot_tSTRING_Float(NULL, $1, $3);
...@@ -4877,7 +4890,7 @@ DefineStruct : ...@@ -4877,7 +4890,7 @@ DefineStruct :
if (!nameSpaces[struct_namespace].count(struct_name)) { if (!nameSpaces[struct_namespace].count(struct_name)) {
int index = (int)$6; int index = (int)$6;
if (index < 0) if (index < 0)
index = nameSpaces[struct_namespace].get().size()+1; index = nameSpaces[struct_namespace].size()+1;
nameSpaces[struct_namespace][struct_name] = nameSpaces[struct_namespace][struct_name] =
Struct(index, floatOptions, charOptions); Struct(index, floatOptions, charOptions);
$$ = (double)index; $$ = (double)index;
......
This diff is collapsed.
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
inline T & operator[] (K key) { return _map[key]; } inline T & operator[] (K key) { return _map[key]; }
inline std::map<K, T> & get() { return _map; } inline std::map<K, T> & get() { return _map; }
inline int count (std::string key) { return _map.count(key); } inline int count (std::string key) { return _map.count(key); }
inline int size () { return _map.size(); }
public: public:
std::map<K, T> _map; std::map<K, T> _map;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment