• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop AutoTools Parser
 

KDevelop AutoTools Parser

  • buildtools
  • lib
  • parsers
  • autotools
autotoolsast.cpp
1/***************************************************************************
2 * Copyright (C) 2005 by Alexander Dymo *
3 * adymo@kdevelop.org *
4 * *
5 * Copyright (c) 2005 by Matt Rogers *
6 * mattr@kde.org *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Library General Public License as *
10 * published by the Free Software Foundation; either version 2 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Library General Public *
19 * License along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 ***************************************************************************/
23#include "autotoolsast.h"
24
25namespace AutoTools {
26
27//AST
28
29AST::~AST()
30{
31 for (TQValueList<AST*>::iterator it = m_children.begin(); it != m_children.end(); ++it)
32 {
33 AST *node = *it;
34 delete node;
35 }
36}
37
38void AST::addChildAST(AST *node)
39{
40 m_children.append(node);
41}
42
43void AST::writeBack(TQString &buffer)
44{
45 for (TQValueList<AST*>::const_iterator it = m_children.constBegin();
46 it != m_children.constEnd(); ++it)
47 {
48 if (*it)
49 (*it)->writeBack(buffer);
50 }
51}
52
53TQString AST::indentation()
54{
55 TQString result;
56 for (int i = 0; i < depth(); i++)
57 result += '\t';
58 return result;
59}
60
61bool AST::hasChildren() const
62{
63 return !m_children.isEmpty();
64}
65
66TQValueList<AST*> AST::children() const
67{
68 return m_children;
69}
70
71//ProjectAST
72
73void ProjectAST::writeBack(TQString &buffer)
74{
75 if ( isRule() )
76 buffer += scopedID;
77 else
78 buffer += indentation();
79
80 AST::writeBack(buffer);
81
82}
83
84void ProjectAST::addChildAST(AST *node)
85{
86 statements.append(node);
87 AST::addChildAST(node);
88}
89
90void AssignmentAST::writeBack(TQString &buffer)
91{
92 buffer += indentation() + scopedID + " " + op + values.join("");
93}
94
95void AutomakeTargetAST::writeBack( TQString& buffer )
96{
97 buffer += target + ":" + deps.join("");
98}
99
100void ConditionAST::writeBack( TQString& buffer )
101{
102 buffer += indentation() + type + " " + conditionName;
103}
104
105void NewLineAST::writeBack(TQString &buffer)
106{
107 buffer += "\n";
108}
109
110void CommentAST::writeBack(TQString &buffer)
111{
112 buffer += indentation() + comment;
113}
114
115}
AutoTools::AST::children
TQValueList< AST * > children() const
Get the children of this ast.
Definition autotoolsast.cpp:66
AutoTools::AST::AST
AST(NodeType nodeType)
Constructs AST with given node type.
Definition autotoolsast.h:60
AutoTools::AST::depth
int depth() const
Definition autotoolsast.h:83
AutoTools::AST::addChildAST
virtual void addChildAST(AST *node)
Adds child AST node to this node.
Definition autotoolsast.cpp:38
AutoTools::AST::hasChildren
bool hasChildren() const
Definition autotoolsast.cpp:61
AutoTools::AST::indentation
virtual TQString indentation()
Definition autotoolsast.cpp:53
AutoTools::AST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition autotoolsast.cpp:43
AutoTools::AssignmentAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition autotoolsast.cpp:90
AutoTools::AssignmentAST::values
TQStringList values
List of values.
Definition autotoolsast.h:204
AutoTools::AssignmentAST::scopedID
TQString scopedID
Scoped name of the variable.
Definition autotoolsast.h:198
AutoTools::AssignmentAST::op
TQString op
Operator.
Definition autotoolsast.h:201
AutoTools::CommentAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition autotoolsast.cpp:110
AutoTools::CommentAST::comment
TQString comment
Comment text.
Definition autotoolsast.h:261
AutoTools::NewLineAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition autotoolsast.cpp:105
AutoTools::ProjectAST::addChildAST
virtual void addChildAST(AST *node)
Adds child AST node to this node.
Definition autotoolsast.cpp:84
AutoTools::ProjectAST::scopedID
TQString scopedID
Scoped identifier (scope name or rule).
Definition autotoolsast.h:153
AutoTools::ProjectAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition autotoolsast.cpp:73
AutoTools::ProjectAST::statements
TQValueList< AutoTools::AST * > statements
List of statements.
Definition autotoolsast.h:162

KDevelop AutoTools Parser

Skip menu "KDevelop AutoTools Parser"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop AutoTools Parser

Skip menu "KDevelop AutoTools 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 AutoTools Parser by doxygen 1.15.0
This website is maintained by Timothy Pearson.