Advertisement
lazix

parser.h

Jan 21st, 2021 (edited)
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. #include "lexer.h"
  2. #include <vector>
  3. #ifndef _PARSER_H_
  4. #define _PARSER_H_
  5. using namespace lexer;
  6.  
  7. struct ast
  8. {
  9.     int leaf;
  10.     kind tokens_ast;
  11.     std::vector<char> tokens;
  12.     int branch;
  13. };
  14.  
  15.  
  16. class token_stream
  17. {
  18.     private:
  19.         typename std::vector<token>::const_iterator sot;
  20.         //typename std::vector<token>::const_iterator eot;
  21.     public:
  22.         token_stream(const std::vector<token> &tokens)
  23.         : sot(tokens.cbegin()),
  24.         eot(tokens.cend())  //;
  25.         ast a;
  26.         const token &get(ast a) const
  27.         {
  28.             if(pos != EOF)
  29.             {
  30.                 return *pos;// return pointer to pos
  31.             }
  32.             if(pos == "\n") a.branch++;
  33.             return invalid_token; // else
  34.         }
  35.  
  36.         void next()
  37.         {
  38.             if(pos != EOF)
  39.             {
  40.                 pos+=1;
  41.             }
  42.         }
  43.  
  44. };
  45.  
  46. struct tokens
  47. {
  48.     std::vector<token> tokens_t;
  49.     std::vector<token_stream> tokens_stream;
  50. }
  51.  
  52. class block_opening
  53. {
  54.     public:
  55.     void set_curl_o(ast);
  56.     //ast *AST = &;
  57.     ast *AST;
  58.    // AST = (ast *)malloc(sizeof(ast));
  59.     std::vector<token> token_holder;
  60.     //token_holder.push_back(this->AST); // beginning of AST
  61.         //std::map<char, ast> a;
  62.     void make_close();
  63.         //this->AST->leaf++;
  64.         //this->AST->tokens_ast = kind::CURLP_C;
  65.     private:
  66.     ast curl_open;
  67. //    curl_open->tokens_ast->kind_t = kind::CURLP_O;
  68. };
  69. struct parent{ ast&& func; };
  70. #endif
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement