aboutsummaryrefslogtreecommitdiff
path: root/Parser.h
blob: 271d0f4c8e1cd03328772902e8a86efef4ff736e (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
39
#pragma once

#include <iostream>
#include <istream>


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

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



class Parser {
public:
	Parser() = default;
	Parser(Circuit & circuit);
	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;
};