summaryrefslogtreecommitdiffstats
path: root/buildtools/lib/parsers/autotools
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/lib/parsers/autotools')
-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
17 files changed, 5167 insertions, 0 deletions
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>