-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgemtext.h
More file actions
32 lines (27 loc) · 685 Bytes
/
gemtext.h
File metadata and controls
32 lines (27 loc) · 685 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
#pragma once
#include <ios>
#include <cstdlib>
#include <string>
#include "markup.h"
// base parser class, abstract layer between input stream and real parser
struct base_parser {
private:
std::istream& input;
public:
explicit base_parser(std::istream& in);
bool test(char c);
int show();
bool take(char c);
void expect(char c);
bool eof();
std::string take_word();
std::string take_line();
std::string take_rest();
void skip_ws();
};
struct gemtext_parser : base_parser {
public:
explicit gemtext_parser(std::istream& in);
// returns unique_ptr to a heap object which was parsed
std::unique_ptr<markup> parse_element();
};