00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef lestes__lang__cplus__lex___macro_hh___included
00029 #define lestes__lang__cplus__lex___macro_hh___included
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include <lestes/common.hh>
00039
00040 package(lestes);
00041
00042 package(std);
00043
00044 class source_location;
00045 end_package(std);
00046
00047 package(lang);
00048 package(cplus);
00049 package(lex);
00050
00051
00052 class pp_token;
00053 class token_value;
00054 class token_input;
00055 class token_sequence;
00056 class macro_item;
00057 class macro_head;
00058 class macro_storage;
00059 class macro_body;
00060
00061
00062
00063
00064
00065
00066 class macro: public ::lestes::std::object {
00067 public:
00068
00069 ptr<source_location> location_get(void) const;
00070
00071 ptr<token_value> name_get(void) const;
00072
00073 bool funlike_get(void) const;
00074
00075 bool predefined_get(void) const;
00076
00077 ptr<token_sequence> expand(
00078
00079 const ptr<pp_token> &name,
00080 const ptr<token_input> &input,
00081 const ptr<macro_storage> ¯os);
00082
00083 bool parse(const ptr<token_input> &ts);
00084
00085 bool equals(const ptr<macro> &other) const;
00086
00087 static ptr<macro> create(void);
00088
00089 static ptr<macro> create_predefined(void);
00090 protected:
00091
00092 macro(void);
00093
00094 virtual void gc_mark(void);
00095 private:
00096
00097 typedef enum { BEGIN, PARSED, DEAD } state_type;
00098
00099 bool parse_name(const ptr<token_input> &input);
00100
00101 bool parse_head(const ptr<token_input> &input);
00102
00103 bool parse_body(const ptr<token_input> &input);
00104
00105 state_type state;
00106
00107 srp<source_location> location;
00108
00109 srp<token_value> name;
00110
00111 bool funlike;
00112
00113 bool predefined;
00114
00115 srp<macro_head> head;
00116
00117 srp<macro_body> body;
00118 };
00119
00120 end_package(lex);
00121 end_package(cplus);
00122 end_package(lang);
00123 end_package(lestes);
00124 #endif
00125