]> git.saurik.com Git - wxWidgets.git/blame - utils/HelpGen/src/cjparser.h
new swig generated code
[wxWidgets.git] / utils / HelpGen / src / cjparser.h
CommitLineData
cecfc5e7
VZ
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
d12e3536 10// Licence: wxWindows licence
cecfc5e7
VZ
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/
d12e3536 25// arguments/etc into structures. Conforms with SourceParserBase
cecfc5e7
VZ
26// interface requirements.
27
28class CJSourceParser : public SourceParserBase
29{
30protected:
d12e3536
VZ
31 // begining of the full-text area of the source file
32 char* mpStart;
cecfc5e7 33
d12e3536
VZ
34 // points to first character after the end
35 // of teh full-text area
36 char* mpEnd;
cecfc5e7 37
d12e3536
VZ
38 // current "privacy level"
39 int mCurVis;
cecfc5e7 40
d12e3536
VZ
41 // current parsing position int full-text area
42 char* cur;
cecfc5e7 43
d12e3536
VZ
44 // about the current class
45 bool mIsVirtual;
46 bool mIsTemplate;
47 size_t mNestingLevel;
cecfc5e7 48
d12e3536
VZ
49 // context data for which is currently being collected
50 spContext* mpCurCtx;
cecfc5e7 51
d12e3536 52 int mCurCtxType; // type of the current context
cecfc5e7 53
d12e3536
VZ
54 bool mCommentsOn;
55 bool mMacrosOn;
cecfc5e7
VZ
56
57protected:
58
d12e3536
VZ
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 );
cecfc5e7 67
d12e3536
VZ
68 void AddClassNode( char*& cur );
69 void AddMacroNode( char*& cur );
70 void AddEnumNode( char*& cur );
71 void AddTypeDefNode( char*& cur );
cecfc5e7 72
d12e3536
VZ
73 void DumpOperationInfo( spOperation& info, const string& tab, ostream& os );
74 void DumpClassHeader( spClass& info, ostream& os );
75 void DumpClassBody( spClass& info, ostream& os );
cecfc5e7
VZ
76
77public:
78
d12e3536
VZ
79 // NOTE:: discarding of macros or comments improves performance and
80 // decreases memory usage
cecfc5e7 81
d12e3536
VZ
82 CJSourceParser(bool collectCommnets = 1,
83 bool collectMacros = 1);
cecfc5e7 84
d12e3536
VZ
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
cecfc5e7 89
d12e3536 90 virtual spFile* Parse( char* start, char* end );
cecfc5e7
VZ
91};
92
93// inline'ed helpers used (just info):
94/*
95static inline void skip_to_eol( char*& cur );
96static inline void skip_eol( char*& cur );
97static inline bool skip_to_next_comment_in_the_line( char*& cur );
98static void skip_to_prev_line( char*& cur );
99static inline void skip_comments( char*& cur );
100static inline void clear_commets_queue();
101static inline void skip_quoted_string( char*& cur );
102static inline bool get_next_token( char*& cur );
103static inline void skip_preprocessor_dir( char*& cur );
104static void skip_token( char*& cur );
105static inline size_t get_token_len( char* tok );
106static inline bool cmp_tokens( char* tok1, char* tok2 );
107static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len );
108static inline void skip_tempalate_statement( char*& cur );
109static inline void skip_statement( char*& cur );
110static inline void skip_token_back( char*& cur );
111static inline void skip_next_token_back( char*& cur );
112static string get_token_str( char* cur );
113static size_t skip_block( char*& cur );
114static inline bool skip_imp_block( char*& cur );
115static bool is_class_token( char*& cur );
116inline static bool is_forward_decl( char* cur );
117inline static bool is_function( char* cur, bool& isAMacro );
118static inline void skip_scope_block( char*& cur );
119static void arrange_indirection_tokens_between( string& type, string& identifier );
120static bool is_keyword( char* cur );
121static inline void get_string_between( char* start, char* end, string* pStr );
122static char* set_comment_text( string& text, char* start );
123*/
124
125#endif