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.

52 lines
1.2 KiB

  1. #include "Operation.h"
  2. #ifndef _PARSER_H
  3. #define _PARSER_H
  4. #define INPUT_BUFFER_SZ 256
  5. #define INPUT_TOKEN_SZ 80
  6. #define TOKEN_SZ_BLANKS " \t\n\r"
  7. #define TOKEN_CH_COM_DELIM ';'
  8. #define TOKEN_CH_NL '\n'
  9. #define TOKEN_CH_STR_DELIM '\"'
  10. #define KEYWORD_PRAGMA "#pragma"
  11. #define KEYWORD_CMD_ADD_EVENT "ADD"
  12. #define KEYWORD_CMD_DEL_EVENT "DELETE"
  13. #define KEYWORD_CMD_ADD_TRAP "ADD_TRAP_DEST"
  14. #define KEYWORD_CMD_DEL_TRAP "DELETE_TRAP_DEST"
  15. class COperation;
  16. class CParser
  17. {
  18. COperation *m_pOperList;
  19. int m_fdInput;
  20. char m_szInput[INPUT_BUFFER_SZ];
  21. char *m_pInput;
  22. DWORD OpenInputFile();
  23. DWORD ReloadInputBuffer();
  24. DWORD AdvanceInputPointer();
  25. public:
  26. DWORD m_nLineNo;
  27. DWORD m_nTokenNo;
  28. CParser();
  29. ~CParser();
  30. DWORD GetNextToken(char *pToken, int nSizeToken);
  31. DWORD UnGetToken(char *szToken);
  32. DWORD CheckUnGetToken(char *pMatchToken, char *pToken);
  33. DWORD ParseInputFile();
  34. DWORD ParseCommand(tOperation opType);
  35. DWORD ProcessCommands();
  36. };
  37. extern CParser gParser;
  38. #endif