MyLang
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
myparser_common.hpp
Go to the documentation of this file.
1 #ifndef MYPARSER_COMMON_HPP
2 #define MYPARSER_COMMON_HPP
3 
4 // option list
5 
6 #if !defined(MYPARSER_CUSTOMIZED)
7  #define MYPARSER_DEBUG
8  #define MYPARSER_AST_CCC
9 
10  #if defined(__GNUC__) || defined(__clang__)
11  #define MYPARSER_FORCE_INLINE
12  #endif
13 
14  // use boost instead of libstdc++
15  #if defined(__GLIBCXX__)
16  #define MYPARSER_BOOST_XPRESSIVE
17  #else
18  #define MYPARSER_STD_REGEX
19  #endif
20 #endif
21 
22 // library
23 
24 #include <limits>
25 #include <string>
26 #include <vector>
27 #include <iostream>
28 #include <sstream>
29 
30 #if defined(MYPARSER_BOOST_REGEX)
31  #include <boost/regex.hpp>
32  namespace regex_lib = boost;
33 #elif defined(MYPARSER_BOOST_XPRESSIVE)
34  #include <boost/xpressive/xpressive_dynamic.hpp>
35  namespace regex_lib = boost::xpressive;
36 #elif defined(MYPARSER_STD_REGEX)
37  #include <regex>
38  namespace regex_lib = std;
39 #else
40  // Error!
41 #endif
42 
43 #if defined(MYPARSER_AST_CCC)
44  #include "lib/ccc.hpp"
45 #endif
46 
47 #if defined(MYPARSER_FORCE_INLINE)
48  #define MYPARSER_INLINE __attribute__((__always_inline__)) inline
49 #else
50  #define MYPARSER_INLINE inline
51 #endif
52 
53 namespace myparser {
54 
55 #if defined(MYPARSER_DEBUG)
56  template <class T>
57  inline void mpDebug(T value) {
58  std::cerr << value << std::endl;
59  }
60 #else
61  template <class T>
62  inline void mpDebug(T value) {}
63 #endif
64 
65 #if defined(MYPARSER_AST_CCC)
69  // const auto style_faint = ccc::s_faint;
70  const auto style_faint = "";
71  const auto style_normal = ccc::d_all;
72 #else
73  const auto style_index = "";
74  const auto style_keyword = "";
75  const auto style_error = "";
76  const auto style_faint = "";
77  const auto style_normal = "";
78 #endif
79 
80 enum {
81  PASS_FILTER, // TODO
84  PASS_MESSAGE, // TODO // input [(list, message), ...] output [lineno:pos message]
85 
86  PASS_FIN = 64
87 };
88 
89 // forward declaration
90 
91 template <size_t I>
92 class Pass;
93 
94 }
95 
96 #endif
Definition: myparser_common.hpp:83
Definition: myparser_common.hpp:82
Definition: ccc.hpp:76
Definition: ccc.hpp:40
void mpDebug(T value)
Definition: myparser_common.hpp:57
Definition: myparser_common.hpp:84
const auto style_keyword
Definition: myparser_common.hpp:67
Definition: myparser_common.hpp:86
Definition: ccc.hpp:55
const auto style_error
Definition: myparser_common.hpp:68
Definition: ccc.hpp:36
const auto style_normal
Definition: myparser_common.hpp:71
Definition: myparser_common.hpp:81
Definition: ccc.hpp:61
Definition: myparser_common.hpp:92
const auto style_faint
Definition: myparser_common.hpp:70
const auto style_index
Definition: myparser_common.hpp:66
Definition: ccc.hpp:38