tokens.h
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 2k
Category:

Windows Develop

Development Platform:

Visual C++

  1. // lexer-specific defines and types
  2. // reserved word and special token ID's
  3. typedef enum {
  4.     RW_NOTFOUND = 0,
  5. // special character RWs
  6.     RW_EOF,
  7.     RW_LBRACKET,
  8.     RW_RBRACKET,
  9.     RW_LCURLY,
  10.     RW_RCURLY,
  11.     RW_LPAREN,
  12.     RW_RPAREN,
  13.     RW_SEMI,
  14.     RW_COLON,
  15.     RW_PERIOD,
  16.     RW_COMMA,
  17.     RW_ASSIGN,
  18.     RW_POINTER,
  19.     RW_HYPHEN,
  20. // keyword RWs
  21.     RW_LIBRARY,
  22.     RW_TYPEDEF,
  23.     RW_ENUM,
  24.     RW_STRUCT,
  25.     RW_MODULE,
  26.     RW_INTERFACE,
  27.     RW_DISPINTERFACE,
  28.     RW_COCLASS,
  29.     RW_PROPERTIES,
  30.     RW_METHODS,
  31.     RW_IMPORTLIB,
  32.     RW_PASCAL,
  33.     RW_CDECL,
  34.     RW_STDCALL,
  35.     RW_UNSIGNED,
  36.     RW_UNION,
  37.     RW_EXTERN,
  38.     RW_FAR,
  39.     RW_SAFEARRAY,
  40.     RW_CONST,
  41. #if FV_PROPSET
  42.     RW_PROPERTY_SET,
  43. #endif //FV_PROPSET
  44. // literals
  45.     LIT_STRING,
  46.     LIT_NUMBER,
  47.     LIT_UUID,
  48.     LIT_ID,
  49. // operators
  50.     OP_ADD,
  51.     OP_SUB,
  52.     OP_MUL,
  53.     OP_DIV,
  54.     OP_MOD,
  55.     OP_EXP,
  56.     OP_LOG_AND,
  57.     OP_LOG_OR,
  58.     OP_LOG_NOT,
  59.     OP_BIT_AND,
  60.     OP_BIT_OR,
  61.     OP_BIT_NOT,
  62.     OP_LSHIFT,
  63.     OP_RSHIFT,
  64.     OP_EQ,
  65.     OP_LE,
  66.     OP_LT,
  67.     OP_GE,
  68.     OP_GT,
  69.     OP_MIN = OP_ADD,
  70.     OP_MAX = OP_GT,
  71. // attribute reserved words
  72.     ATTR_UUID,
  73.     ATTR_VERSION,
  74.     ATTR_DLLNAME,
  75.     ATTR_ENTRY,
  76.     ATTR_ID,
  77.     ATTR_HELPSTRING,
  78.     ATTR_HELPCONTEXT,
  79.     ATTR_HELPFILE,
  80.     ATTR_LCID,
  81.     ATTR_PROPGET,
  82.     ATTR_PROPPUT,
  83.     ATTR_PROPPUTREF,
  84.     ATTR_OPTIONAL,
  85.     ATTR_IN,
  86.     ATTR_OUT,
  87.     ATTR_STRING,
  88.     ATTR_VARARG,
  89.     ATTR_APPOBJECT,
  90.     ATTR_RESTRICTED,
  91.     ATTR_PUBLIC,
  92.     ATTR_READONLY,
  93.     ATTR_ODL,
  94.     ATTR_DEFAULT,
  95.     ATTR_SOURCE,
  96.     ATTR_BINDABLE,
  97.     ATTR_REQUESTEDIT,
  98.     ATTR_DISPLAYBIND,
  99.     ATTR_DEFAULTBIND,
  100.     ATTR_LICENSED,
  101.     ATTR_PREDECLID,
  102.     ATTR_HIDDEN,
  103.     ATTR_RETVAL,
  104.     ATTR_CONTROL,
  105.     ATTR_DUAL,
  106.     ATTR_NONEXTENSIBLE,
  107.     ATTR_OLEAUTOMATION,
  108. } TOKID;
  109. #define fACCEPT_ATTR 0x0001
  110. #define fACCEPT_UUID 0x0002
  111. #define fACCEPT_NUMBER 0x0004
  112. #define fACCEPT_EOF 0x0008
  113. #define fACCEPT_OPERATOR 0x0010
  114. #define fACCEPT_STRING 0x0020
  115. typedef struct {
  116.     TOKID id;
  117.     union {
  118.        LPSTR lpsz;
  119.        GUID FAR * lpUuid;
  120.        DWORD number;
  121.     };
  122.     WORD cbsz; // only if string
  123. } TOKEN;