Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "lexer.h"
- #include <vector>
- #ifndef _PARSER_H_
- #define _PARSER_H_
- using namespace lexer;
- struct ast
- {
- int leaf;
- kind tokens_ast;
- std::vector<char> tokens;
- int branch;
- };
- class token_stream
- {
- private:
- typename std::vector<token>::const_iterator sot;
- //typename std::vector<token>::const_iterator eot;
- public:
- token_stream(const std::vector<token> &tokens)
- : sot(tokens.cbegin()),
- eot(tokens.cend()) //;
- ast a;
- const token &get(ast a) const
- {
- if(pos != EOF)
- {
- return *pos;// return pointer to pos
- }
- if(pos == "\n") a.branch++;
- return invalid_token; // else
- }
- void next()
- {
- if(pos != EOF)
- {
- pos+=1;
- }
- }
- };
- struct tokens
- {
- std::vector<token> tokens_t;
- std::vector<token_stream> tokens_stream;
- }
- class block_opening
- {
- public:
- void set_curl_o(ast);
- //ast *AST = &;
- ast *AST;
- // AST = (ast *)malloc(sizeof(ast));
- std::vector<token> token_holder;
- //token_holder.push_back(this->AST); // beginning of AST
- //std::map<char, ast> a;
- void make_close();
- //this->AST->leaf++;
- //this->AST->tokens_ast = kind::CURLP_C;
- private:
- ast curl_open;
- // curl_open->tokens_ast->kind_t = kind::CURLP_O;
- };
- struct parent{ ast&& func; };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement