Advertisement
TwisterMike

scanner.h

Feb 16th, 2020
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. /*Group 2 Program 1
  2. Paul Maclean- mac7537@calu.edu
  3. Mike Gorse- gor9632@calu.edu
  4. Robert Breckenridge- bre6896@calu.edu
  5. Chase Smith- smi8808@calu.edu
  6.  
  7. CSC 460
  8. Language Translations
  9. */
  10.  
  11. #ifndef SCANNER_H
  12. #define SCANNER_H
  13.  
  14. #include <stdio.h>
  15.  
  16. #define LINE_BUFF_SIZE 1026
  17. #define OUTFILE_BUFF_SIZE 2000
  18. #define TOKEN_BUFF_SIZE 100
  19. #define TOKEN_TYPE_SIZE 20
  20.  
  21. static char* Lex_Err_Buff[LINE_BUFF_SIZE] = { '\0' };
  22. static int Lex_Err_Total = 0;
  23. static int Lex_Err_Index = 0;
  24.  
  25. static const char* TOKEN_TYPES[34] = {
  26. "BEGIN", //0
  27. "END", //1
  28. "READ", //2
  29. "WRITE", //3
  30. "IF", //4
  31. "THEN", //5
  32. "ELSE", //6
  33. "ENDIF", //7
  34. "WHILE", //8
  35. "ENDWHILE", //9
  36. "FALSE", //10
  37. "TRUE", //11
  38. "NULL", //12
  39. "LPAREN", //13
  40. "RPAREN", //14
  41. "SEMICOLON", //15
  42. "COMMA", //16
  43. "ASSIGNOP", //17
  44. "PLUSOP", //18
  45. "MINUSOP", //19
  46. "MULTOP", //20
  47. "DIVOP", //21
  48. "NOTOP", //22
  49. "LESSOP", //23
  50. "LESSEQUALOP", //24
  51. "GREATEROP", //25
  52. "GREATEREQUALOP", //26
  53. "EQUALOP", //27
  54. "NOTEQUALOP", //28
  55. "EOF", //29
  56. "ID", //30
  57. "INTLITERAL", //31
  58. "LEXERR", //32
  59. "COMMENT" //33
  60. };
  61.  
  62. typedef enum {
  63. BEGIN, //0
  64. END, //1
  65. READ, //2
  66. WRITE, //3
  67. IF, //4
  68. THEN, //5
  69. ELSE, //6
  70. ENDIF, //7
  71. WHILE, //8
  72. ENDWHILE, //9
  73. FALSEOP, //10
  74. TRUEOP, //11
  75. NULLOP, //12
  76. LPAREN, //13
  77. RPAREN, //14
  78. SEMICOLON, //15
  79. COMMA, //16
  80. ASSIGNOP, //17
  81. PLUSOP, //18
  82. MINUSOP, //19
  83. MULTOP, //20
  84. DIVOP, //21
  85. NOTOP, //22
  86. LESSOP, //23
  87. LESSEQUALOP, //24
  88. GREATEROP, //25
  89. GREATEREQUALOP, //26
  90. EQUALOP, //27
  91. NOTEQUALOP, //28
  92. SCANEOF, //29
  93. ID, //30
  94. INTLITERAL, //31
  95. LEXERR, //32
  96. COMMENT //33
  97. } TokenId;
  98.  
  99.  
  100. void scanner(FILE*);
  101.  
  102. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement