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.

104 lines
2.4 KiB

  1. /*
  2. FILE: HID.Y
  3. DESCR: YACC compatible BNF Grammar for the HID descriptor
  4. AUTHOR: John Pierce (johnpi)
  5. DATE: 04.18.96
  6. */
  7. %{
  8. #include <windows.h>
  9. #include <stdio.h>
  10. extern HWND ghwndParseEdit;
  11. extern int yylineno;
  12. void main(void);
  13. %}
  14. %token END
  15. %token COLLECTION END_COLLECTION INPUT OUTPUT FEATURE
  16. %token USAGE_PAGE REPORT_COUNT REPORT_SIZE REPORT_ID LOG_MIN LOG_MAX
  17. %token PHYS_MIN PHYS_MAX UNIT EXPONENT STRING_INDEX PUSH POP
  18. %token OPEN_SET CLOSE_SET USAGE USAGE_MIN USAGE_MAX
  19. %token STRING_MIN STRING_MAX DESIGNATOR_INDEX DESIGNATOR_MIN DESIGNATOR_MAX
  20. %%
  21. ReportDescriptor : ItemList END { DisplayPass(); }
  22. ;
  23. ItemList : Attributes MainItemType
  24. | ItemList Attributes MainItemType
  25. ;
  26. MainItemType : COLLECTION ItemList END_COLLECTION
  27. | INPUT
  28. | OUTPUT
  29. | FEATURE
  30. ;
  31. Attributes : GlobalAttribute
  32. | LocalAttribute
  33. | Attributes GlobalAttribute
  34. | Attributes LocalAttribute
  35. | OPEN_SET LocalAttributeList CLOSE_SET
  36. | Attributes OPEN_SET LocalAttributeList CLOSE_SET
  37. ;
  38. LocalAttributeList : LocalAttribute
  39. | LocalAttributeList LocalAttribute
  40. ;
  41. GlobalAttribute : USAGE_PAGE
  42. | LOG_MIN
  43. | LOG_MAX
  44. | PHYS_MIN
  45. | PHYS_MAX
  46. | UNIT
  47. | EXPONENT
  48. | REPORT_SIZE
  49. | REPORT_COUNT
  50. | REPORT_ID
  51. | PUSH
  52. | POP
  53. ;
  54. LocalAttribute : USAGE
  55. | USAGE_MIN
  56. | USAGE_MAX
  57. | DESIGNATOR_INDEX
  58. | DESIGNATOR_MIN
  59. | DESIGNATOR_MAX
  60. | STRING_INDEX
  61. | STRING_MIN
  62. | STRING_MAX
  63. ;
  64. %%
  65. void DisplayPass(void)
  66. {
  67. #ifndef CONSOLE
  68. MessageBeep(MB_OK);MessageBox(NULL,"Descriptor is Valid!","Parse Results",MB_OK);
  69. #else
  70. printf("Descriptor is Valid!\n");
  71. #endif
  72. }
  73. #ifdef CONSOLE
  74. void main(void)
  75. {
  76. yyparse();
  77. }
  78. #endif