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.

26 lines
644 B

1 year ago
1 year ago
1 year ago
  1. #pragma once
  2. #include <vector>
  3. #include <map>
  4. #include <string>
  5. namespace molasses {
  6. // We will always want symbols to be convertible to int for dictionary lookups
  7. struct symbol {
  8. int id;
  9. std::string file_name;
  10. int line;
  11. int column;
  12. [[no_unique_address]] bool is_string;
  13. operator int() const {
  14. return id;
  15. }
  16. };
  17. struct lexed_output {
  18. std::map<int, std::string> dictionary;
  19. std::vector<symbol> symbols;
  20. };
  21. lexed_output lex(const std::string & file_name,const std::string & source);
  22. lexed_output concatenate(const lexed_output& lhs, const lexed_output& rhs);
  23. }