absyntax_utils/absyntax_utils.cc
changeset 350 2c3c4dc34979
parent 338 3037bb7e8a82
child 366 1aeb29ee9381
equal deleted inserted replaced
341:ba80c3ceb6fb 350:2c3c4dc34979
    48 #include <iostream>
    48 #include <iostream>
    49 #include <sstream>
    49 #include <sstream>
    50 #include <typeinfo>
    50 #include <typeinfo>
    51 #include <list>
    51 #include <list>
    52 #include <strings.h>
    52 #include <strings.h>
       
    53 #include <stdlib.h>  /* required for atoi() */
    53 
    54 
    54 #include "../util/symtable.hh"
    55 #include "../util/symtable.hh"
    55 #include "../util/dsymtable.hh"
    56 #include "../util/dsymtable.hh"
    56 #include "../absyntax/visitor.hh"
    57 #include "../absyntax/visitor.hh"
    57 
    58 
    91 
    92 
    92   /* identifiers do not match! */
    93   /* identifiers do not match! */
    93   return 1;
    94   return 1;
    94 }
    95 }
    95 
    96 
       
    97 
       
    98 /* extract the value of an integer from an integer_c object !! */
       
    99 /* NOTE: it must ignore underscores! */
       
   100 int extract_integer(symbol_c *sym) {
       
   101   integer_c *integer = dynamic_cast<integer_c *>(sym);  
       
   102   if (integer == NULL) ERROR;
       
   103   
       
   104   return atoi(integer->value);
       
   105 }
    96 
   106 
    97 
   107 
    98 /***********************************************************************/
   108 /***********************************************************************/
    99 /***********************************************************************/
   109 /***********************************************************************/
   100 /***********************************************************************/
   110 /***********************************************************************/