28Symtab::Symtab(std::string s):
31 type(symtabtype::NUMBER),
40 for(
unsigned int i=0;i<a->
data.size();i++)
42 type = symtabtype::ARRAY;
48 type = symtabtype::STRING;
56 type = symtabtype::NUMBER;
62 type = symtabtype::FUNCTION;
82 if (
type!=symtabtype::NUMBER)
84 std::cout <<
"Symbol is not a number!" << std::endl;
92 if (
type!=symtabtype::STRING)
94 std::cout <<
"Symbol is not a string!" << std::endl;
102 if (
type!=symtabtype::ARRAY)
104 std::cout <<
"Symbol is not a array!" << std::endl;
112 if (
type!=symtabtype::FUNCTION)
114 std::cout <<
"Symbol is not a function!" << std::endl;
122 std::cout <<
"\t" <<
name <<
" = ";
123 std::list<double>::iterator it;
125 case Symtab::symtabtype::NUMBER:
126 std::cout <<
value << std::endl;
129 case Symtab::symtabtype::STRING:
130 std::cout <<
str << std::endl;
133 case Symtab::symtabtype::ARRAY:
136 {std::cout <<
" " << (*it) <<
" ";}
137 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.
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.