stlab.adobe.com Adobe Systems Incorporated

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 
00022 /*************************************************************************************************/
00023 
00024 namespace adobe {
00025 
00026 /*************************************************************************************************/
00027 
00028 struct adam_callback_suite_t
00029 {
00030     enum cell_type_t
00031     {
00032         input_k,            // array_t is an initializer
00033         output_k,           // array_t is an expression
00034         constant_k,         // array_t is an initializer
00035         logic_k,            // array_t is an expression
00036         invariant_k         // array_t is an expression
00037     };
00038 
00039     struct relation_t
00040     {
00041         name_t          name_m;
00042         line_position_t position_m;
00043         array_t         expression_m;
00044         std::string     detailed_m;
00045         std::string     brief_m;
00046 
00047         relation_t& operator=(const relation_t& x) 
00048         { /*REVISIT MOVE*/ 
00049             name_m = x.name_m; 
00050             position_m = x.position_m; 
00051             expression_m = x.expression_m; 
00052             detailed_m = x.detailed_m;
00053             brief_m = x.brief_m;
00054             return *this;
00055         }
00056     };
00057 
00058     typedef boost::function<void (  cell_type_t             type,
00059                                     name_t                  cell_name,
00060                                     const line_position_t&  position,
00061                                     const array_t&          expr_or_init,
00062                                     const std::string&      brief,
00063                                     const std::string&      detailed)>      add_cell_proc_t;
00064 
00065     typedef boost::function<void (  const line_position_t&  position,
00066                                     const array_t&          conditional,
00067                                     const relation_t*       first,
00068                                     const relation_t*       last,
00069                                     const std::string&      brief,
00070                                     const std::string&      detailed)>      add_relation_proc_t; // REVISIT (sparent) where's brief?
00071     
00072     typedef boost::function<void (  name_t                  cell_name,
00073                                     bool                    linked,
00074                                     const line_position_t&  position1,
00075                                     const array_t&          initializer,
00076                                     const line_position_t&  position2,
00077                                     const array_t&          expression,
00078                                     const std::string&      brief,
00079                                     const std::string&      detailed)>      add_interface_proc_t;
00080 
00081     add_cell_proc_t         add_cell_proc_m;
00082     add_relation_proc_t     add_relation_proc_m;
00083     add_interface_proc_t    add_interface_proc_m;
00084 };
00085 
00086 /*************************************************************************************************/
00087 
00088 void parse(std::istream& stream, const line_position_t& position, const adam_callback_suite_t& callbacks);
00089 
00090 /*************************************************************************************************/
00091 
00092 array_t parse_adam_expression(const std::string& expression);
00093 
00094 /*************************************************************************************************/
00095 
00096 } // namespace adobe
00097 
00098 /*************************************************************************************************/
00099 
00100 #endif // ADOBE_ADAM_PARSER_HPP
00101 
00102 /*************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google