30 type(symtabtype::NUMBER),
39 for(
unsigned int i=0;i<a->
data.size();i++)
41 type = symtabtype::ARRAY;
47 type = symtabtype::STRING;
55 type = symtabtype::NUMBER;
61 type = symtabtype::FUNCTION;
81 if (
type!=symtabtype::NUMBER)
83 std::cout <<
"Symbol is not a number!" << std::endl;
91 if (
type!=symtabtype::STRING)
93 std::cout <<
"Symbol is not a string!" << std::endl;
101 if (
type!=symtabtype::ARRAY)
103 std::cout <<
"Symbol is not a array!" << std::endl;
111 if (
type!=symtabtype::FUNCTION)
113 std::cout <<
"Symbol is not a function!" << std::endl;
121 std::cout <<
"\t" <<
name <<
" = ";
122 std::list<double>::iterator it;
124 case Symtab::symtabtype::NUMBER:
125 std::cout <<
value << std::endl;
128 case Symtab::symtabtype::STRING:
129 std::cout <<
str << std::endl;
132 case Symtab::symtabtype::ARRAY:
135 {std::cout <<
" " << (*it) <<
" ";}
136 std::cout <<
"}" << std::endl;
Representation of arrays used in tokens.
std::vector< double > data
Representation of double array.
std::list< double > array
data
std::list< double > GetArray() const
Get methods that check on type.
symtabtype GetType() const
Get type.
function GetFunction() const
Set to function pointer.
double GetNumber() const
Set to double.
double(* function)(double)
typedef for function pointer
void Print()
Print method.
Symtab(std::string s)
Constructor with name.
symtabtype type
Enum type.
bool is_reserved
Flag is parser symbol is a reserved name.
std::string name
Name of parser symbol.
void Set(Array *)
Set to Array value.
bool IsReserved() const
Check if symbol is a reserved name.
std::string GetName() const
Get name.
std::string GetString() const
Set to string.
Parser namespace for GMAD language. Combination of Geant4 and MAD.