struct Token{
    uint col, line;
uint flags;//indicated info about token, serves as both type tag and flag set; //indicates proper type once token was cooked (like "31.415926" -> 3.145926e1) i.e. values are calculated
    union {
        string     chars;
        float     f_val;
        double     d_val;
        uint     uint_val;
        long     long_val;
        ulnog     ulong_val;
        //... anything else you may need (8 bytes are plenty)
    }//even then you may use up to 12bytes
    //total size == 24 or 20
};

I wouldn't convert the string representation to a value unless needed. Even the parser does not need to know.

Reply via email to