diff -r f6bc5230aadd -r e47cc8c954db absyntax/absyntax.hh --- a/absyntax/absyntax.hh Thu Nov 22 18:51:42 2012 +0000 +++ b/absyntax/absyntax.hh Thu Nov 22 18:53:37 2012 +0000 @@ -48,6 +48,7 @@ #include // required for NULL #include +#include #include #include // required for uint64_t, etc... #include "../main.hh" // required for uint8_t, real_64_t, ..., and the macros INT8_MAX, REAL32_MAX, ... */ @@ -72,6 +73,28 @@ +/* Case insensitive string compare */ + /* Case insensitive string compare copied from + * "The C++ Programming Language" - 3rd Edition + * by Bjarne Stroustrup, ISBN 0201889544. + */ +class nocasecmp_c { + public: + bool operator() (const std::string& x, const std::string& y) const { + std::string::const_iterator ix = x.begin(); + std::string::const_iterator iy = y.begin(); + + for(; (ix != x.end()) && (iy != y.end()) && (toupper(*ix) == toupper(*iy)); ++ix, ++iy); + if (ix == x.end()) return (iy != y.end()); + if (iy == y.end()) return false; + return (toupper(*ix) < toupper(*iy)); + }; + }; + + + + + @@ -99,7 +122,7 @@ /* * Annotations produced during stage 3 - */ + */ /*** Data type analysis ***/ std::vector candidate_datatypes; /* All possible data types the expression/literal/etc. may take. Filled in stage3 by fill_candidate_datatypes_c class */ /* Data type of the expression/literal/etc. Filled in stage3 by narrow_candidate_datatypes_c @@ -138,6 +161,12 @@ } const_value_t; const_value_t const_value; + /*** Enumeration datatype checking ***/ + /* Not all symbols will contain the following anotations, which is why they are not declared here in symbol_c + * They will be declared only inside the symbols that require them (have a look at absyntax.def) + */ + typedef std::multimap enumvalue_symtable_t; + public: /* default constructor */ @@ -153,6 +182,8 @@ }; + + class token_c: public symbol_c { public: /* WARNING: only use this method for debugging purposes!! */ @@ -169,6 +200,8 @@ }; + + /* a list of symbols... */ class list_c: public symbol_c { public: @@ -200,6 +233,11 @@ + + + + + #define SYM_LIST(class_name_c, ...) \ class class_name_c: public list_c { \ public: \