aboutsummaryrefslogtreecommitdiff
path: root/Parser.h
blob: b6d7bd5746f35aae38917600965061d0dc508eed (plain)
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
35
36
37
38
#pragma once

#include <iostream>
#include <istream>


#include "Circuit.h"
#include "Exception.h"

using std::istream;
using std::string;



class Parser {
public:
	Parser() = default;
	virtual ~Parser() = default;

	void parse(string input);
	void parse(istream & input);

	/**
	 * \brief preprocess (filter) line of input
	 *
	 * normalize whitespace and remove comments
	 */
	static size_t filter(char * input);

	void set_circuit(Circuit & circuit);

private:
	friend istream & operator << (Parser & parser, istream & s);
	friend istream & operator >> (istream & s, Parser & parser);

	Circuit * circuit;
};