Zen
A cross-platform functional programming language

/home/renji/Data/projects/zenlang/sources/zbl/Lexer.hpp

Go to the documentation of this file.
00001 
00005 #pragma once
00006 
00007 #define INTERNAL_TOKEN_REF
00008 #include "zbl/Token.hpp"
00009 #include "zbl/Scanner.hpp"
00010 
00013 namespace zbl {
00015 
00017     class ParseContext;
00018 
00020 
00022     class Lexer {
00023     public:
00027         inline Lexer(zbl::ParseContext& pctx) : _pctx(pctx) {}
00028 
00029     public:
00034         int parse(zbl::Scanner& scanner);
00035 
00036     public:
00040         inline bool hasToken() const {return !_tokenQ.empty();}
00041 
00045         inline Token deque() {return _tokenQ.deque();}
00046 
00047     private:
00051         inline void enque(const Token& token) {_tokenQ.enque(token);}
00052 
00053     private:
00055         zbl::ParseContext& _pctx;
00056 
00058         z::queue<Token> _tokenQ;
00059     };
00060 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines