Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.3 KiB

  1. // Copyright (c) 1993-1999 Microsoft Corporation
  2. /* SCCSWHAT( "@(#)lex.h 3.2 88/12/08 15:03:58 " ) */
  3. /*
  4. ** union used to return values from the lexer
  5. */
  6. #if !defined(_LEX_H)
  7. #define _LEX_H
  8. typedef unsigned short token_t;
  9. extern token_t yylex(void);
  10. extern void yyunlex( token_t token);
  11. token_t is_keyword(char*, short);
  12. /*
  13. * These parser flags control three things:
  14. * 1] whether the has parser has parsed a valid t_spec yet (ATYPE)
  15. * 2] whether "const" and "volatile" are modifiers (ACVMOD)
  16. * 3] whether we have a declaration with no type (AEMPTY)
  17. * 4] whether the rpc keywords are active. (RPC)
  18. * 5] whether we are in an enum\struct\union (AESU)
  19. *
  20. * ISTYPENAME checks that we have not seen a type yet.
  21. */
  22. #define REG
  23. #define PF_ATYPE 0x01
  24. #define PF_AESU 0x02
  25. #define PF_ASTROP 0x04
  26. #define PF_ACVMOD 0x08
  27. #define PF_AEMPTY 0x10
  28. #define PF_RPC 0x20
  29. #define PF_TMASK (PF_ATYPE | PF_AESU | PF_ASTROP)
  30. #define PF_MMASK (PF_ACVMOD | PF_AEMPTY)
  31. #define PF_ISTYPENAME ((ParseFlags & PF_TMASK) == 0)
  32. #define PF_ISMODIFIER ((ParseFlags & PF_MMASK) != 0)
  33. #define PF_ISEMPTY ((ParseFlags & PF_AEMPTY) != 0)
  34. #define PF_INRPC (ParseFlags & PF_RPC)
  35. #define PF_SET(a) (ParseFlags |= (a))
  36. #define PF_CLEAR(a) (ParseFlags &= (~(a)))
  37. #define PF_LOOKFORTYPENAME ((ParseFlags & PF_ATYPE) == 0)
  38. extern short inside_rpc;
  39. /* some notes about the parse flags....
  40. PF_ATYPE is the important part of PF_LOOKFORTYPENAME, the macro that
  41. tells the lexer whether or not it is valid to return an L_TYPENAME
  42. token. It should be cleared after a valid type is read (int, another
  43. typedefed name, struct x, etc) and reset after an identifier is assigned
  44. to that type.
  45. */
  46. #define KW_IN_IDL 0x0001
  47. #define KW_IN_ACF 0x0002
  48. #define KW_IN_BOTH ( KW_IN_IDL | KW_IN_ACF )
  49. #define M_OSF 0x0010
  50. #define M_MSE 0x0020
  51. #define M_CPORT 0x0040
  52. #define M_ALL (M_OSF | M_MSE | M_CPORT)
  53. #define INBRACKET 0x0100
  54. #define UNCONDITIONAL 0x0000
  55. #define BRACKET_MASK 0x0100
  56. #define LEX_NORMAL 0x0000
  57. #define LEX_VERSION 0x0001 // return VERSION and set mode back to LEX_NORMAL
  58. #define LEX_GUID 0x0002 // return GUID and set mode back to LEX_NORMAL
  59. #define LEX_ODL_BASE_IMPORT 0x0005 // return KWIMPORTODLBASE STRING as next two tokens
  60. #define LEX_ODL_BASE_IMPORT2 0x0006 // return STRING
  61. #define MAX_STRING_SIZE 255
  62. #endif // _LEX_H