-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlexer.h
More file actions
34 lines (24 loc) · 705 Bytes
/
lexer.h
File metadata and controls
34 lines (24 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "token.h"
#include <iosfwd>
#include <boost/coroutine/asymmetric_coroutine.hpp>
namespace pyjamas
{
struct Lexer
{
using OutChannel = boost::coroutines::asymmetric_coroutine< Token >;
using OutChannelWriter = OutChannel::push_type;
using OutChannelReader = OutChannel::pull_type;
Lexer( std::istream& in, OutChannelWriter writer );
void run();
bool at_end() const { return eof; }
private:
void get_string();
void get_keyword();
void consume_char();
std::istream& in;
char c;
bool eof;
OutChannelWriter writer;
};
}