Leaked source code of windows server 2003
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.

74 lines
2.2 KiB

  1. // Copyright (c)1997-1999 Microsoft Corporation, All Rights Reserved
  2. #ifndef __LEX__
  3. #define __LEX__
  4. #include <tchar.h>
  5. #include "fmtinfo.h"
  6. #include "token.h"
  7. #define P_IN(x) const x &
  8. #define P_OUT(x) x &
  9. #define P_IO(x) x &
  10. #define PURE = 0
  11. // Lex state, kept at the beginning of every line (lxsBOL) from
  12. // previous line's state at its end (lxsEOL). Must fit all bits
  13. // necessary to restart lexing on a line by line basis.
  14. typedef DWORD LXS;
  15. typedef LXS * PLXS;
  16. // Lexer and language Metrics
  17. const unsigned ctchUserTokenPhrase = 100;
  18. struct USERTOKENS
  19. {
  20. INT token; // preassigned in the user range
  21. TCHAR szToken[ctchUserTokenPhrase+1]; // token class name exposed to user
  22. COLORREF RGBText;
  23. COLORREF RGBBackground;
  24. AUTO_COLOR autocolorFore;
  25. AUTO_COLOR autocolorBack;
  26. };
  27. typedef USERTOKENS * PUSERTOKENS;
  28. typedef const USERTOKENS * PCUSERTOKENS;
  29. // Alternate way of looking at a token, editor will only look at tokUser.
  30. // Other clients of the lexer (like the parser or the EE) may want to look
  31. // at the actual token in tokAct. If any of tokAct is set, then it is expected
  32. // that the actual token is different than the meta token it passed back.
  33. // The status bits are only used by the lexer for whatever it wants.
  34. union TOK_ALT {
  35. TOKEN tok;
  36. struct {
  37. unsigned tokUser : 12;
  38. unsigned tokUserStatus : 4;
  39. unsigned tokAct : 12;
  40. unsigned tokActStatus : 4;
  41. };
  42. };
  43. // A SUBLANG structure was originally used for identifying different
  44. // dialects of the same language (like fortran fixed and fortran free)
  45. // that use the same lexer, can be treated as two languages in the editor,
  46. // and share all the same color/font info in the format dialog.
  47. //
  48. // We've extended it to be a general descriptor for a type of text file.
  49. //
  50. struct SUBLANG
  51. {
  52. LPCTSTR szSubLang;
  53. LXS lxsInitial;
  54. UINT nIdTemplate; // Icon and MFC doc template string resource id
  55. CLSID clsidTemplate;
  56. };
  57. typedef SUBLANG * PSUBLANG;
  58. typedef const SUBLANG * PCSUBLANG;
  59. #define MAX_LANGNAMELEN (50)
  60. #endif