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.

lexer.h 616B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef LEXER_H
  2. #define LEXER_H
  3. typedef enum lexer_token_class
  4. {
  5. LEXER_TOKEN_WHITESPACE,
  6. LEXER_TOKEN_IDENTIFIER,
  7. LEXER_TOKEN_KEYWORD,
  8. LEXER_TOKEN_OPERATOR,
  9. LEXER_TOKEN_SEPARATOR,
  10. LEXER_TOKEN_INTEGER,
  11. LEXER_TOKEN_STRING,
  12. LEXER_TOKEN_FUNCTION_START,
  13. LEXER_TOKEN_FUNCTION_END,
  14. LEXER_TOKEN_EXPRESSION_START,
  15. LEXER_TOKEN_EXPRESSION_END
  16. } lexer_token_class;
  17. typedef struct lexer_token
  18. {
  19. lexer_token_class tokenClass;
  20. char* str;
  21. size_t len;
  22. } lexer_token;
  23. typedef struct lexer_tokens
  24. {
  25. lexer_token* pairs;
  26. size_t length;
  27. size_t allocd;
  28. } lexer_tokens;
  29. lexer_tokens* lexer_analyze(char* str);
  30. #endif