summaryrefslogtreecommitdiff
path: root/cli/context.hxx
blob: 8dc9fff448b4ad57cc5f1bb888a7b7b167507c4e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// file      : cli/context.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#ifndef CLI_CONTEXT_HXX
#define CLI_CONTEXT_HXX

#include <map>
#include <string>
#include <ostream>

#include <cutl/shared-ptr.hxx>

#include "semantics.hxx"
#include "traversal.hxx"

using std::endl;

class context
{
public:
  typedef std::string string;

private:
  struct data;
  cutl::shared_ptr<data> data_;

public:
  std::ostream& os;

  typedef std::map<string, string> reserved_name_map_type;
  reserved_name_map_type& reserved_name_map;

private:
  struct data
  {
    reserved_name_map_type reserved_name_map_;
  };

public:
  // Escape C++ keywords, reserved names, and illegal characters.
  //
  string
  escape (string const&) const;

public:
  context (std::ostream& os_);
  context (context& c);

private:
  context&
  operator= (context const&);
};

#endif // CLI_CONTEXT_HXX