mCRL2
Loading...
Searching...
No Matches
aterm_io_text.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9
10#ifndef MCRL2_ATERMPP_ATERM_IO_TEXT_H
11#define MCRL2_ATERMPP_ATERM_IO_TEXT_H
12
14
15namespace atermpp
16{
17
20{
21public:
24 text_aterm_ostream(std::ostream& os, bool newline = false);
25
26 void put(const aterm& term) override;
27
28private:
30 void write_term_line(const aterm& term);
31
32 std::ostream& m_stream;
33
34 bool m_newline = false;
35};
36
39{
40public:
41 text_aterm_istream(std::istream& os);
42
43 void get(aterm& t) override;
44
45private:
48
50 aterm parse_aterm_appl(const std::string& function_name, int& character);
51
54
56 aterm_list parse_aterm_list(int& character, char begin, char end);
57
60 std::string parse_quoted_string(int& character);
61
63 std::string parse_unquoted_string(int& character);
64
66 std::string print_parse_error_position();
67
71 int next_char(bool skip_whitespace = true, bool required = false);
72
73 std::istream& m_stream;
74
75 std::size_t m_line = 0;
76 std::size_t m_column = 0;
77
78 std::size_t m_history_limit = 64;
79 std::deque<char> m_history;
80
82};
83
84} // namespace atermpp
85
86#endif // ATERM_IO_TEXT_H
An integer term stores a single std::size_t value. It carries no arguments.
Definition aterm_int.h:26
The interface for a class that reads aterm from a stream. The default constructed term aterm() indica...
Definition aterm_io.h:59
The interface for a class that writes aterm to a stream. Every written term is retrieved by the corre...
Definition aterm_io.h:48
A list of aterm objects.
Definition aterm_list.h:24
Reads terms in textual format from an input stream.
std::size_t m_history_limit
Determines the maximum number of characters that are stored.
std::size_t m_column
The column of the current character.
std::deque< char > m_history
Stores the characters that have been read so-far.
std::string print_parse_error_position()
aterm_int parse_aterm_int(int &character)
Parses an std::size_t as an aterm_int.
aterm parse_aterm(int &character)
Parse a term from the input stream and return it.
std::string parse_quoted_string(int &character)
Reads a quoted string from the stream.
aterm parse_aterm_appl(const std::string &function_name, int &character)
Parses an "f"(t0, ..., tn) application as an aterm.
int next_char(bool skip_whitespace=true, bool required=false)
aterm_list parse_aterm_list(int &character, char begin, char end)
Parses a list of arguments [...] as terms.
std::string parse_unquoted_string(int &character)
Reads an unquoted string from the stream.
void get(aterm &t) override
Reads an aterm from this stream.
int character
The last character that was read.
std::size_t m_line
The line number of the current character.
Writes terms in textual format to an output stream.
bool m_newline
Indicates that terms are separated by a newline.
void write_term_line(const aterm &term)
Writes a term in textual format on the same line.
void put(const aterm &term) override
Write the given term to the stream.
The main namespace for the aterm++ library.
Definition algorithm.h:21