~ubuntu-branches/ubuntu/utopic/kdevelop-php/utopic

« back to all changes in this revision

Viewing changes to duchain/expressionparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2010-01-17 17:10:22 UTC
  • Revision ID: james.westby@ubuntu.com-20100117171022-q2xlgd9ekewo2ijx
Tags: upstream-1.0.0~beta2
ImportĀ upstreamĀ versionĀ 1.0.0~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   This file is part of KDevelop                                         *
 
3
 *   Copyright 2007 David Nolden <david.nolden.kdevelop@art-master.de>     *
 
4
 *   Copyright 2008 Niko Sams <niko.sams@gmail.com>                        *
 
5
 *                                                                         *
 
6
 *   This program is free software; you can redistribute it and/or modify  *
 
7
 *   it under the terms of the GNU Library General Public License as       *
 
8
 *   published by the Free Software Foundation; either version 2 of the    *
 
9
 *   License, or (at your option) any later version.                       *
 
10
 *                                                                         *
 
11
 *   This program is distributed in the hope that it will be useful,       *
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
14
 *   GNU General Public License for more details.                          *
 
15
 *                                                                         *
 
16
 *   You should have received a copy of the GNU Library General Public     *
 
17
 *   License along with this program; if not, write to the                 *
 
18
 *   Free Software Foundation, Inc.,                                       *
 
19
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 
20
 ***************************************************************************/
 
21
#ifndef EXPRESSIONPARSER_H
 
22
#define EXPRESSIONPARSER_H
 
23
 
 
24
#include <language/duchain/duchainpointer.h>
 
25
 
 
26
#include "phpduchainexport.h"
 
27
#include "expressionevaluationresult.h"
 
28
 
 
29
namespace Php
 
30
{
 
31
class AstNode;
 
32
class EditorIntegrator;
 
33
 
 
34
class KDEVPHPDUCHAIN_EXPORT ExpressionParser
 
35
{
 
36
public:
 
37
    /**
 
38
     * @param debug Enables additional output
 
39
     */
 
40
    explicit ExpressionParser(bool debug = false);
 
41
 
 
42
    /**
 
43
     * By default, no problems are created at the top-ducontext.
 
44
     */
 
45
    void setCreateProblems(bool v);
 
46
 
 
47
    /**
 
48
     * Evaluate the @p expression and find it's type and last-used declaration.
 
49
     *
 
50
     * @param offset Set this to the front-edge of the expression.
 
51
     *               Used in the ExpressionVisitor to find visible declarations.
 
52
     *
 
53
     * @see ExpressionVisitor
 
54
     */
 
55
    ExpressionEvaluationResult evaluateType(const QByteArray& expression, KDevelop::DUContextPointer context,
 
56
                                            const KDevelop::SimpleCursor &offset);
 
57
    /**
 
58
     * Sets up an ExpressionVisitor and returns it's result when visiting @p ast .
 
59
     *
 
60
     * @see ExpressionVisitor
 
61
     */
 
62
    ExpressionEvaluationResult evaluateType(AstNode* ast, EditorIntegrator* editor);
 
63
 
 
64
private:
 
65
    /**
 
66
     * This is private instead of reusing the method above with a default argument
 
67
     * for the offset, because we _never_ want to use this directly.
 
68
     */
 
69
    ExpressionEvaluationResult evaluateType(AstNode* ast, EditorIntegrator* editor,
 
70
                                            const KDevelop::SimpleCursor &offset);
 
71
    bool m_debug;
 
72
    bool m_createProblems;
 
73
};
 
74
 
 
75
 
 
76
}
 
77
#endif