adam_parser.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2007 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 00007 /*************************************************************************************************/ 00008 00009 #ifndef ADOBE_ADAM_PARSER_HPP 00010 #define ADOBE_ADAM_PARSER_HPP 00011 00012 #include <adobe/config.hpp> 00013 00014 #include <iosfwd> 00015 #include <string> 00016 00017 #include <boost/function.hpp> 00018 00019 #include <adobe/array.hpp> 00020 #include <adobe/istream.hpp> 00021 #include <adobe/string.hpp> 00022 #include <adobe/vector.hpp> 00023 00127 /*************************************************************************************************/ 00128 00129 namespace adobe { 00130 00131 /*************************************************************************************************/ 00132 00133 struct adam_callback_suite_t 00134 { 00135 enum cell_type_t 00136 { 00137 input_k, // array_t is an initializer 00138 output_k, // array_t is an expression 00139 constant_k, // array_t is an initializer 00140 logic_k, // array_t is an expression 00141 invariant_k // array_t is an expression 00142 }; 00143 00144 struct relation_t 00145 { 00146 vector<name_t> name_set_m; 00147 line_position_t position_m; 00148 array_t expression_m; 00149 string_t detailed_m; 00150 string_t brief_m; 00151 }; 00152 00153 typedef boost::function<void ( cell_type_t type, 00154 name_t cell_name, 00155 const line_position_t& position, 00156 const array_t& expr_or_init, 00157 const std::string& brief, 00158 const std::string& detailed)> add_cell_proc_t; 00159 00160 typedef boost::function<void ( const line_position_t& position, 00161 const array_t& conditional, 00162 const relation_t* first, 00163 const relation_t* last, 00164 const std::string& brief, 00165 const std::string& detailed)> add_relation_proc_t; // REVISIT (sparent) where's brief? 00166 00167 typedef boost::function<void ( name_t cell_name, 00168 bool linked, 00169 const line_position_t& position1, 00170 const array_t& initializer, 00171 const line_position_t& position2, 00172 const array_t& expression, 00173 const std::string& brief, 00174 const std::string& detailed)> add_interface_proc_t; 00175 00176 typedef boost::function<void ( name_t cell_name, 00177 const line_position_t& position, 00178 const std::string& brief, 00179 const std::string& detailed)> add_external_proc_t; 00180 00181 add_cell_proc_t add_cell_proc_m; 00182 add_relation_proc_t add_relation_proc_m; 00183 add_interface_proc_t add_interface_proc_m; 00184 add_external_proc_t add_external_proc_m; 00185 }; 00186 00187 /*************************************************************************************************/ 00188 00189 void parse(std::istream& stream, const line_position_t& position, const adam_callback_suite_t& callbacks); 00190 00191 /*************************************************************************************************/ 00192 00193 array_t parse_adam_expression(const std::string& expression); 00194 00195 /*************************************************************************************************/ 00196 00197 } // namespace adobe 00198 00199 /*************************************************************************************************/ 00200 00201 #endif // ADOBE_ADAM_PARSER_HPP 00202 00203 /*************************************************************************************************/ |