cpp_token_stream.cxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00029
00030
00031 #include <cxxtls/cpp_token_stream.h>
00032 #include <portable_io.h>
00033
00034 namespace cxxtls
00035 {
00036
00037 std::string
00038 CPP_Token::
00039 type_name(int id)
00040 {
00041 switch(id)
00042 {
00043 case eof : return "<eof>";
00044 case eql : return "==";
00045 case neq : return "!=";
00046 case leq : return "<=";
00047 case geq : return ">=";
00048 case sle : return "<<=";
00049 case sre : return ">>=";
00050 case dve : return "/=";
00051 case ple : return "+=";
00052 case mne : return "-=";
00053 case tme : return "*=";
00054 case mde : return "%=";
00055 case adr : return "& ";
00056 case orr : return "||";
00057 case ore : return "|=";
00058 case ade : return "&=";
00059 case inc : return "++";
00060 case dec : return "--";
00061 case shr : return ">>";
00062 case shl : return "<<";
00063 case lan : return "&&";
00064 case der : return "::";
00065 case teq : return "~=";
00066 case ceq : return "^=";
00067 case eli : return "...";
00068 case nmb : return "number";
00069 case aln : return "identifier";
00070 case inv : return "invalid operator";
00071
00072 default:
00073
00074 if(id > 0x100)
00075 {
00076 char buf[40];
00077
00078 sprintf(buf, "<%03x>", id);
00079
00080 return buf;
00081 }
00082 }
00083
00084 char buffer[2];
00085
00086 buffer[0] = id;
00087 buffer[1] = 0;
00088
00089 return buffer;
00090
00091 }
00092 }