blob: c6eee69dbf2c284e94e1cf15b99b50a13609d127 (
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
40
41
42
|
/**
** \file desugar/desugar-visitor.hh
** \brief Declaration of desugar::DesugarVisitor.
*/
#pragma once
#include <map>
#include <astclone/cloner.hh>
namespace desugar
{
/// \brief Desugar some syntactic structures while duplicating an Ast.
class DesugarVisitor : public astclone::Cloner
{
public:
/// Superclass.
using super_type = astclone::Cloner;
// Import overloaded virtual functions.
using super_type::operator();
/// Build a DesugarVisitor.
DesugarVisitor(bool desugar_for_p, bool desugar_string_cmp_p);
/// \name Visit methods.
/// \{
/// Desugar string comparisons.
void operator()(const ast::OpExp&) override;
/// Desugar `for' loops as `while' loops.
void operator()(const ast::ForExp&) override;
/// \}
private:
/// Desugar `for' loops?
bool desugar_for_p_;
/// Desugar string comparisons?
bool desugar_string_cmp_p_;
};
} // namespace desugar
|