]> git.saurik.com Git - wxWidgets.git/blob - utils/HelpGen/src/cjparser.h
file dialogs now remembers the width of the
[wxWidgets.git] / utils / HelpGen / src / cjparser.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Implementation of C++/Java parser
4 // compatible with SourceParserBase interface
5 // Author: Aleksandras Gluchovas
6 // Modified by:
7 // Created: 22/09/98
8 // RCS-ID: $Id$
9 // Copyright: (c) Aleskandars Gluchovas
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __CJPARSESR_G__
14 #define __CJPARSESR_G__
15
16 #include "srcparser.h"
17
18 #include <iostream.h>
19 #include <memory.h>
20 #include <stdlib.h>
21 #include <stdio.h>
22
23 // class parses given "memory-resident" Java or C++ source code
24 // and captures information about classes/attrubutes/methods/
25 // arguments/etc into structures. Conforms with SourceParserBase
26 // interface requirements.
27
28 class CJSourceParser : public SourceParserBase
29 {
30 protected:
31 // begining of the full-text area of the source file
32 char* mpStart;
33
34 // points to first character after the end
35 // of teh full-text area
36 char* mpEnd;
37
38 // current "privacy level"
39 int mCurVis;
40
41 // current parsing position int full-text area
42 char* cur;
43
44 // about the current class
45 bool mIsVirtual;
46 bool mIsTemplate;
47 size_t mNestingLevel;
48
49 // context data for which is currently being collected
50 spContext* mpCurCtx;
51
52 int mCurCtxType; // type of the current context
53
54 bool mCommentsOn;
55 bool mMacrosOn;
56
57 protected:
58
59 void AttachComments( spContext& ctx, char* cur );
60 void ParseKeyword( char*& cur );
61 bool ParseNameAndRetVal( char*& cur, bool& isAMacro );
62 bool ParseArguments( char*& cur );
63 void ParseMemberVar( char*& cur );
64 void SkipFunction( char*& cur );
65 void SkipFunctionBody( char*& cur );
66 bool CheckVisibilty( char*& cur );
67
68 void AddClassNode( char*& cur );
69 void AddMacroNode( char*& cur );
70 void AddEnumNode( char*& cur );
71 void AddTypeDefNode( char*& cur );
72
73 void DumpOperationInfo( spOperation& info, const string& tab, ostream& os );
74 void DumpClassHeader( spClass& info, ostream& os );
75 void DumpClassBody( spClass& info, ostream& os );
76
77 public:
78
79 // NOTE:: discarding of macros or comments improves performance and
80 // decreases memory usage
81
82 CJSourceParser(bool collectCommnets = 1,
83 bool collectMacros = 1);
84
85 // returns the root-node of the created context tree
86 // (user is responsible for releasing it from the heep)
87 // "end" should point to the last (character + 1) of the
88 // source text
89
90 virtual spFile* Parse( char* start, char* end );
91 };
92
93 // inline'ed helpers used (just info):
94 /*
95 static inline void skip_to_eol( char*& cur );
96 static inline void skip_eol( char*& cur );
97 static inline bool skip_to_next_comment_in_the_line( char*& cur );
98 static void skip_to_prev_line( char*& cur );
99 static inline void skip_comments( char*& cur );
100 static inline void clear_commets_queue();
101 static inline void skip_quoted_string( char*& cur );
102 static inline bool get_next_token( char*& cur );
103 static inline void skip_preprocessor_dir( char*& cur );
104 static void skip_token( char*& cur );
105 static inline size_t get_token_len( char* tok );
106 static inline bool cmp_tokens( char* tok1, char* tok2 );
107 static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len );
108 static inline void skip_tempalate_statement( char*& cur );
109 static inline void skip_statement( char*& cur );
110 static inline void skip_token_back( char*& cur );
111 static inline void skip_next_token_back( char*& cur );
112 static string get_token_str( char* cur );
113 static size_t skip_block( char*& cur );
114 static inline bool skip_imp_block( char*& cur );
115 static bool is_class_token( char*& cur );
116 inline static bool is_forward_decl( char* cur );
117 inline static bool is_function( char* cur, bool& isAMacro );
118 static inline void skip_scope_block( char*& cur );
119 static void arrange_indirection_tokens_between( string& type, string& identifier );
120 static bool is_keyword( char* cur );
121 static inline void get_string_between( char* start, char* end, string* pStr );
122 static char* set_comment_text( string& text, char* start );
123 */
124
125 #endif