1 /****************************************************************************
3 ** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
6 ** This file is part of the Qt Script Generator project on Trolltech Labs.
8 ** This file may be used under the terms of the GNU General Public
9 ** License version 2.0 as published by the Free Software Foundation
10 ** and appearing in the file LICENSE.GPL included in the packaging of
11 ** this file. Please review the following information to ensure GNU
12 ** General Public Licensing requirements will be met:
13 ** http://www.trolltech.com/products/qt/opensource.html
15 ** If you are unsure which license is appropriate for your use, please
16 ** review the following information:
17 ** http://www.trolltech.com/products/qt/licensing.html or contact the
18 ** sales department at sales@trolltech.com.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ****************************************************************************/
30 #include "smallobject.h"
32 #include <QtCore/QHash>
43 inline void bind(const NameSymbol
*name
, Type
*type
)
44 { symbol_table
.insert(name
, type
); }
46 inline Type
*resolve(const NameSymbol
*name
) const
48 if (Type
*type
= symbol_table
.value(name
))
51 return parent
->resolve(name
);
56 typedef QHash
<const NameSymbol
*, Type
*> symbol_table_t
;
58 symbol_table_t symbol_table
;
71 inline int line () const { return _M_line
; }
72 inline void setLine (int line
) { _M_line
= line
; }
74 inline int column () const { return _M_column
; }
75 inline void setColumn (int column
) { _M_column
= column
; }
77 inline QString
fileName () const { return _M_fileName
; }
78 inline void setFileName (const QString
&fileName
) { _M_fileName
= fileName
; }
80 inline QString
message () const { return _M_message
; }
81 inline void setMessage (const QString
&message
) { _M_message
= message
; }
93 inline bool skipFunctionBody() const { return _M_skipFunctionBody
; }
94 inline void setSkipFunctionBody(bool skip
) { _M_skipFunctionBody
= skip
; }
96 Lexer
*changeLexer(Lexer
*lexer
);
97 Parser
*changeParser(Parser
*parser
);
99 Lexer
*currentLexer() const { return _M_lexer
; }
100 Parser
*currentParser() const { return _M_parser
; }
102 Context
*current_context
;
104 inline Context
*currentContext() const
105 { return current_context
; }
110 Type
*lookupType(const NameSymbol
*name
) const;
111 void declare(const NameSymbol
*name
, Type
*type
);
113 inline const NameSymbol
*findOrInsertName(const char *data
, size_t count
)
114 { return name_table
.findOrInsert(data
, count
); }
116 void declareTypedef(const NameSymbol
*name
, Declarator
*d
);
117 bool isTypedef(const NameSymbol
*name
) const;
119 void reportError (const ErrorMessage
&errmsg
);
120 QList
<ErrorMessage
> errorMessages () const;
121 void clearErrorMessages ();
124 NameTable name_table
;
125 QHash
<const NameSymbol
*, Declarator
*> stl_typedef_table
;
126 bool _M_skipFunctionBody
;
130 QList
<ErrorMessage
> _M_error_messages
;
135 // kate: space-indent on; indent-width 2; replace-tabs on;