• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop QMake parser
 

KDevelop QMake parser

  • buildtools
  • lib
  • parsers
  • qmake
qmakeast.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Alexander Dymo *
3  * adymo@kdevelop.org *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU Library General Public License as *
7  * published by the Free Software Foundation; either version 2 of the *
8  * License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU Library General Public *
16  * License along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef TQMAKETQMAKEAST_H
21 #define TQMAKETQMAKEAST_H
22 
23 #include <tqstringlist.h>
24 
30 namespace TQMake {
31 
42 class AST {
43 public:
45  enum NodeType {
46  ProjectAST ,
47  AssignmentAST ,
48  NewLineAST ,
49  CommentAST ,
50  IncludeAST ,
51  OrOperatorAST /* | */
52  };
53 
55  AST(NodeType nodeType): m_nodeType(nodeType), m_depth(0) {}
56  virtual ~AST();
57 
61  virtual void addChildAST(AST *node);
65  virtual void removeChildAST(AST *node);
69  virtual void writeBack(TQString &buffer);
70 
72  virtual NodeType nodeType() const { return m_nodeType; }
73 
75  void setDepth(int depth) { m_depth = depth; }
77  int depth() const { return m_depth; }
79  virtual TQString indentation();
80 
82  TQValueList<AST*> m_children;
83 
84 protected:
85  NodeType m_nodeType;
86 
87 private:
88  int m_depth;
89 
90 };
91 
92 
106 class ProjectAST: public AST {
107 public:
109  enum Kind {
110  Project ,
111  Scope ,
112  FunctionScope ,
113  Empty
114  };
115 
116  enum LineEnding {
117  Unix,
118  MacOS,
119  Windows
120  };
121 
123  ProjectAST(Kind kind = Project): AST(AST::ProjectAST), m_kind(kind) {}
124 
125  virtual void writeBack(TQString &buffer);
126 
128  bool isProject() const { return m_kind == Project; }
130  bool isScope() const { return m_kind == Scope; }
132  bool isFunctionScope() const { return m_kind == FunctionScope; }
134  bool isEmpty() const { return m_kind == Empty; }
135 
136  void setFileName(const TQString& fileName) { m_fileName = fileName; }
137  TQString fileName() const { return m_fileName; }
138 
139  void setLineEnding( LineEnding );
140  LineEnding lineEnding();
141 
143  TQString scopedID;
145  TQString args;
146 
147 private:
148  Kind m_kind;
149  TQString m_fileName;
150  LineEnding m_lineEnding;
151 };
152 
153 
174 class AssignmentAST: public AST {
175 public:
176  AssignmentAST(): AST(AST::AssignmentAST){}
177  ~AssignmentAST();
178 
179  virtual void writeBack(TQString &buffer);
180 
182  TQString scopedID;
184  TQString op;
186  TQStringList values;
188  TQString indent;
189 };
190 
191 
196 class NewLineAST: public AST {
197 public:
198  NewLineAST(): AST(AST::NewLineAST) {}
199 
200  virtual void writeBack(TQString &buffer);
201 
202 };
203 
204 
209 class CommentAST: public AST {
210 public:
211  CommentAST(): AST(AST::CommentAST) {}
212 
213  virtual void writeBack(TQString &buffer);
214 
216  TQString comment;
217 
218 };
219 
220 
225 class IncludeAST: public AST {
226 public:
227  IncludeAST(): AST(AST::IncludeAST) {}
228 
229  virtual void writeBack(TQString &buffer);
230 
231  TQString projectName;
232 };
233 
234 }
235 
236 #endif
TQMake::AST::setDepth
void setDepth(int depth)
Sets the depth of the node in AST.
Definition: qmakeast.h:75
TQMake::IncludeAST
Include AST node.
Definition: qmakeast.h:225
TQMake::AssignmentAST::values
TQStringList values
List of values.
Definition: qmakeast.h:186
TQMake::AST::indentation
virtual TQString indentation()
Definition: qmakeast.cpp:60
TQMake::NewLineAST
New line AST node.
Definition: qmakeast.h:196
TQMake::ProjectAST
Project AST node.
Definition: qmakeast.h:106
TQMake::AST::removeChildAST
virtual void removeChildAST(AST *node)
Removes child AST node from this node.
Definition: qmakeast.cpp:43
TQMake::AST::IncludeAST
.pri include.
Definition: qmakeast.h:50
TQMake::AST::AssignmentAST
Variable assignment.
Definition: qmakeast.h:47
TQMake
Definition: location.hh:47
TQMake::CommentAST::comment
TQString comment
Comment text.
Definition: qmakeast.h:216
TQMake::AST::m_children
TQValueList< AST * > m_children
The list of child AST nodes.
Definition: qmakeast.h:82
TQMake::AST::addChildAST
virtual void addChildAST(AST *node)
Adds child AST node to this node.
Definition: qmakeast.cpp:38
TQMake::AST::NewLineAST
Line feed.
Definition: qmakeast.h:48
TQMake::AST::AST
AST(NodeType nodeType)
Constructs AST with given node type.
Definition: qmakeast.h:55
TQMake::ProjectAST::isProject
bool isProject() const
Definition: qmakeast.h:128
TQMake::AST::depth
int depth() const
Definition: qmakeast.h:77
TQMake::ProjectAST::scopedID
TQString scopedID
Scoped identifier (scope name or function name).
Definition: qmakeast.h:143
TQMake::ProjectAST::isScope
bool isScope() const
Definition: qmakeast.h:130
TQMake::AssignmentAST::scopedID
TQString scopedID
Scoped name of the variable.
Definition: qmakeast.h:182
TQMake::AssignmentAST::op
TQString op
Operator.
Definition: qmakeast.h:184
TQMake::CommentAST
Comment AST node.
Definition: qmakeast.h:209
TQMake::AST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: qmakeast.cpp:48
TQMake::ProjectAST::args
TQString args
Function arguments.
Definition: qmakeast.h:145
TQMake::AST
AST node.
Definition: qmakeast.h:42
TQMake::AssignmentAST
Assignment AST node.
Definition: qmakeast.h:174
TQMake::ProjectAST::isEmpty
bool isEmpty() const
Definition: qmakeast.h:134
TQMake::AST::nodeType
virtual NodeType nodeType() const
Definition: qmakeast.h:72
TQMake::AST::CommentAST
Comment.
Definition: qmakeast.h:49
TQMake::ProjectAST::Kind
Kind
The kind of a project node.
Definition: qmakeast.h:109
TQMake::ProjectAST::isFunctionScope
bool isFunctionScope() const
Definition: qmakeast.h:132
TQMake::ProjectAST::ProjectAST
ProjectAST(Kind kind=Project)
Constructs a project node of given kind.
Definition: qmakeast.h:123
TQMake::AST::NodeType
NodeType
Type of AST node.
Definition: qmakeast.h:45
TQMake::AssignmentAST::indent
TQString indent
Indentation of multiline values.
Definition: qmakeast.h:188

KDevelop QMake parser

Skip menu "KDevelop QMake parser"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop QMake parser

Skip menu "KDevelop QMake parser"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop QMake parser by doxygen 1.8.13
This website is maintained by Timothy Pearson.