JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Control.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 11/23/17.
3 //
4 
5 #ifndef JODA_CONTROL_H
6 #define JODA_CONTROL_H
7 #include <tao/pegtl/normal.hpp>
9 template <typename Rule>
10 struct query_control : tao::pegtl::normal<Rule> {
11  static const std::string error_message;
12 
13  template <typename Input, typename... States>
14  inline static void raise(const Input &in, States &&...) {
15  throw tao::pegtl::parse_error(error_message, in);
16  }
17 };
18 } // namespace joda::queryparsing::grammar
19 #include "error/LOAD_error.h"
20 #include "grammar/Grammar.h"
21 
23 /*
24  * Errors
25  */
26 
27 // Store
28 template <>
30  "Missing 'STORE' file specifier";
31 template <>
32 const std::string query_control<tao::pegtl::sor<
33  storeAsFileCommand, tao::pegtl::pad<storeIdent, tao::pegtl::space>>>::
34  error_message = "'STORE' command is missing store specifier";
35 // Delete
36 template <>
38  "Missing 'DELETE' variable";
39 // Unknown Aggregation KW
40 template <>
42  "Unknown aggregation function";
43 template <>
45  "Illegal 'From-Pointer' in 'AGG' command";
46 template <>
48  "Illegal 'To-Pointer' in 'AGG' command";
49 template <>
51  "Error in 'AGG' command";
52 
53 // Unknown Projection FROM
54 template <>
56  "Unknown/Illegal 'From-Expression' in 'AS' command";
57 template <>
59  "Illegal 'To-Pointer' in 'AS' command";
60 template <>
62  "Error in 'AS' command";
63 template <>
65  "Expected '*' or '(<Ptr>:<Source>)'";
66 
67 // Choose
68 template <>
70  "Error in 'CHOOSE' expression";
71 template <>
73  "Atomic value, pointer or function expected.";
74 template <>
76  "Atomic value or function expected.";
77 
78 /*
79  * Generic erros
80  */
81 
82 // Brackets expected
83 template <>
84 const std::string query_control<
85  tao::pegtl::pad<tao::pegtl::one<'('>, tao::pegtl::space>>::error_message =
86  "Expected '('";
87 template <>
89  "Expected '('";
90 template <>
91 const std::string query_control<tao::pegtl::one<'('>>::error_message =
92  "Expected '('";
93 template <>
94 const std::string query_control<
95  tao::pegtl::pad<tao::pegtl::one<')'>, tao::pegtl::space>>::error_message =
96  "Expected ')'";
97 template <>
98 const std::string query_control<tao::pegtl::one<')'>>::error_message =
99  "Expected ')'";
100 template <>
102  "Expected ',' or ')'";
103 template <>
104 const std::string query_control<tao::pegtl::one<'"'>>::error_message =
105  "Expected '\"'";
106 
107 //: expected
108 template <>
109 const std::string query_control<
110  tao::pegtl::pad<tao::pegtl::one<':'>, tao::pegtl::space>>::error_message =
111  "Expected ':'";
112 template <>
113 const std::string query_control<tao::pegtl::one<':'>>::error_message =
114  "Expected ':'";
115 
116 // Wrong command/eof
117 template <>
119  "Expected STORE/DELETE/CHOOSE/AS/AGG/EOF";
120 
121 /*
122  * Default
123  */
124 template <typename T>
125 const std::string query_control<T>::error_message =
126  "Parse error matching " + tao::pegtl::internal::demangle<T>();
127 
128 } // namespace joda::queryparsing::grammar
129 #endif // JODA_CONTROL_H
static const std::string error_message
Definition: Control.h:11