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> *
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. *
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. *
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
24
#include <language/duchain/duchainpointer.h>
26
#include "phpduchainexport.h"
27
#include "expressionevaluationresult.h"
32
class EditorIntegrator;
34
class KDEVPHPDUCHAIN_EXPORT ExpressionParser
38
* @param debug Enables additional output
40
explicit ExpressionParser(bool debug = false);
43
* By default, no problems are created at the top-ducontext.
45
void setCreateProblems(bool v);
48
* Evaluate the @p expression and find it's type and last-used declaration.
50
* @param offset Set this to the front-edge of the expression.
51
* Used in the ExpressionVisitor to find visible declarations.
53
* @see ExpressionVisitor
55
ExpressionEvaluationResult evaluateType(const QByteArray& expression, KDevelop::DUContextPointer context,
56
const KDevelop::SimpleCursor &offset);
58
* Sets up an ExpressionVisitor and returns it's result when visiting @p ast .
60
* @see ExpressionVisitor
62
ExpressionEvaluationResult evaluateType(AstNode* ast, EditorIntegrator* editor);
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.
69
ExpressionEvaluationResult evaluateType(AstNode* ast, EditorIntegrator* editor,
70
const KDevelop::SimpleCursor &offset);
72
bool m_createProblems;