lexer.h 444 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __sti__lexer_lexer_h__
  2. #define __sti__lexer_lexer_h__
  3. typedef struct lexer_token {
  4. long start_line, start_col;
  5. long end_line, end_col;
  6. char* text;
  7. size_t text_len;
  8. char sol, eol;
  9. char is_generic;
  10. char is_whitespace;
  11. void* id;
  12. } lexer_token_t;
  13. typedef struct lexer_opts {
  14. void (*got_token)(lexer_token_t*);
  15. char** symbols;
  16. } lexer_opts_t;
  17. int lex_file(char* path, lexer_opts_t* opts);
  18. #endif