summaryrefslogtreecommitdiffstats
path: root/buildtools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/lib')
-rw-r--r--buildtools/lib/Makefile.am8
-rw-r--r--buildtools/lib/base/Mainpage.dox19
-rw-r--r--buildtools/lib/base/Makefile.am15
-rw-r--r--buildtools/lib/base/kdevbuildtool.cpp38
-rw-r--r--buildtools/lib/base/kdevbuildtool.h41
-rw-r--r--buildtools/lib/parsers/Makefile.am8
-rw-r--r--buildtools/lib/parsers/autotools/Mainpage.dox11
-rw-r--r--buildtools/lib/parsers/autotools/Makefile.am24
-rw-r--r--buildtools/lib/parsers/autotools/autotools.ll136
-rw-r--r--buildtools/lib/parsers/autotools/autotools.yy323
-rw-r--r--buildtools/lib/parsers/autotools/autotools_lex.cpp1894
-rw-r--r--buildtools/lib/parsers/autotools/autotools_yacc.cpp1631
-rw-r--r--buildtools/lib/parsers/autotools/autotools_yacc.h100
-rw-r--r--buildtools/lib/parsers/autotools/autotoolsast.cpp117
-rw-r--r--buildtools/lib/parsers/autotools/autotoolsast.h269
-rw-r--r--buildtools/lib/parsers/autotools/autotoolsdriver.cpp70
-rw-r--r--buildtools/lib/parsers/autotools/autotoolsdriver.h76
-rw-r--r--buildtools/lib/parsers/autotools/tests/Makefile.am21
-rw-r--r--buildtools/lib/parsers/autotools/tests/runner.cpp33
-rw-r--r--buildtools/lib/parsers/autotools/tests/viewer.cpp162
-rw-r--r--buildtools/lib/parsers/autotools/tests/viewer.h46
-rw-r--r--buildtools/lib/parsers/autotools/tests/viewer_main.cpp34
-rw-r--r--buildtools/lib/parsers/autotools/tests/viewerbase.ui220
-rw-r--r--buildtools/lib/parsers/qmake/FlexLexer.h205
-rw-r--r--buildtools/lib/parsers/qmake/Mainpage.dox16
-rw-r--r--buildtools/lib/parsers/qmake/Makefile.am31
-rw-r--r--buildtools/lib/parsers/qmake/location.hh145
-rw-r--r--buildtools/lib/parsers/qmake/position.hh142
-rw-r--r--buildtools/lib/parsers/qmake/qmake.ll237
-rw-r--r--buildtools/lib/parsers/qmake/qmake.yy430
-rw-r--r--buildtools/lib/parsers/qmake/qmake_lex.cpp2239
-rw-r--r--buildtools/lib/parsers/qmake/qmake_lex.h49
-rw-r--r--buildtools/lib/parsers/qmake/qmake_yacc.cpp1243
-rw-r--r--buildtools/lib/parsers/qmake/qmake_yacc.hpp418
-rw-r--r--buildtools/lib/parsers/qmake/qmakeast.cpp170
-rw-r--r--buildtools/lib/parsers/qmake/qmakeast.h236
-rw-r--r--buildtools/lib/parsers/qmake/qmakeastvisitor.cpp68
-rw-r--r--buildtools/lib/parsers/qmake/qmakeastvisitor.h46
-rw-r--r--buildtools/lib/parsers/qmake/qmakedriver.cpp113
-rw-r--r--buildtools/lib/parsers/qmake/qmakedriver.h55
-rw-r--r--buildtools/lib/parsers/qmake/stack.hh129
-rw-r--r--buildtools/lib/parsers/qmake/tests/Makefile.am21
-rw-r--r--buildtools/lib/parsers/qmake/tests/runner.cpp169
-rw-r--r--buildtools/lib/parsers/qmake/tests/viewer.cpp182
-rw-r--r--buildtools/lib/parsers/qmake/tests/viewer.h48
-rw-r--r--buildtools/lib/parsers/qmake/tests/viewer_main.cpp33
-rw-r--r--buildtools/lib/parsers/qmake/tests/viewerbase.ui250
-rw-r--r--buildtools/lib/widgets/Mainpage.dox10
-rw-r--r--buildtools/lib/widgets/Makefile.am30
-rw-r--r--buildtools/lib/widgets/addenvvardlg.cpp84
-rw-r--r--buildtools/lib/widgets/addenvvardlg.h54
-rw-r--r--buildtools/lib/widgets/addfilesdialog.cpp78
-rw-r--r--buildtools/lib/widgets/addfilesdialog.h57
-rw-r--r--buildtools/lib/widgets/environmentdisplaydialog.cpp54
-rw-r--r--buildtools/lib/widgets/environmentdisplaydialog.h35
-rw-r--r--buildtools/lib/widgets/environmentdisplaydialogbase.ui111
-rw-r--r--buildtools/lib/widgets/environmentvariableswidget.cpp126
-rw-r--r--buildtools/lib/widgets/environmentvariableswidget.h59
-rw-r--r--buildtools/lib/widgets/environmentvariableswidgetbase.ui200
-rw-r--r--buildtools/lib/widgets/envvartools.cpp31
-rw-r--r--buildtools/lib/widgets/envvartools.h28
-rw-r--r--buildtools/lib/widgets/makeoptionswidget.cpp64
-rw-r--r--buildtools/lib/widgets/makeoptionswidget.h50
-rw-r--r--buildtools/lib/widgets/makeoptionswidgetbase.ui194
-rw-r--r--buildtools/lib/widgets/removesubprojectdialog.cpp52
-rw-r--r--buildtools/lib/widgets/removesubprojectdialog.h52
-rw-r--r--buildtools/lib/widgets/removesubprojectdlgbase.ui154
-rw-r--r--buildtools/lib/widgets/runoptionswidget.cpp138
-rw-r--r--buildtools/lib/widgets/runoptionswidget.h57
-rw-r--r--buildtools/lib/widgets/runoptionswidgetbase.ui257
-rw-r--r--buildtools/lib/widgets/subclassesdlg.cpp122
-rw-r--r--buildtools/lib/widgets/subclassesdlg.h58
-rw-r--r--buildtools/lib/widgets/subclassesdlgbase.ui224
73 files changed, 14350 insertions, 0 deletions
diff --git a/buildtools/lib/Makefile.am b/buildtools/lib/Makefile.am
new file mode 100644
index 00000000..c772e395
--- /dev/null
+++ b/buildtools/lib/Makefile.am
@@ -0,0 +1,8 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+SUBDIRS = parsers widgets base
+
+DOXYGEN_EMPTY = YES
+include ../../Doxyfile.am
diff --git a/buildtools/lib/base/Mainpage.dox b/buildtools/lib/base/Mainpage.dox
new file mode 100644
index 00000000..dbf199a5
--- /dev/null
+++ b/buildtools/lib/base/Mainpage.dox
@@ -0,0 +1,19 @@
+/**
+@mainpage The KDevelop Buildtool Base Library
+
+This library contains base classes for KDevelop builtool support plugins.
+
+<b>Link with</b>: -lkdevbuildbase
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/buildtools/base
+
+\section btbaseoverview Overview
+This library is created to provide KDevBuildTool compat class which can be used
+as drop-in replacement of KDevProject class for buildtool support plugins
+written for old KDevelop architecture (before version 3.2).
+
+Nevertheless, it can be useful for new buildtool plugins as well because it provides
+useful methods to get application and make frontend extensions.
+
+*/
+
diff --git a/buildtools/lib/base/Makefile.am b/buildtools/lib/base/Makefile.am
new file mode 100644
index 00000000..6c9f6df6
--- /dev/null
+++ b/buildtools/lib/base/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \
+ $(all_includes)
+METASOURCES = AUTO
+lib_LTLIBRARIES = libkdevbuildbase.la
+libkdevbuildbase_la_LDFLAGS = $(all_libraries)
+libkdevbuildbase_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la $(LIB_QT) $(LIB_KDEUI)
+libkdevbuildbase_la_SOURCES = kdevbuildtool.cpp
+kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/base
+kdevelopbuildtoolsinclude_HEADERS = kdevbuildtool.h
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevextensions
+DOXYGEN_PROJECTNAME = KDevelop Buildtool Base Library
+DOXYGEN_DOCDIRPREFIX = kdevbt
+include ../../../Doxyfile.am
diff --git a/buildtools/lib/base/kdevbuildtool.cpp b/buildtools/lib/base/kdevbuildtool.cpp
new file mode 100644
index 00000000..a8b7de3a
--- /dev/null
+++ b/buildtools/lib/base/kdevbuildtool.cpp
@@ -0,0 +1,38 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevbuildtool.h"
+
+#include <kdevmakefrontend.h>
+#include <kdevappfrontend.h>
+
+KDevBuildTool::KDevBuildTool(const KDevPluginInfo* info, QObject* parent, const char* name)
+ :KDevProject(info, parent, name)
+{
+}
+
+KDevMakeFrontend * KDevBuildTool::makeFrontend()
+{
+ return extension<KDevMakeFrontend>("KDevelop/MakeFrontend");
+}
+
+KDevAppFrontend * KDevBuildTool::appFrontend()
+{
+ return extension<KDevAppFrontend>("KDevelop/AppFrontend");
+}
+
diff --git a/buildtools/lib/base/kdevbuildtool.h b/buildtools/lib/base/kdevbuildtool.h
new file mode 100644
index 00000000..95ed8d37
--- /dev/null
+++ b/buildtools/lib/base/kdevbuildtool.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999-2001 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVBUILDTOOL_H
+#define KDEVBUILDTOOL_H
+
+#include <kdevproject.h>
+
+class KDevMakeFrontend;
+class KDevAppFrontend;
+
+/**Base class for KDevelop build tool support plugins.*/
+class KDevBuildTool: public KDevProject
+{
+public:
+ KDevBuildTool(const KDevPluginInfo* info, QObject* parent, const char* name);
+
+ /**@return The make frontend.*/
+ KDevMakeFrontend *makeFrontend();
+ /**@return The application frontend.*/
+ KDevAppFrontend *appFrontend();
+
+};
+
+#endif
diff --git a/buildtools/lib/parsers/Makefile.am b/buildtools/lib/parsers/Makefile.am
new file mode 100644
index 00000000..a1c9f256
--- /dev/null
+++ b/buildtools/lib/parsers/Makefile.am
@@ -0,0 +1,8 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+SUBDIRS = qmake autotools
+
+DOXYGEN_EMPTY = YES
+include ../../../Doxyfile.am
diff --git a/buildtools/lib/parsers/autotools/Mainpage.dox b/buildtools/lib/parsers/autotools/Mainpage.dox
new file mode 100644
index 00000000..99d200d9
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/Mainpage.dox
@@ -0,0 +1,11 @@
+/**
+@mainpage The KDevelop Makefile.am Parser
+
+This library contains a parser that handles Makefile.am.
+
+<b>Link with</b>: -lkdevautotoolsparser
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/buildtools/parsers/autotools
+
+*/
+
diff --git a/buildtools/lib/parsers/autotools/Makefile.am b/buildtools/lib/parsers/autotools/Makefile.am
new file mode 100644
index 00000000..c0776c2f
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/Makefile.am
@@ -0,0 +1,24 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+SUBDIRS = . tests
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \
+ $(all_includes)
+METASOURCES = AUTO
+noinst_LTLIBRARIES = libkdevautotoolsparser.la
+libkdevautotoolsparser_la_LDFLAGS = $(all_libraries) $(LIB_KIO)
+libkdevautotoolsparser_la_SOURCES = autotoolsast.cpp autotoolsdriver.cpp autotools_yacc.cpp
+
+parser:
+ cd $(srcdir) ; \
+ bison -d autotools.yy -o autotools_yacc.cpp ; \
+ mv -f autotools_yacc.hpp autotools_yacc.h ; \
+ flex -oautotools_lex.cpp autotools.ll
+
+EXTRA_DIST = autotools.yy autotools.ll
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils
+DOXYGEN_PROJECTNAME = KDevelop AutoTools Parser
+DOXYGEN_DOCDIRPREFIX = kdevparser
+include ../../../../Doxyfile.am
diff --git a/buildtools/lib/parsers/autotools/autotools.ll b/buildtools/lib/parsers/autotools/autotools.ll
new file mode 100644
index 00000000..ae646edb
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotools.ll
@@ -0,0 +1,136 @@
+%{
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <autotools_yacc.h>
+#include <stdlib.h>
+
+/**
+@file autotools.ll
+Autotools Lexer
+
+There are 3 types of identifiers recognized by this lexer:
+-id_simple: examples of such identifiers are qmake variables and scoped variables
+at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp");
+-id_list: those are "value list identifiers" at the right side in assignments
+(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp");
+-id_args: function arguments recognized as one identifier
+(example: ""${QMAKE_FILE} is intended only for Windows!""
+in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements).
+.
+
+To recognize those identifiers two additional start conditions are used: list and funcargs.
+
+@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to
+the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped
+so no indentation is preserved by this lexer (and parser).
+
+To debug this lexer, put the line below into the next flex file section.
+%option debug
+*/
+%}
+%option noyywrap
+
+%x list
+%x funcargs
+%x conditional
+
+delim [ \t]
+ws {delim}+
+letter [A-Za-z]
+digit [0-9]
+id_simple ({digit}|{letter}|\!|-|_|\*|\$|@)({letter}|{digit}|\||\!|-|_|\*|\$|\(|\.|\+|\-|\)|\/)*
+id_list [^\n]*\\{ws}*
+id_args [^\n]*\)
+number {digit}+
+comment #.*
+comment_cont {ws}*#.*\n
+id_list_single [^\n]*
+cont \\{ws}*\n
+keywords (if|else|endif|include)
+rule [\t]+[^\n]*
+
+%%
+
+<list,INITIAL>{ws} {}
+<list,INITIAL>{cont} { BEGIN(list); return CONT; }
+{keywords} {
+ yylval.value = yytext;
+ if ( yylval.value == "if" )
+ return IF_KEYWORD;
+
+ if ( yylval.value == "else" )
+ return ELSE_KEYWORD;
+
+ if ( yylval.value == "endif" )
+ return ENDIF_KEYWORD;
+
+ return KEYWORD;
+}
+
+
+{id_simple} { yylval.value = yytext; return (ID_SIMPLE); }
+
+<INITIAL>{rule} {
+ yylval.value = yytext;
+ return RULE;
+}
+
+<list>{id_list} {
+ yylval.value = yytext;
+ yylval.value = yylval.value.mid(0, yylval.value.findRev("\\"));
+ unput('\\');
+ BEGIN(INITIAL);
+ return (ID_LIST);
+ }
+
+<list>{comment_cont} {
+ yylval.value = yytext;
+ BEGIN(list);
+ return (LIST_COMMENT);
+ }
+
+<list>{id_list_single} {
+ yylval.value = yytext;
+ BEGIN(INITIAL);
+ return (ID_LIST_SINGLE);
+ }
+
+<funcargs>{id_args} {
+ yylval.value = yytext;
+ yylval.value = yylval.value.mid(0, yylval.value.length()-1);
+ unput(')');
+ BEGIN(INITIAL);
+ return (ID_ARGS);
+ }
+
+"=" { BEGIN(list); yylval.value = yytext; return EQ; }
+"+=" { BEGIN(list); yylval.value = yytext; return PLUSEQ; }
+"{" { return LCURLY; }
+"}" { return RCURLY; }
+":" { BEGIN(list); yylval.value = yytext; return COLON; }
+<list,INITIAL>"\n" { BEGIN(INITIAL); return NEWLINE; }
+{comment} { yylval.value = yytext; return (COMMENT); }
+
+%%
+
diff --git a/buildtools/lib/parsers/autotools/autotools.yy b/buildtools/lib/parsers/autotools/autotools.yy
new file mode 100644
index 00000000..e124ee85
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotools.yy
@@ -0,0 +1,323 @@
+%{
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/**
+@file qmake.yy
+Autotools Parser
+
+Simple LALR parser which builds the syntax tree (see @ref Autotools::AST).
+
+@todo Recognize comments after statements like:
+noinst_HEADERS = foo.h #regognize me
+
+@fixme Parser fails on files that do not end with a newline
+@fixme 1 shift/reduce conflict in "line_body" rule
+*/
+
+#include <qvaluestack.h>
+#include "autotoolsast.h"
+
+#define YYSTYPE_IS_DECLARED
+
+using namespace AutoTools;
+
+/**
+The yylval type.
+*/
+struct Result {
+ Result(): node(0) {}
+
+ /**Type of semantic value for simple grammar rules.*/
+ QString value;
+ /**Type of semantic value for grammar rules which are parts of AST.*/
+ AST *node;
+ /**Type of semantic value for "multiline_values" grammar rule.
+ Each line of multiline value is stored as a string in the list.
+
+ For example we have in Makefile.am file:
+ @code
+ foo_SOURCES = foo1.cpp \
+ foo2.cpp \
+ foo3.cpp foo4.cpp
+ @endcode
+ The string list will be populated with three strings:
+ <pre>
+ foo1.cpp
+ foo2.cpp
+ foo3.cpp foo4.cpp
+ </pre>
+ */
+ QStringList values;
+};
+
+typedef Result YYSTYPE;
+
+void yyerror(const char *str) {
+ printf("bison error: %s\n", str);
+}
+
+int yylex();
+
+/**
+The stack to store ProjectAST pointers when a new child
+ProjectAST is created and filled with statements.
+
+Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
+adding statements. Each statement is added as a child StatementAST to the ProjectAST
+currently on the top in the stack.
+
+When a scope or function scope statement is parsed, the child ProjectAST is created
+and pushed onto the stack. Therefore all statements which belong to the scope
+or function scope are added as childs to their direct parent (scope or function scope).
+*/
+QValueStack<ProjectAST*> projects;
+
+/**
+The current depth of AST node is stored here.
+AST depth is important to know because automatic indentation can
+be easily implemented (the parser itself looses all information
+about indentation).
+*/
+int depth = 0;
+
+/*
+To debug this parser, put the line below into the next bison file section.
+Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
+%debug
+*/
+%}
+
+%token ID_SIMPLE
+%token ID_LIST
+%token LBRACE
+%token EQ
+%token PLUSEQ
+%token MINUSQE
+%token STAREQ
+%token TILDEEQ
+%token LBRACE
+%token RBRACE
+%token COLON
+%token NUMSIGN
+%token NEWLINE
+%token NUMBER
+%token COMMENT
+%token CONT
+%token DOT
+%token RCURLY
+%token LCURLY
+%token ID_ARGS
+%token LIST_COMMENT
+%token ID_LIST_SINGLE
+%token IF_KEYWORD
+%token ELSE_KEYWORD
+%token ENDIF_KEYWORD
+%token KEYWORD
+%token RULE
+
+%%
+
+project :
+{
+ ProjectAST *projectAST = new ProjectAST();
+ projects.push(projectAST);
+}
+statements
+;
+
+statements : statements statement
+{
+ projects.top()->addChildAST($<node>2);
+
+ if ( $<node>2->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( $<node>2 )->scopedID == "if" )
+ {
+ $<node>2->setDepth(depth);
+ depth++;
+ }
+ else if ( $<node>2->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( $<node>2 )->scopedID == "else" )
+ {
+ --depth;
+ $<node>2->setDepth(depth);
+ ++depth;
+ }
+ else if ( $<node>2->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( $<node>2 )->scopedID == "endif" )
+ {
+ --depth;
+ $<node>2->setDepth(depth);
+ }
+ else
+ $<node>2->setDepth(depth);
+}
+|
+;
+
+statement : variable_assignment
+{
+ $<node>$ = $<node>1;
+}
+| automake_if
+{
+ $<node>$ = $<node>1;
+}
+| else_statement
+{
+ $<node>$ = $<node>1;
+}
+| endif_statement
+{
+ $<node>$ = $<node>1;
+}
+| target
+{
+ $<node>$ = $<node>1;
+}
+| am_rule
+{
+ $<node>$ = $<node>1;
+}
+| include_directive
+{
+ $<node>$ = $<node>1;
+}
+| comment
+{
+ $<node>$ = $<node>1;
+}
+| emptyline
+{
+ $<node>$ = new NewLineAST();
+}
+;
+
+automake_if: IF_KEYWORD scoped_identifier
+{
+ ConditionAST* projectAST = new ConditionAST();
+ projectAST->type = "if";
+ projectAST->conditionName = $<value>2;
+ $<node>$ = projectAST;
+};
+
+endif_statement: ENDIF_KEYWORD
+{
+ ConditionAST* past = new ConditionAST();
+ past->type= "endif";
+ $<node>$ = past;
+}
+| ENDIF_KEYWORD scoped_identifier
+{
+ ConditionAST* past = new ConditionAST();
+ past->type= "endif";
+ past->conditionName = $<value>2;
+ $<node>$ = past;
+}
+;
+
+else_statement: ELSE_KEYWORD
+{
+ ConditionAST* past = new ConditionAST();
+ past->type = "else";
+ $<node>$ = past;
+}
+| ELSE_KEYWORD scoped_identifier
+{
+ ConditionAST* past = new ConditionAST();
+ past->type = "else";
+ past->conditionName = $<value>2;
+ $<node>$ = past;
+}
+;
+
+variable_assignment : scoped_identifier operator multiline_values
+{
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3;
+ $<node>$ = node;
+}
+;
+
+scoped_identifier : ID_SIMPLE scoped_identifier
+{ $<value>$ = $<value>1 + $<value>2; }
+| ID_SIMPLE
+;
+
+multiline_values : multiline_values line_body
+{
+ $<values>$.append($<value>2);
+}
+| { $<values>$.clear(); }
+ ;
+
+line_body : ID_LIST CONT { $<value>$ = $<value>1 + " \\\n"; }
+ | ID_LIST_SINGLE NEWLINE { $<value>$ = $<value>1 + "\n"; }
+ | CONT { $<value>$ = "\\\n"; }
+ | LIST_COMMENT
+ ;
+
+target: scoped_identifier COLON multiline_values
+{
+ AutomakeTargetAST *node = new AutomakeTargetAST();
+ node->target = $<value>1;
+ node->deps = $<values>3;
+ $<node>$ = node;
+}
+;
+
+am_rule: RULE
+{
+ ProjectAST* node = new ProjectAST(ProjectAST::Rule);
+ node->scopedID = $<value>1;
+ $<node>$ = node;
+}
+;
+
+include_directive: KEYWORD scoped_identifier
+{
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->values = QStringList($<value>2);
+ $<node>$ = node;
+}
+;
+
+operator : EQ | PLUSEQ
+;
+
+comment : COMMENT NEWLINE
+{
+ CommentAST *node = new CommentAST();
+ node->comment = $<value>1 + "\n";
+ $<node>$ = node;
+}
+;
+
+emptyline : NEWLINE
+;
+%%
+
+#include "autotools_lex.cpp"
diff --git a/buildtools/lib/parsers/autotools/autotools_lex.cpp b/buildtools/lib/parsers/autotools/autotools_lex.cpp
new file mode 100644
index 00000000..ac307240
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotools_lex.cpp
@@ -0,0 +1,1894 @@
+#line 2 "autotools_lex.cpp"
+
+#line 4 "autotools_lex.cpp"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 31
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef unsigned int yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 17
+#define YY_END_OF_BUFFER 18
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[64] =
+ { 0,
+ 0, 0, 8, 8, 0, 0, 0, 0, 18, 17,
+ 1, 15, 1, 4, 16, 17, 14, 10, 17, 4,
+ 4, 12, 13, 8, 1, 8, 6, 17, 9, 5,
+ 1, 1, 1, 4, 4, 16, 11, 0, 2, 4,
+ 4, 3, 4, 8, 6, 1, 8, 8, 7, 6,
+ 6, 0, 9, 4, 4, 4, 6, 6, 4, 4,
+ 4, 4, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 4, 5, 1, 6, 7, 1, 1, 1, 8,
+ 9, 10, 11, 1, 12, 13, 14, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 16, 1, 1,
+ 17, 1, 1, 18, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 1, 20, 1, 1, 21, 1, 19, 19, 22, 23,
+
+ 24, 25, 19, 19, 26, 19, 19, 27, 19, 28,
+ 19, 19, 19, 19, 29, 19, 30, 19, 19, 19,
+ 19, 19, 31, 32, 33, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[34] =
+ { 0,
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[72] =
+ { 0,
+ 0, 0, 32, 51, 34, 36, 0, 0, 155, 156,
+ 38, 156, 42, 67, 0, 137, 156, 156, 45, 23,
+ 31, 156, 156, 133, 63, 38, 98, 134, 133, 0,
+ 58, 59, 62, 0, 0, 0, 156, 101, 156, 112,
+ 117, 0, 117, 118, 104, 105, 65, 67, 156, 110,
+ 113, 127, 126, 110, 106, 104, 117, 124, 104, 93,
+ 99, 96, 156, 144, 146, 148, 109, 97, 83, 150,
+ 72
+ } ;
+
+static yyconst flex_int16_t yy_def[72] =
+ { 0,
+ 63, 1, 64, 64, 65, 65, 66, 66, 63, 63,
+ 67, 63, 63, 63, 68, 63, 63, 63, 63, 14,
+ 14, 63, 63, 69, 69, 70, 69, 71, 71, 67,
+ 67, 67, 63, 14, 14, 68, 63, 63, 63, 14,
+ 14, 14, 14, 69, 69, 69, 70, 70, 63, 70,
+ 69, 71, 71, 14, 14, 14, 69, 70, 14, 14,
+ 14, 14, 0, 63, 63, 63, 63, 63, 63, 63,
+ 63
+ } ;
+
+static yyconst flex_int16_t yy_nxt[190] =
+ { 0,
+ 10, 11, 12, 13, 14, 15, 14, 10, 10, 14,
+ 16, 14, 10, 10, 14, 17, 18, 14, 14, 19,
+ 14, 14, 14, 20, 14, 21, 14, 14, 14, 14,
+ 22, 10, 23, 25, 12, 25, 10, 26, 10, 31,
+ 49, 32, 29, 33, 29, 33, 38, 39, 38, 40,
+ 41, 27, 25, 12, 25, 42, 26, 50, 43, 31,
+ 32, 32, 32, 33, 46, 33, 46, 49, 47, 49,
+ 27, 34, 52, 34, 34, 34, 34, 34, 35, 34,
+ 34, 34, 45, 44, 50, 34, 50, 34, 34, 34,
+ 34, 34, 34, 34, 34, 34, 34, 36, 34, 51,
+
+ 39, 51, 38, 39, 38, 57, 46, 57, 46, 30,
+ 47, 58, 49, 58, 51, 39, 51, 45, 57, 42,
+ 57, 62, 61, 45, 45, 58, 49, 58, 42, 50,
+ 60, 59, 45, 42, 53, 53, 45, 45, 56, 55,
+ 54, 53, 53, 50, 24, 24, 28, 28, 10, 10,
+ 48, 48, 45, 37, 63, 9, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63
+ } ;
+
+static yyconst flex_int16_t yy_chk[190] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 3, 3, 3, 5, 3, 6, 11,
+ 26, 11, 5, 13, 6, 13, 19, 19, 19, 20,
+ 20, 3, 4, 4, 4, 21, 4, 26, 21, 31,
+ 32, 31, 32, 33, 25, 33, 25, 47, 25, 48,
+ 4, 14, 71, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 25, 69, 47, 14, 48, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 68, 14, 27,
+
+ 27, 27, 38, 38, 38, 45, 46, 45, 46, 67,
+ 46, 50, 50, 50, 51, 51, 51, 27, 57, 62,
+ 57, 61, 60, 45, 46, 58, 58, 58, 59, 50,
+ 56, 55, 51, 54, 53, 52, 57, 44, 43, 41,
+ 40, 29, 28, 58, 64, 64, 65, 65, 66, 66,
+ 70, 70, 24, 16, 9, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "autotools.ll"
+#line 2 "autotools.ll"
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <autotools_yacc.h>
+#include <stdlib.h>
+
+/**
+@file autotools.ll
+Autotools Lexer
+
+There are 3 types of identifiers recognized by this lexer:
+-id_simple: examples of such identifiers are qmake variables and scoped variables
+at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp");
+-id_list: those are "value list identifiers" at the right side in assignments
+(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp");
+-id_args: function arguments recognized as one identifier
+(example: ""${QMAKE_FILE} is intended only for Windows!""
+in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements).
+.
+
+To recognize those identifiers two additional start conditions are used: list and funcargs.
+
+@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to
+the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped
+so no indentation is preserved by this lexer (and parser).
+
+To debug this lexer, put the line below into the next flex file section.
+%option debug
+*/
+
+
+
+#line 559 "autotools_lex.cpp"
+
+#define INITIAL 0
+#define list 1
+#define funcargs 2
+#define conditional 3
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+ static void yyunput (int c,char *buf_ptr );
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 73 "autotools.ll"
+
+
+#line 716 "autotools_lex.cpp"
+
+ if ( (yy_init) )
+ {
+ (yy_init) = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 64 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 156 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 75 "autotools.ll"
+{}
+ YY_BREAK
+case 2:
+/* rule 2 can match eol */
+YY_RULE_SETUP
+#line 76 "autotools.ll"
+{ BEGIN(list); return CONT; }
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 77 "autotools.ll"
+{
+ yylval.value = yytext;
+ if ( yylval.value == "if" )
+ return IF_KEYWORD;
+
+ if ( yylval.value == "else" )
+ return ELSE_KEYWORD;
+
+ if ( yylval.value == "endif" )
+ return ENDIF_KEYWORD;
+
+ return KEYWORD;
+}
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 92 "autotools.ll"
+{ yylval.value = yytext; return (ID_SIMPLE); }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 94 "autotools.ll"
+{
+ yylval.value = yytext;
+ return RULE;
+}
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 99 "autotools.ll"
+{
+ yylval.value = yytext;
+ yylval.value = yylval.value.mid(0, yylval.value.findRev("\\"));
+ unput('\\');
+ BEGIN(INITIAL);
+ return (ID_LIST);
+ }
+ YY_BREAK
+case 7:
+/* rule 7 can match eol */
+YY_RULE_SETUP
+#line 107 "autotools.ll"
+{
+ yylval.value = yytext;
+ BEGIN(list);
+ return (LIST_COMMENT);
+ }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 113 "autotools.ll"
+{
+ yylval.value = yytext;
+ BEGIN(INITIAL);
+ return (ID_LIST_SINGLE);
+ }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 119 "autotools.ll"
+{
+ yylval.value = yytext;
+ yylval.value = yylval.value.mid(0, yylval.value.length()-1);
+ unput(')');
+ BEGIN(INITIAL);
+ return (ID_ARGS);
+ }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 127 "autotools.ll"
+{ BEGIN(list); yylval.value = yytext; return EQ; }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 128 "autotools.ll"
+{ BEGIN(list); yylval.value = yytext; return PLUSEQ; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 129 "autotools.ll"
+{ return LCURLY; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 130 "autotools.ll"
+{ return RCURLY; }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 131 "autotools.ll"
+{ BEGIN(list); yylval.value = yytext; return COLON; }
+ YY_BREAK
+case 15:
+/* rule 15 can match eol */
+YY_RULE_SETUP
+#line 132 "autotools.ll"
+{ BEGIN(INITIAL); return NEWLINE; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 133 "autotools.ll"
+{ yylval.value = yytext; return (COMMENT); }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 135 "autotools.ll"
+ECHO;
+ YY_BREAK
+#line 922 "autotools_lex.cpp"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(list):
+case YY_STATE_EOF(funcargs):
+case YY_STATE_EOF(conditional):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = (yytext_ptr);
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 64 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ register int yy_is_jam;
+ register char *yy_cp = (yy_c_buf_p);
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 64 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 63);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+ static void yyunput (int c, register char * yy_bp )
+{
+ register char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = (yy_n_chars) + 2;
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ int offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ int num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param str a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str )
+{
+
+ return yy_scan_bytes(yy_str,strlen(yy_str) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+int yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str )
+{
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str )
+{
+ yyout = out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug )
+{
+ yy_flex_debug = bdebug ;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef yytext_ptr
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+#line 135 "autotools.ll"
+
+
+
+
diff --git a/buildtools/lib/parsers/autotools/autotools_yacc.cpp b/buildtools/lib/parsers/autotools/autotools_yacc.cpp
new file mode 100644
index 00000000..f4a3892c
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotools_yacc.cpp
@@ -0,0 +1,1631 @@
+/* A Bison parser, made by GNU Bison 1.875d. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* Written by Richard Stallman by simplifying the original so called
+ ``semantic'' parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ ID_SIMPLE = 258,
+ ID_LIST = 259,
+ LBRACE = 260,
+ EQ = 261,
+ PLUSEQ = 262,
+ MINUSQE = 263,
+ STAREQ = 264,
+ TILDEEQ = 265,
+ RBRACE = 266,
+ COLON = 267,
+ NUMSIGN = 268,
+ NEWLINE = 269,
+ NUMBER = 270,
+ COMMENT = 271,
+ CONT = 272,
+ DOT = 273,
+ RCURLY = 274,
+ LCURLY = 275,
+ ID_ARGS = 276,
+ LIST_COMMENT = 277,
+ ID_LIST_SINGLE = 278,
+ IF_KEYWORD = 279,
+ ELSE_KEYWORD = 280,
+ ENDIF_KEYWORD = 281,
+ KEYWORD = 282,
+ RULE = 283
+ };
+#endif
+#define ID_SIMPLE 258
+#define ID_LIST 259
+#define LBRACE 260
+#define EQ 261
+#define PLUSEQ 262
+#define MINUSQE 263
+#define STAREQ 264
+#define TILDEEQ 265
+#define RBRACE 266
+#define COLON 267
+#define NUMSIGN 268
+#define NEWLINE 269
+#define NUMBER 270
+#define COMMENT 271
+#define CONT 272
+#define DOT 273
+#define RCURLY 274
+#define LCURLY 275
+#define ID_ARGS 276
+#define LIST_COMMENT 277
+#define ID_LIST_SINGLE 278
+#define IF_KEYWORD 279
+#define ELSE_KEYWORD 280
+#define ENDIF_KEYWORD 281
+#define KEYWORD 282
+#define RULE 283
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 1 "autotools.yy"
+
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/**
+@file qmake.yy
+Autotools Parser
+
+Simple LALR parser which builds the syntax tree (see @ref Autotools::AST).
+
+@todo Recognize comments after statements like:
+noinst_HEADERS = foo.h #regognize me
+
+@fixme Parser fails on files that do not end with a newline
+@fixme 1 shift/reduce conflict in "line_body" rule
+*/
+
+#include <qvaluestack.h>
+#include "autotoolsast.h"
+
+#define YYSTYPE_IS_DECLARED
+
+using namespace AutoTools;
+
+/**
+The yylval type.
+*/
+struct Result {
+ Result(): node(0) {}
+
+ /**Type of semantic value for simple grammar rules.*/
+ QString value;
+ /**Type of semantic value for grammar rules which are parts of AST.*/
+ AST *node;
+ /**Type of semantic value for "multiline_values" grammar rule.
+ Each line of multiline value is stored as a string in the list.
+
+ For example we have in Makefile.am file:
+ @code
+ foo_SOURCES = foo1.cpp \
+ foo2.cpp \
+ foo3.cpp foo4.cpp
+ @endcode
+ The string list will be populated with three strings:
+ <pre>
+ foo1.cpp
+ foo2.cpp
+ foo3.cpp foo4.cpp
+ </pre>
+ */
+ QStringList values;
+};
+
+typedef Result YYSTYPE;
+
+void yyerror(const char *str) {
+ printf("bison error: %s\n", str);
+}
+
+int yylex();
+
+/**
+The stack to store ProjectAST pointers when a new child
+ProjectAST is created and filled with statements.
+
+Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
+adding statements. Each statement is added as a child StatementAST to the ProjectAST
+currently on the top in the stack.
+
+When a scope or function scope statement is parsed, the child ProjectAST is created
+and pushed onto the stack. Therefore all statements which belong to the scope
+or function scope are added as childs to their direct parent (scope or function scope).
+*/
+QValueStack<ProjectAST*> projects;
+
+/**
+The current depth of AST node is stored here.
+AST depth is important to know because automatic indentation can
+be easily implemented (the parser itself looses all information
+about indentation).
+*/
+int depth = 0;
+
+/*
+To debug this parser, put the line below into the next bison file section.
+Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
+%debug
+*/
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+typedef int YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 214 of yacc.c. */
+#line 253 "autotools_yacc.cpp"
+
+#if ! defined (yyoverflow) || YYERROR_VERBOSE
+
+# ifndef YYFREE
+# define YYFREE free
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# endif
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
+# endif
+# else
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# endif
+#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
+
+
+#if (! defined (yyoverflow) \
+ && (! defined (__cplusplus) \
+ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ short int yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined (__GNUC__) && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ register YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif
+
+#if defined (__STDC__) || defined (__cplusplus)
+ typedef signed char yysigned_char;
+#else
+ typedef short int yysigned_char;
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 3
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 33
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 29
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 18
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 35
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 43
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 283
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const unsigned char yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const unsigned char yyprhs[] =
+{
+ 0, 0, 3, 4, 7, 10, 11, 13, 15, 17,
+ 19, 21, 23, 25, 27, 29, 32, 34, 37, 39,
+ 42, 46, 49, 51, 54, 55, 58, 61, 63, 65,
+ 69, 71, 74, 76, 78, 81
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yysigned_char yyrhs[] =
+{
+ 30, 0, -1, -1, 31, 32, -1, 32, 33, -1,
+ -1, 37, -1, 34, -1, 36, -1, 35, -1, 41,
+ -1, 42, -1, 43, -1, 45, -1, 46, -1, 24,
+ 38, -1, 26, -1, 26, 38, -1, 25, -1, 25,
+ 38, -1, 38, 44, 39, -1, 3, 38, -1, 3,
+ -1, 39, 40, -1, -1, 4, 17, -1, 23, 14,
+ -1, 17, -1, 22, -1, 38, 12, 39, -1, 28,
+ -1, 27, 38, -1, 6, -1, 7, -1, 16, 14,
+ -1, 14, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const unsigned short int yyrline[] =
+{
+ 0, 142, 142, 142, 149, 175, 178, 182, 186, 190,
+ 194, 198, 202, 206, 210, 216, 224, 230, 239, 245,
+ 254, 264, 266, 269, 273, 276, 277, 278, 279, 282,
+ 291, 299, 308, 308, 311, 319
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE
+/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "ID_SIMPLE", "ID_LIST", "LBRACE", "EQ",
+ "PLUSEQ", "MINUSQE", "STAREQ", "TILDEEQ", "RBRACE", "COLON", "NUMSIGN",
+ "NEWLINE", "NUMBER", "COMMENT", "CONT", "DOT", "RCURLY", "LCURLY",
+ "ID_ARGS", "LIST_COMMENT", "ID_LIST_SINGLE", "IF_KEYWORD",
+ "ELSE_KEYWORD", "ENDIF_KEYWORD", "KEYWORD", "RULE", "$accept", "project",
+ "@1", "statements", "statement", "automake_if", "endif_statement",
+ "else_statement", "variable_assignment", "scoped_identifier",
+ "multiline_values", "line_body", "target", "am_rule",
+ "include_directive", "operator", "comment", "emptyline", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const unsigned short int yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const unsigned char yyr1[] =
+{
+ 0, 29, 31, 30, 32, 32, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 34, 35, 35, 36, 36,
+ 37, 38, 38, 39, 39, 40, 40, 40, 40, 41,
+ 42, 43, 44, 44, 45, 46
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const unsigned char yyr2[] =
+{
+ 0, 2, 0, 2, 2, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 1, 2, 1, 2,
+ 3, 2, 1, 2, 0, 2, 2, 1, 1, 3,
+ 1, 2, 1, 1, 2, 1
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const unsigned char yydefact[] =
+{
+ 2, 0, 5, 1, 3, 22, 35, 0, 0, 18,
+ 16, 0, 30, 4, 7, 9, 8, 6, 0, 10,
+ 11, 12, 13, 14, 21, 34, 15, 19, 17, 31,
+ 32, 33, 24, 24, 29, 20, 0, 27, 28, 0,
+ 23, 25, 26
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yysigned_char yydefgoto[] =
+{
+ -1, 1, 2, 4, 13, 14, 15, 16, 17, 18,
+ 34, 40, 19, 20, 21, 33, 22, 23
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -18
+static const yysigned_char yypact[] =
+{
+ -18, 2, -18, -18, -3, 0, -18, -6, 0, 0,
+ 0, 0, -18, -18, -18, -18, -18, -18, 3, -18,
+ -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
+ -18, -18, -18, -18, 10, 10, -5, -18, -18, 4,
+ -18, -18, -18
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yysigned_char yypgoto[] =
+{
+ -18, -18, -18, -18, -18, -18, -18, -18, -18, -4,
+ -17, -18, -18, -18, -18, -18, -18, -18
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -1
+static const unsigned char yytable[] =
+{
+ 5, 24, 3, 5, 26, 27, 28, 29, 25, 30,
+ 31, 6, 41, 7, 36, 32, 35, 0, 42, 0,
+ 0, 8, 9, 10, 11, 12, 0, 37, 0, 0,
+ 0, 0, 38, 39
+};
+
+static const yysigned_char yycheck[] =
+{
+ 3, 5, 0, 3, 8, 9, 10, 11, 14, 6,
+ 7, 14, 17, 16, 4, 12, 33, -1, 14, -1,
+ -1, 24, 25, 26, 27, 28, -1, 17, -1, -1,
+ -1, -1, 22, 23
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const unsigned char yystos[] =
+{
+ 0, 30, 31, 0, 32, 3, 14, 16, 24, 25,
+ 26, 27, 28, 33, 34, 35, 36, 37, 38, 41,
+ 42, 43, 45, 46, 38, 14, 38, 38, 38, 38,
+ 6, 7, 12, 44, 39, 39, 4, 17, 22, 23,
+ 40, 17, 14
+};
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror ("syntax error: cannot back up");\
+ YYERROR; \
+ } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+/* YYLLOC_DEFAULT -- Compute the default location (before the actions
+ are run). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ ((Current).first_line = (Rhs)[1].first_line, \
+ (Current).first_column = (Rhs)[1].first_column, \
+ (Current).last_line = (Rhs)[N].last_line, \
+ (Current).last_column = (Rhs)[N].last_column)
+#endif
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+# define YYDSYMPRINT(Args) \
+do { \
+ if (yydebug) \
+ yysymprint Args; \
+} while (0)
+
+# define YYDSYMPRINTF(Title, Token, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yysymprint (stderr, \
+ Token, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short int *bottom, short int *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ short int *bottom;
+ short int *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (/* Nothing. */; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_reduce_print (int yyrule)
+#else
+static void
+yy_reduce_print (yyrule)
+ int yyrule;
+#endif
+{
+ int yyi;
+ unsigned int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ yyrule - 1, yylno);
+ /* Print the symbols being reduced, and their result. */
+ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
+ YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (Rule); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YYDSYMPRINT(Args)
+# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
+# undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined (__GLIBC__) && defined (_STRING_H)
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+# if defined (__STDC__) || defined (__cplusplus)
+yystrlen (const char *yystr)
+# else
+yystrlen (yystr)
+ const char *yystr;
+# endif
+{
+ register const char *yys = yystr;
+
+ while (*yys++ != '\0')
+ continue;
+
+ return yys - yystr - 1;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+# if defined (__STDC__) || defined (__cplusplus)
+yystpcpy (char *yydest, const char *yysrc)
+# else
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+# endif
+{
+ register char *yyd = yydest;
+ register const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+#endif /* !YYERROR_VERBOSE */
+
+
+
+#if YYDEBUG
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yysymprint (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ /* Pacify ``unused variable'' warnings. */
+ (void) yyvaluep;
+
+ if (yytype < YYNTOKENS)
+ {
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+# ifdef YYPRINT
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ }
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+ YYFPRINTF (yyoutput, ")");
+}
+
+#endif /* ! YYDEBUG */
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yydestruct (int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yytype, yyvaluep)
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ /* Pacify ``unused variable'' warnings. */
+ (void) yyvaluep;
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM);
+# else
+int yyparse ();
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The lookahead symbol. */
+int yychar;
+
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM)
+# else
+int yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+
+ register int yystate;
+ register int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ short int yyssa[YYINITDEPTH];
+ short int *yyss = yyssa;
+ register short int *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ register YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK (yyvsp--, yyssp--)
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* When reducing, the number of symbols on the RHS of the reduced
+ rule. */
+ int yylen;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks.
+ */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short int *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyoverflowlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyoverflowlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ short int *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyoverflowlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+#line 142 "autotools.yy"
+ {
+ ProjectAST *projectAST = new ProjectAST();
+ projects.push(projectAST);
+;}
+ break;
+
+ case 4:
+#line 150 "autotools.yy"
+ {
+ projects.top()->addChildAST(yyvsp[0].node);
+
+ if ( yyvsp[0].node->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( yyvsp[0].node )->scopedID == "if" )
+ {
+ yyvsp[0].node->setDepth(depth);
+ depth++;
+ }
+ else if ( yyvsp[0].node->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( yyvsp[0].node )->scopedID == "else" )
+ {
+ --depth;
+ yyvsp[0].node->setDepth(depth);
+ ++depth;
+ }
+ else if ( yyvsp[0].node->nodeType() == AST::ProjectAST &&
+ static_cast<ProjectAST*>( yyvsp[0].node )->scopedID == "endif" )
+ {
+ --depth;
+ yyvsp[0].node->setDepth(depth);
+ }
+ else
+ yyvsp[0].node->setDepth(depth);
+;}
+ break;
+
+ case 6:
+#line 179 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 7:
+#line 183 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 8:
+#line 187 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 9:
+#line 191 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 10:
+#line 195 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 11:
+#line 199 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 12:
+#line 203 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 13:
+#line 207 "autotools.yy"
+ {
+ yyval.node = yyvsp[0].node;
+;}
+ break;
+
+ case 14:
+#line 211 "autotools.yy"
+ {
+ yyval.node = new NewLineAST();
+;}
+ break;
+
+ case 15:
+#line 217 "autotools.yy"
+ {
+ ConditionAST* projectAST = new ConditionAST();
+ projectAST->type = "if";
+ projectAST->conditionName = yyvsp[0].value;
+ yyval.node = projectAST;
+;}
+ break;
+
+ case 16:
+#line 225 "autotools.yy"
+ {
+ ConditionAST* past = new ConditionAST();
+ past->type= "endif";
+ yyval.node = past;
+;}
+ break;
+
+ case 17:
+#line 231 "autotools.yy"
+ {
+ ConditionAST* past = new ConditionAST();
+ past->type= "endif";
+ past->conditionName = yyvsp[0].value;
+ yyval.node = past;
+;}
+ break;
+
+ case 18:
+#line 240 "autotools.yy"
+ {
+ ConditionAST* past = new ConditionAST();
+ past->type = "else";
+ yyval.node = past;
+;}
+ break;
+
+ case 19:
+#line 246 "autotools.yy"
+ {
+ ConditionAST* past = new ConditionAST();
+ past->type = "else";
+ past->conditionName = yyvsp[0].value;
+ yyval.node = past;
+;}
+ break;
+
+ case 20:
+#line 255 "autotools.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = yyvsp[-2].value;
+ node->op = yyvsp[-1].value;
+ node->values = yyvsp[0].values;
+ yyval.node = node;
+;}
+ break;
+
+ case 21:
+#line 265 "autotools.yy"
+ { yyval.value = yyvsp[-1].value + yyvsp[0].value; ;}
+ break;
+
+ case 23:
+#line 270 "autotools.yy"
+ {
+ yyval.values.append(yyvsp[0].value);
+;}
+ break;
+
+ case 24:
+#line 273 "autotools.yy"
+ { yyval.values.clear(); ;}
+ break;
+
+ case 25:
+#line 276 "autotools.yy"
+ { yyval.value = yyvsp[-1].value + " \\\n"; ;}
+ break;
+
+ case 26:
+#line 277 "autotools.yy"
+ { yyval.value = yyvsp[-1].value + "\n"; ;}
+ break;
+
+ case 27:
+#line 278 "autotools.yy"
+ { yyval.value = "\\\n"; ;}
+ break;
+
+ case 29:
+#line 283 "autotools.yy"
+ {
+ AutomakeTargetAST *node = new AutomakeTargetAST();
+ node->target = yyvsp[-2].value;
+ node->deps = yyvsp[0].values;
+ yyval.node = node;
+;}
+ break;
+
+ case 30:
+#line 292 "autotools.yy"
+ {
+ ProjectAST* node = new ProjectAST(ProjectAST::Rule);
+ node->scopedID = yyvsp[0].value;
+ yyval.node = node;
+;}
+ break;
+
+ case 31:
+#line 300 "autotools.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = yyvsp[-1].value;
+ node->values = QStringList(yyvsp[0].value);
+ yyval.node = node;
+;}
+ break;
+
+ case 34:
+#line 312 "autotools.yy"
+ {
+ CommentAST *node = new CommentAST();
+ node->comment = yyvsp[-1].value + "\n";
+ yyval.node = node;
+;}
+ break;
+
+
+ }
+
+/* Line 1010 of yacc.c. */
+#line 1403 "autotools_yacc.cpp"
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+
+
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (YYPACT_NINF < yyn && yyn < YYLAST)
+ {
+ YYSIZE_T yysize = 0;
+ int yytype = YYTRANSLATE (yychar);
+ const char* yyprefix;
+ char *yymsg;
+ int yyx;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 0;
+
+ yyprefix = ", expecting ";
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
+ yycount += 1;
+ if (yycount == 5)
+ {
+ yysize = 0;
+ break;
+ }
+ }
+ yysize += (sizeof ("syntax error, unexpected ")
+ + yystrlen (yytname[yytype]));
+ yymsg = (char *) YYSTACK_ALLOC (yysize);
+ if (yymsg != 0)
+ {
+ char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
+ yyp = yystpcpy (yyp, yytname[yytype]);
+
+ if (yycount < 5)
+ {
+ yyprefix = ", expecting ";
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ yyp = yystpcpy (yyp, yyprefix);
+ yyp = yystpcpy (yyp, yytname[yyx]);
+ yyprefix = " or ";
+ }
+ }
+ yyerror (yymsg);
+ YYSTACK_FREE (yymsg);
+ }
+ else
+ yyerror ("syntax error; also virtual memory exhausted");
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ yyerror ("syntax error");
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* If at end of input, pop the error token,
+ then the rest of the stack, then return failure. */
+ if (yychar == YYEOF)
+ for (;;)
+ {
+ YYPOPSTACK;
+ if (yyssp == yyss)
+ YYABORT;
+ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+ yydestruct (yystos[*yyssp], yyvsp);
+ }
+ }
+ else
+ {
+ YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
+ yydestruct (yytoken, &yylval);
+ yychar = YYEMPTY;
+
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+#ifdef __GNUC__
+ /* Pacify GCC when the user code never invokes YYERROR and the label
+ yyerrorlab therefore never appears in user code. */
+ if (0)
+ goto yyerrorlab;
+#endif
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+ yydestruct (yystos[yystate], yyvsp);
+ YYPOPSTACK;
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ YYDPRINTF ((stderr, "Shifting error token, "));
+
+ *++yyvsp = yylval;
+
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*----------------------------------------------.
+| yyoverflowlab -- parser overflow comes here. |
+`----------------------------------------------*/
+yyoverflowlab:
+ yyerror ("parser stack overflow");
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+ return yyresult;
+}
+
+
+#line 321 "autotools.yy"
+
+
+#include "autotools_lex.cpp"
+
diff --git a/buildtools/lib/parsers/autotools/autotools_yacc.h b/buildtools/lib/parsers/autotools/autotools_yacc.h
new file mode 100644
index 00000000..b8becb4a
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotools_yacc.h
@@ -0,0 +1,100 @@
+/* A Bison parser, made by GNU Bison 1.875d. */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ ID_SIMPLE = 258,
+ ID_LIST = 259,
+ LBRACE = 260,
+ EQ = 261,
+ PLUSEQ = 262,
+ MINUSQE = 263,
+ STAREQ = 264,
+ TILDEEQ = 265,
+ RBRACE = 266,
+ COLON = 267,
+ NUMSIGN = 268,
+ NEWLINE = 269,
+ NUMBER = 270,
+ COMMENT = 271,
+ CONT = 272,
+ DOT = 273,
+ RCURLY = 274,
+ LCURLY = 275,
+ ID_ARGS = 276,
+ LIST_COMMENT = 277,
+ ID_LIST_SINGLE = 278,
+ IF_KEYWORD = 279,
+ ELSE_KEYWORD = 280,
+ ENDIF_KEYWORD = 281,
+ KEYWORD = 282,
+ RULE = 283
+ };
+#endif
+#define ID_SIMPLE 258
+#define ID_LIST 259
+#define LBRACE 260
+#define EQ 261
+#define PLUSEQ 262
+#define MINUSQE 263
+#define STAREQ 264
+#define TILDEEQ 265
+#define RBRACE 266
+#define COLON 267
+#define NUMSIGN 268
+#define NEWLINE 269
+#define NUMBER 270
+#define COMMENT 271
+#define CONT 272
+#define DOT 273
+#define RCURLY 274
+#define LCURLY 275
+#define ID_ARGS 276
+#define LIST_COMMENT 277
+#define ID_LIST_SINGLE 278
+#define IF_KEYWORD 279
+#define ELSE_KEYWORD 280
+#define ENDIF_KEYWORD 281
+#define KEYWORD 282
+#define RULE 283
+
+
+
+
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
+typedef int YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
+
+
diff --git a/buildtools/lib/parsers/autotools/autotoolsast.cpp b/buildtools/lib/parsers/autotools/autotoolsast.cpp
new file mode 100644
index 00000000..71596e3d
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotoolsast.cpp
@@ -0,0 +1,117 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "autotoolsast.h"
+
+namespace AutoTools {
+
+//AST
+
+AST::~AST()
+{
+ for (QValueList<AST*>::iterator it = m_children.begin(); it != m_children.end(); ++it)
+ {
+ AST *node = *it;
+ delete node;
+ }
+}
+
+void AST::addChildAST(AST *node)
+{
+ m_children.append(node);
+}
+
+void AST::writeBack(QString &buffer)
+{
+ for (QValueList<AST*>::const_iterator it = m_children.constBegin();
+ it != m_children.constEnd(); ++it)
+ {
+ if (*it)
+ (*it)->writeBack(buffer);
+ }
+}
+
+QString AST::indentation()
+{
+ QString result;
+ for (int i = 0; i < depth(); i++)
+ result += '\t';
+ return result;
+}
+
+bool AST::hasChildren() const
+{
+ return !m_children.isEmpty();
+}
+
+QValueList<AST*> AST::children() const
+{
+ return m_children;
+}
+
+//ProjectAST
+
+void ProjectAST::writeBack(QString &buffer)
+{
+ if ( isRule() )
+ buffer += scopedID;
+ else
+ buffer += indentation();
+
+ AST::writeBack(buffer);
+
+}
+
+void ProjectAST::addChildAST(AST *node)
+{
+ statements.append(node);
+ AST::addChildAST(node);
+}
+
+void AssignmentAST::writeBack(QString &buffer)
+{
+ buffer += indentation() + scopedID + " " + op + values.join("");
+}
+
+void AutomakeTargetAST::writeBack( QString& buffer )
+{
+ buffer += target + ":" + deps.join("");
+}
+
+void ConditionAST::writeBack( QString& buffer )
+{
+ buffer += indentation() + type + " " + conditionName;
+}
+
+void NewLineAST::writeBack(QString &buffer)
+{
+ buffer += "\n";
+}
+
+void CommentAST::writeBack(QString &buffer)
+{
+ buffer += indentation() + comment;
+}
+
+}
+
+// kate: indent-mode csands; tab-width 4; space-indent off;
diff --git a/buildtools/lib/parsers/autotools/autotoolsast.h b/buildtools/lib/parsers/autotools/autotoolsast.h
new file mode 100644
index 00000000..c92c17c7
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotoolsast.h
@@ -0,0 +1,269 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef AUTOTOOLSAST_H
+#define AUTOTOOLSAST_H
+
+#include <qstringlist.h>
+
+/**
+@file autotools.h
+Abstract Syntax Tree (AST) class declarations.
+*/
+
+namespace AutoTools
+{
+
+/**
+ * AST node.
+ * This is the base class. Objects of this type are not created by the parser.
+ *
+ * Each AST node holds the list of its children which are always deleted in the
+ * destructor. This way, it's possible call delete for only root AST node and
+ * others will be deleted automatically.
+ *
+ * Each AST node also knows how to write the information back into .pro file.
+ */
+class AST
+{
+public:
+ /**Type of AST node.*/
+ enum NodeType {
+ ProjectAST, ///< Project, scope or function scope.
+ AssignmentAST, ///< Variable assignment.
+ TargetAST, ///< Automake target
+ MakefileConditionalAST, ///< Makefile.am conditional
+ NewLineAST, ///< Line feed.
+ CommentAST ///< Comment.
+ };
+
+ /** Constructs AST with given node type.*/
+ AST(NodeType nodeType): m_nodeType(nodeType), m_depth(0) {}
+ virtual ~AST();
+
+ /**
+ * Adds child AST node to this node. Despite this function is virtual,
+ * reimplementations should call it to make automatic destruction of
+ * AST tree possible.*/
+ virtual void addChildAST(AST *node);
+
+ /**
+ * Writes information stored in the AST into the @p buffer.
+ * This is a default implementation which iterates over child nodes
+ * and calls writeBack for each child node.
+ */
+ virtual void writeBack(QString &buffer);
+
+ /** @return The type of the node.*/
+ virtual NodeType nodeType() const { return m_nodeType; }
+
+ /** Sets the depth of the node in AST.*/
+ void setDepth(int depth) { m_depth = depth; }
+
+ /** @return The depth of the node in AST.*/
+ int depth() const { return m_depth; }
+
+ /** @return The indentation string based on node depth.*/
+ virtual QString indentation();
+
+ //! \return true if this AST has children
+ bool hasChildren() const;
+
+ /**
+ * Get the children of this ast
+ * \return the list of this ast's childre
+ */
+ QValueList<AST*> children() const;
+
+
+
+protected:
+ NodeType m_nodeType;
+ QValueList<AST*> m_children;
+
+private:
+ int m_depth;
+
+};
+
+
+/**
+ * Project AST node.
+ * Represents complete projects, scopes and function scopes.
+ * Examples:
+ * @code
+ * scopename{
+ * var=value
+ * }
+ * function(args){
+ * var=value
+ * }
+ * @endcode
+ */
+class ProjectAST: public AST
+{
+public:
+ /**The kind of a project node.*/
+ enum Kind
+ {
+ Project, ///< Project
+ Target, ///< Custom Automake Target
+ ConditionalScope, ///< Automake Conditional
+ Rule, ///< Automake Rule
+ Empty ///< Project does not exist. the AST is empty
+ };
+
+ /** Constructs a project node of given @p kind. */
+ ProjectAST(Kind kind = Project): AST(AST::ProjectAST), m_kind(kind) {}
+
+ virtual void writeBack(QString &buffer);
+ virtual void addChildAST(AST *node);
+
+ /** @return true if this node is a project.*/
+ bool isProject() const { return m_kind == Project; }
+
+ bool isRule() const { return m_kind == Rule; }
+
+ /** @return true if this node is an automake conditional */
+ bool isConditionalScope() const { return m_kind == ConditionalScope; }
+
+ /** @return true if this node is empty.*/
+ bool isEmpty() const { return m_kind == Empty; }
+
+ /**Scoped identifier (scope name or rule).*/
+ QString scopedID;
+
+ /**Function arguments. Empty for other kinds of projects.*/
+ QString args;
+
+ /** The automake conditional has an else attached */
+ bool hasElse;
+
+ /**List of statements.*/
+ QValueList<AutoTools::AST*> statements;
+
+private:
+ Kind m_kind;
+
+};
+
+
+/**
+ * Assignment AST node.
+ * Represents assignments, for example:
+ * \code
+ * var=value
+ * \endcode
+ *
+ * Values can be specified on several lines and
+ * each line is stored as a string in the list of values.@n
+ * For example, if we have in .pro:
+ * \code
+ * SOURCES=a.cpp \
+ * b.cpp c.cpp
+ * \endcode
+ * then values will be stored as a two elements list:
+ * \code
+ * a.cpp
+ * b.cpp c.cpp
+ * \endcode
+ */
+class AssignmentAST: public AST
+{
+public:
+ AssignmentAST(): AST(AST::AssignmentAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+ /**Scoped name of the variable.*/
+ QString scopedID;
+
+ /**Operator.*/
+ QString op;
+
+ /**List of values.*/
+ QStringList values;
+};
+
+class AutomakeTargetAST : public AST
+{
+public:
+ AutomakeTargetAST() : AST(AST::TargetAST) {}
+
+ virtual void writeBack( QString& buffer );
+
+ /// The name of the target
+ QString target;
+
+ /// The dependencies for the target, if any
+ QStringList deps;
+};
+
+class ConditionAST : public AST
+{
+public:
+ ConditionAST() : AST( AST::MakefileConditionalAST ) {}
+
+ virtual void writeBack( QString& buffer );
+
+ /// The keyword for the condition (if, else, endif)
+ QString type;
+
+ /// The name of the condition
+ QString conditionName;
+};
+
+/**
+ * New line AST node.
+ * Represents line feeds in files.
+ */
+class NewLineAST: public AST
+{
+public:
+ NewLineAST(): AST(AST::NewLineAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+};
+
+
+/**
+ * Comment AST node.
+ * Represents comments.
+ */
+class CommentAST: public AST
+{
+public:
+ CommentAST(): AST(AST::CommentAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+ /**Comment text.*/
+ QString comment;
+
+};
+
+}
+
+#endif
+
+// kate: indent-mode csands; space-indent off; tab-width 4; auto-insert-doxygen on;
diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp
new file mode 100644
index 00000000..8ec643ab
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "autotoolsdriver.h"
+#include "autotoolsast.h"
+
+#include <stdio.h>
+#include <qvaluestack.h>
+#include <kio/netaccess.h>
+
+extern FILE *yyin, *yyout;
+extern int yyparse();
+//extern int yydebug;
+extern QValueStack<AutoTools::ProjectAST *> projects;
+
+namespace AutoTools {
+
+int Driver::parseFile(const char *fileName, ProjectAST **ast)
+{
+ //yydebug = 1;
+ yyin = fopen(fileName, "r");
+ if (yyin == 0)
+ {
+ ast = 0;
+ return 1;
+ }
+ int ret = yyparse();
+ *ast = projects.top();
+ fclose(yyin);
+ return ret;
+}
+
+int Driver::parseFile(QString fileName, ProjectAST **ast)
+{
+ return parseFile(fileName.ascii(), ast);
+}
+
+int Driver::parseFile(KURL fileName, ProjectAST **ast)
+{
+ QString tmpFile;
+ int ret = 0;
+ if (KIO::NetAccess::download(fileName, tmpFile, 0))
+ ret = parseFile(tmpFile, ast);
+ KIO::NetAccess::removeTempFile(tmpFile);
+ return ret;
+}
+
+}
+
+//kate: indent-mode csands; space-indent off; tab-width 4;
+
diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.h b/buildtools/lib/parsers/autotools/autotoolsdriver.h
new file mode 100644
index 00000000..eba0a823
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/autotoolsdriver.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * Copyright (c) 2005 by Matt Rogers *
+ * mattr@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef QMAKEQMAKEDRIVER_H
+#define QMAKEQMAKEDRIVER_H
+
+#include <qvaluelist.h>
+#include <kurl.h>
+
+namespace AutoTools {
+
+/**
+@file autotoolsdriver.h
+Driver for a qmake parser.
+*/
+
+class ProjectAST;
+
+/**
+ * Driver.
+ * Use methods of this class to lauch parsing and build the AST.
+ */
+class Driver
+{
+public:
+ /**
+ * Parses the file @p fileName and stores the resulting ProjectAST root
+ * into @p ast. @p ast should not be initialized before. Driver will
+ * initialize it on its own.
+ * @return The result of parsing. Result is 0 on success and <> 0 on failure.
+ */
+ static int parseFile(const char *fileName, ProjectAST **ast);
+ static int parseFile(QString fileName, ProjectAST **ast);
+ static int parseFile(KURL fileName, ProjectAST **ast);
+
+/* template<class Op>
+ static void walkAST(Op &op, const ProjectAST *ast)
+ {
+// op(ast);
+ for (QValueList<QMake::AST*>::const_iterator it = ast->statements.constBegin();
+ it != ast->statements.constEnd(); ++it)
+ {
+ const AST *child = *it;
+ if (child->nodeType() == AST::ProjectAST)
+ walkAST<Op>(op, static_cast<const QMake::ProjectAST*>(child));
+ else
+ op(child);
+ }
+ }
+*/
+};
+
+}
+
+#endif
+
+// kate: indent-mode csands; tab-width 4; space-indent off; auto-insert-doxygen on;
diff --git a/buildtools/lib/parsers/autotools/tests/Makefile.am b/buildtools/lib/parsers/autotools/tests/Makefile.am
new file mode 100644
index 00000000..222a0482
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/Makefile.am
@@ -0,0 +1,21 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \
+ -I$(top_srcdir)/buildtools/lib/parsers/autotools \
+ -I$(top_builddir)/buildtools/lib/parsers/autotools/tests \
+ $(all_includes)
+
+METASOURCES = AUTO
+
+check_PROGRAMS = runner viewer
+
+runner_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH)
+runner_LDADD = $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la
+runner_SOURCES = runner.cpp
+
+viewer_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH)
+viewer_LDADD = $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la
+viewer_SOURCES = viewer.cpp viewer_main.cpp viewerbase.ui
diff --git a/buildtools/lib/parsers/autotools/tests/runner.cpp b/buildtools/lib/parsers/autotools/tests/runner.cpp
new file mode 100644
index 00000000..cf9f68d1
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/runner.cpp
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <autotoolsast.h>
+#include <autotoolsdriver.h>
+
+using namespace AutoTools;
+
+int main(int argc, char *argv[])
+{
+ ProjectAST *projectAST;
+ if (argc > 1)
+ return Driver::parseFile(argv[1], &projectAST);
+ else
+ return 0;
+}
+
diff --git a/buildtools/lib/parsers/autotools/tests/viewer.cpp b/buildtools/lib/parsers/autotools/tests/viewer.cpp
new file mode 100644
index 00000000..047e6b28
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/viewer.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "viewer.h"
+
+#include <qdir.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qfiledialog.h>
+#include <qtextedit.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qlistview.h>
+#include <qtabwidget.h>
+
+#include <autotoolsast.h>
+#include <autotoolsdriver.h>
+
+using namespace AutoTools;
+
+Viewer::Viewer(QWidget *parent, const char *name)
+ :ViewerBase(parent, name)
+{
+ if (QFile::exists(QDir::currentDirPath() + "/" + "qtlist"))
+ {
+ QFile f(QDir::currentDirPath() + "/" + "qtlist");
+ f.open(IO_ReadOnly);
+ QTextStream str(&f);
+ while (!str.eof())
+ files->insertItem(str.readLine());
+ }
+ ast->setSorting(-1);
+ parentProject.push((QListViewItem*)0);
+}
+
+void Viewer::addAll_clicked()
+{
+ if (allLocation->text().isEmpty())
+ return;
+ QDir d(allLocation->text());
+ QStringList l = d.entryList("*.am");
+ for (QStringList::iterator it = l.begin(); it != l.end(); ++it)
+ (*it) = QDir::cleanDirPath(allLocation->text() + "/" + (*it));
+ files->insertStringList(l);
+}
+
+void Viewer::choose_clicked()
+{
+ QString fileName = QFileDialog::getOpenFileName(QDir::currentDirPath(), "*.am", this);
+ if (!fileName.isEmpty())
+ files->insertItem(fileName);
+}
+
+void Viewer::files_currentChanged(QListBoxItem* item)
+{
+ ast->clear();
+
+ QFile f(item->text());
+ f.open(IO_ReadOnly);
+ QTextStream str(&f);
+ source->setText(str.read());
+ f.close();
+
+ int result = Driver::parseFile(item->text().ascii(), &projectAST);
+ if (projectAST && (result == 0))
+ {
+ processAST(projectAST);
+ }
+ if (tabWidget2->currentPageIndex() == 1)
+ tabWidget2_selected("Source to be written back");
+}
+
+void Viewer::tabWidget2_selected(const QString& text)
+{
+ if ((text == "Source to be written back") && projectAST)
+ {
+ QString buffer;
+ projectAST->writeBack(buffer);
+ writeBack->setText(buffer);
+ }
+}
+
+void Viewer::processAST(ProjectAST *projectAST, QListViewItem *globAfter)
+{
+ QListViewItem *projectIt;
+ if (!parentProject.top())
+ projectIt = new QListViewItem(ast, "Project");
+ else
+ {
+ if ( projectAST->isConditionalScope() || projectAST->isRule() )
+ projectIt = new QListViewItem(parentProject.top(), globAfter, projectAST->scopedID);
+ }
+ projectIt->setOpen(true);
+
+ QListViewItem *after = 0;
+ for (QValueList<AST*>::const_iterator it = projectAST->statements.constBegin();
+ it != projectAST->statements.constEnd(); ++it)
+ {
+ AST *ast = *it;
+ if (ast == 0)
+ continue;
+ switch (ast->nodeType()) {
+ case AST::AssignmentAST: {
+ AssignmentAST *assignmentAST = static_cast<AssignmentAST*>(ast);
+ QListViewItem *item = new QListViewItem(projectIt, after,
+ assignmentAST->scopedID, assignmentAST->op, assignmentAST->values.join(""));
+ item->setMultiLinesEnabled(true);
+ after = item; }
+ break;
+
+ case AST::TargetAST:
+ {
+ AutomakeTargetAST* ata = static_cast<AutomakeTargetAST*>(ast);
+ QListViewItem* item = new QListViewItem(projectIt, after,
+ ata->target, QString::null, ata->deps.join(""));
+ after = item;
+ }
+ break;
+
+ case AST::NewLineAST:
+// after = new QListViewItem(projectIt, after, "<newline>");
+ break;
+
+ case AST::CommentAST:
+// after = new QListViewItem(projectIt, after, "<comment>");
+ break;
+
+ case AST::MakefileConditionalAST:
+ {
+ ConditionAST* ata = static_cast<ConditionAST*>(ast);
+ QListViewItem* item = new QListViewItem(projectIt, after,
+ ata->type, ata->conditionName, QString::null );
+ after = item;
+ }
+ case AST::ProjectAST: {
+ ProjectAST *projectAST = static_cast<ProjectAST*>(ast);
+ parentProject.push(projectIt);
+ processAST(projectAST, after);
+ parentProject.pop(); }
+ break;
+ }
+ }
+}
+
+#include "viewer.moc"
+
diff --git a/buildtools/lib/parsers/autotools/tests/viewer.h b/buildtools/lib/parsers/autotools/tests/viewer.h
new file mode 100644
index 00000000..46698483
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/viewer.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef VIEWER_H
+#define VIEWER_H
+
+#include <qvaluestack.h>
+
+#include "viewerbase.h"
+
+namespace AutoTools { class ProjectAST; }
+
+class QListViewItem;
+
+class Viewer: public ViewerBase {
+Q_OBJECT
+public:
+ Viewer(QWidget *parent = 0, const char *name = 0);
+ void processAST(AutoTools::ProjectAST *projectAST, QListViewItem *globAfter = 0);
+public slots:
+ virtual void tabWidget2_selected(const QString&);
+ virtual void files_currentChanged(QListBoxItem*);
+ virtual void choose_clicked();
+ virtual void addAll_clicked();
+private:
+ AutoTools::ProjectAST *projectAST;
+ QValueStack<QListViewItem *> parentProject;
+};
+
+#endif
diff --git a/buildtools/lib/parsers/autotools/tests/viewer_main.cpp b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp
new file mode 100644
index 00000000..32641eff
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <qapplication.h>
+#include "viewer.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ Viewer viewer;
+ app.setMainWidget(&viewer);
+ viewer.show();
+ viewer.resize(800, 600);
+ //viewer.setWindowState(viewer.windowState() | Qt::WindowMaximized);
+
+ return app.exec();
+}
diff --git a/buildtools/lib/parsers/autotools/tests/viewerbase.ui b/buildtools/lib/parsers/autotools/tests/viewerbase.ui
new file mode 100644
index 00000000..7c228299
--- /dev/null
+++ b/buildtools/lib/parsers/autotools/tests/viewerbase.ui
@@ -0,0 +1,220 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ViewerBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ViewerBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Viewer</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="1" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>source</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Parse Tree</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>ast</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Source to Be Written Back</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit" row="0" column="0">
+ <property name="name">
+ <cstring>writeBack</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>allLocation</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>addAll</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Add All From Directory</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>choose</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Choose File to Add...</string>
+ </property>
+ </widget>
+ <widget class="QListBox" row="3" column="0">
+ <property name="name">
+ <cstring>files</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>addAll</sender>
+ <signal>clicked()</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>addAll_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>choose</sender>
+ <signal>clicked()</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>choose_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>files</sender>
+ <signal>currentChanged(QListBoxItem*)</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>files_currentChanged(QListBoxItem*)</slot>
+ </connection>
+ <connection>
+ <sender>tabWidget2</sender>
+ <signal>selected(const QString&amp;)</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>tabWidget2_selected(const QString&amp;)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>addAll_clicked()</slot>
+ <slot>choose_clicked()</slot>
+ <slot>files_currentChanged(QListBoxItem*)</slot>
+ <slot>tabWidget2_selected(const QString&amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/buildtools/lib/parsers/qmake/FlexLexer.h b/buildtools/lib/parsers/qmake/FlexLexer.h
new file mode 100644
index 00000000..1db844da
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/FlexLexer.h
@@ -0,0 +1,205 @@
+
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+
+// Neither the name of the University nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer. You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer xxFlexLexer
+// #include <FlexLexer.h>
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer zzFlexLexer
+// #include <FlexLexer.h>
+// ...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+# ifndef FLEX_STD
+# define FLEX_STD std::
+# endif
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer {
+public:
+ virtual ~FlexLexer() { }
+
+ const char* YYText() const { return yytext; }
+ int YYLeng() const { return yyleng; }
+
+ virtual void
+ yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+ virtual struct yy_buffer_state*
+ yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
+ virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+ virtual void yyrestart( FLEX_STD istream* s ) = 0;
+
+ virtual int yylex() = 0;
+
+ // Call yylex with new input/output sources.
+ int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ // Switch to new input/output streams. A nil stream pointer
+ // indicates "keep the current one".
+ virtual void switch_streams( FLEX_STD istream* new_in = 0,
+ FLEX_STD ostream* new_out = 0 ) = 0;
+
+ int lineno() const { return yylineno; }
+
+ int debug() const { return yy_flex_debug; }
+ void set_debug( int flag ) { yy_flex_debug = flag; }
+
+protected:
+ char* yytext;
+ int yyleng;
+ int yylineno; // only maintained if you use %option yylineno
+ int yy_flex_debug; // only has effect with -d or "%option debug"
+};
+
+}
+#endif
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex man page.
+#define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+ // arg_yyin and arg_yyout default to the cin and cout, but we
+ // only make that assignment when initializing in yylex().
+ yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
+
+ virtual ~yyFlexLexer();
+
+ void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+ struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
+ void yy_delete_buffer( struct yy_buffer_state* b );
+ void yyrestart( FLEX_STD istream* s );
+
+ void yypush_buffer_state( struct yy_buffer_state* new_buffer );
+ void yypop_buffer_state(void);
+
+ virtual int yylex();
+ virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out );
+
+protected:
+ virtual int LexerInput( char* buf, int max_size );
+ virtual void LexerOutput( const char* buf, int size );
+ virtual void LexerError( const char* msg );
+
+ void yyunput( int c, char* buf_ptr );
+ int yyinput();
+
+ void yy_load_buffer_state();
+ void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
+ void yy_flush_buffer( struct yy_buffer_state* b );
+
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int* yy_start_stack;
+
+ void yy_push_state( int new_state );
+ void yy_pop_state();
+ int yy_top_state();
+
+ yy_state_type yy_get_previous_state();
+ yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+ int yy_get_next_buffer();
+
+ FLEX_STD istream* yyin; // input source for default LexerInput
+ FLEX_STD ostream* yyout; // output sink for default LexerOutput
+
+ // yy_hold_char holds the character lost when yytext is formed.
+ char yy_hold_char;
+
+ // Number of characters read into yy_ch_buf.
+ int yy_n_chars;
+
+ // Points to current character in buffer.
+ char* yy_c_buf_p;
+
+ int yy_init; // whether we need to initialize
+ int yy_start; // start state number
+
+ // Flag which is used to allow yywrap()'s to do buffer switches
+ // instead of setting up a fresh yyin. A bit of a hack ...
+ int yy_did_buffer_switch_on_eof;
+
+
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+ void yyensure_buffer_stack(void);
+
+ // The following are not always needed, but may be depending
+ // on use of certain flex features (like REJECT or yymore()).
+
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ yy_state_type* yy_state_buf;
+ yy_state_type* yy_state_ptr;
+
+ char* yy_full_match;
+ int* yy_full_state;
+ int yy_full_lp;
+
+ int yy_lp;
+ int yy_looking_for_trail_begin;
+
+ int yy_more_flag;
+ int yy_more_len;
+ int yy_more_offset;
+ int yy_prev_more_offset;
+};
+
+}
+
+#endif
diff --git a/buildtools/lib/parsers/qmake/Mainpage.dox b/buildtools/lib/parsers/qmake/Mainpage.dox
new file mode 100644
index 00000000..7b2e2682
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/Mainpage.dox
@@ -0,0 +1,16 @@
+/**
+@mainpage The KDevelop QMake Parser
+
+This library contains qmake parser.
+
+<b>Link with</b>: -lkdevqmakeparser
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/buildtools/parsers/qmake
+
+\section qmakeparseroverview Overview
+Here resides a parser for qmake .pro (.pri) files. This parser
+reads project files, builds an AST which then can be written
+back to the project file.
+
+*/
+
diff --git a/buildtools/lib/parsers/qmake/Makefile.am b/buildtools/lib/parsers/qmake/Makefile.am
new file mode 100644
index 00000000..fd80170c
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/Makefile.am
@@ -0,0 +1,31 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+#SUBDIRS = tests
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \
+ $(all_includes)
+METASOURCES = AUTO
+lib_LTLIBRARIES = libkdevqmakeparser.la
+libkdevqmakeparser_la_LDFLAGS = -no-undefined $(all_libraries) $(LIB_KIO)
+libkdevqmakeparser_la_SOURCES = qmake_lex.cpp qmake_yacc.cpp qmakeast.cpp \
+ qmakeastvisitor.cpp qmakedriver.cpp
+
+kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/parsers/qmake
+kdevelopbuildtoolsinclude_HEADERS = qmakeast.h qmakedriver.h qmakeastvisitor.h
+
+parser:
+ cd $(srcdir) ; \
+ bison -d qmake.yy -r all -k -t -oqmake_yacc.cpp ; \
+ flex -d -oqmake_lex.cpp qmake.ll
+
+EXTRA_DIST = qmake.yy qmake.ll
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils
+DOXYGEN_PROJECTNAME = KDevelop QMake parser
+DOXYGEN_DOCDIRPREFIX = kdevparser
+include ../../../../Doxyfile.am
+
+noinst_HEADERS = qmake.ll qmake.yy qmake_lex.h
diff --git a/buildtools/lib/parsers/qmake/location.hh b/buildtools/lib/parsers/qmake/location.hh
new file mode 100644
index 00000000..4da36b8a
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/location.hh
@@ -0,0 +1,145 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Locations for Bison parsers in C++
+
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/**
+ ** \file location.hh
+ ** Define the QMake::location class.
+ */
+
+#ifndef BISON_LOCATION_HH
+# define BISON_LOCATION_HH
+
+# include <iostream>
+# include <string>
+# include "position.hh"
+
+namespace QMake
+{
+
+ /// Abstract a location.
+ class location
+ {
+ public:
+
+ /// Construct a location.
+ location ()
+ : begin (), end ()
+ {
+ }
+
+
+ /// Initialization.
+ inline void initialize (std::string* fn)
+ {
+ begin.initialize (fn);
+ end = begin;
+ }
+
+ /** \name Line and Column related manipulators
+ ** \{ */
+ public:
+ /// Reset initial location to final location.
+ inline void step ()
+ {
+ begin = end;
+ }
+
+ /// Extend the current location to the COUNT next columns.
+ inline void columns (unsigned int count = 1)
+ {
+ end += count;
+ }
+
+ /// Extend the current location to the COUNT next lines.
+ inline void lines (unsigned int count = 1)
+ {
+ end.lines (count);
+ }
+ /** \} */
+
+
+ public:
+ /// Beginning of the located region.
+ position begin;
+ /// End of the located region.
+ position end;
+ };
+
+ /// Join two location objects to create a location.
+ inline const location operator+ (const location& begin, const location& end)
+ {
+ location res = begin;
+ res.end = end.end;
+ return res;
+ }
+
+ /// Add two location objects.
+ inline const location operator+ (const location& begin, unsigned int width)
+ {
+ location res = begin;
+ res.columns (width);
+ return res;
+ }
+
+ /// Add and assign a location.
+ inline location& operator+= (location& res, unsigned int width)
+ {
+ res.columns (width);
+ return res;
+ }
+
+ /** \brief Intercept output stream redirection.
+ ** \param ostr the destination output stream
+ ** \param loc a reference to the location to redirect
+ **
+ ** Avoid duplicate information.
+ */
+ inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
+ {
+ position last = loc.end - 1;
+ ostr << loc.begin;
+ if (last.filename
+ && (!loc.begin.filename
+ || *loc.begin.filename != *last.filename))
+ ostr << '-' << last;
+ else if (loc.begin.line != last.line)
+ ostr << '-' << last.line << '.' << last.column;
+ else if (loc.begin.column != last.column)
+ ostr << '-' << last.column;
+ return ostr;
+ }
+
+}
+
+#endif // not BISON_LOCATION_HH
diff --git a/buildtools/lib/parsers/qmake/position.hh b/buildtools/lib/parsers/qmake/position.hh
new file mode 100644
index 00000000..704f0df4
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/position.hh
@@ -0,0 +1,142 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Positions for Bison parsers in C++
+
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/**
+ ** \file position.hh
+ ** Define the QMake::position class.
+ */
+
+#ifndef BISON_POSITION_HH
+# define BISON_POSITION_HH
+
+# include <iostream>
+# include <string>
+
+namespace QMake
+{
+ /// Abstract a position.
+ class position
+ {
+ public:
+
+ /// Construct a position.
+ position ()
+ : filename (0), line (1), column (0)
+ {
+ }
+
+
+ /// Initialization.
+ inline void initialize (std::string* fn)
+ {
+ filename = fn;
+ line = 1;
+ column = 0;
+ }
+
+ /** \name Line and Column related manipulators
+ ** \{ */
+ public:
+ /// (line related) Advance to the COUNT next lines.
+ inline void lines (int count = 1)
+ {
+ column = 0;
+ line += count;
+ }
+
+ /// (column related) Advance to the COUNT next columns.
+ inline void columns (int count = 1)
+ {
+ int leftmost = 0;
+ int current = column;
+ if (leftmost <= current + count)
+ column += count;
+ else
+ column = 0;
+ }
+ /** \} */
+
+ public:
+ /// File name to which this position refers.
+ std::string* filename;
+ /// Current line number.
+ unsigned int line;
+ /// Current column number.
+ unsigned int column;
+ };
+
+ /// Add and assign a position.
+ inline const position&
+ operator+= (position& res, const int width)
+ {
+ res.columns (width);
+ return res;
+ }
+
+ /// Add two position objects.
+ inline const position
+ operator+ (const position& begin, const int width)
+ {
+ position res = begin;
+ return res += width;
+ }
+
+ /// Add and assign a position.
+ inline const position&
+ operator-= (position& res, const int width)
+ {
+ return res += -width;
+ }
+
+ /// Add two position objects.
+ inline const position
+ operator- (const position& begin, const int width)
+ {
+ return begin + -width;
+ }
+
+ /** \brief Intercept output stream redirection.
+ ** \param ostr the destination output stream
+ ** \param pos a reference to the position to redirect
+ */
+ inline std::ostream&
+ operator<< (std::ostream& ostr, const position& pos)
+ {
+ if (pos.filename)
+ ostr << *pos.filename << ':';
+ return ostr << pos.line << '.' << pos.column;
+ }
+
+}
+#endif // not BISON_POSITION_HH
diff --git a/buildtools/lib/parsers/qmake/qmake.ll b/buildtools/lib/parsers/qmake/qmake.ll
new file mode 100644
index 00000000..715d60b3
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake.ll
@@ -0,0 +1,237 @@
+%{
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <stdlib.h>
+
+#define DONT_INCLUDE_FLEXLEXER
+
+#include "qmake_lex.h"
+
+/**
+@file qmake.ll
+QMake Lexer
+
+There are 3 types of identifiers recognized by this lexer:
+-id_simple: examples of such identifiers are qmake variables and scoped variables
+at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp");
+-id_list: those are "value list identifiers" at the right side in assignments
+(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp");
+-id_args: function arguments recognized as one identifier
+(example: ""${QMAKE_FILE} is intended only for Windows!""
+in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements).
+.
+
+To recognize those identifiers two additional start conditions are used: list and funcargs.
+
+@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to
+the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped
+so no indentation is preserved by this lexer (and parser).
+
+To debug this lexer, put the line below into the next flex file section.
+%option debug
+*/
+%}
+
+%option noyywrap
+%option yylineno
+%option c++
+%option yyclass="QMake::Lexer"
+
+%x vallist
+%x funcargs
+
+delim [ \t]
+ws {delim}+
+newline (\n|\r|\r\n)
+quote "\""
+var_value [^#\r\n\t ]*[^\r\n\t \\]
+quoted_var_value {quote}({var_value}|[\t ])({var_value}|[\t ])*{quote}
+letter [A-Za-z]
+digit [0-9]
+id_simple ({digit}|{letter}|\!|-|_|\*|\$)({letter}|{digit}|\||\!|-|_|\*|\$|\.|\+)*
+id_args [^\r\n]*\)
+number {digit}+
+comment #[^\r\n]*{newline}
+comment_cont (\\{ws}*#[^\r\n]*{newline}|#[^\r\n]*\\{newline})
+cont \\{ws}*{newline}
+
+%%
+<vallist><<EOF>> {
+ BEGIN(INITIAL);
+ return Parser::token::token::ENDOFFILE;
+}
+<INITIAL>{ws} {}
+
+<vallist>{ws} {
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::LIST_WS;
+}
+
+<vallist,INITIAL>{cont} {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::CONT;
+}
+
+<vallist,INITIAL>{comment_cont} {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::COMMENT_CONT;
+}
+
+{id_simple} {
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return (Parser::token::token::ID_SIMPLE);
+}
+
+<funcargs>{id_args} {
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ mylval->value = mylval->value.mid(0, mylval->value.length()-1);
+ unput(')');
+ BEGIN(INITIAL);
+ return (Parser::token::token::ID_ARGS);
+ }
+
+<vallist>{var_value} {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::VARIABLE_VALUE;
+}
+
+<vallist>{quoted_var_value} {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::QUOTED_VARIABLE_VALUE;
+}
+
+"=" {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::EQ;
+}
+
+"+=" {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::PLUSEQ;
+}
+
+"-=" {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::MINUSEQ;
+}
+
+"*=" {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::STAREQ;
+}
+
+"~=" {
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::TILDEEQ;
+}
+
+"{" {
+ return Parser::token::token::LCURLY;
+}
+
+":"{delim}*"{" {
+ return Parser::token::token::LCURLY;
+}
+
+"}" {
+ return Parser::token::token::RCURLY;
+}
+
+"(" {
+ BEGIN(funcargs);
+ return Parser::token::token::LBRACE;
+}
+
+<funcargs,INITIAL>")" {
+ BEGIN(INITIAL);
+ return Parser::token::token::RBRACE;
+}
+
+":" {
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::COLON;
+}
+
+
+<vallist>{ws}{newline} {
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ setLineEndingFromString( mylval->value );
+ return Parser::token::token::NEWLINE;
+}
+
+<vallist,INITIAL>{newline} {
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ setLineEndingFromString( mylval->value );
+ return Parser::token::token::NEWLINE;
+}
+
+<vallist,INITIAL>{comment} {
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return (Parser::token::token::COMMENT);
+}
+
+%%
+namespace QMake
+{
+ Lexer::Lexer( std::istream* argin, std::ostream* argout )
+ : yyFlexLexer(argin, argout), mylval(0), m_lineEnding(None)
+ {
+ }
+
+ int Lexer::yylex( QMake::Parser::semantic_type* yylval )
+ {
+ mylval = yylval;
+ return yylex();
+ }
+
+ void Lexer::setLineEndingFromString( const QString& str )
+ {
+ if( str.endsWith("\r\n") && m_lineEnding == None )
+ m_lineEnding = Windows;
+ else if ( str.endsWith("\r") && m_lineEnding == None )
+ m_lineEnding = MacOS;
+ else if ( m_lineEnding == None )
+ m_lineEnding = Unix;
+ }
+
+ Lexer::LineEnding Lexer::lineending()
+ {
+ return m_lineEnding;
+ }
+}
+
+int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer)
+{
+ return lexer->yylex( yylval );
+}
+
diff --git a/buildtools/lib/parsers/qmake/qmake.yy b/buildtools/lib/parsers/qmake/qmake.yy
new file mode 100644
index 00000000..9e6d378a
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake.yy
@@ -0,0 +1,430 @@
+%{
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * Copyright (C) 2006 by Andreas Pakulat *
+ * apaku@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/**
+@file qmake.yy
+QMake Parser
+
+Simple LALR parser which builds the syntax tree (see @ref QMake::AST).
+
+@todo Recognize comments after statements like:
+SOURCES = foo #regognize me
+
+@fixme Parser fails on files that do not end with a newline
+@fixme 1 shift/reduce conflict in "line_body" rule
+*/
+
+#include <qvaluestack.h>
+#include "qmakeast.h"
+#include <qregexp.h>
+
+#define YYSTYPE_IS_DECLARED
+
+namespace QMake
+{
+ class Lexer;
+
+/**
+The yylval type.
+*/
+struct Result {
+ Result(): node(0) {}
+
+ /**Type of semantic value for simple grammar rules.*/
+ QString value;
+ /**Type of semantic value for grammar rules which are parts of AST.*/
+ AST *node;
+ /**Type of semantic value for "multiline_values" grammar rule.
+ Each line of multiline value is stored as a string in the list.
+
+ For example we have in .pro file:
+ @code
+ SOURCE = foo1.cpp \
+ foo2.cpp \
+ foo3.cpp foo4.cpp
+ @endcode
+ The string list will be populated with three strings:
+ <pre>
+ foo1.cpp
+ foo2.cpp
+ foo3.cpp foo4.cpp
+ </pre>
+ */
+ QStringList values;
+ QString indent;
+};
+
+#define YYSTYPE Result
+typedef Result YYSTYPE;
+}
+
+extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer );
+
+/**
+The stack to store ProjectAST pointers when a new child
+ProjectAST is created and filled with statements.
+
+Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
+adding statements. Each statement is added as a child StatementAST to the ProjectAST
+currently on the top in the stack.
+
+When a scope or function scope statement is parsed, the child ProjectAST is created
+and pushed onto the stack. Therefore all statements which belong to the scope
+or function scope are added as childs to their direct parent (scope or function scope).
+*/
+//QValueStack<ProjectAST*> projects;
+
+/**
+The current depth of AST node is stored here.
+AST depth is important to know because automatic indentation can
+be easily implemented (the parser itself looses all information
+about indentation).
+*/
+// int depth = 0;
+
+/*
+To debug this parser, put the line below into the next bison file section.
+Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
+%debug
+*/
+%}
+
+%skeleton "lalr1.cc"
+%define "parser_class_name" "Parser"
+%name-prefix="QMake"
+%parse-param { QMake::Lexer* lexer }
+%parse-param { QValueStack<ProjectAST*>& projects }
+%parse-param { int depth }
+%lex-param { QMake::Lexer* lexer }
+%start project
+
+%token ID_SIMPLE
+%token EQ
+%token PLUSEQ
+%token MINUSEQ
+%token STAREQ
+%token TILDEEQ
+%token LBRACE
+%token RBRACE
+%token COLON
+%token NEWLINE
+%token COMMENT
+%token CONT
+%token COMMENT_CONT
+%token RCURLY
+%token LCURLY
+%token ID_ARGS
+%token QUOTED_VARIABLE_VALUE
+%token VARIABLE_VALUE
+%token LIST_WS
+%token ENDOFFILE
+%%
+
+project :
+ {
+ ProjectAST *projectAST = new ProjectAST();
+ projects.push(projectAST);
+ }
+ statements
+ ;
+
+statements : statements statement
+ {
+ projects.top()->addChildAST($<node>2);
+ $<node>2->setDepth(depth);
+ }
+ |
+ ;
+
+statement : variable_assignment
+ {
+ $<node>$ = $<node>1;
+ }
+ | scope
+ {
+ $<node>$ = $<node>1;
+ }
+ | function_call
+ {
+ $<node>$ = $<node>1;
+ }
+ | comment
+ {
+ $<node>$ = $<node>1;
+ }
+ | emptyline
+ {
+ $<node>$ = new NewLineAST();
+ }
+ ;
+
+variable_assignment : ID_SIMPLE operator multiline_values listws NEWLINE
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3 ;
+ node->values.append( $<value>4 );
+ node->values.append( $<value>5 );
+ node->indent = $<indent>3;
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator multiline_values listws ENDOFFILE
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3 ;
+ node->values.append( $<value>4 );
+ node->indent = $<indent>3;
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator multiline_values listws CONT
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3 ;
+ node->values.append( $<value>4 );
+ node->values.append( $<value>5 );
+ node->indent = $<indent>3;
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator multiline_values listws COMMENT_CONT
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3 ;
+ node->values.append( $<value>4 );
+ node->values.append( $<value>5 );
+ node->indent = $<indent>3;
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator listws NEWLINE
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values.append( $<value>3 );
+ node->values.append( $<value>4 );
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator listws ENDOFFILE
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values.append( $<value>3 );
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator listws COMMENT
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values.append( $<value>3 );
+ node->values.append( $<value>4 );
+ $<node>$ = node;
+ }
+ | ID_SIMPLE operator multiline_values listws COMMENT
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = $<value>1;
+ node->op = $<value>2;
+ node->values = $<values>3;
+ node->values.append( $<value>4 );
+ node->values.append( $<value>5 );
+ node->indent = $<indent>3;
+ $<node>$ = node;
+ }
+ ;
+
+possible_value : variable_value | COMMENT_CONT | CONT
+
+multiline_values : multiline_values LIST_WS possible_value
+ {
+ $<values>$.append( $<value>2 );
+ $<values>$.append( $<value>3 );
+ }
+ | multiline_values variable_value
+ {
+ $<values>$.append( $<value>2 );
+ }
+ | multiline_values listws CONT listws possible_value
+ {
+ $<values>$.append( $<value>2 );
+ $<values>$.append( $<value>3 );
+ $<values>$.append( $<value>4 );
+ $<values>$.append( $<value>5 );
+ if( $<indent>4 != "" && $<indent>$ == "" )
+ $<indent>$ = $<indent>4;
+ }
+ | multiline_values listws COMMENT_CONT listws possible_value
+ {
+ $<values>$.append( $<value>2 );
+ $<values>$.append( $<value>3 );
+ $<values>$.append( $<value>4 );
+ $<values>$.append( $<value>5 );
+ if( $<indent>4 != "" && $<indent>$ == "" )
+ $<indent>$ = $<indent>4;
+ }
+ | listws possible_value
+ {
+ $<values>$ = QStringList();
+ $<values>$.append( $<value>1 );
+ $<values>$.append( $<value>2 );
+ }
+ ;
+
+
+variable_value : VARIABLE_VALUE { $<value>$ = $<value>1; }
+ | QUOTED_VARIABLE_VALUE { $<value>$ = $<value>1; }
+ ;
+
+
+listws: LIST_WS
+ {
+ $<value>$ = $<value>1;
+ $<indent>$ = $<value>1;
+ }
+ |
+ {
+ $<value>$ = QString();
+ $<indent>$ = QString();
+ }
+ ;
+operator : EQ
+ {
+ $<value>$ = $<value>1;
+ }
+ | PLUSEQ
+ {
+ $<value>$ = $<value>1;
+ }
+ | MINUSEQ
+ {
+ $<value>$ = $<value>1;
+ }
+ | STAREQ
+ {
+ $<value>$ = $<value>1;
+ }
+ | TILDEEQ
+ {
+ $<value>$ = $<value>1;
+ }
+ ;
+
+scope : ID_SIMPLE
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope);
+ projects.push(projectAST);
+ projects.top()->scopedID = $<value>1;
+ depth++;
+ }
+ scope_body
+ {
+ $<node>$ = projects.pop();
+ depth--;
+ }
+ ;
+
+function_call : ID_SIMPLE LBRACE function_args RBRACE
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
+ projects.push(projectAST);
+ projects.top()->scopedID = $<value>1;
+ projects.top()->args = $<value>3;
+ depth++;
+
+ //qWarning("%s", $<value>1.ascii());
+ if ($<value>1.contains("include"))
+ {
+ IncludeAST *includeAST = new IncludeAST();
+ includeAST->projectName = $<value>3;
+ projects.top()->addChildAST(includeAST);
+ includeAST->setDepth(depth);
+ }
+ }
+ scope_body
+ else_statement
+ {
+ $<node>$ = projects.pop();
+ depth--;
+ }
+ ;
+
+function_args : ID_ARGS { $<value>$ = $<value>1; }
+ | { $<value>$ = ""; }
+ ;
+
+scope_body : LCURLY statements RCURLY
+ | COLON statement
+ {
+ projects.top()->addChildAST($<node>2);
+ $<node>2->setDepth(depth);
+ }
+ |
+ ;
+
+else_statement : "else" LCURLY
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
+ projects.push(projectAST);
+ projects.top()->scopedID = "else";
+ projects.top()->args = "";
+ depth++;
+ }
+ scope_body RCURLY
+ {
+ $<node>$ = projects.pop();
+ depth--;
+ }
+ |
+ {
+ $<node>$ = new ProjectAST();
+ }
+ ;
+
+comment : COMMENT
+ {
+ CommentAST *node = new CommentAST();
+ node->comment = $<value>1;
+ $<node>$ = node;
+ }
+ ;
+
+emptyline : NEWLINE
+ ;
+
+%%
+
+
+namespace QMake
+{
+ void Parser::error(const location_type& /*l*/, const std::string& m)
+ {
+ std::cerr << m << std::endl;
+ }
+}
diff --git a/buildtools/lib/parsers/qmake/qmake_lex.cpp b/buildtools/lib/parsers/qmake/qmake_lex.cpp
new file mode 100644
index 00000000..b49677fe
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake_lex.cpp
@@ -0,0 +1,2239 @@
+#line 2 "qmake_lex.cpp"
+
+#line 4 "qmake_lex.cpp"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 33
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* %if-c++-only */
+ /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+ * following macro. This is required in order to pass the c++-multiple-scanners
+ * test in the regression suite. We get reports that it breaks inheritance.
+ * We will address this in a future release of flex, or omit the C++ scanner
+ * altogether.
+ */
+ #define yyFlexLexer yyFlexLexer
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+/* %if-c-only */
+/* %endif */
+
+/* %if-tables-serialization */
+/* %endif */
+/* end standard C headers. */
+
+/* %if-c-or-c++ */
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+/* %endif */
+
+/* %if-c++-only */
+/* begin standard C++ headers. */
+#include <iostream>
+#include <errno.h>
+#include <cstdlib>
+#include <cstring>
+/* end standard C++ headers. */
+/* %endif */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* %not-for-header */
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+/* %ok-for-header */
+
+/* %not-for-header */
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+/* %ok-for-header */
+
+/* %if-reentrant */
+/* %endif */
+
+/* %if-not-reentrant */
+
+/* %endif */
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+/* %if-not-reentrant */
+extern int yyleng;
+/* %endif */
+
+/* %if-c-only */
+/* %if-not-reentrant */
+/* %endif */
+/* %endif */
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef unsigned int yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+/* %if-c-only */
+/* %endif */
+
+/* %if-c++-only */
+ std::istream* yy_input_file;
+/* %endif */
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+
+/* %if-not-reentrant */
+/* %endif */
+/* %ok-for-header */
+
+/* %endif */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* %if-c-only Standard (non-C++) definition */
+/* %if-not-reentrant */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %endif */
+/* %endif */
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
+/* Begin user sect3 */
+
+#define yywrap() 1
+#define YY_SKIP_YYWRAP
+
+#define FLEX_DEBUG
+
+typedef unsigned char YY_CHAR;
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+int yyFlexLexer::yylex()
+ {
+ LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
+ return 0;
+ }
+
+#define YY_DECL int QMake::Lexer::yylex()
+
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
+ (yy_c_buf_p) = yy_cp;
+
+/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[76] =
+ { 0,
+ 0, 0, 0, 0, 0, 0, 24, 23, 1, 21,
+ 21, 5, 23, 17, 18, 5, 23, 5, 19, 9,
+ 23, 14, 16, 23, 7, 2, 7, 7, 23, 23,
+ 6, 1, 21, 5, 0, 22, 22, 0, 12, 10,
+ 11, 0, 15, 0, 3, 3, 0, 13, 7, 7,
+ 0, 2, 20, 20, 7, 0, 7, 0, 7, 0,
+ 6, 4, 4, 0, 4, 4, 7, 0, 7, 7,
+ 0, 0, 8, 0, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 5, 6, 7, 8, 1, 1, 1, 9,
+ 10, 11, 12, 1, 13, 14, 1, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 16, 1, 1,
+ 17, 1, 1, 1, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 1, 19, 1, 1, 20, 1, 18, 18, 18, 18,
+
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 21, 22, 23, 24, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[25] =
+ { 0,
+ 1, 2, 3, 3, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[85] =
+ { 0,
+ 0, 0, 23, 41, 28, 30, 132, 289, 126, 289,
+ 123, 56, 32, 289, 289, 106, 105, 104, 35, 289,
+ 77, 289, 289, 103, 34, 55, 47, 69, 87, 108,
+ 106, 111, 289, 0, 79, 289, 96, 82, 289, 289,
+ 289, 44, 289, 0, 289, 90, 59, 289, 68, 289,
+ 85, 93, 289, 74, 105, 123, 141, 98, 99, 45,
+ 42, 289, 47, 105, 289, 36, 159, 177, 195, 213,
+ 108, 231, 249, 112, 289, 268, 271, 274, 27, 277,
+ 279, 281, 284, 286
+ } ;
+
+static yyconst flex_int16_t yy_def[85] =
+ { 0,
+ 75, 1, 76, 76, 77, 77, 75, 75, 75, 75,
+ 75, 75, 78, 75, 75, 12, 75, 12, 75, 75,
+ 75, 75, 75, 75, 79, 75, 80, 78, 79, 81,
+ 81, 75, 75, 12, 78, 75, 75, 78, 75, 75,
+ 75, 75, 75, 21, 75, 75, 82, 75, 79, 75,
+ 79, 75, 75, 75, 83, 84, 84, 80, 82, 81,
+ 81, 75, 75, 82, 75, 75, 83, 84, 83, 84,
+ 83, 84, 84, 84, 0, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75
+ } ;
+
+static yyconst flex_int16_t yy_nxt[314] =
+ { 0,
+ 8, 9, 10, 11, 12, 8, 13, 12, 14, 15,
+ 16, 17, 18, 8, 12, 19, 20, 12, 21, 12,
+ 22, 8, 23, 24, 26, 10, 11, 49, 27, 28,
+ 8, 8, 8, 8, 36, 37, 42, 31, 65, 31,
+ 50, 29, 26, 10, 11, 42, 27, 28, 56, 62,
+ 38, 61, 51, 57, 61, 43, 52, 53, 54, 29,
+ 34, 65, 66, 34, 43, 58, 34, 34, 34, 34,
+ 34, 36, 37, 34, 50, 34, 53, 34, 44, 45,
+ 46, 36, 37, 47, 62, 63, 51, 38, 44, 45,
+ 46, 50, 45, 59, 52, 53, 54, 38, 36, 75,
+
+ 38, 65, 66, 51, 57, 51, 68, 65, 66, 75,
+ 69, 70, 32, 75, 70, 61, 58, 61, 68, 48,
+ 41, 40, 39, 71, 68, 33, 71, 32, 73, 68,
+ 74, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 74, 68, 75, 75, 75, 73, 68, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 74,
+ 68, 75, 75, 75, 69, 70, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 71, 68, 75,
+ 75, 75, 73, 68, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 74, 68, 75, 75, 75,
+
+ 69, 70, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 71, 68, 75, 75, 75, 73, 68,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 74, 68, 75, 75, 75, 73, 68, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 74,
+ 68, 75, 75, 75, 73, 68, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 74, 25, 25,
+ 25, 30, 30, 30, 35, 35, 35, 55, 55, 60,
+ 60, 64, 64, 64, 67, 67, 72, 72, 7, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75
+ } ;
+
+static yyconst flex_int16_t yy_chk[314] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 3, 3, 3, 79, 3, 3,
+ 5, 5, 6, 6, 13, 13, 19, 5, 66, 6,
+ 25, 3, 4, 4, 4, 42, 4, 4, 27, 63,
+ 13, 61, 25, 27, 60, 19, 26, 26, 26, 4,
+ 12, 47, 47, 12, 42, 27, 12, 12, 12, 12,
+ 12, 28, 28, 12, 49, 12, 54, 12, 21, 21,
+ 21, 35, 35, 21, 38, 38, 49, 28, 29, 29,
+ 29, 51, 46, 29, 52, 52, 52, 35, 37, 58,
+
+ 38, 59, 59, 51, 58, 29, 55, 64, 64, 71,
+ 55, 55, 32, 74, 71, 31, 58, 30, 74, 24,
+ 18, 17, 16, 55, 56, 11, 71, 9, 56, 56,
+ 74, 7, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 56, 57, 0, 0, 0, 57, 57, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 57,
+ 67, 0, 0, 0, 67, 67, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 67, 68, 0,
+ 0, 0, 68, 68, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 68, 69, 0, 0, 0,
+
+ 69, 69, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 69, 70, 0, 0, 0, 70, 70,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 70, 72, 0, 0, 0, 72, 72, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
+ 73, 0, 0, 0, 73, 73, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 73, 76, 76,
+ 76, 77, 77, 77, 78, 78, 78, 80, 80, 81,
+ 81, 82, 82, 82, 83, 83, 84, 84, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75
+ } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[24] =
+ { 0,
+0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 0, };
+
+static yyconst flex_int16_t yy_rule_linenum[23] =
+ { 0,
+ 81, 83, 88, 94, 100, 105, 113, 119, 125, 131,
+ 137, 143, 149, 155, 159, 163, 167, 172, 177, 183,
+ 190, 197
+ } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "qmake.ll"
+#line 2 "qmake.ll"
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <stdlib.h>
+
+#define DONT_INCLUDE_FLEXLEXER
+
+#include "qmake_lex.h"
+
+/**
+@file qmake.ll
+QMake Lexer
+
+There are 3 types of identifiers recognized by this lexer:
+-id_simple: examples of such identifiers are qmake variables and scoped variables
+at the left of the operator in assignments (like "SOURCES" in "SOURCES+=foo.cpp goo.cpp");
+-id_list: those are "value list identifiers" at the right side in assignments
+(like "foo.cpp goo.cpp" in "SOURCES+=foo.cpp goo.cpp");
+-id_args: function arguments recognized as one identifier
+(example: ""${QMAKE_FILE} is intended only for Windows!""
+in "!win32-*:!wince-*:error("${QMAKE_FILE} is intended only for Windows!")" statements).
+.
+
+To recognize those identifiers two additional start conditions are used: list and funcargs.
+
+@note "Not" operator (!) is recognized as a part of an identifier. Linefeeds passed to
+the parser as NEWLINE tokens to preserve file structure but whitespaces are stripped
+so no indentation is preserved by this lexer (and parser).
+
+To debug this lexer, put the line below into the next flex file section.
+%option debug
+*/
+
+
+#line 657 "qmake_lex.cpp"
+
+#define INITIAL 0
+#define vallist 1
+#define funcargs 2
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+#include <unistd.h>
+/* %endif */
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* %if-c-only Reentrant structure and macros (non-C++). */
+/* %if-reentrant */
+/* %if-c-only */
+/* %endif */
+/* %if-reentrant */
+/* %endif */
+/* %if-bison-bridge */
+/* %endif */
+/* %endif End reentrant structures and macros. */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %endif */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+/* %if-c-only Standard (non-C++) definition */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %endif */
+#endif
+
+/* %if-c-only */
+/* %endif */
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+/* %if-c++-only C++ definition */
+#define ECHO LexerOutput( yytext, yyleng )
+/* %endif */
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
+\
+/* %if-c++-only C++ definition \ */\
+ if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+/* %endif */
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+/* %endif */
+#endif
+
+/* %if-tables-serialization structures and prototypes */
+/* %not-for-header */
+
+/* %ok-for-header */
+
+/* %not-for-header */
+
+/* %tables-yydmap generated elements */
+/* %endif */
+/* end tables serialization structures and prototypes */
+
+/* %ok-for-header */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+/* %if-c-only Standard (non-C++) definition */
+/* %endif */
+/* %if-c++-only C++ definition */
+#define YY_DECL int yyFlexLexer::yylex()
+/* %endif */
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+/* %% [6.0] YY_RULE_SETUP definition goes here */
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/* %not-for-header */
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+/* %% [7.0] user's declarations go here */
+#line 76 "qmake.ll"
+
+#line 818 "qmake_lex.cpp"
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yyin = & std::cin;
+/* %endif */
+
+ if ( ! yyout )
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yyout = & std::cout;
+/* %endif */
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+/* %% [8.0] yymore()-related code goes here */
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+/* %% [9.0] code to set up and find next match goes here */
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 76 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 289 );
+
+yy_find_action:
+/* %% [10.0] code to find the action number goes here */
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+/* %% [11.0] code for yylineno update goes here */
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ int yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ yylineno++;
+;
+ }
+
+do_action: /* This label is used only to access EOF actions. */
+
+/* %% [12.0] debug code goes here */
+ if ( yy_flex_debug )
+ {
+ if ( yy_act == 0 )
+ std::cerr << "--scanner backing up\n";
+ else if ( yy_act < 23 )
+ std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
+ "(\"" << yytext << "\")\n";
+ else if ( yy_act == 23 )
+ std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
+ else if ( yy_act == 24 )
+ std::cerr << "--(end of buffer or a NUL)\n";
+ else
+ std::cerr << "--EOF (start condition " << YY_START << ")\n";
+ }
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+/* %% [13.0] actions go here */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case YY_STATE_EOF(vallist):
+#line 77 "qmake.ll"
+{
+ BEGIN(INITIAL);
+ return Parser::token::token::ENDOFFILE;
+}
+ YY_BREAK
+case 1:
+YY_RULE_SETUP
+#line 81 "qmake.ll"
+{}
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 83 "qmake.ll"
+{
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::LIST_WS;
+}
+ YY_BREAK
+case 3:
+/* rule 3 can match eol */
+YY_RULE_SETUP
+#line 88 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::CONT;
+}
+ YY_BREAK
+case 4:
+/* rule 4 can match eol */
+YY_RULE_SETUP
+#line 94 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::COMMENT_CONT;
+}
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 100 "qmake.ll"
+{
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return (Parser::token::token::ID_SIMPLE);
+}
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 105 "qmake.ll"
+{
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ mylval->value = mylval->value.mid(0, mylval->value.length()-1);
+ unput(')');
+ BEGIN(INITIAL);
+ return (Parser::token::token::ID_ARGS);
+ }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 113 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::VARIABLE_VALUE;
+}
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 119 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::QUOTED_VARIABLE_VALUE;
+}
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 125 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::EQ;
+}
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 131 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::PLUSEQ;
+}
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 137 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::MINUSEQ;
+}
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 143 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::STAREQ;
+}
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 149 "qmake.ll"
+{
+ BEGIN(vallist);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::TILDEEQ;
+}
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 155 "qmake.ll"
+{
+ return Parser::token::token::LCURLY;
+}
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 159 "qmake.ll"
+{
+ return Parser::token::token::LCURLY;
+}
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 163 "qmake.ll"
+{
+ return Parser::token::token::RCURLY;
+}
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 167 "qmake.ll"
+{
+ BEGIN(funcargs);
+ return Parser::token::token::LBRACE;
+}
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 172 "qmake.ll"
+{
+ BEGIN(INITIAL);
+ return Parser::token::token::RBRACE;
+}
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 177 "qmake.ll"
+{
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return Parser::token::token::COLON;
+}
+ YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 183 "qmake.ll"
+{
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ setLineEndingFromString( mylval->value );
+ return Parser::token::token::NEWLINE;
+}
+ YY_BREAK
+case 21:
+/* rule 21 can match eol */
+YY_RULE_SETUP
+#line 190 "qmake.ll"
+{
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ setLineEndingFromString( mylval->value );
+ return Parser::token::token::NEWLINE;
+}
+ YY_BREAK
+case 22:
+/* rule 22 can match eol */
+YY_RULE_SETUP
+#line 197 "qmake.ll"
+{
+ BEGIN(INITIAL);
+ mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
+ return (Parser::token::token::COMMENT);
+}
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 203 "qmake.ll"
+ECHO;
+ YY_BREAK
+#line 1145 "qmake_lex.cpp"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(funcargs):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+/* %ok-for-header */
+
+/* %if-c++-only */
+/* %not-for-header */
+
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
+{
+ yyin = arg_yyin;
+ yyout = arg_yyout;
+ yy_c_buf_p = 0;
+ yy_init = 0;
+ yy_start = 0;
+ yy_flex_debug = 0;
+ yylineno = 1; // this will only get updated if %option yylineno
+
+ yy_did_buffer_switch_on_eof = 0;
+
+ yy_looking_for_trail_begin = 0;
+ yy_more_flag = 0;
+ yy_more_len = 0;
+ yy_more_offset = yy_prev_more_offset = 0;
+
+ yy_start_stack_ptr = yy_start_stack_depth = 0;
+ yy_start_stack = NULL;
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+
+ yy_state_buf = 0;
+
+}
+
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+ if ( new_in )
+ {
+ yy_delete_buffer( YY_CURRENT_BUFFER );
+ yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
+ }
+
+ if ( new_out )
+ yyout = new_out;
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+ if ( yyin->eof() || yyin->fail() )
+ return 0;
+
+#ifdef YY_INTERACTIVE
+ yyin->get( buf[0] );
+
+ if ( yyin->eof() )
+ return 0;
+
+ if ( yyin->bad() )
+ return -1;
+
+ return 1;
+
+#else
+ (void) yyin->read( buf, max_size );
+
+ if ( yyin->bad() )
+ return -1;
+ else
+ return yyin->gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+ (void) yyout->write( buf, size );
+}
+/* %ok-for-header */
+
+/* %endif */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+int yyFlexLexer::yy_get_next_buffer()
+/* %endif */
+{
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = (yytext_ptr);
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), (size_t) num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+/* %if-c-only */
+/* %not-for-header */
+
+/* %endif */
+/* %if-c++-only */
+ yy_state_type yyFlexLexer::yy_get_previous_state()
+/* %endif */
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+/* %% [15.0] code to get the start state into yy_current_state goes here */
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+/* %% [16.0] code to find the next state goes here */
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 76 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+/* %endif */
+{
+ register int yy_is_jam;
+ /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
+ register char *yy_cp = (yy_c_buf_p);
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 76 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 75);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yyunput( int c, register char* yy_bp)
+/* %endif */
+{
+ register char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = (yy_n_chars) + 2;
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+/* %% [18.0] update yylineno here */
+
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ int yyFlexLexer::yyinput()
+/* %endif */
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ int offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+/* %% [19.0] update BOL and yylineno */
+ if ( c == '\n' )
+
+ yylineno++;
+;
+
+ return c;
+}
+/* %if-c-only */
+/* %endif */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yyrestart( std::istream* input_file )
+/* %endif */
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+ }
+
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+/* %endif */
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_load_buffer_state()
+/* %endif */
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+/* %endif */
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+/* %endif */
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c++-only */
+
+extern "C" int isatty (int );
+
+/* %endif */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+/* %endif */
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ b->yy_is_interactive = 0;
+/* %endif */
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+/* %endif */
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/* %if-c-or-c++ */
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+/* %endif */
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+/* %endif */
+
+/* %if-c-or-c++ */
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yypop_buffer_state (void)
+/* %endif */
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+/* %endif */
+
+/* %if-c-or-c++ */
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::yyensure_buffer_stack(void)
+/* %endif */
+{
+ int num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_push_state( int new_state )
+/* %endif */
+{
+ if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+ {
+ yy_size_t new_size;
+
+ (yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = (yy_start_stack_depth) * sizeof( int );
+
+ if ( ! (yy_start_stack) )
+ (yy_start_stack) = (int *) yyalloc(new_size );
+
+ else
+ (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
+
+ if ( ! (yy_start_stack) )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+ BEGIN(new_state);
+}
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ void yyFlexLexer::yy_pop_state()
+/* %endif */
+{
+ if ( --(yy_start_stack_ptr) < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+ int yyFlexLexer::yy_top_state()
+/* %endif */
+{
+ return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+ std::cerr << msg << std::endl;
+ exit( YY_EXIT_FAILURE );
+}
+/* %endif */
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/* %if-c-only */
+/* %if-reentrant */
+/* %endif */
+/* %if-reentrant */
+/* %endif */
+/* %endif */
+
+/* %if-reentrant */
+/* %if-bison-bridge */
+/* %endif */
+/* %endif */
+
+/* %if-c-only */
+/* %endif */
+
+/* %if-c-or-c++ */
+/* %if-c-only */
+/* %endif */
+/* %if-c++-only */
+yyFlexLexer::~yyFlexLexer()
+/* %endif */
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer( YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+/* %if-c++-only */
+ delete [] (yy_state_buf);
+ yyfree((yy_start_stack) );
+/* %endif */
+
+/* %if-c-only */
+/* %if-reentrant */
+/* %endif */
+/* %endif */
+}
+/* %endif */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+/* %if-tables-serialization definitions */
+/* %define-yytables The name for this specific scanner's tables. */
+#define YYTABLES_NAME "yytables"
+/* %endif */
+
+/* %ok-for-header */
+
+#line 203 "qmake.ll"
+
+
+namespace QMake
+{
+ Lexer::Lexer( std::istream* argin, std::ostream* argout )
+ : yyFlexLexer(argin, argout), mylval(0), m_lineEnding(None)
+ {
+ }
+
+ int Lexer::yylex( QMake::Parser::semantic_type* yylval )
+ {
+ mylval = yylval;
+ return yylex();
+ }
+
+ void Lexer::setLineEndingFromString( const QString& str )
+ {
+ if( str.endsWith("\r\n") && m_lineEnding == None )
+ m_lineEnding = Windows;
+ else if ( str.endsWith("\r") && m_lineEnding == None )
+ m_lineEnding = MacOS;
+ else if ( m_lineEnding == None )
+ m_lineEnding = Unix;
+ }
+
+ Lexer::LineEnding Lexer::lineending()
+ {
+ return m_lineEnding;
+ }
+}
+
+int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer)
+{
+ return lexer->yylex( yylval );
+}
+
+
diff --git a/buildtools/lib/parsers/qmake/qmake_lex.h b/buildtools/lib/parsers/qmake/qmake_lex.h
new file mode 100644
index 00000000..1b91e747
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake_lex.h
@@ -0,0 +1,49 @@
+/* KDevelop QMake Support
+ *
+ * Copyright 2007 Andreas Pakulat <apaku@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+#ifndef QMAKE_LEX_H
+#define QMAKE_LEX_H
+
+#include "qmake_yacc.hpp"
+#include <iostream>
+
+#ifndef DONT_INCLUDE_FLEXLEXER
+#include "FlexLexer.h"
+#endif
+
+namespace QMake
+{
+ class Lexer : public yyFlexLexer
+ {
+ public:
+ enum LineEnding{ None, Unix, MacOS, Windows };
+ Lexer( std::istream* argin = 0, std::ostream* argout = 0 );
+ int yylex( QMake::Parser::semantic_type* yylval );
+ int yylex();
+ void setLineEndingFromString( const QString& );
+ LineEnding lineending();
+ private:
+ QMake::Parser::semantic_type* mylval;
+ LineEnding m_lineEnding;
+ };
+}
+
+#endif
+
+// kate: space-indent on; indent-width 4; tab-width: 4; replace-tabs on; auto-insert-doxygen on
diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.cpp b/buildtools/lib/parsers/qmake/qmake_yacc.cpp
new file mode 100644
index 00000000..9cd09ebe
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake_yacc.cpp
@@ -0,0 +1,1243 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison LALR(1) parsers in C++
+
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+// Take the name prefix into account.
+#define yylex QMakelex
+
+#include "qmake_yacc.hpp"
+
+/* User implementation prologue. */
+
+
+/* Line 317 of lalr1.cc. */
+#line 45 "qmake_yacc.cpp"
+
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#define YYUSE(e) ((void) (e))
+
+/* A pseudo ostream that takes yydebug_ into account. */
+# define YYCDEBUG \
+ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
+ (*yycdebug_)
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug_) \
+ { \
+ *yycdebug_ << Title << ' '; \
+ yy_symbol_print_ ((Type), (Value), (Location)); \
+ *yycdebug_ << std::endl; \
+ } \
+} while (false)
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug_) \
+ yy_reduce_print_ (Rule); \
+} while (false)
+
+# define YY_STACK_PRINT() \
+do { \
+ if (yydebug_) \
+ yystack_print_ (); \
+} while (false)
+
+#else /* !YYDEBUG */
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_REDUCE_PRINT(Rule)
+# define YY_STACK_PRINT()
+
+#endif /* !YYDEBUG */
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+namespace QMake
+{
+#if YYERROR_VERBOSE
+
+ /* Return YYSTR after stripping away unnecessary quotes and
+ backslashes, so that it's suitable for yyerror. The heuristic is
+ that double-quoting is unnecessary unless the string contains an
+ apostrophe, a comma, or backslash (other than backslash-backslash).
+ YYSTR is taken from yytname. */
+ std::string
+ Parser::yytnamerr_ (const char *yystr)
+ {
+ if (*yystr == '"')
+ {
+ std::string yyr = "";
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ yyr += *yyp;
+ break;
+
+ case '"':
+ return yyr;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ return yystr;
+ }
+
+#endif
+
+ /// Build a parser object.
+ Parser::Parser (QMake::Lexer* lexer_yyarg, QValueStack<ProjectAST*>& projects_yyarg, int depth_yyarg)
+ : yydebug_ (false),
+ yycdebug_ (&std::cerr),
+ lexer (lexer_yyarg),
+ projects (projects_yyarg),
+ depth (depth_yyarg)
+ {
+ }
+
+ Parser::~Parser ()
+ {
+ }
+
+#if YYDEBUG
+ /*--------------------------------.
+ | Print this symbol on YYOUTPUT. |
+ `--------------------------------*/
+
+ inline void
+ Parser::yy_symbol_value_print_ (int yytype,
+ const semantic_type* yyvaluep, const location_type* yylocationp)
+ {
+ YYUSE (yylocationp);
+ YYUSE (yyvaluep);
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+ }
+
+
+ void
+ Parser::yy_symbol_print_ (int yytype,
+ const semantic_type* yyvaluep, const location_type* yylocationp)
+ {
+ *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
+ << ' ' << yytname_[yytype] << " ("
+ << *yylocationp << ": ";
+ yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
+ *yycdebug_ << ')';
+ }
+#endif /* ! YYDEBUG */
+
+ void
+ Parser::yydestruct_ (const char* yymsg,
+ int yytype, semantic_type* yyvaluep, location_type* yylocationp)
+ {
+ YYUSE (yylocationp);
+ YYUSE (yymsg);
+ YYUSE (yyvaluep);
+
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+ }
+
+ void
+ Parser::yypop_ (unsigned int n)
+ {
+ yystate_stack_.pop (n);
+ yysemantic_stack_.pop (n);
+ yylocation_stack_.pop (n);
+ }
+
+ std::ostream&
+ Parser::debug_stream () const
+ {
+ return *yycdebug_;
+ }
+
+ void
+ Parser::set_debug_stream (std::ostream& o)
+ {
+ yycdebug_ = &o;
+ }
+
+
+ Parser::debug_level_type
+ Parser::debug_level () const
+ {
+ return yydebug_;
+ }
+
+ void
+ Parser::set_debug_level (debug_level_type l)
+ {
+ yydebug_ = l;
+ }
+
+
+ int
+ Parser::parse ()
+ {
+ /// Look-ahead and look-ahead in internal form.
+ int yychar = yyempty_;
+ int yytoken = 0;
+
+ /* State. */
+ int yyn;
+ int yylen = 0;
+ int yystate = 0;
+
+ /* Error handling. */
+ int yynerrs_ = 0;
+ int yyerrstatus_ = 0;
+
+ /// Semantic value of the look-ahead.
+ semantic_type yylval;
+ /// Location of the look-ahead.
+ location_type yylloc;
+ /// The locations where the error started and ended.
+ location yyerror_range[2];
+
+ /// $$.
+ semantic_type yyval;
+ /// @$.
+ location_type yyloc;
+
+ int yyresult;
+
+ YYCDEBUG << "Starting parse" << std::endl;
+
+
+ /* Initialize the stacks. The initial state will be pushed in
+ yynewstate, since the latter expects the semantical and the
+ location values to have been already stored, initialize these
+ stacks with a primary value. */
+ yystate_stack_ = state_stack_type (0);
+ yysemantic_stack_ = semantic_stack_type (0);
+ yylocation_stack_ = location_stack_type (0);
+ yysemantic_stack_.push (yylval);
+ yylocation_stack_.push (yylloc);
+
+ /* New state. */
+ yynewstate:
+ yystate_stack_.push (yystate);
+ YYCDEBUG << "Entering state " << yystate << std::endl;
+ goto yybackup;
+
+ /* Backup. */
+ yybackup:
+
+ /* Try to take a decision without look-ahead. */
+ yyn = yypact_[yystate];
+ if (yyn == yypact_ninf_)
+ goto yydefault;
+
+ /* Read a look-ahead token. */
+ if (yychar == yyempty_)
+ {
+ YYCDEBUG << "Reading a token: ";
+ yychar = yylex (&yylval, lexer);
+ }
+
+
+ /* Convert token to internal form. */
+ if (yychar <= yyeof_)
+ {
+ yychar = yytoken = yyeof_;
+ YYCDEBUG << "Now at end of input." << std::endl;
+ }
+ else
+ {
+ yytoken = yytranslate_ (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
+ goto yydefault;
+
+ /* Reduce or error. */
+ yyn = yytable_[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == yytable_ninf_)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Accept? */
+ if (yyn == yyfinal_)
+ goto yyacceptlab;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != yyeof_)
+ yychar = yyempty_;
+
+ yysemantic_stack_.push (yylval);
+ yylocation_stack_.push (yylloc);
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus_)
+ --yyerrstatus_;
+
+ yystate = yyn;
+ goto yynewstate;
+
+ /*-----------------------------------------------------------.
+ | yydefault -- do the default action for the current state. |
+ `-----------------------------------------------------------*/
+ yydefault:
+ yyn = yydefact_[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+ /*-----------------------------.
+ | yyreduce -- Do a reduction. |
+ `-----------------------------*/
+ yyreduce:
+ yylen = yyr2_[yyn];
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'. Otherwise, use the top of the stack.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. */
+ if (yylen)
+ yyval = yysemantic_stack_[yylen - 1];
+ else
+ yyval = yysemantic_stack_[0];
+
+ {
+ slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
+ YYLLOC_DEFAULT (yyloc, slice, yylen);
+ }
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+#line 144 "qmake.yy"
+ {
+ ProjectAST *projectAST = new ProjectAST();
+ projects.push(projectAST);
+ ;}
+ break;
+
+ case 4:
+#line 152 "qmake.yy"
+ {
+ projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
+ (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
+ ;}
+ break;
+
+ case 6:
+#line 160 "qmake.yy"
+ {
+ (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
+ ;}
+ break;
+
+ case 7:
+#line 164 "qmake.yy"
+ {
+ (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
+ ;}
+ break;
+
+ case 8:
+#line 168 "qmake.yy"
+ {
+ (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
+ ;}
+ break;
+
+ case 9:
+#line 172 "qmake.yy"
+ {
+ (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
+ ;}
+ break;
+
+ case 10:
+#line 176 "qmake.yy"
+ {
+ (yyval.node) = new NewLineAST();
+ ;}
+ break;
+
+ case 11:
+#line 182 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(5) - (1)].value);
+ node->op = (yysemantic_stack_[(5) - (2)].value);
+ node->values = (yysemantic_stack_[(5) - (3)].values) ;
+ node->values.append( (yysemantic_stack_[(5) - (4)].value) );
+ node->values.append( (yysemantic_stack_[(5) - (5)].value) );
+ node->indent = (yysemantic_stack_[(5) - (3)].indent);
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 12:
+#line 193 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(5) - (1)].value);
+ node->op = (yysemantic_stack_[(5) - (2)].value);
+ node->values = (yysemantic_stack_[(5) - (3)].values) ;
+ node->values.append( (yysemantic_stack_[(5) - (4)].value) );
+ node->indent = (yysemantic_stack_[(5) - (3)].indent);
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 13:
+#line 203 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(5) - (1)].value);
+ node->op = (yysemantic_stack_[(5) - (2)].value);
+ node->values = (yysemantic_stack_[(5) - (3)].values) ;
+ node->values.append( (yysemantic_stack_[(5) - (4)].value) );
+ node->values.append( (yysemantic_stack_[(5) - (5)].value) );
+ node->indent = (yysemantic_stack_[(5) - (3)].indent);
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 14:
+#line 214 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(5) - (1)].value);
+ node->op = (yysemantic_stack_[(5) - (2)].value);
+ node->values = (yysemantic_stack_[(5) - (3)].values) ;
+ node->values.append( (yysemantic_stack_[(5) - (4)].value) );
+ node->values.append( (yysemantic_stack_[(5) - (5)].value) );
+ node->indent = (yysemantic_stack_[(5) - (3)].indent);
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 15:
+#line 225 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(4) - (1)].value);
+ node->op = (yysemantic_stack_[(4) - (2)].value);
+ node->values.append( (yysemantic_stack_[(4) - (3)].value) );
+ node->values.append( (yysemantic_stack_[(4) - (4)].value) );
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 16:
+#line 234 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(4) - (1)].value);
+ node->op = (yysemantic_stack_[(4) - (2)].value);
+ node->values.append( (yysemantic_stack_[(4) - (3)].value) );
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 17:
+#line 242 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(4) - (1)].value);
+ node->op = (yysemantic_stack_[(4) - (2)].value);
+ node->values.append( (yysemantic_stack_[(4) - (3)].value) );
+ node->values.append( (yysemantic_stack_[(4) - (4)].value) );
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 18:
+#line 251 "qmake.yy"
+ {
+ AssignmentAST *node = new AssignmentAST();
+ node->scopedID = (yysemantic_stack_[(5) - (1)].value);
+ node->op = (yysemantic_stack_[(5) - (2)].value);
+ node->values = (yysemantic_stack_[(5) - (3)].values);
+ node->values.append( (yysemantic_stack_[(5) - (4)].value) );
+ node->values.append( (yysemantic_stack_[(5) - (5)].value) );
+ node->indent = (yysemantic_stack_[(5) - (3)].indent);
+ (yyval.node) = node;
+ ;}
+ break;
+
+ case 22:
+#line 266 "qmake.yy"
+ {
+ (yyval.values).append( (yysemantic_stack_[(3) - (2)].value) );
+ (yyval.values).append( (yysemantic_stack_[(3) - (3)].value) );
+ ;}
+ break;
+
+ case 23:
+#line 271 "qmake.yy"
+ {
+ (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) );
+ ;}
+ break;
+
+ case 24:
+#line 275 "qmake.yy"
+ {
+ (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) );
+ if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" )
+ (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent);
+ ;}
+ break;
+
+ case 25:
+#line 284 "qmake.yy"
+ {
+ (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) );
+ (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) );
+ if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" )
+ (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent);
+ ;}
+ break;
+
+ case 26:
+#line 293 "qmake.yy"
+ {
+ (yyval.values) = QStringList();
+ (yyval.values).append( (yysemantic_stack_[(2) - (1)].value) );
+ (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) );
+ ;}
+ break;
+
+ case 27:
+#line 301 "qmake.yy"
+ { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
+ break;
+
+ case 28:
+#line 302 "qmake.yy"
+ { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
+ break;
+
+ case 29:
+#line 307 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ (yyval.indent) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 30:
+#line 312 "qmake.yy"
+ {
+ (yyval.value) = QString();
+ (yyval.indent) = QString();
+ ;}
+ break;
+
+ case 31:
+#line 318 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 32:
+#line 322 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 33:
+#line 326 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 34:
+#line 330 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 35:
+#line 334 "qmake.yy"
+ {
+ (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
+ ;}
+ break;
+
+ case 36:
+#line 340 "qmake.yy"
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope);
+ projects.push(projectAST);
+ projects.top()->scopedID = (yysemantic_stack_[(1) - (1)].value);
+ depth++;
+ ;}
+ break;
+
+ case 37:
+#line 347 "qmake.yy"
+ {
+ (yyval.node) = projects.pop();
+ depth--;
+ ;}
+ break;
+
+ case 38:
+#line 354 "qmake.yy"
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
+ projects.push(projectAST);
+ projects.top()->scopedID = (yysemantic_stack_[(4) - (1)].value);
+ projects.top()->args = (yysemantic_stack_[(4) - (3)].value);
+ depth++;
+
+ //qWarning("%s", $<value>1.ascii());
+ if ((yysemantic_stack_[(4) - (1)].value).contains("include"))
+ {
+ IncludeAST *includeAST = new IncludeAST();
+ includeAST->projectName = (yysemantic_stack_[(4) - (3)].value);
+ projects.top()->addChildAST(includeAST);
+ includeAST->setDepth(depth);
+ }
+ ;}
+ break;
+
+ case 39:
+#line 372 "qmake.yy"
+ {
+ (yyval.node) = projects.pop();
+ depth--;
+ ;}
+ break;
+
+ case 40:
+#line 378 "qmake.yy"
+ { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
+ break;
+
+ case 41:
+#line 379 "qmake.yy"
+ { (yyval.value) = ""; ;}
+ break;
+
+ case 43:
+#line 384 "qmake.yy"
+ {
+ projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
+ (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
+ ;}
+ break;
+
+ case 45:
+#line 392 "qmake.yy"
+ {
+ ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
+ projects.push(projectAST);
+ projects.top()->scopedID = "else";
+ projects.top()->args = "";
+ depth++;
+ ;}
+ break;
+
+ case 46:
+#line 400 "qmake.yy"
+ {
+ (yyval.node) = projects.pop();
+ depth--;
+ ;}
+ break;
+
+ case 47:
+#line 405 "qmake.yy"
+ {
+ (yyval.node) = new ProjectAST();
+ ;}
+ break;
+
+ case 48:
+#line 411 "qmake.yy"
+ {
+ CommentAST *node = new CommentAST();
+ node->comment = (yysemantic_stack_[(1) - (1)].value);
+ (yyval.node) = node;
+ ;}
+ break;
+
+
+ /* Line 675 of lalr1.cc. */
+#line 756 "qmake_yacc.cpp"
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
+
+ yypop_ (yylen);
+ yylen = 0;
+ YY_STACK_PRINT ();
+
+ yysemantic_stack_.push (yyval);
+ yylocation_stack_.push (yyloc);
+
+ /* Shift the result of the reduction. */
+ yyn = yyr1_[yyn];
+ yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
+ if (0 <= yystate && yystate <= yylast_
+ && yycheck_[yystate] == yystate_stack_[0])
+ yystate = yytable_[yystate];
+ else
+ yystate = yydefgoto_[yyn - yyntokens_];
+ goto yynewstate;
+
+ /*------------------------------------.
+ | yyerrlab -- here on detecting error |
+ `------------------------------------*/
+ yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus_)
+ {
+ ++yynerrs_;
+ error (yylloc, yysyntax_error_ (yystate));
+ }
+
+ yyerror_range[0] = yylloc;
+ if (yyerrstatus_ == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= yyeof_)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == yyeof_)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
+ yychar = yyempty_;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+ /*---------------------------------------------------.
+ | yyerrorlab -- error raised explicitly by YYERROR. |
+ `---------------------------------------------------*/
+ yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (false)
+ goto yyerrorlab;
+
+ yyerror_range[0] = yylocation_stack_[yylen - 1];
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ yypop_ (yylen);
+ yylen = 0;
+ yystate = yystate_stack_[0];
+ goto yyerrlab1;
+
+ /*-------------------------------------------------------------.
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
+ `-------------------------------------------------------------*/
+ yyerrlab1:
+ yyerrstatus_ = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact_[yystate];
+ if (yyn != yypact_ninf_)
+ {
+ yyn += yyterror_;
+ if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
+ {
+ yyn = yytable_[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yystate_stack_.height () == 1)
+ YYABORT;
+
+ yyerror_range[0] = yylocation_stack_[0];
+ yydestruct_ ("Error: popping",
+ yystos_[yystate],
+ &yysemantic_stack_[0], &yylocation_stack_[0]);
+ yypop_ ();
+ yystate = yystate_stack_[0];
+ YY_STACK_PRINT ();
+ }
+
+ if (yyn == yyfinal_)
+ goto yyacceptlab;
+
+ yyerror_range[1] = yylloc;
+ // Using YYLLOC is tempting, but would change the location of
+ // the look-ahead. YYLOC is available though.
+ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
+ yysemantic_stack_.push (yylval);
+ yylocation_stack_.push (yyloc);
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
+ &yysemantic_stack_[0], &yylocation_stack_[0]);
+
+ yystate = yyn;
+ goto yynewstate;
+
+ /* Accept. */
+ yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+ /* Abort. */
+ yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+ yyreturn:
+ if (yychar != yyeof_ && yychar != yyempty_)
+ yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ yypop_ (yylen);
+ while (yystate_stack_.height () != 1)
+ {
+ yydestruct_ ("Cleanup: popping",
+ yystos_[yystate_stack_[0]],
+ &yysemantic_stack_[0],
+ &yylocation_stack_[0]);
+ yypop_ ();
+ }
+
+ return yyresult;
+ }
+
+ // Generate an error message.
+ std::string
+ Parser::yysyntax_error_ (int yystate)
+ {
+ std::string res;
+ YYUSE (yystate);
+#if YYERROR_VERBOSE
+ int yyn = yypact_[yystate];
+ if (yypact_ninf_ < yyn && yyn <= yylast_)
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = yylast_ - yyn + 1;
+ int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
+ int count = 0;
+ for (int x = yyxbegin; x < yyxend; ++x)
+ if (yycheck_[x + yyn] == x && x != yyterror_)
+ ++count;
+
+ // FIXME: This method of building the message is not compatible
+ // with internationalization. It should work like yacc.c does it.
+ // That is, first build a string that looks like this:
+ // "syntax error, unexpected %s or %s or %s"
+ // Then, invoke YY_ on this string.
+ // Finally, use the string as a format to output
+ // yytname_[tok], etc.
+ // Until this gets fixed, this message appears in English only.
+ res = "syntax error, unexpected ";
+ res += yytnamerr_ (yytname_[tok]);
+ if (count < 5)
+ {
+ count = 0;
+ for (int x = yyxbegin; x < yyxend; ++x)
+ if (yycheck_[x + yyn] == x && x != yyterror_)
+ {
+ res += (!count++) ? ", expecting " : " or ";
+ res += yytnamerr_ (yytname_[x]);
+ }
+ }
+ }
+ else
+#endif
+ res = YY_("syntax error");
+ return res;
+ }
+
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+ const signed char Parser::yypact_ninf_ = -44;
+ const signed char
+ Parser::yypact_[] =
+ {
+ -44, 19, -44, -44, 8, 45, -44, -44, -44, -44,
+ -44, -44, -44, -44, -44, -44, -44, -44, -44, 12,
+ 10, 31, -44, 24, -44, -15, -5, 8, -44, -44,
+ -44, -44, -44, 26, -44, 14, -44, -44, -44, -44,
+ -44, -44, -44, -44, 0, 31, -44, -44, -44, 18,
+ 18, -44, -44, 20, 26, 26, 27, -44, -44, -44,
+ -44, 31, 39, -44
+ };
+
+ /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
+ doesn't specify something else to do. Zero means the default is an
+ error. */
+ const unsigned char
+ Parser::yydefact_[] =
+ {
+ 2, 0, 5, 1, 3, 36, 49, 48, 4, 6,
+ 7, 8, 9, 10, 31, 32, 33, 34, 35, 41,
+ 30, 44, 40, 0, 29, 30, 0, 0, 5, 37,
+ 38, 28, 27, 29, 23, 0, 15, 17, 21, 20,
+ 16, 26, 19, 43, 0, 44, 22, 11, 18, 13,
+ 14, 12, 42, 47, 0, 0, 0, 39, 24, 25,
+ 45, 44, 0, 46
+ };
+
+ /* YYPGOTO[NTERM-NUM]. */
+ const signed char
+ Parser::yypgoto_[] =
+ {
+ -44, -44, -44, 7, 29, -44, -32, -44, 22, -25,
+ -44, -44, -44, -44, -44, -44, -43, -44, -44, -44,
+ -44
+ };
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+ const signed char
+ Parser::yydefgoto_[] =
+ {
+ -1, 1, 2, 4, 8, 9, 41, 25, 42, 26,
+ 20, 10, 21, 11, 45, 23, 29, 57, 61, 12,
+ 13
+ };
+
+ /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says. */
+ const signed char Parser::yytable_ninf_ = -31;
+ const signed char
+ Parser::yytable_[] =
+ {
+ 35, 46, 53, 5, 31, 32, 33, 36, 37, 38,
+ 39, 5, 6, 7, 31, 32, 52, 40, 62, 3,
+ 6, 7, 58, 59, 54, 55, 47, 48, 49, 50,
+ 22, 24, -30, -30, 30, 44, 51, -30, -30, 24,
+ 38, 39, 27, 56, 60, 31, 32, 34, 28, 14,
+ 15, 16, 17, 18, 19, 63, 43
+ };
+
+ /* YYCHECK. */
+ const unsigned char
+ Parser::yycheck_[] =
+ {
+ 25, 33, 45, 3, 19, 20, 21, 12, 13, 14,
+ 15, 3, 12, 13, 19, 20, 16, 22, 61, 0,
+ 12, 13, 54, 55, 49, 50, 12, 13, 14, 15,
+ 18, 21, 14, 15, 10, 28, 22, 19, 20, 21,
+ 14, 15, 11, 23, 17, 19, 20, 25, 17, 4,
+ 5, 6, 7, 8, 9, 16, 27
+ };
+
+ /* STOS_[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+ const unsigned char
+ Parser::yystos_[] =
+ {
+ 0, 25, 26, 0, 27, 3, 12, 13, 28, 29,
+ 35, 37, 43, 44, 4, 5, 6, 7, 8, 9,
+ 34, 36, 18, 39, 21, 31, 33, 11, 17, 40,
+ 10, 19, 20, 21, 32, 33, 12, 13, 14, 15,
+ 22, 30, 32, 28, 27, 38, 30, 12, 13, 14,
+ 15, 22, 16, 40, 33, 33, 23, 41, 30, 30,
+ 17, 42, 40, 16
+ };
+
+#if YYDEBUG
+ /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
+ to YYLEX-NUM. */
+ const unsigned short int
+ Parser::yytoken_number_[] =
+ {
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278
+ };
+#endif
+
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+ const unsigned char
+ Parser::yyr1_[] =
+ {
+ 0, 24, 26, 25, 27, 27, 28, 28, 28, 28,
+ 28, 29, 29, 29, 29, 29, 29, 29, 29, 30,
+ 30, 30, 31, 31, 31, 31, 31, 32, 32, 33,
+ 33, 34, 34, 34, 34, 34, 36, 35, 38, 37,
+ 39, 39, 40, 40, 40, 42, 41, 41, 43, 44
+ };
+
+ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+ const unsigned char
+ Parser::yyr2_[] =
+ {
+ 0, 2, 0, 2, 2, 0, 1, 1, 1, 1,
+ 1, 5, 5, 5, 5, 4, 4, 4, 5, 1,
+ 1, 1, 3, 2, 5, 5, 2, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 0, 3, 0, 7,
+ 1, 0, 3, 2, 0, 0, 5, 0, 1, 1
+ };
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at \a yyntokens_, nonterminals. */
+ const char*
+ const Parser::yytname_[] =
+ {
+ "$end", "error", "$undefined", "ID_SIMPLE", "EQ", "PLUSEQ", "MINUSEQ",
+ "STAREQ", "TILDEEQ", "LBRACE", "RBRACE", "COLON", "NEWLINE", "COMMENT",
+ "CONT", "COMMENT_CONT", "RCURLY", "LCURLY", "ID_ARGS",
+ "QUOTED_VARIABLE_VALUE", "VARIABLE_VALUE", "LIST_WS", "ENDOFFILE",
+ "\"else\"", "$accept", "project", "@1", "statements", "statement",
+ "variable_assignment", "possible_value", "multiline_values",
+ "variable_value", "listws", "operator", "scope", "@2", "function_call",
+ "@3", "function_args", "scope_body", "else_statement", "@4", "comment",
+ "emptyline", 0
+ };
+#endif
+
+#if YYDEBUG
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
+ const Parser::rhs_number_type
+ Parser::yyrhs_[] =
+ {
+ 25, 0, -1, -1, 26, 27, -1, 27, 28, -1,
+ -1, 29, -1, 35, -1, 37, -1, 43, -1, 44,
+ -1, 3, 34, 31, 33, 12, -1, 3, 34, 31,
+ 33, 22, -1, 3, 34, 31, 33, 14, -1, 3,
+ 34, 31, 33, 15, -1, 3, 34, 33, 12, -1,
+ 3, 34, 33, 22, -1, 3, 34, 33, 13, -1,
+ 3, 34, 31, 33, 13, -1, 32, -1, 15, -1,
+ 14, -1, 31, 21, 30, -1, 31, 32, -1, 31,
+ 33, 14, 33, 30, -1, 31, 33, 15, 33, 30,
+ -1, 33, 30, -1, 20, -1, 19, -1, 21, -1,
+ -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
+ -1, -1, 3, 36, 40, -1, -1, 3, 9, 39,
+ 10, 38, 40, 41, -1, 18, -1, -1, 17, 27,
+ 16, -1, 11, 28, -1, -1, -1, 23, 17, 42,
+ 40, 16, -1, -1, 13, -1, 12, -1
+ };
+
+ /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+ const unsigned char
+ Parser::yyprhs_[] =
+ {
+ 0, 0, 3, 4, 7, 10, 11, 13, 15, 17,
+ 19, 21, 27, 33, 39, 45, 50, 55, 60, 66,
+ 68, 70, 72, 76, 79, 85, 91, 94, 96, 98,
+ 100, 101, 103, 105, 107, 109, 111, 112, 116, 117,
+ 125, 127, 128, 132, 135, 136, 137, 143, 144, 146
+ };
+
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+ const unsigned short int
+ Parser::yyrline_[] =
+ {
+ 0, 144, 144, 144, 151, 156, 159, 163, 167, 171,
+ 175, 181, 192, 202, 213, 224, 233, 241, 250, 263,
+ 263, 263, 265, 270, 274, 283, 292, 301, 302, 306,
+ 312, 317, 321, 325, 329, 333, 340, 339, 354, 353,
+ 378, 379, 382, 383, 388, 392, 391, 405, 410, 418
+ };
+
+ // Print the state stack on the debug stream.
+ void
+ Parser::yystack_print_ ()
+ {
+ *yycdebug_ << "Stack now";
+ for (state_stack_type::const_iterator i = yystate_stack_.begin ();
+ i != yystate_stack_.end (); ++i)
+ *yycdebug_ << ' ' << *i;
+ *yycdebug_ << std::endl;
+ }
+
+ // Report on the debug stream that the rule \a yyrule is going to be reduced.
+ void
+ Parser::yy_reduce_print_ (int yyrule)
+ {
+ unsigned int yylno = yyrline_[yyrule];
+ int yynrhs = yyr2_[yyrule];
+ /* Print the symbols being reduced, and their result. */
+ *yycdebug_ << "Reducing stack by rule " << yyrule - 1
+ << " (line " << yylno << "), ";
+ /* The symbols being reduced. */
+ for (int yyi = 0; yyi < yynrhs; yyi++)
+ YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
+ yyrhs_[yyprhs_[yyrule] + yyi],
+ &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
+ &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
+ }
+#endif // YYDEBUG
+
+ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+ Parser::token_number_type
+ Parser::yytranslate_ (int t)
+ {
+ static
+ const token_number_type
+ translate_table[] =
+ {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23
+ };
+ if ((unsigned int) t <= yyuser_token_number_max_)
+ return translate_table[t];
+ else
+ return yyundef_token_;
+ }
+
+ const int Parser::yyeof_ = 0;
+ const int Parser::yylast_ = 56;
+ const int Parser::yynnts_ = 21;
+ const int Parser::yyempty_ = -2;
+ const int Parser::yyfinal_ = 3;
+ const int Parser::yyterror_ = 1;
+ const int Parser::yyerrcode_ = 256;
+ const int Parser::yyntokens_ = 24;
+
+ const unsigned int Parser::yyuser_token_number_max_ = 278;
+ const Parser::token_number_type Parser::yyundef_token_ = 2;
+
+} // namespace QMake
+
+#line 421 "qmake.yy"
+
+
+
+namespace QMake
+{
+ void Parser::error(const location_type& /*l*/, const std::string& m)
+ {
+ std::cerr << m << std::endl;
+ }
+}
+
diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.hpp b/buildtools/lib/parsers/qmake/qmake_yacc.hpp
new file mode 100644
index 00000000..69b8a035
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmake_yacc.hpp
@@ -0,0 +1,418 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison LALR(1) parsers in C++
+
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C++ LALR(1) parser skeleton written by Akim Demaille. */
+
+#ifndef PARSER_HEADER_H
+# define PARSER_HEADER_H
+
+#include <string>
+#include <iostream>
+#include "stack.hh"
+
+namespace QMake
+{
+ class position;
+ class location;
+}
+
+/* First part of user declarations. */
+#line 1 "qmake.yy"
+
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * Copyright (C) 2006 by Andreas Pakulat *
+ * apaku@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+/**
+@file qmake.yy
+QMake Parser
+
+Simple LALR parser which builds the syntax tree (see @ref QMake::AST).
+
+@todo Recognize comments after statements like:
+SOURCES = foo #regognize me
+
+@fixme Parser fails on files that do not end with a newline
+@fixme 1 shift/reduce conflict in "line_body" rule
+*/
+
+#include <qvaluestack.h>
+#include "qmakeast.h"
+#include <qregexp.h>
+
+#define YYSTYPE_IS_DECLARED
+
+namespace QMake
+{
+ class Lexer;
+
+/**
+The yylval type.
+*/
+struct Result {
+ Result(): node(0) {}
+
+ /**Type of semantic value for simple grammar rules.*/
+ QString value;
+ /**Type of semantic value for grammar rules which are parts of AST.*/
+ AST *node;
+ /**Type of semantic value for "multiline_values" grammar rule.
+ Each line of multiline value is stored as a string in the list.
+
+ For example we have in .pro file:
+ @code
+ SOURCE = foo1.cpp \
+ foo2.cpp \
+ foo3.cpp foo4.cpp
+ @endcode
+ The string list will be populated with three strings:
+ <pre>
+ foo1.cpp
+ foo2.cpp
+ foo3.cpp foo4.cpp
+ </pre>
+ */
+ QStringList values;
+ QString indent;
+};
+
+#define YYSTYPE Result
+typedef Result YYSTYPE;
+}
+
+extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer );
+
+/**
+The stack to store ProjectAST pointers when a new child
+ProjectAST is created and filled with statements.
+
+Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
+adding statements. Each statement is added as a child StatementAST to the ProjectAST
+currently on the top in the stack.
+
+When a scope or function scope statement is parsed, the child ProjectAST is created
+and pushed onto the stack. Therefore all statements which belong to the scope
+or function scope are added as childs to their direct parent (scope or function scope).
+*/
+//QValueStack<ProjectAST*> projects;
+
+/**
+The current depth of AST node is stored here.
+AST depth is important to know because automatic indentation can
+be easily implemented (the parser itself looses all information
+about indentation).
+*/
+// int depth = 0;
+
+/*
+To debug this parser, put the line below into the next bison file section.
+Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
+%debug
+*/
+
+
+/* Line 35 of lalr1.cc. */
+#line 165 "qmake_yacc.hpp"
+
+#include "location.hh"
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 1
+#endif
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+do { \
+ if (N) \
+ { \
+ (Current).begin = (Rhs)[1].begin; \
+ (Current).end = (Rhs)[N].end; \
+ } \
+ else \
+ { \
+ (Current).begin = (Current).end = (Rhs)[0].end; \
+ } \
+} while (false)
+#endif
+
+namespace QMake
+{
+
+ /// A Bison parser.
+ class Parser
+ {
+ public:
+ /// Symbol semantic values.
+#ifndef YYSTYPE
+ typedef int semantic_type;
+#else
+ typedef YYSTYPE semantic_type;
+#endif
+ /// Symbol locations.
+ typedef location location_type;
+ /// Tokens.
+ struct token
+ {
+ /* Tokens. */
+ enum yytokentype {
+ ID_SIMPLE = 258,
+ EQ = 259,
+ PLUSEQ = 260,
+ MINUSEQ = 261,
+ STAREQ = 262,
+ TILDEEQ = 263,
+ LBRACE = 264,
+ RBRACE = 265,
+ COLON = 266,
+ NEWLINE = 267,
+ COMMENT = 268,
+ CONT = 269,
+ COMMENT_CONT = 270,
+ RCURLY = 271,
+ LCURLY = 272,
+ ID_ARGS = 273,
+ QUOTED_VARIABLE_VALUE = 274,
+ VARIABLE_VALUE = 275,
+ LIST_WS = 276,
+ ENDOFFILE = 277
+ };
+
+ };
+ /// Token type.
+ typedef token::yytokentype token_type;
+
+ /// Build a parser object.
+ Parser (QMake::Lexer* lexer_yyarg, QValueStack<ProjectAST*>& projects_yyarg, int depth_yyarg);
+ virtual ~Parser ();
+
+ /// Parse.
+ /// \returns 0 iff parsing succeeded.
+ virtual int parse ();
+
+ /// The current debugging stream.
+ std::ostream& debug_stream () const;
+ /// Set the current debugging stream.
+ void set_debug_stream (std::ostream &);
+
+ /// Type for debugging levels.
+ typedef int debug_level_type;
+ /// The current debugging level.
+ debug_level_type debug_level () const;
+ /// Set the current debugging level.
+ void set_debug_level (debug_level_type l);
+
+ private:
+ /// Report a syntax error.
+ /// \param loc where the syntax error is found.
+ /// \param msg a description of the syntax error.
+ virtual void error (const location_type& loc, const std::string& msg);
+
+ /// Generate an error message.
+ /// \param state the state where the error occurred.
+ /// \param tok the look-ahead token.
+ virtual std::string yysyntax_error_ (int yystate);
+
+#if YYDEBUG
+ /// \brief Report a symbol value on the debug stream.
+ /// \param yytype The token type.
+ /// \param yyvaluep Its semantic value.
+ /// \param yylocationp Its location.
+ virtual void yy_symbol_value_print_ (int yytype,
+ const semantic_type* yyvaluep,
+ const location_type* yylocationp);
+ /// \brief Report a symbol on the debug stream.
+ /// \param yytype The token type.
+ /// \param yyvaluep Its semantic value.
+ /// \param yylocationp Its location.
+ virtual void yy_symbol_print_ (int yytype,
+ const semantic_type* yyvaluep,
+ const location_type* yylocationp);
+#endif /* ! YYDEBUG */
+
+
+ /// State numbers.
+ typedef int state_type;
+ /// State stack type.
+ typedef stack<state_type> state_stack_type;
+ /// Semantic value stack type.
+ typedef stack<semantic_type> semantic_stack_type;
+ /// location stack type.
+ typedef stack<location_type> location_stack_type;
+
+ /// The state stack.
+ state_stack_type yystate_stack_;
+ /// The semantic value stack.
+ semantic_stack_type yysemantic_stack_;
+ /// The location stack.
+ location_stack_type yylocation_stack_;
+
+ /// Internal symbol numbers.
+ typedef unsigned char token_number_type;
+ /* Tables. */
+ /// For a state, the index in \a yytable_ of its portion.
+ static const signed char yypact_[];
+ static const signed char yypact_ninf_;
+
+ /// For a state, default rule to reduce.
+ /// Unless\a yytable_ specifies something else to do.
+ /// Zero means the default is an error.
+ static const unsigned char yydefact_[];
+
+ static const signed char yypgoto_[];
+ static const signed char yydefgoto_[];
+
+ /// What to do in a state.
+ /// \a yytable_[yypact_[s]]: what to do in state \a s.
+ /// - if positive, shift that token.
+ /// - if negative, reduce the rule which number is the opposite.
+ /// - if zero, do what YYDEFACT says.
+ static const signed char yytable_[];
+ static const signed char yytable_ninf_;
+
+ static const unsigned char yycheck_[];
+
+ /// For a state, its accessing symbol.
+ static const unsigned char yystos_[];
+
+ /// For a rule, its LHS.
+ static const unsigned char yyr1_[];
+ /// For a rule, its RHS length.
+ static const unsigned char yyr2_[];
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+ /// For a symbol, its name in clear.
+ static const char* const yytname_[];
+#endif
+
+#if YYERROR_VERBOSE
+ /// Convert the symbol name \a n to a form suitable for a diagnostic.
+ virtual std::string yytnamerr_ (const char *n);
+#endif
+
+#if YYDEBUG
+ /// A type to store symbol numbers and -1.
+ typedef signed char rhs_number_type;
+ /// A `-1'-separated list of the rules' RHS.
+ static const rhs_number_type yyrhs_[];
+ /// For each rule, the index of the first RHS symbol in \a yyrhs_.
+ static const unsigned char yyprhs_[];
+ /// For each rule, its source line number.
+ static const unsigned short int yyrline_[];
+ /// For each scanner token number, its symbol number.
+ static const unsigned short int yytoken_number_[];
+ /// Report on the debug stream that the rule \a r is going to be reduced.
+ virtual void yy_reduce_print_ (int r);
+ /// Print the state stack on the debug stream.
+ virtual void yystack_print_ ();
+#endif
+
+ /// Convert a scanner token number \a t to a symbol number.
+ token_number_type yytranslate_ (int t);
+
+ /// \brief Reclaim the memory associated to a symbol.
+ /// \param yymsg Why this token is reclaimed.
+ /// \param yytype The symbol type.
+ /// \param yyvaluep Its semantic value.
+ /// \param yylocationp Its location.
+ inline void yydestruct_ (const char* yymsg,
+ int yytype,
+ semantic_type* yyvaluep,
+ location_type* yylocationp);
+
+ /// Pop \a n symbols the three stacks.
+ inline void yypop_ (unsigned int n = 1);
+
+ /* Constants. */
+ static const int yyeof_;
+ /* LAST_ -- Last index in TABLE_. */
+ static const int yylast_;
+ static const int yynnts_;
+ static const int yyempty_;
+ static const int yyfinal_;
+ static const int yyterror_;
+ static const int yyerrcode_;
+ static const int yyntokens_;
+ static const unsigned int yyuser_token_number_max_;
+ static const token_number_type yyundef_token_;
+
+ /* Debugging. */
+ int yydebug_;
+ std::ostream* yycdebug_;
+
+
+ /* User arguments. */
+ QMake::Lexer* lexer;
+ QValueStack<ProjectAST*>& projects;
+ int depth;
+ };
+}
+
+
+#endif /* ! defined PARSER_HEADER_H */
diff --git a/buildtools/lib/parsers/qmake/qmakeast.cpp b/buildtools/lib/parsers/qmake/qmakeast.cpp
new file mode 100644
index 00000000..e6283e28
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakeast.cpp
@@ -0,0 +1,170 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "qmakeast.h"
+
+#include <kdebug.h>
+
+namespace QMake {
+
+//AST
+
+AST::~AST()
+{
+ for (QValueList<AST*>::iterator it = m_children.begin(); it != m_children.end(); ++it)
+ {
+ AST *node = *it;
+ delete node;
+ }
+ m_children.clear();
+}
+
+void AST::addChildAST(AST *node)
+{
+ m_children.append(node);
+}
+
+void AST::removeChildAST(AST *node)
+{
+ m_children.remove(node);
+}
+
+void AST::writeBack(QString &buffer)
+{
+ for (QValueList<AST*>::const_iterator it = m_children.constBegin();
+ it != m_children.constEnd(); ++it)
+ {
+ if (*it)
+ {
+ (*it)->writeBack(buffer);
+ }
+ }
+}
+
+QString AST::indentation()
+{
+ QString result;
+ for (int i = 0; i < depth(); i++)
+ result += " ";
+ return result;
+}
+
+//ProjectAST
+
+void ProjectAST::writeBack(QString &buffer)
+{
+ bool hasActualStatements = false;
+ for (QValueList<QMake::AST*>::const_iterator it = m_children.begin(); it != m_children.end(); ++it)
+ {
+ if ((*it)->nodeType() != AST::IncludeAST)
+ {
+ hasActualStatements = true;
+ break;
+ }
+ }
+
+ if (isScope())
+ {
+ if( !buffer.endsWith(": ") )
+ buffer += indentation();
+ buffer += scopedID;
+ if( m_children.count() == 1 )
+ buffer += " : ";
+ else
+ buffer += " {";
+ }
+ else if (isFunctionScope())
+ {
+ if( !buffer.endsWith(": ") )
+ buffer += indentation();
+ buffer += scopedID + "(" + args + ")";
+ if( m_children.count() == 1 && hasActualStatements )
+ buffer += ": ";
+ else if( (m_children.count() > 0 && hasActualStatements) )
+ buffer += "{";
+ else
+ buffer += "";
+ }
+ else if( !buffer.endsWith(": ") )
+ buffer += indentation();
+ AST::writeBack(buffer);
+ if (isScope() && m_children.count() > 1 )
+ buffer += indentation() + "}";
+
+ if (isFunctionScope() && (hasActualStatements) && m_children.count() > 1)
+ buffer += indentation() + "}";
+}
+
+
+void ProjectAST::setLineEnding( ProjectAST::LineEnding l )
+{
+ m_lineEnding = l;
+}
+
+ProjectAST::LineEnding ProjectAST::lineEnding()
+{
+ return m_lineEnding;
+}
+
+//AssignmentAST
+
+AssignmentAST::~AssignmentAST()
+{
+}
+
+void AssignmentAST::writeBack(QString &buffer)
+{
+ if( !buffer.endsWith(": ") )
+ buffer += indentation();
+ buffer += scopedID + " " + op;
+ if( values.first().stripWhiteSpace() != "" )
+ buffer += " ";
+ buffer += values.join("");
+}
+
+
+//NewLineAST
+
+void NewLineAST::writeBack(QString &buffer)
+{
+ buffer += "\n";
+}
+
+
+//CommentAST
+
+void CommentAST::writeBack(QString &buffer)
+{
+ if( !buffer.endsWith(": ") )
+ buffer += indentation();
+ buffer += comment;
+}
+
+
+//IncludeAST
+
+void IncludeAST::writeBack(QString &/*buffer*/)
+{
+}
+
+}
+
+// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
+
+
diff --git a/buildtools/lib/parsers/qmake/qmakeast.h b/buildtools/lib/parsers/qmake/qmakeast.h
new file mode 100644
index 00000000..b8486433
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakeast.h
@@ -0,0 +1,236 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef QMAKEQMAKEAST_H
+#define QMAKEQMAKEAST_H
+
+#include <qstringlist.h>
+
+/**
+@file qmakeast.h
+Abstract Syntax Tree (AST) class declarations.
+*/
+
+namespace QMake {
+
+/**
+AST node.
+This is the base class. Objects of this type are not created by the parser.
+
+Each AST node holds the list of its children which are always deleted in the
+destructor. This way, it's possible call delete for only root AST node and
+others will be deleted automatically.
+
+Each AST node also knows how to write the information back into .pro file.
+*/
+class AST {
+public:
+ /**Type of AST node.*/
+ enum NodeType {
+ ProjectAST /**<Project, scope or function scope.*/,
+ AssignmentAST /**<Variable assignment.*/,
+ NewLineAST /**<Line feed.*/,
+ CommentAST /**<Comment.*/,
+ IncludeAST /**<.pri include.*/,
+ OrOperatorAST /* | */
+ };
+
+ /**Constructs AST with given node type.*/
+ AST(NodeType nodeType): m_nodeType(nodeType), m_depth(0) {}
+ virtual ~AST();
+
+ /**Adds child AST node to this node. Despite this function is virtual,
+ reimplementations should call it to make automatic destruction of
+ AST tree possible.*/
+ virtual void addChildAST(AST *node);
+ /**Removes child AST node from this node. Despite this function is virtual,
+ reimplementations should call it to make automatic destruction of
+ AST tree possible.*/
+ virtual void removeChildAST(AST *node);
+ /**Writes information stored in the AST into the @p buffer.
+ This is a default implementation which iterates over child nodes
+ and calls writeBack for each child node.*/
+ virtual void writeBack(QString &buffer);
+
+ /**@return The type of the node.*/
+ virtual NodeType nodeType() const { return m_nodeType; }
+
+ /**Sets the depth of the node in AST.*/
+ void setDepth(int depth) { m_depth = depth; }
+ /**@return The depth of the node in AST.*/
+ int depth() const { return m_depth; }
+ /**@return The indentation string based on node depth.*/
+ virtual QString indentation();
+
+ /**The list of child AST nodes.*/
+ QValueList<AST*> m_children;
+
+protected:
+ NodeType m_nodeType;
+
+private:
+ int m_depth;
+
+};
+
+
+/**
+Project AST node.
+Represents complete projects, scopes and function scopes.
+Examples:
+@code
+scopename{
+var=value
+}
+function(args){
+var=value
+}
+@endcode
+*/
+class ProjectAST: public AST {
+public:
+ /**The kind of a project node.*/
+ enum Kind {
+ Project /**<Project*/,
+ Scope /**<Scope*/,
+ FunctionScope /**<FunctionScope*/,
+ Empty /**<Project does not exist, the AST is empty*/
+ };
+
+ enum LineEnding {
+ Unix,
+ MacOS,
+ Windows
+ };
+
+ /**Constructs a project node of given @p kind.*/
+ ProjectAST(Kind kind = Project): AST(AST::ProjectAST), m_kind(kind) {}
+
+ virtual void writeBack(QString &buffer);
+
+ /**@return true if this node is a project.*/
+ bool isProject() const { return m_kind == Project; }
+ /**@return true if this node is a scope.*/
+ bool isScope() const { return m_kind == Scope; }
+ /**@return true if this node is a function scope.*/
+ bool isFunctionScope() const { return m_kind == FunctionScope; }
+ /**@return true if this node is empty.*/
+ bool isEmpty() const { return m_kind == Empty; }
+
+ void setFileName(const QString& fileName) { m_fileName = fileName; }
+ QString fileName() const { return m_fileName; }
+
+ void setLineEnding( LineEnding );
+ LineEnding lineEnding();
+
+ /**Scoped identifier (scope name or function name).*/
+ QString scopedID;
+ /**Function arguments. Empty for other kinds of projects.*/
+ QString args;
+
+private:
+ Kind m_kind;
+ QString m_fileName;
+ LineEnding m_lineEnding;
+};
+
+
+/**
+Assignment AST node.
+Represents assignments, for example:
+<pre>
+var=value
+</pre>
+
+Values can be specified on several lines and
+each line is stored as a string in the list of values.@n
+For example, if we have in .pro:
+<pre>
+SOURCES=a.cpp \
+ b.cpp c.cpp
+</pre>
+then values will be stored as a two elements list:
+<pre>
+a.cpp
+ b.cpp c.cpp
+</pre>
+*/
+class AssignmentAST: public AST {
+public:
+ AssignmentAST(): AST(AST::AssignmentAST){}
+ ~AssignmentAST();
+
+ virtual void writeBack(QString &buffer);
+
+ /**Scoped name of the variable.*/
+ QString scopedID;
+ /**Operator.*/
+ QString op;
+ /**List of values.*/
+ QStringList values;
+ /**Indentation of multiline values*/
+ QString indent;
+};
+
+
+/**
+New line AST node.
+Represents line feeds in files.
+*/
+class NewLineAST: public AST {
+public:
+ NewLineAST(): AST(AST::NewLineAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+};
+
+
+/**
+Comment AST node.
+Represents comments.
+*/
+class CommentAST: public AST {
+public:
+ CommentAST(): AST(AST::CommentAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+ /**Comment text.*/
+ QString comment;
+
+};
+
+
+/**
+Include AST node.
+Represents pri include.
+ */
+class IncludeAST: public AST {
+public:
+ IncludeAST(): AST(AST::IncludeAST) {}
+
+ virtual void writeBack(QString &buffer);
+
+ QString projectName;
+};
+
+}
+
+#endif
diff --git a/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp b/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp
new file mode 100644
index 00000000..d8dd7751
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakeastvisitor.cpp
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "qmakeastvisitor.h"
+
+namespace QMake {
+
+void ASTVisitor::processProject(ProjectAST *project)
+{
+ if (project->isProject())
+ enterRealProject(project);
+ else if (project->isScope())
+ enterScope(project);
+ else if (project->isFunctionScope())
+ enterFunctionScope(project);
+ for (QValueList<QMake::AST*>::const_iterator it = project->m_children.constBegin();
+ it != project->m_children.constEnd(); ++it)
+ {
+ AST *ast = *it;
+ if (ast == 0)
+ continue;
+ switch (ast->nodeType()) {
+ case AST::AssignmentAST:
+ processAssignment(static_cast<QMake::AssignmentAST*>(ast));
+ break;
+
+ case AST::NewLineAST:
+ processNewLine(static_cast<QMake::NewLineAST*>(ast));
+ break;
+
+ case AST::CommentAST:
+ processComment(static_cast<QMake::CommentAST*>(ast));
+ break;
+
+ case AST::ProjectAST:
+ processProject(static_cast<QMake::ProjectAST*>(ast));
+ break;
+
+ case AST::IncludeAST:
+ processInclude(static_cast<QMake::IncludeAST*>(ast));
+ break;
+ }
+ }
+ if (project->isProject())
+ leaveRealProject(project);
+ else if (project->isScope())
+ leaveScope(project);
+ else if (project->isFunctionScope())
+ leaveFunctionScope(project);
+}
+
+}
diff --git a/buildtools/lib/parsers/qmake/qmakeastvisitor.h b/buildtools/lib/parsers/qmake/qmakeastvisitor.h
new file mode 100644
index 00000000..006d1de3
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakeastvisitor.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef QMAKEQMAKEASTVISITOR_H
+#define QMAKEQMAKEASTVISITOR_H
+
+#include "qmakeast.h"
+
+namespace QMake {
+
+class ASTVisitor{
+public:
+ ASTVisitor() {}
+
+ virtual void processProject(ProjectAST *);
+ virtual void enterRealProject(ProjectAST *) {}
+ virtual void leaveRealProject(ProjectAST *) {}
+ virtual void enterScope(ProjectAST *) {}
+ virtual void leaveScope(ProjectAST *) {}
+ virtual void enterFunctionScope(ProjectAST *) {}
+ virtual void leaveFunctionScope(ProjectAST *) {}
+ virtual void processAssignment(AssignmentAST *) {}
+ virtual void processNewLine(NewLineAST *) {}
+ virtual void processComment(CommentAST *) {}
+ virtual void processInclude(IncludeAST *) {}
+};
+
+}
+
+#endif
diff --git a/buildtools/lib/parsers/qmake/qmakedriver.cpp b/buildtools/lib/parsers/qmake/qmakedriver.cpp
new file mode 100644
index 00000000..3e385c7a
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakedriver.cpp
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "qmakedriver.h"
+#include "qmakeast.h"
+
+#include <qvaluestack.h>
+#include <kio/netaccess.h>
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+#include "qmake_lex.h"
+#include "qmake_yacc.hpp"
+
+namespace QMake {
+
+int Driver::parseFile(const char *fileName, ProjectAST **ast, int debug)
+{
+ std::ifstream inf( fileName, std::ios::in );
+ if ( !inf.is_open() )
+ {
+ *ast = 0;
+ return 1;
+ }
+// yydebug = 1;
+ Lexer l(&inf);
+ l.set_debug(debug);
+ int depth = 0;
+ QValueStack<ProjectAST*> stack;
+ Parser p(&l, stack, depth);
+ p.set_debug_level(debug);
+ int ret = p.parse();
+ *ast = stack.top();
+ (*ast)->setFileName(fileName);
+ switch( l.lineending() )
+ {
+ case QMake::Lexer::Windows:
+ (*ast)->setLineEnding(QMake::ProjectAST::Windows);
+ break;
+ case QMake::Lexer::MacOS:
+ (*ast)->setLineEnding(QMake::ProjectAST::MacOS);
+ break;
+ case QMake::Lexer::Unix:
+ default:
+ (*ast)->setLineEnding(QMake::ProjectAST::Unix);
+ break;
+ }
+ return ret;
+}
+
+int Driver::parseFile(QString fileName, ProjectAST **ast, int debug)
+{
+ return parseFile(fileName.ascii(), ast, debug);
+}
+
+int Driver::parseFile(KURL fileName, ProjectAST **ast, int debug)
+{
+ QString tmpFile;
+ int ret = 0;
+ if (KIO::NetAccess::download(fileName, tmpFile, 0))
+ ret = parseFile(tmpFile, ast, debug);
+ KIO::NetAccess::removeTempFile(tmpFile);
+ return ret;
+}
+
+int Driver::parseString( const char* string, ProjectAST **ast, int debug )
+{
+ std::istringstream ins;
+ ins.str(string);
+ Lexer l(&ins);
+ l.set_debug(debug);
+ int depth = 0;
+ QValueStack<ProjectAST*> stack;
+ Parser p(&l, stack, depth);
+ p.set_debug_level(debug);
+ int ret = p.parse();
+ *ast = stack.top();
+ (*ast)->setFileName("");
+ switch( l.lineending() )
+ {
+ case QMake::Lexer::Windows:
+ (*ast)->setLineEnding(QMake::ProjectAST::Windows);
+ break;
+ case QMake::Lexer::MacOS:
+ (*ast)->setLineEnding(QMake::ProjectAST::MacOS);
+ break;
+ case QMake::Lexer::Unix:
+ default:
+ (*ast)->setLineEnding(QMake::ProjectAST::Unix);
+ break;
+ }
+ return ret;
+}
+
+}
diff --git a/buildtools/lib/parsers/qmake/qmakedriver.h b/buildtools/lib/parsers/qmake/qmakedriver.h
new file mode 100644
index 00000000..a1cdc9d9
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/qmakedriver.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef QMAKEQMAKEDRIVER_H
+#define QMAKEQMAKEDRIVER_H
+
+class QString;
+class KURL;
+
+namespace QMake {
+
+/**
+@file qmakedriver.h
+Driver for a qmake parser.
+*/
+
+class ProjectAST;
+
+/**
+Driver.
+Use methods of this class to lauch parsing and build the AST.
+*/
+class Driver{
+public:
+ /**Parses the file @p fileName and stores the resulting ProjectAST root
+ into @p ast. @p ast should not be initialized before. Driver will
+ initialize it on its own.
+ @return The result of parsing. Result is 0 on success and <> 0 on failure.
+ */
+ static int parseFile(const char *fileName, ProjectAST **ast, int debug);
+ static int parseFile(QString fileName, ProjectAST **ast, int debug);
+ static int parseFile(KURL fileName, ProjectAST **ast, int debug);
+ static int parseString(const char* string, ProjectAST **ast, int debug);
+
+};
+
+}
+
+#endif
diff --git a/buildtools/lib/parsers/qmake/stack.hh b/buildtools/lib/parsers/qmake/stack.hh
new file mode 100644
index 00000000..b81e4a28
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/stack.hh
@@ -0,0 +1,129 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Stack handling for Bison parsers in C++
+
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+#ifndef BISON_STACK_HH
+# define BISON_STACK_HH
+
+#include <deque>
+
+namespace QMake
+{
+ template <class T, class S = std::deque<T> >
+ class stack
+ {
+ public:
+
+ // Hide our reversed order.
+ typedef typename S::reverse_iterator iterator;
+ typedef typename S::const_reverse_iterator const_iterator;
+
+ stack () : seq_ ()
+ {
+ }
+
+ stack (unsigned int n) : seq_ (n)
+ {
+ }
+
+ inline
+ T&
+ operator [] (unsigned int i)
+ {
+ return seq_[i];
+ }
+
+ inline
+ const T&
+ operator [] (unsigned int i) const
+ {
+ return seq_[i];
+ }
+
+ inline
+ void
+ push (const T& t)
+ {
+ seq_.push_front (t);
+ }
+
+ inline
+ void
+ pop (unsigned int n = 1)
+ {
+ for (; n; --n)
+ seq_.pop_front ();
+ }
+
+ inline
+ unsigned int
+ height () const
+ {
+ return seq_.size ();
+ }
+
+ inline const_iterator begin () const { return seq_.rbegin (); }
+ inline const_iterator end () const { return seq_.rend (); }
+
+ private:
+
+ S seq_;
+ };
+
+ /// Present a slice of the top of a stack.
+ template <class T, class S = stack<T> >
+ class slice
+ {
+ public:
+
+ slice (const S& stack,
+ unsigned int range) : stack_ (stack),
+ range_ (range)
+ {
+ }
+
+ inline
+ const T&
+ operator [] (unsigned int i) const
+ {
+ return stack_[range_ - i];
+ }
+
+ private:
+
+ const S& stack_;
+ unsigned int range_;
+ };
+}
+
+#endif // not BISON_STACK_HH
diff --git a/buildtools/lib/parsers/qmake/tests/Makefile.am b/buildtools/lib/parsers/qmake/tests/Makefile.am
new file mode 100644
index 00000000..a73f8f4e
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/Makefile.am
@@ -0,0 +1,21 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets/propeditor \
+ -I$(top_srcdir)/buildtools/lib/parsers/qmake \
+ -I$(top_builddir)/buildtools/lib/parsers/qmake/tests \
+ $(all_includes)
+
+METASOURCES = AUTO
+
+noinst_PROGRAMS = runner viewer
+
+runner_LDFLAGS = $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH)
+runner_LDADD = $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la
+runner_SOURCES = runner.cpp
+
+viewer_LDFLAGS = --no-undefined $(all_libraries) $(LIB_KDECORE) $(KDE_RPATH)
+viewer_LDADD = $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la
+viewer_SOURCES = viewer.cpp viewer_main.cpp viewerbase.ui
diff --git a/buildtools/lib/parsers/qmake/tests/runner.cpp b/buildtools/lib/parsers/qmake/tests/runner.cpp
new file mode 100644
index 00000000..b01284f1
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/runner.cpp
@@ -0,0 +1,169 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <cstdlib>
+#include <iostream>
+#include <stdio.h>
+#include "qmakedriver.h"
+#include "qmakeastvisitor.h"
+
+#include <qstring.h>
+
+#include <kdebug.h>
+#include <kcmdlineargs.h>
+#include <kurl.h>
+
+static const KCmdLineOptions options[] =
+{
+ {"silent", "Enable Parser debug output", 0},
+ {"!debug", "Disable output of the generated AST", 0},
+ {"!+files", "QMake project files", 0}
+};
+
+
+class PrintAST : QMake::ASTVisitor
+{
+public:
+ PrintAST() : QMake::ASTVisitor()
+ {
+ indent = 0;
+ }
+
+ virtual void processProject( QMake::ProjectAST* p )
+ {
+ QMake::ASTVisitor::processProject(p);
+ }
+private:
+ virtual void enterRealProject( QMake::ProjectAST* p )
+ {
+ kdDebug(9024) << getIndent() << "--------- Entering Project: " << replaceWs(p->fileName()) << "| LineEnding:" << p->lineEnding() << " --------------" << endl;
+ indent += 4;
+ QMake::ASTVisitor::enterRealProject(p);
+ }
+
+ virtual void leaveRealProject( QMake::ProjectAST* p )
+ {
+ indent -= 4;
+ kdDebug(9024) << getIndent() << "--------- Leaving Project: " << replaceWs(p->fileName()) << " --------------" << endl;
+ QMake::ASTVisitor::leaveRealProject(p);
+ }
+
+ virtual void enterScope( QMake::ProjectAST* p )
+ {
+ kdDebug(9024) << getIndent() << "--------- Entering Scope: " << replaceWs(p->scopedID) << " --------------" << endl;
+ indent += 4;
+ QMake::ASTVisitor::enterScope(p);
+ }
+
+ virtual void leaveScope( QMake::ProjectAST* p )
+ {
+ indent -= 4;
+ kdDebug(9024) << getIndent() << "--------- Leaving Scope: " << replaceWs(p->scopedID) << " --------------" << endl;
+ QMake::ASTVisitor::leaveScope(p);
+ }
+
+ virtual void enterFunctionScope( QMake::ProjectAST* p )
+ {
+ kdDebug(9024) << getIndent() << "--------- Entering FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl;
+ indent += 4;
+ QMake::ASTVisitor::enterFunctionScope(p);
+ }
+
+ virtual void leaveFunctionScope( QMake::ProjectAST* p )
+ {
+ indent -= 4;
+ kdDebug(9024) << getIndent() << "--------- Leaving FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl;
+ QMake::ASTVisitor::leaveFunctionScope(p);
+ }
+
+ QString replaceWs(QString s)
+ {
+ return s.replace("\n", "%nl").replace("\t", "%tab").replace(" ", "%spc");
+ }
+
+ virtual void processAssignment( QMake::AssignmentAST* a)
+ {
+ kdDebug(9024) << getIndent() << "Assignment(" << replaceWs(a->indent) << "):" << replaceWs(a->scopedID) << " " << replaceWs(a->op) << " " << replaceWs(a->values.join("|")) << endl;
+ QMake::ASTVisitor::processAssignment(a);
+ }
+
+ virtual void processNewLine( QMake::NewLineAST* n)
+ {
+ kdDebug(9024) << getIndent() << "Newline " << endl;
+ QMake::ASTVisitor::processNewLine(n);
+ }
+
+ virtual void processComment( QMake::CommentAST* a)
+ {
+ kdDebug(9024) << getIndent() << "Comment: " << replaceWs(a->comment) << endl;
+ QMake::ASTVisitor::processComment(a);
+ }
+
+ virtual void processInclude( QMake::IncludeAST* a)
+ {
+ kdDebug(9024) << getIndent() << "Include: " << replaceWs(a->projectName) << endl;
+ QMake::ASTVisitor::processInclude(a);
+ }
+
+ QString getIndent()
+ {
+ QString ind;
+ for( int i = 0 ; i < indent ; i++)
+ ind += " ";
+ return ind;
+ }
+ int indent;
+};
+int main(int argc, char *argv[])
+{
+ KCmdLineArgs::init( argc, argv, "QMake Parser", "qmake-parser", "Parse QMake project files", "1.0.0");
+ KCmdLineArgs::addCmdLineOptions(options);
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if( args->count() < 1 )
+ {
+ KCmdLineArgs::usage(0);
+ }
+
+ int debug = 0;
+ bool silent = false;
+
+ if( args->isSet("silent") )
+ silent = true;
+ if( args->isSet("debug") )
+ debug = 1;
+ for( int i = 0 ; i < args->count() ; i++ )
+ {
+ QMake::ProjectAST *projectAST;
+ int ret = QMake::Driver::parseFile(args->url(i).path(), &projectAST, debug);
+ PrintAST pa;
+ if ( ret == 0 )
+ if ( !silent )
+ {
+ pa.processProject(projectAST);
+ QString profile;
+ projectAST->writeBack(profile);
+ kdDebug(9024) << "QMake file written back:\n" << profile << endl;
+ }
+ return ret;
+ }
+ return 0;
+}
diff --git a/buildtools/lib/parsers/qmake/tests/viewer.cpp b/buildtools/lib/parsers/qmake/tests/viewer.cpp
new file mode 100644
index 00000000..dba2b7fb
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/viewer.cpp
@@ -0,0 +1,182 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "viewer.h"
+
+#include <qdir.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qfiledialog.h>
+#include <qtextedit.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qlistview.h>
+#include <qtabwidget.h>
+
+#include <qmakeast.h>
+#include <qmakedriver.h>
+#include <qmakeastvisitor.h>
+
+using namespace QMake;
+
+Viewer::Viewer(QWidget *parent, const char *name)
+ :ViewerBase(parent, name), projectAST(0)
+{
+ if (QFile::exists(QDir::currentDirPath() + "/" + "qtlist"))
+ {
+ QFile f(QDir::currentDirPath() + "/" + "qtlist");
+ f.open(IO_ReadOnly);
+ QTextStream str(&f);
+ while (!str.eof())
+ files->insertItem(str.readLine());
+ }
+ ast->setSorting(-1);
+// parentProject.push((QListViewItem*)0);
+}
+
+void Viewer::addAll_clicked()
+{
+ if (allLocation->text().isEmpty())
+ return;
+ QDir d(allLocation->text());
+ QStringList l = d.entryList("*.pro *.pri");
+ for (QStringList::iterator it = l.begin(); it != l.end(); ++it)
+ (*it) = QDir::cleanDirPath(allLocation->text() + "/" + (*it));
+ files->insertStringList(l);
+}
+
+void Viewer::choose_clicked()
+{
+ QString fileName = QFileDialog::getOpenFileName(QDir::currentDirPath(), "*.pro *.pri", this);
+ if (!fileName.isEmpty())
+ files->insertItem(fileName);
+}
+
+void Viewer::files_currentChanged(QListBoxItem* item)
+{
+ ast->clear();
+
+ QFile f(item->text());
+ f.open(IO_ReadOnly);
+ QTextStream str(&f);
+ source->setText(str.read());
+ f.close();
+
+ int result = QMake::Driver::parseFile(item->text().ascii(), &projectAST, 0);
+ if (projectAST && (result == 0))
+ {
+ processAST(projectAST);
+ }
+ if (tabWidget2->currentPageIndex() == 1)
+ tabWidget2_selected("Source to be written back");
+}
+
+void Viewer::tabWidget2_selected(const QString& text)
+{
+ if ((text == "Source to Be Written Back") && projectAST)
+ {
+ QString buffer;
+ projectAST->writeBack(buffer);
+ writeBack->setText(buffer);
+ }
+}
+
+class ViewerVisitor: public ASTVisitor {
+public:
+ ViewerVisitor(Viewer *v): ASTVisitor()
+ {
+ this->v = v;
+ parentProject.push((QListViewItem*)0);
+ }
+
+ virtual void processProject(ProjectAST *project)
+ {
+ ASTVisitor::processProject(project);
+ }
+
+ virtual void enterRealProject(ProjectAST *project)
+ {
+ QListViewItem *projectIt;
+ if (!parentProject.top())
+ {
+ projectIt = new QListViewItem(v->ast, "Project");
+ projectIt->setOpen(true);
+ parentProject.push(projectIt);
+ }
+
+ ASTVisitor::enterRealProject(project);
+ }
+ virtual void enterScope(ProjectAST *scope)
+ {
+ QListViewItem *projectIt = new QListViewItem(parentProject.top(), scope->scopedID, "scope");
+ parentProject.push(projectIt);
+ ASTVisitor::enterScope(scope);
+ }
+ virtual void leaveScope(ProjectAST *scope)
+ {
+ parentProject.pop();
+ }
+ virtual void enterFunctionScope(ProjectAST *fscope)
+ {
+ QListViewItem *projectIt = new QListViewItem(parentProject.top(),
+ fscope->scopedID + "(" + fscope->args + ")", "function scope");
+ parentProject.push(projectIt);
+ ASTVisitor::enterFunctionScope(fscope);
+ }
+ virtual void leaveFunctionScope(ProjectAST *fscope)
+ {
+ parentProject.pop();
+ }
+ virtual void processAssignment(AssignmentAST *assignment)
+ {
+ QListViewItem *item = new QListViewItem(parentProject.top(),
+ assignment->scopedID, assignment->op, assignment->values.join("|"),
+ "assignment");
+ item->setMultiLinesEnabled(true);
+
+ ASTVisitor::processAssignment(assignment);
+ }
+ virtual void processNewLine(NewLineAST *newline)
+ {
+ new QListViewItem(parentProject.top(), "<newline>");
+ ASTVisitor::processNewLine(newline);
+ }
+ virtual void processComment(CommentAST *comment)
+ {
+ new QListViewItem(parentProject.top(), "<comment>");
+ ASTVisitor::processComment(comment);
+ }
+ virtual void processInclude(IncludeAST *include)
+ {
+ new QListViewItem(parentProject.top(), "<include>", include->projectName);
+ QMake::ASTVisitor::processInclude(include);
+ }
+
+ Viewer *v;
+ QValueStack<QListViewItem *> parentProject;
+};
+
+
+void Viewer::processAST(QMake::ProjectAST *projectAST, QListViewItem *globAfter)
+{
+ ViewerVisitor visitor(this);
+ visitor.processProject(projectAST);
+}
+
+#include "viewer.moc"
diff --git a/buildtools/lib/parsers/qmake/tests/viewer.h b/buildtools/lib/parsers/qmake/tests/viewer.h
new file mode 100644
index 00000000..8d0da49f
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/viewer.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef VIEWER_H
+#define VIEWER_H
+
+#include <qvaluestack.h>
+
+#include "viewerbase.h"
+
+namespace QMake {
+class ProjectAST;
+}
+
+class QListViewItem;
+
+class Viewer: public ViewerBase {
+Q_OBJECT
+public:
+ Viewer(QWidget *parent = 0, const char *name = 0);
+ void processAST(QMake::ProjectAST *projectAST, QListViewItem *globAfter = 0);
+public slots:
+ virtual void tabWidget2_selected(const QString&);
+ virtual void files_currentChanged(QListBoxItem*);
+ virtual void choose_clicked();
+ virtual void addAll_clicked();
+private:
+ QMake::ProjectAST *projectAST;
+ friend class ViewerVisitor;
+};
+
+#endif
diff --git a/buildtools/lib/parsers/qmake/tests/viewer_main.cpp b/buildtools/lib/parsers/qmake/tests/viewer_main.cpp
new file mode 100644
index 00000000..8fdbc910
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/viewer_main.cpp
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <qapplication.h>
+#include "viewer.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ Viewer viewer;
+ app.setMainWidget(&viewer);
+ viewer.show();
+ viewer.setWindowState(viewer.windowState() | Qt::WindowMaximized);
+
+ return app.exec();
+}
diff --git a/buildtools/lib/parsers/qmake/tests/viewerbase.ui b/buildtools/lib/parsers/qmake/tests/viewerbase.ui
new file mode 100644
index 00000000..976d4d0f
--- /dev/null
+++ b/buildtools/lib/parsers/qmake/tests/viewerbase.ui
@@ -0,0 +1,250 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ViewerBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ViewerBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Viewer</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter" row="0" column="0">
+ <property name="name">
+ <cstring>splitter5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>allLocation</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addAll</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Add All From Directory</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>choose</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Choose File to Add...</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>files</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="hScrollBarMode">
+ <enum>Auto</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>source</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Parse Tree</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value 1</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value 2</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value 3</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>ast</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Source to Be Written Back</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit" row="0" column="0">
+ <property name="name">
+ <cstring>writeBack</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>addAll</sender>
+ <signal>clicked()</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>addAll_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>choose</sender>
+ <signal>clicked()</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>choose_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>files</sender>
+ <signal>currentChanged(QListBoxItem*)</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>files_currentChanged(QListBoxItem*)</slot>
+ </connection>
+ <connection>
+ <sender>tabWidget2</sender>
+ <signal>selected(const QString&amp;)</signal>
+ <receiver>ViewerBase</receiver>
+ <slot>tabWidget2_selected(const QString&amp;)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>addAll_clicked()</slot>
+ <slot>choose_clicked()</slot>
+ <slot>files_currentChanged( QListBoxItem * )</slot>
+ <slot>tabWidget2_selected( const QString &amp; )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/buildtools/lib/widgets/Mainpage.dox b/buildtools/lib/widgets/Mainpage.dox
new file mode 100644
index 00000000..56884c97
--- /dev/null
+++ b/buildtools/lib/widgets/Mainpage.dox
@@ -0,0 +1,10 @@
+/**
+@mainpage The KDevelop Buildtool Widgets Library
+
+This library contains widgets commonly used in buildtool support plugins.
+
+<b>Link with</b>: -lkdevbuildtoolswidgets
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/buildtools/widgets
+*/
+
diff --git a/buildtools/lib/widgets/Makefile.am b/buildtools/lib/widgets/Makefile.am
new file mode 100644
index 00000000..2277d9d0
--- /dev/null
+++ b/buildtools/lib/widgets/Makefile.am
@@ -0,0 +1,30 @@
+# This directory collects some classes related to
+# project management for the sole purpose that they
+# can be shared between parts.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/lib/widgets/propeditor $(all_includes)
+
+lib_LTLIBRARIES = libkdevbuildtoolswidgets.la
+libkdevbuildtoolswidgets_la_LDFLAGS = $(all_libraries)
+libkdevbuildtoolswidgets_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la \
+ $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) -lktexteditor
+libkdevbuildtoolswidgets_la_SOURCES = addenvvardlg.cpp addfilesdialog.cpp \
+ environmentdisplaydialog.cpp environmentdisplaydialogbase.ui environmentvariableswidget.cpp \
+ environmentvariableswidgetbase.ui envvartools.cpp makeoptionswidget.cpp makeoptionswidgetbase.ui \
+ removesubprojectdialog.cpp removesubprojectdlgbase.ui runoptionswidget.cpp runoptionswidgetbase.ui \
+ subclassesdlg.cpp subclassesdlgbase.ui
+
+METASOURCES = AUTO
+
+kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/widgets
+kdevelopbuildtoolsinclude_HEADERS = addenvvardlg.h addfilesdialog.h \
+ environmentvariableswidget.h environmentvariableswidgetbase.h envvartools.h makeoptionswidget.h \
+ makeoptionswidgetbase.h removesubprojectdialog.h removesubprojectdlgbase.h runoptionswidget.h \
+ runoptionswidgetbase.h subclassesdlg.h subclassesdlgbase.h
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevutil
+DOXYGEN_PROJECTNAME = KDevelop Buildtool Widgets Library
+DOXYGEN_DOCDIRPREFIX = kdevbt
+include ../../../Doxyfile.am
+noinst_HEADERS = environmentdisplaydialog.h
diff --git a/buildtools/lib/widgets/addenvvardlg.cpp b/buildtools/lib/widgets/addenvvardlg.cpp
new file mode 100644
index 00000000..aaf82774
--- /dev/null
+++ b/buildtools/lib/widgets/addenvvardlg.cpp
@@ -0,0 +1,84 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <kbuttonbox.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+#include "addenvvardlg.h"
+
+
+AddEnvvarDialog::AddEnvvarDialog(QWidget *parent, const char *name)
+ : QDialog(parent, name, true)
+{
+ setCaption(i18n("Add Environment Variable"));
+
+ QLabel *varname_label = new QLabel(i18n("&Name:"), this);
+ varname_edit = new KLineEdit(this);
+ varname_edit->setFocus();
+ varname_label->setBuddy(varname_edit);
+
+ connect( varname_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) );
+ QLabel *value_label = new QLabel(i18n("&Value:"), this);
+ value_edit = new KLineEdit(this);
+ value_label->setBuddy(value_edit);
+ QFontMetrics fm(value_edit->fontMetrics());
+ value_edit->setMinimumWidth(fm.width('X')*35);
+ connect( value_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) );
+
+
+ QVBoxLayout *layout = new QVBoxLayout(this, 10);
+
+ QGridLayout *grid = new QGridLayout(2, 2);
+ layout->addLayout(grid);
+ grid->addWidget(varname_label, 0, 0);
+ grid->addWidget(varname_edit, 0, 1);
+ grid->addWidget(value_label, 1, 0);
+ grid->addWidget(value_edit, 1, 1);
+
+ QFrame *frame = new QFrame(this);
+ frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+ layout->addWidget(frame, 0);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ buttonbox->addStretch();
+ m_pOk = buttonbox->addButton( KStdGuiItem::ok());
+ QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
+ m_pOk->setDefault(true);
+ connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) );
+ buttonbox->layout();
+ layout->addWidget(buttonbox, 0);
+ slotTextChanged();
+}
+
+
+AddEnvvarDialog::~AddEnvvarDialog()
+{}
+
+void AddEnvvarDialog::slotTextChanged()
+{
+ m_pOk->setEnabled( !varname_edit->text().isEmpty() && !value_edit->text().isEmpty() );
+}
+
+#include "addenvvardlg.moc"
diff --git a/buildtools/lib/widgets/addenvvardlg.h b/buildtools/lib/widgets/addenvvardlg.h
new file mode 100644
index 00000000..0ffdbde1
--- /dev/null
+++ b/buildtools/lib/widgets/addenvvardlg.h
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _ADDENVVARDLG_H_
+#define _ADDENVVARDLG_H_
+
+#include <qdialog.h>
+#include <klineedit.h>
+class QPushButton;
+
+/**
+Dialog to add environment variables.
+*/
+class AddEnvvarDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddEnvvarDialog( QWidget *parent=0, const char *name=0 );
+ ~AddEnvvarDialog();
+
+ QString varname() const
+ { return varname_edit->text(); }
+ QString value() const
+ { return value_edit->text(); }
+ void setvarname(const QString name) const
+ { varname_edit->setText(name); }
+ void setvalue(const QString value) const
+ { value_edit->setText(value); }
+ private slots:
+ void slotTextChanged();
+private:
+ KLineEdit *varname_edit;
+ KLineEdit *value_edit;
+ QPushButton *m_pOk;
+};
+
+#endif
diff --git a/buildtools/lib/widgets/addfilesdialog.cpp b/buildtools/lib/widgets/addfilesdialog.cpp
new file mode 100644
index 00000000..8ba14539
--- /dev/null
+++ b/buildtools/lib/widgets/addfilesdialog.cpp
@@ -0,0 +1,78 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <klocale.h>
+#include <kapplication.h>
+
+#include <qcombobox.h>
+
+#include "addfilesdialog.h"
+#include "addfilesdialog.moc"
+
+AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name, bool modal):
+ KFileDialog(startDir, filter, parent, name, modal)
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Add Files Dialog");
+
+ m_extraWidget = new QComboBox(false, this);
+ m_extraWidget->insertItem(i18n("Copy File(s)"), 0);
+ m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1);
+ m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2);
+ m_extraWidget->setCurrentItem(config->readNumEntry("Mode"));
+ connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int)));
+
+ setPreviewWidget(m_extraWidget);
+
+ setOperationMode(Opening);
+}
+
+
+AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name, bool modal, QComboBox *extraWidget):
+ KFileDialog(startDir, filter, parent, name, modal, extraWidget), m_extraWidget(extraWidget)
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Add Files Dialog");
+
+ m_extraWidget->insertItem(i18n("Copy File(s)"), 0);
+ m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1);
+ m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2);
+ m_extraWidget->setCurrentItem(config->readNumEntry("Mode"));
+ connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int)));
+
+ setOperationMode(Opening);
+}
+
+
+AddFilesDialog::~AddFilesDialog()
+{
+}
+
+AddFilesDialog::Mode AddFilesDialog::mode( )
+{
+ return (AddFilesDialog::Mode)m_extraWidget->currentItem();
+}
+
+void AddFilesDialog::storePreferred( int index )
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Add Files Dialog");
+ config->writeEntry("Mode", index);
+}
diff --git a/buildtools/lib/widgets/addfilesdialog.h b/buildtools/lib/widgets/addfilesdialog.h
new file mode 100644
index 00000000..00b238a7
--- /dev/null
+++ b/buildtools/lib/widgets/addfilesdialog.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef ADDFILESDIALOG_H
+#define ADDFILESDIALOG_H
+
+#include <kdeversion.h>
+#include <kfiledialog.h>
+
+class QComboBox;
+
+/**
+This class allows you to choose additional modes when adding
+files to the project.
+Currently available modes are Copy, Link and Relative.
+Relative means that file should be not copied but added
+with the relative path (e.g. ../../dir/filename)
+*/
+class AddFilesDialog : public KFileDialog
+{
+ Q_OBJECT
+public:
+ enum Mode { Copy, Link, Relative };
+
+ AddFilesDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name, bool modal);
+
+ AddFilesDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name, bool modal, QComboBox *extraWidget);
+
+ virtual ~AddFilesDialog();
+
+ virtual AddFilesDialog::Mode mode();
+
+private:
+ QComboBox * m_extraWidget;
+
+private slots:
+ void storePreferred(int index);
+};
+
+#endif
diff --git a/buildtools/lib/widgets/environmentdisplaydialog.cpp b/buildtools/lib/widgets/environmentdisplaydialog.cpp
new file mode 100644
index 00000000..7d01b031
--- /dev/null
+++ b/buildtools/lib/widgets/environmentdisplaydialog.cpp
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 Jens Dagerbo <jens.dagerbo@swipnet.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <unistd.h>
+#include <klistview.h>
+#include <qstringlist.h>
+
+#include "environmentdisplaydialog.h"
+
+extern char **environ;
+
+EnvironmentDisplayDialog::EnvironmentDisplayDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
+: EnvironmentDisplayDialogBase(parent,name, modal,fl)
+{
+ QStringList environment;
+ char ** e = ::environ;
+
+ while ( *e )
+ {
+ environment << *e;
+ e++;
+ }
+
+ QStringList::ConstIterator it = environment.begin();
+ while( it !=environment.end() )
+ {
+ QStringList pair = QStringList::split( QChar('='), *it );
+ if ( pair.count() == 2 )
+ {
+ new QListViewItem( environmentListView, pair.first(), pair.last() );
+ }
+ ++it;
+ }
+}
+
+
+#include "environmentdisplaydialog.moc"
+
diff --git a/buildtools/lib/widgets/environmentdisplaydialog.h b/buildtools/lib/widgets/environmentdisplaydialog.h
new file mode 100644
index 00000000..af284a3b
--- /dev/null
+++ b/buildtools/lib/widgets/environmentdisplaydialog.h
@@ -0,0 +1,35 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 Jens Dagerbo <jens.dagerbo@swipnet.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef ENVIRONMENTDISPLAYDIALOG_H
+#define ENVIRONMENTDISPLAYDIALOG_H
+
+
+#include "environmentdisplaydialogbase.h"
+
+class EnvironmentDisplayDialog : public EnvironmentDisplayDialogBase
+{
+Q_OBJECT
+
+public:
+ EnvironmentDisplayDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+};
+
+#endif
+
diff --git a/buildtools/lib/widgets/environmentdisplaydialogbase.ui b/buildtools/lib/widgets/environmentdisplaydialogbase.ui
new file mode 100644
index 00000000..8b41862f
--- /dev/null
+++ b/buildtools/lib/widgets/environmentdisplaydialogbase.ui
@@ -0,0 +1,111 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>EnvironmentDisplayDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EnvironmentDisplayDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>583</width>
+ <height>523</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Environment</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Current Environment</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Variable</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>environmentListView</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>321</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>EnvironmentDisplayDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/lib/widgets/environmentvariableswidget.cpp b/buildtools/lib/widgets/environmentvariableswidget.cpp
new file mode 100644
index 00000000..7ba08427
--- /dev/null
+++ b/buildtools/lib/widgets/environmentvariableswidget.cpp
@@ -0,0 +1,126 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2003 John Firebaugh <jfirebaugh@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "environmentvariableswidget.h"
+#include "environmentdisplaydialog.h"
+
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+#include <qlistview.h>
+#include "domutil.h"
+#include "addenvvardlg.h"
+
+
+void EnvironmentVariablesWidget::addVarClicked()
+{
+ AddEnvvarDialog dlg( this, "add env dialog" ) ;
+ if (QListViewItem *Item = listview->selectedItem())
+ {
+ dlg.setvarname(Item->text(0));
+ dlg.setvalue(Item->text(1));
+ }
+ if (!dlg.exec())
+ return;
+
+ (void) new QListViewItem(listview, dlg.varname(), dlg.value());
+}
+
+
+void EnvironmentVariablesWidget::editVarClicked()
+{
+ AddEnvvarDialog dlg( this, "edit env dialog" );
+ QListViewItem *item = listview->selectedItem();
+ if ( !item )
+ return;
+ dlg.setvarname(item->text(0));
+ dlg.setvalue(item->text(1));
+ if (!dlg.exec())
+ return;
+
+ item->setText(0,dlg.varname());
+ item->setText(1,dlg.value());
+}
+
+
+void EnvironmentVariablesWidget::removeVarClicked()
+{
+ delete listview->selectedItem();
+}
+
+
+EnvironmentVariablesWidget::EnvironmentVariablesWidget(QDomDocument &dom, const QString &configGroup,
+ QWidget *parent, const char *name)
+ : EnvironmentVariablesWidgetBase(parent, name),
+ m_dom(dom), m_configGroup(configGroup)
+{
+ readEnvironment(dom, configGroup);
+ connect( listview, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), this, SLOT( editVarClicked() ) );
+}
+
+
+EnvironmentVariablesWidget::~EnvironmentVariablesWidget()
+{}
+
+void EnvironmentVariablesWidget::readEnvironment(QDomDocument &dom, const QString &configGroup)
+{
+ m_dom = dom;
+ m_configGroup = configGroup;
+
+ listview->clear();
+
+ DomUtil::PairList list =
+ DomUtil::readPairListEntry(dom, m_configGroup, "envvar", "name", "value");
+
+ QListViewItem *lastItem = 0;
+
+ DomUtil::PairList::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ QListViewItem *newItem = new QListViewItem(listview, (*it).first, (*it).second);
+ if (lastItem)
+ newItem->moveItem(lastItem);
+ lastItem = newItem;
+ }
+}
+
+void EnvironmentVariablesWidget::changeConfigGroup( const QString &configGroup)
+{
+ m_configGroup = configGroup;
+}
+
+void EnvironmentVariablesWidget::accept()
+{
+ DomUtil::PairList list;
+ QListViewItem *item = listview->firstChild();
+ while (item) {
+ list << DomUtil::Pair(item->text(0), item->text(1));
+ item = item->nextSibling();
+ }
+
+ DomUtil::writePairListEntry(m_dom, m_configGroup, "envvar", "name", "value", list);
+}
+
+void EnvironmentVariablesWidget::environmentClicked()
+{
+ EnvironmentDisplayDialog dlg;
+ dlg.exec();
+}
+
+#include "environmentvariableswidget.moc"
diff --git a/buildtools/lib/widgets/environmentvariableswidget.h b/buildtools/lib/widgets/environmentvariableswidget.h
new file mode 100644
index 00000000..9f2d472e
--- /dev/null
+++ b/buildtools/lib/widgets/environmentvariableswidget.h
@@ -0,0 +1,59 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (C) 2003 John Firebaugh <jfirebaugh@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _ENVIRONMENTVARIABLESWIDGET_H_
+#define _ENVIRONMENTVARIABLESWIDGET_H_
+
+#include "environmentvariableswidgetbase.h"
+
+#include <qdom.h>
+
+/**
+Environment variables widget.
+*/
+class EnvironmentVariablesWidget : public EnvironmentVariablesWidgetBase
+{
+ Q_OBJECT
+
+public:
+ EnvironmentVariablesWidget( QDomDocument &dom, const QString &configGroup,
+ QWidget *parent=0, const char *name=0 );
+ ~EnvironmentVariablesWidget();
+
+ /// read in a set of environment variables from the DOM document
+ void readEnvironment(QDomDocument &dom, const QString &configGroup);
+
+ /// changes the path in the DOM structure where the environment variables are stored
+ void changeConfigGroup( const QString &configGroup);
+
+public slots:
+ void accept();
+
+private:
+ virtual void addVarClicked();
+ virtual void removeVarClicked();
+ virtual void editVarClicked();
+ virtual void environmentClicked();
+
+ QDomDocument &m_dom;
+ QString m_configGroup;
+};
+
+#endif
diff --git a/buildtools/lib/widgets/environmentvariableswidgetbase.ui b/buildtools/lib/widgets/environmentvariableswidgetbase.ui
new file mode 100644
index 00000000..d16cc613
--- /dev/null
+++ b/buildtools/lib/widgets/environmentvariableswidgetbase.ui
@@ -0,0 +1,200 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>EnvironmentVariablesWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>EnvironmentVariablesWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>451</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Environment Variables</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView" row="0" column="0" rowspan="6" colspan="1">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>removevar_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>editvar_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Edit</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>addvar_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>A&amp;dd / Copy</string>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="4" column="1">
+ <property name="name">
+ <cstring>environmentButton</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;nvironment</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>171</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>addvar_button</sender>
+ <signal>clicked()</signal>
+ <receiver>EnvironmentVariablesWidgetBase</receiver>
+ <slot>addVarClicked()</slot>
+ </connection>
+ <connection>
+ <sender>removevar_button</sender>
+ <signal>clicked()</signal>
+ <receiver>EnvironmentVariablesWidgetBase</receiver>
+ <slot>removeVarClicked()</slot>
+ </connection>
+ <connection>
+ <sender>editvar_button</sender>
+ <signal>clicked()</signal>
+ <receiver>EnvironmentVariablesWidgetBase</receiver>
+ <slot>editVarClicked()</slot>
+ </connection>
+ <connection>
+ <sender>environmentButton</sender>
+ <signal>clicked()</signal>
+ <receiver>EnvironmentVariablesWidgetBase</receiver>
+ <slot>environmentClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>listview</tabstop>
+ <tabstop>addvar_button</tabstop>
+ <tabstop>removevar_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot>addVarClicked()</slot>
+ <slot>removeVarClicked()</slot>
+ <slot>editVarClicked()</slot>
+ <slot>environmentClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/lib/widgets/envvartools.cpp b/buildtools/lib/widgets/envvartools.cpp
new file mode 100644
index 00000000..bc8eaf51
--- /dev/null
+++ b/buildtools/lib/widgets/envvartools.cpp
@@ -0,0 +1,31 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "envvartools.h"
+
+#include <qregexp.h>
+
+QString EnvVarTools::quote( const QString & arg )
+{
+ QString res = arg;
+ res.replace(QRegExp(QString::fromLatin1("'")), QString::fromLatin1("'\\''"));
+ res.prepend("\"");
+ res.append("\"");
+ return res;
+}
+
diff --git a/buildtools/lib/widgets/envvartools.h b/buildtools/lib/widgets/envvartools.h
new file mode 100644
index 00000000..65db1b8d
--- /dev/null
+++ b/buildtools/lib/widgets/envvartools.h
@@ -0,0 +1,28 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <qstring.h>
+
+/**Environment support functions.*/
+namespace EnvVarTools{
+
+ /**Quotes the argument using double quotes ("). Created as a replacement
+ for KShellProcess::quote.*/
+ QString quote(const QString &arg);
+
+}
diff --git a/buildtools/lib/widgets/makeoptionswidget.cpp b/buildtools/lib/widgets/makeoptionswidget.cpp
new file mode 100644
index 00000000..c720de8b
--- /dev/null
+++ b/buildtools/lib/widgets/makeoptionswidget.cpp
@@ -0,0 +1,64 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "makeoptionswidget.h"
+
+#include <qcheckbox.h>
+#include <klineedit.h>
+#include <qspinbox.h>
+#include <qlistview.h>
+#include <qgroupbox.h>
+
+#include "domutil.h"
+#include "environmentvariableswidget.h"
+
+MakeOptionsWidget::MakeOptionsWidget(QDomDocument &dom, const QString &configGroup,
+ QWidget *parent, const char *name)
+ : MakeOptionsWidgetBase(parent, name),
+ m_dom(dom), m_configGroup(configGroup)
+{
+ env_var_group->setColumnLayout( 1, Qt::Vertical );
+ m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/make/envvars", env_var_group );
+
+ abort_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/abortonerror", true ));
+ jobs_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/numberofjobs"));
+ runMultiJobs->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/runmultiplejobs"));
+ dontact_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/dontact"));
+ makebin_edit->setText(DomUtil::readEntry(dom, configGroup + "/make/makebin"));
+ prio_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/prio"));
+}
+
+
+MakeOptionsWidget::~MakeOptionsWidget()
+{}
+
+
+void MakeOptionsWidget::accept()
+{
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/abortonerror", abort_box->isChecked());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/runmultiplejobs", runMultiJobs->isChecked());
+ DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/numberofjobs", jobs_box->value());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/dontact", dontact_box->isChecked());
+ DomUtil::writeEntry(m_dom, m_configGroup + "/make/makebin", makebin_edit->text());
+ DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/prio", prio_box->value());
+
+ m_environmentVariablesWidget->accept();
+}
+
+#include "makeoptionswidget.moc"
diff --git a/buildtools/lib/widgets/makeoptionswidget.h b/buildtools/lib/widgets/makeoptionswidget.h
new file mode 100644
index 00000000..b6deeb05
--- /dev/null
+++ b/buildtools/lib/widgets/makeoptionswidget.h
@@ -0,0 +1,50 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _MAKEOPTIONSWIDGET_H_
+#define _MAKEOPTIONSWIDGET_H_
+
+#include "makeoptionswidgetbase.h"
+
+#include <qdom.h>
+
+class EnvironmentVariablesWidget;
+
+/**
+Make options widget.
+*/
+class MakeOptionsWidget : public MakeOptionsWidgetBase
+{
+ Q_OBJECT
+
+public:
+ MakeOptionsWidget( QDomDocument &dom, const QString &configGroup,
+ QWidget *parent=0, const char *name=0 );
+ ~MakeOptionsWidget();
+
+public slots:
+ void accept();
+
+private:
+ QDomDocument &m_dom;
+ QString m_configGroup;
+ EnvironmentVariablesWidget* m_environmentVariablesWidget;
+};
+
+#endif
diff --git a/buildtools/lib/widgets/makeoptionswidgetbase.ui b/buildtools/lib/widgets/makeoptionswidgetbase.ui
new file mode 100644
index 00000000..4bddebd1
--- /dev/null
+++ b/buildtools/lib/widgets/makeoptionswidgetbase.ui
@@ -0,0 +1,194 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MakeOptionsWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>make_options_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>507</width>
+ <height>366</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Make Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>abort_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Abort on first error</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>dontact_box</cstring>
+ </property>
+ <property name="text">
+ <string>Onl&amp;y display commands without actually executing them</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="6" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>env_var_group</cstring>
+ </property>
+ <property name="title">
+ <string>Environment &amp;Variables</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>makebin_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name of make executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>makebin_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="5" column="3" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>makebin_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="4" column="4">
+ <property name="name">
+ <cstring>jobs_box</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>30</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Num&amp;ber of jobs to run simultaneously:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>jobs_box</cstring>
+ </property>
+ </widget>
+ <spacer row="4" column="5">
+ <property name="name">
+ <cstring>spacer33</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>121</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>runMultiJobs</cstring>
+ </property>
+ <property name="text">
+ <string>Run more than one &amp;job at a time</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>prio_label</cstring>
+ </property>
+ <property name="text">
+ <string>Make priority:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="2">
+ <property name="name">
+ <cstring>prio_box</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>19</number>
+ </property>
+ <property name="minValue">
+ <number>-20</number>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>runMultiJobs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>textLabel1</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>runMultiJobs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>jobs_box</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>abort_box</tabstop>
+ <tabstop>dontact_box</tabstop>
+ <tabstop>makebin_edit</tabstop>
+ <tabstop>jobs_box</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/lib/widgets/removesubprojectdialog.cpp b/buildtools/lib/widgets/removesubprojectdialog.cpp
new file mode 100644
index 00000000..37f9aaf8
--- /dev/null
+++ b/buildtools/lib/widgets/removesubprojectdialog.cpp
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include "removesubprojectdialog.h"
+
+RemoveSubprojectDialog::RemoveSubprojectDialog(QString caption, QString question, QWidget* parent, const char* name, bool modal, WFlags fl)
+ : RemoveSubprojectDlgBase(parent,name, modal,fl)
+{
+ setCaption(caption);
+ removeLabel->setText(question);
+}
+
+RemoveSubprojectDialog::~RemoveSubprojectDialog()
+{
+}
+
+/*$SPECIALIZATION$*/
+void RemoveSubprojectDialog::reject()
+{
+ QDialog::reject();
+}
+
+void RemoveSubprojectDialog::accept()
+{
+ QDialog::accept();
+}
+
+bool RemoveSubprojectDialog::removeFromDisk( )
+{
+ return removeCheckBox->isChecked();
+}
+
+
+#include "removesubprojectdialog.moc"
+
diff --git a/buildtools/lib/widgets/removesubprojectdialog.h b/buildtools/lib/widgets/removesubprojectdialog.h
new file mode 100644
index 00000000..89487511
--- /dev/null
+++ b/buildtools/lib/widgets/removesubprojectdialog.h
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef REMOVESUBPROJECTDIALOG_H
+#define REMOVESUBPROJECTDIALOG_H
+
+#include "removesubprojectdlgbase.h"
+
+/**
+Subproject removal dialog.
+*/
+class RemoveSubprojectDialog : public RemoveSubprojectDlgBase
+{
+ Q_OBJECT
+
+public:
+ RemoveSubprojectDialog(QString caption, QString question, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~RemoveSubprojectDialog();
+ /*$PUBLIC_FUNCTIONS$*/
+ bool removeFromDisk();
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ virtual void reject();
+ virtual void accept();
+
+};
+
+#endif
+
diff --git a/buildtools/lib/widgets/removesubprojectdlgbase.ui b/buildtools/lib/widgets/removesubprojectdlgbase.ui
new file mode 100644
index 00000000..cd36b6ff
--- /dev/null
+++ b/buildtools/lib/widgets/removesubprojectdlgbase.ui
@@ -0,0 +1,154 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>RemoveSubprojectDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>RemoveSubprojectDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>378</width>
+ <height>147</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>[REMOVE SUBPROJECT]</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>fileGroupBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>140</height>
+ </size>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>&amp;Information</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>removeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[REMOVE QUESTION]</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>removeCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Also &amp;remove it from disk</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>noticeLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Note:&lt;/b&gt; You will not be able to undo this operation.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>buttonLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>removeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>RemoveSubprojectDlgBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>RemoveSubprojectDlgBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot>accept()</slot>
+ <slot>reject()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/lib/widgets/runoptionswidget.cpp b/buildtools/lib/widgets/runoptionswidget.cpp
new file mode 100644
index 00000000..95fe4529
--- /dev/null
+++ b/buildtools/lib/widgets/runoptionswidget.cpp
@@ -0,0 +1,138 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "runoptionswidget.h"
+
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <klineedit.h>
+#include <urlutil.h>
+
+#include <qlistview.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qpushbutton.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+
+#include "domutil.h"
+#include "environmentvariableswidget.h"
+
+
+RunOptionsWidget::RunOptionsWidget(QDomDocument &dom, const QString &configGroup,
+ const QString &buildDirectory, QWidget *parent, const char *name)
+ : RunOptionsWidgetBase(parent, name),
+ m_dom(dom), m_configGroup(configGroup)
+{
+ // Create the "Environment Variables" GUI
+ env_var_group->setColumnLayout( 1, Qt::Vertical );
+ m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/run/envvars", env_var_group );
+
+ mainprogram_edit->completionObject()->setMode(KURLCompletion::FileCompletion);
+ mainprogram_edit->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
+ if( DomUtil::readEntry(dom, configGroup + "/run/mainprogram").isEmpty() && QFileInfo( buildDirectory ).exists() )
+ {
+ mainprogram_edit->setURL( buildDirectory );
+ mainprogram_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) );
+ }else if ( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/mainprogram") ).exists() )
+ {
+ QString program = DomUtil::readEntry(dom, configGroup + "/run/mainprogram");
+ if( QDir::isRelativePath(program) )
+ program = buildDirectory + "/" + program;
+ mainprogram_edit->setURL(program);
+ mainprogram_edit->fileDialog()->setURL( program );
+ }else
+ {
+ mainprogram_edit->setURL(QString());
+ mainprogram_edit->fileDialog()->setURL(QString());
+ }
+
+ cwd_edit->completionObject()->setMode(KURLCompletion::DirCompletion);
+ cwd_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+ if( DomUtil::readEntry(dom, configGroup + "/run/globalcwd").isEmpty() && QFileInfo( buildDirectory ).exists() )
+ {
+ cwd_edit->setURL( buildDirectory );
+ cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) );
+ }else if( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ).exists() )
+ {
+ cwd_edit->setURL(DomUtil::readEntry(dom, configGroup + "/run/globalcwd"));
+ cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ) );
+ }else
+ {
+ cwd_edit->setURL(QString());
+ cwd_edit->fileDialog()->setURL(QString());
+ }
+
+ if( configGroup == "/kdevautoproject" || configGroup == "/kdevtrollproject" )
+ {
+ mainProgramGroupBox->setCheckable(true);
+ mainProgramGroupBox->setChecked( DomUtil::readBoolEntry(dom, configGroup+"/run/useglobalprogram", false ) );
+ }else
+ {
+ delete notelabel;
+ }
+
+ // Read the main program command line arguments and store them in the edit box
+
+ runargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/programargs"));
+ debugargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/globaldebugarguments"));
+
+ startinterminal_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/terminal"));
+ autocompile_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autocompile", false));
+ autoinstall_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autoinstall", false));
+ autokdesu_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autokdesu", false));
+}
+
+
+RunOptionsWidget::~RunOptionsWidget()
+{}
+
+
+void RunOptionsWidget::accept()
+{
+ DomUtil::writeEntry(m_dom, m_configGroup + "/run/mainprogram", mainprogram_edit->url());
+ DomUtil::writeEntry(m_dom, m_configGroup + "/run/programargs", runargs_edit->text());
+ DomUtil::writeEntry(m_dom, m_configGroup + "/run/globaldebugarguments", debugargs_edit->text());
+ DomUtil::writeEntry(m_dom, m_configGroup + "/run/globalcwd", cwd_edit->url());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/useglobalprogram", mainProgramGroupBox->isChecked());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/terminal", startinterminal_box->isChecked());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autocompile", autocompile_box->isChecked());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autoinstall", autoinstall_box->isChecked());
+ DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autokdesu", autokdesu_box->isChecked());
+
+ m_environmentVariablesWidget->accept();
+}
+
+void RunOptionsWidget::mainProgramChanged( )
+{
+
+ if( mainProgramGroupBox->isChecked() && mainprogram_edit->url().isEmpty() )
+ {
+ mainprogram_label->setPaletteForegroundColor(QColor("#ff0000"));
+ }
+ else
+ {
+ mainprogram_label->unsetPalette();
+ }
+}
+
+#include "runoptionswidget.moc"
diff --git a/buildtools/lib/widgets/runoptionswidget.h b/buildtools/lib/widgets/runoptionswidget.h
new file mode 100644
index 00000000..758ef4b1
--- /dev/null
+++ b/buildtools/lib/widgets/runoptionswidget.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _RUNOPTIONSWIDGET_H_
+#define _RUNOPTIONSWIDGET_H_
+
+#include "runoptionswidgetbase.h"
+
+#include <qdom.h>
+#include <kurl.h>
+
+class EnvironmentVariablesWidget;
+
+/**
+Run options widget.
+*/
+class RunOptionsWidget : public RunOptionsWidgetBase
+{
+ Q_OBJECT
+
+public:
+ RunOptionsWidget( QDomDocument &dom, //!< document DOM
+ const QString &configGroup, //!< configuration group
+ const QString &buildDirectory, //!< project build directory
+ QWidget *parent=0, //!< parent widget
+ const char *name=0 //!< widget's name
+ );
+ ~RunOptionsWidget();
+
+public slots:
+ void accept();
+
+private:
+ virtual void mainProgramChanged( );
+
+ QDomDocument &m_dom;
+ QString m_configGroup;
+ EnvironmentVariablesWidget* m_environmentVariablesWidget;
+};
+
+#endif
diff --git a/buildtools/lib/widgets/runoptionswidgetbase.ui b/buildtools/lib/widgets/runoptionswidgetbase.ui
new file mode 100644
index 00000000..1163484c
--- /dev/null
+++ b/buildtools/lib/widgets/runoptionswidgetbase.ui
@@ -0,0 +1,257 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>RunOptionsWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>run_options_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>506</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Run Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>mainProgramGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Main Program</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>notelabel</cstring>
+ </property>
+ <property name="text">
+ <string>Note: These options override target specific settings.</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>For Automake and QMake type projects, the proper way to set these options are per target in the &lt;b&gt;Automake Manager&lt;/b&gt; and &lt;b&gt;QMake Manager&lt;/b&gt;, respectively.</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>runargs_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The command line arguments passed to the main program when run</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>mainprogram_label_2</cstring>
+ </property>
+ <property name="text">
+ <string>Run Arg&amp;uments:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mainprogram_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mainprogram_label</cstring>
+ </property>
+ <property name="text">
+ <string>Executa&amp;ble:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mainprogram_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>mainprogram_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Full path to the executable</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>mainprogram_label_3</cstring>
+ </property>
+ <property name="text">
+ <string>Debug Ar&amp;guments:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mainprogram_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>debugargs_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The command line arguments passed to the main program when debugged</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>mainprogram_label_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Working &amp;Directory:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mainprogram_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="4" column="1">
+ <property name="name">
+ <cstring>cwd_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Sets the current working directory for the launched process</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>autocompile_box</cstring>
+ </property>
+ <property name="text">
+ <string>Automaticall&amp;y compile before execution</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If the program is not up-to-date with the source code, compile it before starting its execution</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>autoinstall_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Automatically install before execution</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>autokdesu_box</cstring>
+ </property>
+ <property name="text">
+ <string>Use &amp;kdesu when installing</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>startinterminal_box</cstring>
+ </property>
+ <property name="text">
+ <string>Start in e&amp;xternal terminal</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Start the main program in an external terminal</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>env_var_group</cstring>
+ </property>
+ <property name="title">
+ <string>Environment &amp;Variables</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>mainprogram_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>run_options_widget</receiver>
+ <slot>mainProgramChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mainprogram_edit</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>run_options_widget</receiver>
+ <slot>mainProgramChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mainProgramGroupBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>run_options_widget</receiver>
+ <slot>mainProgramChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>startinterminal_box</tabstop>
+ <tabstop>autocompile_box</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="global" impldecl="in declaration">ksqueezedtextlabel.h</include>
+</includes>
+<slots>
+ <slot>mainProgramChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/lib/widgets/subclassesdlg.cpp b/buildtools/lib/widgets/subclassesdlg.cpp
new file mode 100644
index 00000000..5c3a0fef
--- /dev/null
+++ b/buildtools/lib/widgets/subclassesdlg.cpp
@@ -0,0 +1,122 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include <qlistbox.h>
+#include <kurlrequester.h>
+
+#include "subclassesdlg.h"
+#include "subclassesdlg.moc"
+SubclassesDlg::SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent, const char* name, bool modal, WFlags fl)
+: SubclassesDlgBase(parent,name, modal,fl), m_form(form), m_config(config), m_projectDir(projectDir)
+{
+ subclass_url->setEnabled(false);
+
+ DomUtil::PairList::iterator it;
+ for ( it = config.begin(); it != config.end(); ++it )
+ {
+ if ((*it).second == form)
+ subclasses_box->insertItem(projectDir + (*it).first);
+ }
+}
+
+SubclassesDlg::~SubclassesDlg()
+{
+}
+
+/*$SPECIALIZATION$*/
+void SubclassesDlg::accept()
+{
+ QPtrList<DomUtil::Pair> pairsToRemove;
+
+ DomUtil::PairList::iterator it;
+ for ( it = m_config.begin(); it != m_config.end(); ++it )
+ {
+ if ((*it).second == m_form)
+ {
+ pairsToRemove.append(&(*it));
+ }
+ }
+
+ DomUtil::Pair *pair;
+ for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() )
+ {
+ m_config.remove(*pair);
+ }
+
+ for (int i = 0; i < (int)subclasses_box->count(); ++i)
+ {
+ m_config << DomUtil::Pair(subclasses_box->text(i).remove(0,m_projectDir.length()), m_form);
+ }
+
+ SubclassesDlgBase::accept();
+}
+
+
+void SubclassesDlg::newRelation()
+{
+ subclasses_box->setFocus();
+ subclasses_box->insertItem("");
+ subclasses_box->setCurrentItem(subclasses_box->count()-1);
+ subclass_url->setEnabled(true);
+ subclass_url->setURL("");
+ subclass_url->setFocus();
+}
+
+void SubclassesDlg::removeRelation()
+{
+ if (subclasses_box->currentItem() > -1)
+ {
+ QListBoxItem *item = subclasses_box->item(subclasses_box->currentItem());
+ int itemIdx = subclasses_box->currentItem();
+
+ if (item->prev())
+ {
+ subclasses_box->setCurrentItem(item->prev());
+ subclass_url->setURL(item->prev()->text());
+ }
+ else if (item->next())
+ {
+ subclasses_box->setCurrentItem(item->next());
+ subclass_url->setURL(item->next()->text());
+ }
+ else
+ {
+ subclass_url->setEnabled(false);
+ subclass_url->setURL("");
+ }
+ subclasses_box->removeItem(itemIdx);
+ }
+}
+
+void SubclassesDlg::changeCurrentURL(const QString &str)
+{
+ if ( subclasses_box->currentItem() > -1 )
+ {
+ subclasses_box->changeItem(str, subclasses_box->currentItem());
+ }
+}
+
+void SubclassesDlg::currentRelationChanged( QListBoxItem * item )
+{
+ if (item)
+ {
+ subclass_url->setEnabled(true);
+ subclass_url->setURL(item->text());
+ }
+}
+
diff --git a/buildtools/lib/widgets/subclassesdlg.h b/buildtools/lib/widgets/subclassesdlg.h
new file mode 100644
index 00000000..46b07b31
--- /dev/null
+++ b/buildtools/lib/widgets/subclassesdlg.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef SUBCLASSESDLG_H
+#define SUBCLASSESDLG_H
+#include "domutil.h"
+#include "subclassesdlgbase.h"
+
+/**
+Subclass creation dialog.
+*/
+class SubclassesDlg : public SubclassesDlgBase
+{
+ Q_OBJECT
+
+public:
+ SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SubclassesDlg();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void accept();
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ virtual void newRelation();
+ virtual void removeRelation();
+ virtual void changeCurrentURL(const QString &str);
+ virtual void currentRelationChanged(QListBoxItem *item);
+
+private:
+ QString m_form;
+ DomUtil::PairList &m_config;
+ QString m_projectDir;
+};
+
+#endif
+
diff --git a/buildtools/lib/widgets/subclassesdlgbase.ui b/buildtools/lib/widgets/subclassesdlgbase.ui
new file mode 100644
index 00000000..026ab2ca
--- /dev/null
+++ b/buildtools/lib/widgets/subclassesdlgbase.ui
@@ -0,0 +1,224 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>SubclassesDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SubclassesDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>514</width>
+ <height>278</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Related Subclasses</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>add_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Relation</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>remove_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove Relation</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="1" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>subclasses_box</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>subclass_url</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>90</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Related subclass &amp;location:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>subclass_url</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>310</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>subclass_url</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>changeCurrentURL(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>remove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>removeRelation()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>add_button</sender>
+ <signal>clicked()</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>newRelation()</slot>
+ </connection>
+ <connection>
+ <sender>subclasses_box</sender>
+ <signal>clicked(QListBoxItem*)</signal>
+ <receiver>SubclassesDlgBase</receiver>
+ <slot>currentRelationChanged(QListBoxItem*)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>subclasses_box</tabstop>
+ <tabstop>add_button</tabstop>
+ <tabstop>subclass_url</tabstop>
+ <tabstop>remove_button</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">changeCurrentURL(const QString &amp;str)</slot>
+ <slot access="protected">removeRelation()</slot>
+ <slot access="protected">newRelation()</slot>
+ <slot access="protected">currentRelationChanged(QListBoxItem *item)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>