Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 165526 | Differences between
and this patch

Collapse All | Expand All

(-)kdevelop-3.4.0.orig/buildtools/autotools/subprojectoptionsdlg.cpp (+4 lines)
Lines 301-307 Link Here
301
{
301
{
302
    QString dir = KFileDialog::getExistingDirectory();
302
    QString dir = KFileDialog::getExistingDirectory();
303
    if (!dir.isEmpty())
303
    if (!dir.isEmpty())
304
    {
305
        if( !dir.startsWith( "-I" ) )
306
            dir = "-I"+dir;
304
        new QListViewItem(outsideinc_listview, dir);
307
        new QListViewItem(outsideinc_listview, dir);
308
    }
305
}
309
}
306
310
307
311
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/FlexLexer.h (+205 lines)
Line 0 Link Here
1
2
// -*-C++-*-
3
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
4
// by flex
5
6
// Copyright (c) 1993 The Regents of the University of California.
7
// All rights reserved.
8
//
9
// This code is derived from software contributed to Berkeley by
10
// Kent Williams and Tom Epperly.
11
//
12
//  Redistribution and use in source and binary forms, with or without
13
//  modification, are permitted provided that the following conditions
14
//  are met:
15
16
//  1. Redistributions of source code must retain the above copyright
17
//  notice, this list of conditions and the following disclaimer.
18
//  2. Redistributions in binary form must reproduce the above copyright
19
//  notice, this list of conditions and the following disclaimer in the
20
//  documentation and/or other materials provided with the distribution.
21
22
//  Neither the name of the University nor the names of its contributors
23
//  may be used to endorse or promote products derived from this software
24
//  without specific prior written permission.
25
26
//  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
27
//  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
28
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
//  PURPOSE.
30
31
// This file defines FlexLexer, an abstract class which specifies the
32
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
33
// which defines a particular lexer class.
34
//
35
// If you want to create multiple lexer classes, you use the -P flag
36
// to rename each yyFlexLexer to some other xxFlexLexer.  You then
37
// include <FlexLexer.h> in your other sources once per lexer class:
38
//
39
//	#undef yyFlexLexer
40
//	#define yyFlexLexer xxFlexLexer
41
//	#include <FlexLexer.h>
42
//
43
//	#undef yyFlexLexer
44
//	#define yyFlexLexer zzFlexLexer
45
//	#include <FlexLexer.h>
46
//	...
47
48
#ifndef __FLEX_LEXER_H
49
// Never included before - need to define base class.
50
#define __FLEX_LEXER_H
51
52
#include <iostream>
53
#  ifndef FLEX_STD
54
#    define FLEX_STD std::
55
#  endif
56
57
extern "C++" {
58
59
struct yy_buffer_state;
60
typedef int yy_state_type;
61
62
class FlexLexer {
63
public:
64
	virtual ~FlexLexer()	{ }
65
66
	const char* YYText() const	{ return yytext; }
67
	int YYLeng()	const	{ return yyleng; }
68
69
	virtual void
70
		yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
71
	virtual struct yy_buffer_state*
72
		yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
73
	virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
74
	virtual void yyrestart( FLEX_STD istream* s ) = 0;
75
76
	virtual int yylex() = 0;
77
78
	// Call yylex with new input/output sources.
79
	int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
80
		{
81
		switch_streams( new_in, new_out );
82
		return yylex();
83
		}
84
85
	// Switch to new input/output streams.  A nil stream pointer
86
	// indicates "keep the current one".
87
	virtual void switch_streams( FLEX_STD istream* new_in = 0,
88
					FLEX_STD ostream* new_out = 0 ) = 0;
89
90
	int lineno() const		{ return yylineno; }
91
92
	int debug() const		{ return yy_flex_debug; }
93
	void set_debug( int flag )	{ yy_flex_debug = flag; }
94
95
protected:
96
	char* yytext;
97
	int yyleng;
98
	int yylineno;		// only maintained if you use %option yylineno
99
	int yy_flex_debug;	// only has effect with -d or "%option debug"
100
};
101
102
}
103
#endif
104
105
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
106
// Either this is the first time through (yyFlexLexerOnce not defined),
107
// or this is a repeated include to define a different flavor of
108
// yyFlexLexer, as discussed in the flex man page.
109
#define yyFlexLexerOnce
110
111
extern "C++" {
112
113
class yyFlexLexer : public FlexLexer {
114
public:
115
	// arg_yyin and arg_yyout default to the cin and cout, but we
116
	// only make that assignment when initializing in yylex().
117
	yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
118
119
	virtual ~yyFlexLexer();
120
121
	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
122
	struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
123
	void yy_delete_buffer( struct yy_buffer_state* b );
124
	void yyrestart( FLEX_STD istream* s );
125
126
    void yypush_buffer_state( struct yy_buffer_state* new_buffer );
127
    void yypop_buffer_state(void);
128
129
	virtual int yylex();
130
	virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out );
131
132
protected:
133
	virtual int LexerInput( char* buf, int max_size );
134
	virtual void LexerOutput( const char* buf, int size );
135
	virtual void LexerError( const char* msg );
136
137
	void yyunput( int c, char* buf_ptr );
138
	int yyinput();
139
140
	void yy_load_buffer_state();
141
	void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
142
	void yy_flush_buffer( struct yy_buffer_state* b );
143
144
	int yy_start_stack_ptr;
145
	int yy_start_stack_depth;
146
	int* yy_start_stack;
147
148
	void yy_push_state( int new_state );
149
	void yy_pop_state();
150
	int yy_top_state();
151
152
	yy_state_type yy_get_previous_state();
153
	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
154
	int yy_get_next_buffer();
155
156
	FLEX_STD istream* yyin;	// input source for default LexerInput
157
	FLEX_STD ostream* yyout;	// output sink for default LexerOutput
158
159
	// yy_hold_char holds the character lost when yytext is formed.
160
	char yy_hold_char;
161
162
	// Number of characters read into yy_ch_buf.
163
	int yy_n_chars;
164
165
	// Points to current character in buffer.
166
	char* yy_c_buf_p;
167
168
	int yy_init;		// whether we need to initialize
169
	int yy_start;		// start state number
170
171
	// Flag which is used to allow yywrap()'s to do buffer switches
172
	// instead of setting up a fresh yyin.  A bit of a hack ...
173
	int yy_did_buffer_switch_on_eof;
174
175
176
    size_t yy_buffer_stack_top; /**< index of top of stack. */
177
    size_t yy_buffer_stack_max; /**< capacity of stack. */
178
    struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
179
    void yyensure_buffer_stack(void);
180
181
	// The following are not always needed, but may be depending
182
	// on use of certain flex features (like REJECT or yymore()).
183
184
	yy_state_type yy_last_accepting_state;
185
	char* yy_last_accepting_cpos;
186
187
	yy_state_type* yy_state_buf;
188
	yy_state_type* yy_state_ptr;
189
190
	char* yy_full_match;
191
	int* yy_full_state;
192
	int yy_full_lp;
193
194
	int yy_lp;
195
	int yy_looking_for_trail_begin;
196
197
	int yy_more_flag;
198
	int yy_more_len;
199
	int yy_more_offset;
200
	int yy_prev_more_offset;
201
};
202
203
}
204
205
#endif
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/location.hh (+145 lines)
Line 0 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
3
/* Locations for Bison parsers in C++
4
5
   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 2, or (at your option)
10
   any later version.
11
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
22
/* As a special exception, you may create a larger work that contains
23
   part or all of the Bison parser skeleton and distribute that work
24
   under terms of your choice, so long as that work isn't itself a
25
   parser generator using the skeleton or a modified version thereof
26
   as a parser skeleton.  Alternatively, if you modify or redistribute
27
   the parser skeleton itself, you may (at your option) remove this
28
   special exception, which will cause the skeleton and the resulting
29
   Bison output files to be licensed under the GNU General Public
30
   License without this special exception.
31
32
   This special exception was added by the Free Software Foundation in
33
   version 2.2 of Bison.  */
34
35
/**
36
 ** \file location.hh
37
 ** Define the QMake::location class.
38
 */
39
40
#ifndef BISON_LOCATION_HH
41
# define BISON_LOCATION_HH
42
43
# include <iostream>
44
# include <string>
45
# include "position.hh"
46
47
namespace QMake
48
{
49
50
  /// Abstract a location.
51
  class location
52
  {
53
  public:
54
55
    /// Construct a location.
56
    location ()
57
      : begin (), end ()
58
    {
59
    }
60
61
62
    /// Initialization.
63
    inline void initialize (std::string* fn)
64
    {
65
      begin.initialize (fn);
66
      end = begin;
67
    }
68
69
    /** \name Line and Column related manipulators
70
     ** \{ */
71
  public:
72
    /// Reset initial location to final location.
73
    inline void step ()
74
    {
75
      begin = end;
76
    }
77
78
    /// Extend the current location to the COUNT next columns.
79
    inline void columns (unsigned int count = 1)
80
    {
81
      end += count;
82
    }
83
84
    /// Extend the current location to the COUNT next lines.
85
    inline void lines (unsigned int count = 1)
86
    {
87
      end.lines (count);
88
    }
89
    /** \} */
90
91
92
  public:
93
    /// Beginning of the located region.
94
    position begin;
95
    /// End of the located region.
96
    position end;
97
  };
98
99
  /// Join two location objects to create a location.
100
  inline const location operator+ (const location& begin, const location& end)
101
  {
102
    location res = begin;
103
    res.end = end.end;
104
    return res;
105
  }
106
107
  /// Add two location objects.
108
  inline const location operator+ (const location& begin, unsigned int width)
109
  {
110
    location res = begin;
111
    res.columns (width);
112
    return res;
113
  }
114
115
  /// Add and assign a location.
116
  inline location& operator+= (location& res, unsigned int width)
117
  {
118
    res.columns (width);
119
    return res;
120
  }
121
122
  /** \brief Intercept output stream redirection.
123
   ** \param ostr the destination output stream
124
   ** \param loc a reference to the location to redirect
125
   **
126
   ** Avoid duplicate information.
127
   */
128
  inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
129
  {
130
    position last = loc.end - 1;
131
    ostr << loc.begin;
132
    if (last.filename
133
	&& (!loc.begin.filename
134
	    || *loc.begin.filename != *last.filename))
135
      ostr << '-' << last;
136
    else if (loc.begin.line != last.line)
137
      ostr << '-' << last.line  << '.' << last.column;
138
    else if (loc.begin.column != last.column)
139
      ostr << '-' << last.column;
140
    return ostr;
141
  }
142
143
}
144
145
#endif // not BISON_LOCATION_HH
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/Makefile.am (-6 / +5 lines)
Lines 10-31 Link Here
10
METASOURCES = AUTO
10
METASOURCES = AUTO
11
lib_LTLIBRARIES = libkdevqmakeparser.la
11
lib_LTLIBRARIES = libkdevqmakeparser.la
12
libkdevqmakeparser_la_LDFLAGS = -no-undefined $(all_libraries) $(LIB_KIO)
12
libkdevqmakeparser_la_LDFLAGS = -no-undefined $(all_libraries) $(LIB_KIO)
13
libkdevqmakeparser_la_SOURCES = qmakeast.cpp qmakedriver.cpp qmake_yacc.cpp \
13
libkdevqmakeparser_la_SOURCES = qmake_lex.cpp qmake_yacc.cpp qmakeast.cpp \
14
	qmakeastvisitor.cpp
14
	qmakeastvisitor.cpp qmakedriver.cpp
15
15
16
kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/parsers/qmake
16
kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/parsers/qmake
17
kdevelopbuildtoolsinclude_HEADERS = qmakeast.h qmakedriver.h qmakeastvisitor.h
17
kdevelopbuildtoolsinclude_HEADERS = qmakeast.h qmakedriver.h qmakeastvisitor.h
18
18
19
parser:
19
parser:
20
	cd $(srcdir) ; \
20
	cd $(srcdir) ; \
21
	bison -d qmake.yy -o qmake_yacc.cpp ; \
21
	bison -d qmake.yy -oqmake_yacc.cpp ; \
22
	mv -f qmake_yacc.hpp qmake_yacc.h ; \
23
	flex -oqmake_lex.cpp qmake.ll
22
	flex -oqmake_lex.cpp qmake.ll
24
23
25
parser_dbg:
24
parser_dbg:
26
	cd $(srcdir) ; \
25
	cd $(srcdir) ; \
27
	bison -d qmake.yy -r all -k -t -o qmake_yacc.cpp ; \
26
	bison -d qmake.yy -r all -k -t -oqmake_yacc.cpp ; \
28
	mv -f qmake_yacc.hpp qmake_yacc.h ; \
29
	flex -d -oqmake_lex.cpp qmake.ll
27
	flex -d -oqmake_lex.cpp qmake.ll
30
28
31
EXTRA_DIST = qmake.yy qmake.ll
29
EXTRA_DIST = qmake.yy qmake.ll
Lines 35-37 Link Here
35
DOXYGEN_DOCDIRPREFIX = kdevparser
33
DOXYGEN_DOCDIRPREFIX = kdevparser
36
include ../../../../Doxyfile.am
34
include ../../../../Doxyfile.am
37
35
36
noinst_HEADERS = qmake_lex.h
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/position.hh (+142 lines)
Line 0 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
3
/* Positions for Bison parsers in C++
4
5
   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 2, or (at your option)
10
   any later version.
11
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
22
/* As a special exception, you may create a larger work that contains
23
   part or all of the Bison parser skeleton and distribute that work
24
   under terms of your choice, so long as that work isn't itself a
25
   parser generator using the skeleton or a modified version thereof
26
   as a parser skeleton.  Alternatively, if you modify or redistribute
27
   the parser skeleton itself, you may (at your option) remove this
28
   special exception, which will cause the skeleton and the resulting
29
   Bison output files to be licensed under the GNU General Public
30
   License without this special exception.
31
32
   This special exception was added by the Free Software Foundation in
33
   version 2.2 of Bison.  */
34
35
/**
36
 ** \file position.hh
37
 ** Define the QMake::position class.
38
 */
39
40
#ifndef BISON_POSITION_HH
41
# define BISON_POSITION_HH
42
43
# include <iostream>
44
# include <string>
45
46
namespace QMake
47
{
48
  /// Abstract a position.
49
  class position
50
  {
51
  public:
52
53
    /// Construct a position.
54
    position ()
55
      : filename (0), line (1), column (0)
56
    {
57
    }
58
59
60
    /// Initialization.
61
    inline void initialize (std::string* fn)
62
    {
63
      filename = fn;
64
      line = 1;
65
      column = 0;
66
    }
67
68
    /** \name Line and Column related manipulators
69
     ** \{ */
70
  public:
71
    /// (line related) Advance to the COUNT next lines.
72
    inline void lines (int count = 1)
73
    {
74
      column = 0;
75
      line += count;
76
    }
77
78
    /// (column related) Advance to the COUNT next columns.
79
    inline void columns (int count = 1)
80
    {
81
      int leftmost = 0;
82
      int current  = column;
83
      if (leftmost <= current + count)
84
	column += count;
85
      else
86
	column = 0;
87
    }
88
    /** \} */
89
90
  public:
91
    /// File name to which this position refers.
92
    std::string* filename;
93
    /// Current line number.
94
    unsigned int line;
95
    /// Current column number.
96
    unsigned int column;
97
  };
98
99
  /// Add and assign a position.
100
  inline const position&
101
  operator+= (position& res, const int width)
102
  {
103
    res.columns (width);
104
    return res;
105
  }
106
107
  /// Add two position objects.
108
  inline const position
109
  operator+ (const position& begin, const int width)
110
  {
111
    position res = begin;
112
    return res += width;
113
  }
114
115
  /// Add and assign a position.
116
  inline const position&
117
  operator-= (position& res, const int width)
118
  {
119
    return res += -width;
120
  }
121
122
  /// Add two position objects.
123
  inline const position
124
  operator- (const position& begin, const int width)
125
  {
126
    return begin + -width;
127
  }
128
129
  /** \brief Intercept output stream redirection.
130
   ** \param ostr the destination output stream
131
   ** \param pos a reference to the position to redirect
132
   */
133
  inline std::ostream&
134
  operator<< (std::ostream& ostr, const position& pos)
135
  {
136
    if (pos.filename)
137
      ostr << *pos.filename << ':';
138
    return ostr << pos.line << '.' << pos.column;
139
  }
140
141
}
142
#endif // not BISON_POSITION_HH
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmakedriver.cpp (-22 / +32 lines)
Lines 20-76 Link Here
20
#include "qmakedriver.h"
20
#include "qmakedriver.h"
21
#include "qmakeast.h"
21
#include "qmakeast.h"
22
22
23
#include <stdio.h>
24
#include <qvaluestack.h>
23
#include <qvaluestack.h>
25
#include <kio/netaccess.h>
24
#include <kio/netaccess.h>
26
25
27
extern FILE *yyin, *yyout;
26
#include <iostream>
28
extern int yyparse();
27
#include <fstream>
29
extern int yydebug;
28
#include <sstream>
30
typedef struct yy_buffer_state *YY_BUFFER_STATE;
29
31
extern YY_BUFFER_STATE yy_scan_string(const char*);
30
#include "qmake_lex.h"
32
extern void yy_delete_buffer(YY_BUFFER_STATE);
31
#include "qmake_yacc.hpp"
33
extern QValueStack<QMake::ProjectAST *> projects;
34
32
35
namespace QMake {
33
namespace QMake {
36
34
37
int Driver::parseFile(const char *fileName, ProjectAST **ast)
35
int Driver::parseFile(const char *fileName, ProjectAST **ast, int debug)
38
{
36
{
39
    yyin = fopen(fileName, "r");
37
    std::ifstream inf( fileName, std::ios::in );
40
    if (yyin == 0)
38
    if ( !inf.is_open() )
41
    {
39
    {
42
        *ast = 0;
40
        *ast = 0;
43
        return 1;
41
        return 1;
44
    }
42
    }
45
//     yydebug = 1;
43
//     yydebug = 1;
46
    int ret = yyparse();
44
    Lexer l(&inf);
47
    *ast = projects.top();
45
    l.set_debug(debug);
46
    int depth = 0;
47
    QValueStack<ProjectAST*> stack;
48
    Parser p(&l, stack, depth);
49
    p.set_debug_level(debug);
50
    int ret = p.parse();
51
    *ast = stack.top();
48
    (*ast)->setFileName(fileName);
52
    (*ast)->setFileName(fileName);
49
    return ret;
53
    return ret;
50
}
54
}
51
55
52
int Driver::parseFile(QString fileName, ProjectAST **ast)
56
int Driver::parseFile(QString fileName, ProjectAST **ast, int debug)
53
{
57
{
54
    return parseFile(fileName.ascii(), ast);
58
    return parseFile(fileName.ascii(), ast, debug);
55
}
59
}
56
60
57
int Driver::parseFile(KURL fileName, ProjectAST **ast)
61
int Driver::parseFile(KURL fileName, ProjectAST **ast, int debug)
58
{
62
{
59
    QString tmpFile;
63
    QString tmpFile;
60
    int ret = 0;
64
    int ret = 0;
61
    if (KIO::NetAccess::download(fileName, tmpFile, 0))
65
    if (KIO::NetAccess::download(fileName, tmpFile, 0))
62
        ret = parseFile(tmpFile, ast);
66
        ret = parseFile(tmpFile, ast, debug);
63
    KIO::NetAccess::removeTempFile(tmpFile);
67
    KIO::NetAccess::removeTempFile(tmpFile);
64
    return ret;
68
    return ret;
65
}
69
}
66
70
67
int Driver::parseString( const char* string, ProjectAST **ast )
71
int Driver::parseString( const char* string, ProjectAST **ast, int debug )
68
{
72
{
69
    YY_BUFFER_STATE state = yy_scan_string( string );
73
    std::istringstream ins;
70
    int ret = yyparse();
74
    ins.str(string);
71
    *ast = projects.top();
75
    Lexer l(&ins);
76
    l.set_debug(debug);
77
    int depth = 0;
78
    QValueStack<ProjectAST*> stack;
79
    Parser p(&l, stack, depth);
80
    p.set_debug_level(debug);
81
    int ret = p.parse();
82
    *ast = stack.top();
72
    (*ast)->setFileName("");
83
    (*ast)->setFileName("");
73
    yy_delete_buffer( state );
74
    return ret;
84
    return ret;
75
}
85
}
76
86
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmakedriver.h (-24 / +7 lines)
Lines 20-29 Link Here
20
#ifndef QMAKEQMAKEDRIVER_H
20
#ifndef QMAKEQMAKEDRIVER_H
21
#define QMAKEQMAKEDRIVER_H
21
#define QMAKEQMAKEDRIVER_H
22
22
23
#include "qmakeast.h"
23
class QString;
24
24
class KURL;
25
#include <qvaluelist.h>
26
#include <kurl.h>
27
25
28
namespace QMake {
26
namespace QMake {
29
27
Lines 45-70 Link Here
45
    initialize it on its own.
43
    initialize it on its own.
46
    @return The result of parsing. Result is 0 on success and <> 0 on failure.
44
    @return The result of parsing. Result is 0 on success and <> 0 on failure.
47
    */
45
    */
48
    static int parseFile(const char *fileName, ProjectAST **ast);
46
    static int parseFile(const char *fileName, ProjectAST **ast, int debug);
49
    static int parseFile(QString fileName, ProjectAST **ast);
47
    static int parseFile(QString fileName, ProjectAST **ast, int debug);
50
    static int parseFile(KURL fileName, ProjectAST **ast);
48
    static int parseFile(KURL fileName, ProjectAST **ast, int debug);
51
    static int parseString(const char* string, ProjectAST **ast);
49
    static int parseString(const char* string, ProjectAST **ast, int debug);
52
50
53
/*    template<class Op>
54
    static void walkAST(Op &op, const ProjectAST *ast)
55
    {
56
//         op(ast);
57
        for (QValueList<QMake::AST*>::const_iterator it = ast->statements.constBegin();
58
                it != ast->statements.constEnd(); ++it)
59
        {
60
            const AST *child = *it;
61
            if (child->nodeType() == AST::ProjectAST)
62
                walkAST<Op>(op, static_cast<const QMake::ProjectAST*>(child));
63
            else
64
                op(child);
65
        }
66
    }
67
*/
68
};
51
};
69
52
70
}
53
}
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake_lex.cpp (-510 / +426 lines)
Lines 14-26 Link Here
14
#define FLEX_BETA
14
#define FLEX_BETA
15
#endif
15
#endif
16
16
17
    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
18
     * following macro. This is required in order to pass the c++-multiple-scanners
19
     * test in the regression suite. We get reports that it breaks inheritance.
20
     * We will address this in a future release of flex, or omit the C++ scanner
21
     * altogether.
22
     */
23
    #define yyFlexLexer yyFlexLexer
24
17
/* First, we deal with  platform-specific or compiler-specific issues. */
25
/* First, we deal with  platform-specific or compiler-specific issues. */
18
26
19
/* begin standard C headers. */
27
/* begin standard C headers. */
20
#include <stdio.h>
21
#include <string.h>
22
#include <errno.h>
23
#include <stdlib.h>
24
28
25
/* end standard C headers. */
29
/* end standard C headers. */
26
30
Lines 87-92 Link Here
87
91
88
#endif /* ! FLEXINT_H */
92
#endif /* ! FLEXINT_H */
89
93
94
/* begin standard C++ headers. */
95
#include <iostream> 
96
#include <errno.h>
97
#include <cstdlib>
98
#include <cstring>
99
/* end standard C++ headers. */
100
90
#ifdef __cplusplus
101
#ifdef __cplusplus
91
102
92
/* The "const" storage-class-modifier is valid. */
103
/* The "const" storage-class-modifier is valid. */
Lines 134-140 Link Here
134
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
145
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
135
146
136
/* Special action meaning "start processing a new file". */
147
/* Special action meaning "start processing a new file". */
137
#define YY_NEW_FILE yyrestart(yyin  )
148
#define YY_NEW_FILE yyrestart( yyin  )
138
149
139
#define YY_END_OF_BUFFER_CHAR 0
150
#define YY_END_OF_BUFFER_CHAR 0
140
151
Lines 154-166 Link Here
154
165
155
extern int yyleng;
166
extern int yyleng;
156
167
157
extern FILE *yyin, *yyout;
158
159
#define EOB_ACT_CONTINUE_SCAN 0
168
#define EOB_ACT_CONTINUE_SCAN 0
160
#define EOB_ACT_END_OF_FILE 1
169
#define EOB_ACT_END_OF_FILE 1
161
#define EOB_ACT_LAST_MATCH 2
170
#define EOB_ACT_LAST_MATCH 2
162
171
163
    #define YY_LESS_LINENO(n)
172
    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
173
     *       access to the local variable yy_act. Since yyless() is a macro, it would break
174
     *       existing scanners that call yyless() from OUTSIDE yylex. 
175
     *       One obvious solution it to make yy_act a global. I tried that, and saw
176
     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
177
     *       normally declared as a register variable-- so it is not worth it.
178
     */
179
    #define  YY_LESS_LINENO(n) \
180
            do { \
181
                int yyl;\
182
                for ( yyl = n; yyl < yyleng; ++yyl )\
183
                    if ( yytext[yyl] == '\n' )\
184
                        --yylineno;\
185
            }while(0)
164
    
186
    
165
/* Return all but the first "n" matched characters back to the input stream. */
187
/* Return all but the first "n" matched characters back to the input stream. */
166
#define yyless(n) \
188
#define yyless(n) \
Lines 192-198 Link Here
192
#define YY_STRUCT_YY_BUFFER_STATE
214
#define YY_STRUCT_YY_BUFFER_STATE
193
struct yy_buffer_state
215
struct yy_buffer_state
194
	{
216
	{
195
	FILE *yy_input_file;
217
218
	std::istream* yy_input_file;
196
219
197
	char *yy_ch_buf;		/* input buffer */
220
	char *yy_ch_buf;		/* input buffer */
198
	char *yy_buf_pos;		/* current position in input buffer */
221
	char *yy_buf_pos;		/* current position in input buffer */
Lines 253-263 Link Here
253
	};
276
	};
254
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
277
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
255
278
256
/* Stack of input buffers. */
257
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
258
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
259
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
260
261
/* We provide macros for accessing buffer states in case in the
279
/* We provide macros for accessing buffer states in case in the
262
 * future we want to put the buffer states in a more general
280
 * future we want to put the buffer states in a more general
263
 * "scanner state".
281
 * "scanner state".
Lines 273-311 Link Here
273
 */
291
 */
274
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
292
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
275
293
276
/* yy_hold_char holds the character lost when yytext is formed. */
277
static char yy_hold_char;
278
static int yy_n_chars;		/* number of characters read into yy_ch_buf */
279
int yyleng;
280
281
/* Points to current character in buffer. */
282
static char *yy_c_buf_p = (char *) 0;
283
static int yy_init = 0;		/* whether we need to initialize */
284
static int yy_start = 0;	/* start state number */
285
286
/* Flag which is used to allow yywrap()'s to do buffer switches
287
 * instead of setting up a fresh yyin.  A bit of a hack ...
288
 */
289
static int yy_did_buffer_switch_on_eof;
290
291
void yyrestart (FILE *input_file  );
292
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
293
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
294
void yy_delete_buffer (YY_BUFFER_STATE b  );
295
void yy_flush_buffer (YY_BUFFER_STATE b  );
296
void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
297
void yypop_buffer_state (void );
298
299
static void yyensure_buffer_stack (void );
300
static void yy_load_buffer_state (void );
301
static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
302
303
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
304
305
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
306
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
307
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
308
309
void *yyalloc (yy_size_t  );
294
void *yyalloc (yy_size_t  );
310
void *yyrealloc (void *,yy_size_t  );
295
void *yyrealloc (void *,yy_size_t  );
311
void yyfree (void *  );
296
void yyfree (void *  );
Lines 317-323 Link Here
317
	if ( ! YY_CURRENT_BUFFER ){ \
302
	if ( ! YY_CURRENT_BUFFER ){ \
318
        yyensure_buffer_stack (); \
303
        yyensure_buffer_stack (); \
319
		YY_CURRENT_BUFFER_LVALUE =    \
304
		YY_CURRENT_BUFFER_LVALUE =    \
320
            yy_create_buffer(yyin,YY_BUF_SIZE ); \
305
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
321
	} \
306
	} \
322
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
307
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
323
	}
308
	}
Lines 327-333 Link Here
327
	if ( ! YY_CURRENT_BUFFER ){\
312
	if ( ! YY_CURRENT_BUFFER ){\
328
        yyensure_buffer_stack (); \
313
        yyensure_buffer_stack (); \
329
		YY_CURRENT_BUFFER_LVALUE =    \
314
		YY_CURRENT_BUFFER_LVALUE =    \
330
            yy_create_buffer(yyin,YY_BUF_SIZE ); \
315
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
331
	} \
316
	} \
332
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
317
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
333
	}
318
	}
Lines 341-361 Link Here
341
326
342
typedef unsigned char YY_CHAR;
327
typedef unsigned char YY_CHAR;
343
328
344
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
345
346
typedef int yy_state_type;
347
348
extern int yylineno;
349
350
int yylineno = 1;
351
352
extern char *yytext;
353
#define yytext_ptr yytext
329
#define yytext_ptr yytext
330
#define YY_INTERACTIVE
354
331
355
static yy_state_type yy_get_previous_state (void );
332
#include <FlexLexer.h>
356
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
333
int yyFlexLexer::yylex()
357
static int yy_get_next_buffer (void );
334
	{
358
static void yy_fatal_error (yyconst char msg[]  );
335
	LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
336
	return 0;
337
	}
338
339
#define YY_DECL int QMake::Lexer::yylex()
359
340
360
/* Done after the current pattern has been matched and before the
341
/* Done after the current pattern has been matched and before the
361
 * corresponding action - sets up yytext.
342
 * corresponding action - sets up yytext.
Lines 376-399 Link Here
376
	flex_int32_t yy_verify;
357
	flex_int32_t yy_verify;
377
	flex_int32_t yy_nxt;
358
	flex_int32_t yy_nxt;
378
	};
359
	};
379
static yyconst flex_int16_t yy_accept[79] =
360
static yyconst flex_int16_t yy_accept[82] =
380
    {   0,
361
    {   0,
381
        0,    0,    0,    0,    0,    0,    0,    0,   25,   24,
362
        0,    0,    0,    0,    0,    0,    0,    0,   25,   24,
382
        1,   22,    5,   23,   19,   20,    5,   24,    5,   21,
363
        1,   22,    5,   23,   19,   20,    5,   24,    5,   21,
383
       11,   24,   16,   18,   24,    9,    2,    9,    9,   24,
364
       11,   24,   16,   18,   24,    9,    2,    9,    9,   24,
384
        2,    2,    6,    2,   24,    8,    1,    5,    5,   23,
365
        2,    2,    6,    2,   24,    8,    1,    5,   23,   14,
385
       14,   12,   13,    0,   17,    0,    4,   15,    9,    0,
366
       12,   13,    0,   17,    0,    4,    4,   15,    9,    0,
386
        2,    0,    9,    0,    9,    0,    7,    0,    3,    2,
367
        2,    0,    9,    0,    0,    9,    0,    7,    7,    0,
387
        3,    2,    6,    6,    6,    6,    2,    3,    0,    8,
368
        3,    2,    3,    2,    6,    6,    6,    6,    2,    3,
388
        9,    0,    9,    0,    0,   10,    0,    0
369
        0,    8,    9,    0,    9,    0,    0,   10,    0,    7,
370
        0
389
    } ;
371
    } ;
390
372
391
static yyconst flex_int32_t yy_ec[256] =
373
static yyconst flex_int32_t yy_ec[256] =
392
    {   0,
374
    {   0,
393
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
375
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
376
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
394
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
377
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
395
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
378
        1,    2,    5,    6,    7,    8,    1,    1,    1,    9,
396
        1,    4,    5,    6,    7,    8,    1,    1,    1,    9,
397
       10,   11,   12,    1,   13,   14,    1,   15,   15,   15,
379
       10,   11,   12,    1,   13,   14,    1,   15,   15,   15,
398
       15,   15,   15,   15,   15,   15,   15,   16,    1,    1,
380
       15,   15,   15,   15,   15,   15,   15,   16,    1,    1,
399
       17,    1,    1,    1,   18,   18,   18,   18,   18,   18,
381
       17,    1,    1,    1,   18,   18,   18,   18,   18,   18,
Lines 422-543 Link Here
422
404
423
static yyconst flex_int32_t yy_meta[25] =
405
static yyconst flex_int32_t yy_meta[25] =
424
    {   0,
406
    {   0,
425
        1,    2,    3,    2,    1,    1,    1,    1,    1,    1,
407
        1,    2,    3,    4,    1,    1,    1,    1,    1,    1,
426
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
408
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
427
        1,    1,    1,    1
409
        1,    1,    1,    1
428
    } ;
410
    } ;
429
411
430
static yyconst flex_int16_t yy_base[92] =
412
static yyconst flex_int16_t yy_base[95] =
431
    {   0,
413
    {   0,
432
        0,    0,   23,   41,   29,   30,   25,   36,  144,  285,
414
        0,    0,   23,   41,   26,   29,   31,   36,  157,  202,
433
       36,  285,   56,    0,  285,  285,  125,  124,  123,   51,
415
      154,  202,   56,    0,  202,  202,  138,  137,  135,   30,
434
      285,   47,  285,  285,  122,  119,   50,  118,   77,   95,
416
      202,   50,  202,  202,  132,  128,   48,   47,   77,   95,
435
       80,   81,   54,   87,  126,  120,   61,    0,    0,    0,
417
       55,   56,   71,   70,  131,  123,  129,    0,    0,  202,
436
      285,  285,  285,   88,  285,   98,  285,  285,  106,   93,
418
      202,  202,   35,  202,   80,  202,   98,  202,   76,   49,
437
      101,  104,  113,   67,  131,   74,  285,  149,  285,  109,
419
       84,   84,   83,   98,   90,  116,   90,  202,  102,  134,
438
       72,  116,    0,   91,    0,  102,  120,    0,   56,   52,
420
      202,  101,  107,  105,    0,  111,    0,  120,  114,    0,
439
      167,  185,  203,  124,  221,  239,  127,  285,  258,  261,
421
       55,   49,  121,  123,  126,  124,  142,  144,  132,  202,
440
      264,   58,   40,  266,  269,  271,  273,  275,  278,  280,
422
      202,  163,  167,  171,   37,  175,  177,  181,  183,  187,
441
      282
423
      189,  193,  195,  197
442
424
443
    } ;
425
    } ;
444
426
445
static yyconst flex_int16_t yy_def[92] =
427
static yyconst flex_int16_t yy_def[95] =
446
    {   0,
428
    {   0,
447
       78,    1,   79,   79,    4,    4,   80,   80,   78,   78,
429
       81,    1,   82,   82,    4,    4,   83,   83,   81,   81,
448
       78,   78,   78,   81,   78,   78,   13,   78,   13,   78,
430
       81,   81,   81,   84,   81,   81,   13,   81,   13,   81,
449
       78,   78,   78,   78,   78,   82,   78,   83,   84,   82,
431
       81,   81,   81,   81,   81,   85,   81,   86,   87,   85,
450
       85,   78,   86,   85,   87,   87,   78,   13,   13,   81,
432
       88,   81,   89,   88,   90,   90,   81,   13,   84,   81,
451
       78,   78,   78,   78,   78,   78,   78,   78,   82,   82,
433
       81,   81,   81,   81,   81,   81,   81,   81,   85,   85,
452
       78,   88,   89,   83,   84,   88,   78,   84,   78,   85,
434
       81,   91,   92,   93,   86,   87,   91,   81,   91,   87,
453
       88,   78,   90,   86,   90,   86,   85,   90,   87,   87,
435
       81,   88,   91,   81,   94,   89,   94,   89,   88,   94,
454
       89,   91,   89,   89,   91,   91,   91,    0,   78,   78,
436
       90,   90,   92,   93,   92,   92,   93,   93,   93,   81,
455
       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
437
        0,   81,   81,   81,   81,   81,   81,   81,   81,   81,
456
       78
438
       81,   81,   81,   81
457
439
458
    } ;
440
    } ;
459
441
460
static yyconst flex_int16_t yy_nxt[310] =
442
static yyconst flex_int16_t yy_nxt[227] =
461
    {   0,
443
    {   0,
462
       10,   11,   12,   11,   13,   10,   14,   13,   15,   16,
444
       10,   11,   12,   10,   13,   10,   14,   13,   15,   16,
463
       17,   18,   19,   10,   13,   20,   21,   13,   22,   13,
445
       17,   18,   19,   10,   13,   20,   21,   13,   22,   13,
464
       23,   10,   24,   25,   27,   12,   27,   10,   28,   29,
446
       23,   10,   24,   25,   27,   12,   10,   32,   28,   29,
465
       32,   34,   32,   34,   36,   33,   33,   37,   10,   37,
447
       34,   43,   33,   10,   10,   33,   43,   49,   10,   10,
466
       53,   30,   31,   12,   31,   36,   28,   29,   46,   47,
448
       36,   30,   31,   12,   10,   36,   28,   29,   54,   51,
467
       46,   51,   44,   51,   44,   65,   52,   65,   49,   30,
449
       44,   45,   46,   47,   52,   44,   62,   64,   72,   30,
468
       38,   70,   37,   38,   37,   70,   38,   38,   39,   38,
450
       38,   63,   65,   38,   72,   55,   38,   50,   38,   38,
469
       38,   45,   66,   38,   57,   38,   57,   38,   56,   57,
451
       38,   69,   67,   38,   67,   38,   70,   38,   57,   58,
470
       56,   60,   62,   60,   62,   54,   61,   63,   67,   44,
452
       59,   45,   46,   47,   74,   51,   58,   59,   75,   68,
471
       67,   44,   65,   68,   65,   58,   46,   47,   46,   46,
453
       52,   81,   58,   59,   50,   60,   45,   46,   47,   74,
472
454
473
       47,   46,   51,   65,   51,   65,   57,   52,   45,   66,
455
       46,   76,   62,   78,   80,   59,   64,   63,   55,   58,
474
       60,   50,   60,   50,   72,   61,   72,   62,   73,   62,
456
       59,   65,   67,   50,   67,   69,   79,   57,   58,   59,
475
       66,   67,   63,   67,   50,   78,   68,   78,   78,   70,
457
       70,   67,   74,   67,   74,   81,   75,   74,   78,   68,
476
       78,   74,   56,   57,   56,   70,   54,   50,   48,   43,
458
       37,   75,   72,   81,   60,   57,   58,   59,   68,   76,
477
       42,   41,   74,   78,   78,   77,   78,   78,   78,   58,
459
       72,   79,   76,   74,   76,   74,   50,   78,   48,   78,
478
       56,   57,   56,   78,   78,   78,   78,   78,   78,   78,
460
       79,   42,   60,   41,   40,   37,   81,   81,   81,   81,
479
       78,   78,   78,   78,   78,   78,   78,   58,   72,   78,
461
       79,   81,   79,   26,   26,   26,   26,   35,   35,   35,
480
       72,   78,   73,   78,   78,   78,   78,   78,   78,   78,
462
       35,   39,   39,   81,   39,   53,   53,   56,   56,   56,
481
       78,   78,   78,   78,   78,   74,   72,   78,   72,   78,
463
       56,   61,   61,   66,   66,   81,   66,   71,   71,   57,
482
       76,   78,   78,   78,   78,   78,   78,   78,   78,   78,
464
       57,   57,   57,   73,   73,   77,   77,   67,   67,   81,
483
465
484
       78,   78,   78,   77,   72,   78,   72,   78,   73,   78,
466
       67,    9,   81,   81,   81,   81,   81,   81,   81,   81,
485
       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
467
       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,
486
       78,   74,   72,   78,   72,   78,   76,   78,   78,   78,
468
       81,   81,   81,   81,   81,   81
487
       78,   78,   78,   78,   78,   78,   78,   78,   78,   77,
488
       72,   78,   72,   78,   76,   78,   78,   78,   78,   78,
489
       78,   78,   78,   78,   78,   78,   78,   77,   26,   26,
490
       26,   35,   35,   35,   40,   40,   55,   55,   55,   59,
491
       59,   64,   64,   69,   69,   56,   56,   56,   71,   71,
492
       65,   65,   75,   75,    9,   78,   78,   78,   78,   78,
493
       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
494
495
       78,   78,   78,   78,   78,   78,   78,   78,   78
496
    } ;
469
    } ;
497
470
498
static yyconst flex_int16_t yy_chk[310] =
471
static yyconst flex_int16_t yy_chk[227] =
499
    {   0,
472
    {   0,
500
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
473
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
501
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
474
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
502
        1,    1,    1,    1,    3,    3,    3,    7,    3,    3,
475
        1,    1,    1,    1,    3,    3,    3,    5,    3,    3,
503
        5,    6,    5,    6,    7,    5,    6,   11,    8,   11,
476
        6,   20,    5,    7,    7,    6,   43,   85,    8,    8,
504
       83,    3,    4,    4,    4,    8,    4,    4,   22,   22,
477
        7,    3,    4,    4,    4,    8,    4,    4,   28,   27,
505
       22,   27,   20,   27,   20,   33,   27,   33,   82,    4,
478
       20,   22,   22,   22,   27,   43,   31,   32,   72,    4,
506
       13,   70,   37,   13,   37,   69,   13,   13,   13,   13,
479
       13,   31,   32,   13,   71,   28,   13,   50,   13,   13,
507
       13,   20,   33,   13,   61,   13,   56,   13,   29,   29,
480
       13,   34,   33,   13,   33,   13,   34,   13,   29,   29,
508
       29,   31,   32,   31,   32,   54,   31,   32,   34,   44,
481
       29,   45,   45,   45,   53,   51,   52,   52,   53,   33,
509
       34,   44,   64,   34,   64,   29,   30,   30,   30,   46,
482
       51,   55,   57,   57,   49,   29,   30,   30,   30,   54,
510
483
511
       46,   46,   51,   66,   51,   66,   52,   51,   44,   64,
484
       47,   53,   62,   54,   59,   59,   64,   62,   55,   63,
512
       60,   50,   60,   30,   53,   60,   53,   62,   53,   62,
485
       63,   64,   66,   30,   66,   69,   54,   56,   56,   56,
513
       66,   67,   62,   67,   49,   74,   67,   74,   77,   36,
486
       69,   68,   73,   68,   74,   76,   73,   75,   74,   66,
514
       77,   53,   55,   55,   55,   35,   28,   26,   25,   19,
487
       37,   75,   36,   79,   56,   60,   60,   60,   68,   73,
515
       18,   17,   74,    9,    0,   77,    0,    0,    0,   55,
488
       35,   74,   76,   77,   75,   78,   26,   77,   25,   78,
516
       58,   58,   58,    0,    0,    0,    0,    0,    0,    0,
489
       79,   19,   60,   18,   17,   11,    9,    0,    0,    0,
517
        0,    0,    0,    0,    0,    0,    0,   58,   71,    0,
490
       77,    0,   78,   82,   82,   82,   82,   83,   83,   83,
518
       71,    0,   71,    0,    0,    0,    0,    0,    0,    0,
491
       83,   84,   84,    0,   84,   86,   86,   87,   87,   87,
519
        0,    0,    0,    0,    0,   71,   72,    0,   72,    0,
492
       87,   88,   88,   89,   89,    0,   89,   90,   90,   91,
520
       72,    0,    0,    0,    0,    0,    0,    0,    0,    0,
493
       91,   91,   91,   92,   92,   93,   93,   94,   94,    0,
521
494
522
        0,    0,    0,   72,   73,    0,   73,    0,   73,    0,
495
       94,   81,   81,   81,   81,   81,   81,   81,   81,   81,
523
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
496
       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,
524
        0,   73,   75,    0,   75,    0,   75,    0,    0,    0,
497
       81,   81,   81,   81,   81,   81
525
        0,    0,    0,    0,    0,    0,    0,    0,    0,   75,
526
       76,    0,   76,    0,   76,    0,    0,    0,    0,    0,
527
        0,    0,    0,    0,    0,    0,    0,   76,   79,   79,
528
       79,   80,   80,   80,   81,   81,   84,   84,   84,   85,
529
       85,   86,   86,   87,   87,   88,   88,   88,   89,   89,
530
       90,   90,   91,   91,   78,   78,   78,   78,   78,   78,
531
       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
532
533
       78,   78,   78,   78,   78,   78,   78,   78,   78
534
    } ;
498
    } ;
535
499
536
static yy_state_type yy_last_accepting_state;
500
/* Table of booleans, true if rule could match eol. */
537
static char *yy_last_accepting_cpos;
501
static yyconst flex_int32_t yy_rule_can_match_eol[25] =
538
502
    {   0,
539
extern int yy_flex_debug;
503
0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
540
int yy_flex_debug = 0;
504
    0, 0, 1, 0, 0,     };
541
505
542
/* The intent behind this definition is that it'll catch
506
/* The intent behind this definition is that it'll catch
543
 * any uses of REJECT which flex missed.
507
 * any uses of REJECT which flex missed.
Lines 546-552 Link Here
546
#define yymore() yymore_used_but_not_detected
510
#define yymore() yymore_used_but_not_detected
547
#define YY_MORE_ADJ 0
511
#define YY_MORE_ADJ 0
548
#define YY_RESTORE_YY_MORE_OFFSET
512
#define YY_RESTORE_YY_MORE_OFFSET
549
char *yytext;
550
#line 1 "qmake.ll"
513
#line 1 "qmake.ll"
551
#line 2 "qmake.ll"
514
#line 2 "qmake.ll"
552
/***************************************************************************
515
/***************************************************************************
Lines 569-577 Link Here
569
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
532
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
570
 ***************************************************************************/
533
 ***************************************************************************/
571
534
572
#include <qmake_yacc.h>
573
#include <stdlib.h>
535
#include <stdlib.h>
574
536
537
#define DONT_INCLUDE_FLEXLEXER
538
539
#include "qmake_lex.h"
540
575
/**
541
/**
576
@file qmake.ll
542
@file qmake.ll
577
QMake Lexer
543
QMake Lexer
Lines 598-604 Link Here
598
564
599
565
600
566
601
#line 602 "qmake_lex.cpp"
567
#line 568 "qmake_lex.cpp"
602
568
603
#define INITIAL 0
569
#define INITIAL 0
604
#define list 1
570
#define list 1
Lines 617-638 Link Here
617
#define YY_EXTRA_TYPE void *
583
#define YY_EXTRA_TYPE void *
618
#endif
584
#endif
619
585
620
static int yy_init_globals (void );
621
622
/* Macros after this point can all be overridden by user definitions in
623
 * section 1.
624
 */
625
626
#ifndef YY_SKIP_YYWRAP
627
#ifdef __cplusplus
628
extern "C" int yywrap (void );
629
#else
630
extern int yywrap (void );
631
#endif
632
#endif
633
634
    static void yyunput (int c,char *buf_ptr  );
635
    
636
#ifndef yytext_ptr
586
#ifndef yytext_ptr
637
static void yy_flex_strncpy (char *,yyconst char *,int );
587
static void yy_flex_strncpy (char *,yyconst char *,int );
638
#endif
588
#endif
Lines 643-654 Link Here
643
593
644
#ifndef YY_NO_INPUT
594
#ifndef YY_NO_INPUT
645
595
646
#ifdef __cplusplus
647
static int yyinput (void );
648
#else
649
static int input (void );
650
#endif
651
652
#endif
596
#endif
653
597
654
/* Amount of stuff to slurp up with each read. */
598
/* Amount of stuff to slurp up with each read. */
Lines 658-667 Link Here
658
602
659
/* Copy whatever the last rule matched to the standard output. */
603
/* Copy whatever the last rule matched to the standard output. */
660
#ifndef ECHO
604
#ifndef ECHO
661
/* This used to be an fputs(), but since the string might contain NUL's,
605
#define ECHO LexerOutput( yytext, yyleng )
662
 * we now use fwrite().
663
 */
664
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
665
#endif
606
#endif
666
607
667
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
608
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
Lines 669-702 Link Here
669
 */
610
 */
670
#ifndef YY_INPUT
611
#ifndef YY_INPUT
671
#define YY_INPUT(buf,result,max_size) \
612
#define YY_INPUT(buf,result,max_size) \
672
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
673
		{ \
674
		int c = '*'; \
675
		size_t n; \
676
		for ( n = 0; n < max_size && \
677
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
678
			buf[n] = (char) c; \
679
		if ( c == '\n' ) \
680
			buf[n++] = (char) c; \
681
		if ( c == EOF && ferror( yyin ) ) \
682
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
683
		result = n; \
684
		} \
685
	else \
686
		{ \
687
		errno=0; \
688
		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
689
			{ \
690
			if( errno != EINTR) \
691
				{ \
692
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
693
				break; \
694
				} \
695
			errno=0; \
696
			clearerr(yyin); \
697
			} \
698
		}\
699
\
613
\
614
	if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
615
		YY_FATAL_ERROR( "input in flex scanner failed" );
700
616
701
#endif
617
#endif
702
618
Lines 715-721 Link Here
715
631
716
/* Report a fatal error. */
632
/* Report a fatal error. */
717
#ifndef YY_FATAL_ERROR
633
#ifndef YY_FATAL_ERROR
718
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
634
#define YY_FATAL_ERROR(msg) LexerError( msg )
719
#endif
635
#endif
720
636
721
/* end tables serialization structures and prototypes */
637
/* end tables serialization structures and prototypes */
Lines 725-734 Link Here
725
 */
641
 */
726
#ifndef YY_DECL
642
#ifndef YY_DECL
727
#define YY_DECL_IS_OURS 1
643
#define YY_DECL_IS_OURS 1
728
644
#define YY_DECL int yyFlexLexer::yylex()
729
extern int yylex (void);
730
731
#define YY_DECL int yylex (void)
732
#endif /* !YY_DECL */
645
#endif /* !YY_DECL */
733
646
734
/* Code executed at the beginning of each rule, after yytext and yyleng
647
/* Code executed at the beginning of each rule, after yytext and yyleng
Lines 757-765 Link Here
757
	register char *yy_cp, *yy_bp;
670
	register char *yy_cp, *yy_bp;
758
	register int yy_act;
671
	register int yy_act;
759
    
672
    
760
#line 72 "qmake.ll"
673
#line 78 "qmake.ll"
761
674
762
#line 763 "qmake_lex.cpp"
675
#line 676 "qmake_lex.cpp"
763
676
764
	if ( !(yy_init) )
677
	if ( !(yy_init) )
765
		{
678
		{
Lines 773-787 Link Here
773
			(yy_start) = 1;	/* first start state */
686
			(yy_start) = 1;	/* first start state */
774
687
775
		if ( ! yyin )
688
		if ( ! yyin )
776
			yyin = stdin;
689
			yyin = & std::cin;
777
690
778
		if ( ! yyout )
691
		if ( ! yyout )
779
			yyout = stdout;
692
			yyout = & std::cout;
780
693
781
		if ( ! YY_CURRENT_BUFFER ) {
694
		if ( ! YY_CURRENT_BUFFER ) {
782
			yyensure_buffer_stack ();
695
			yyensure_buffer_stack ();
783
			YY_CURRENT_BUFFER_LVALUE =
696
			YY_CURRENT_BUFFER_LVALUE =
784
				yy_create_buffer(yyin,YY_BUF_SIZE );
697
				yy_create_buffer( yyin, YY_BUF_SIZE );
785
		}
698
		}
786
699
787
		yy_load_buffer_state( );
700
		yy_load_buffer_state( );
Lines 813-825 Link Here
813
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
726
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
814
				{
727
				{
815
				yy_current_state = (int) yy_def[yy_current_state];
728
				yy_current_state = (int) yy_def[yy_current_state];
816
				if ( yy_current_state >= 79 )
729
				if ( yy_current_state >= 82 )
817
					yy_c = yy_meta[(unsigned int) yy_c];
730
					yy_c = yy_meta[(unsigned int) yy_c];
818
				}
731
				}
819
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
732
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
820
			++yy_cp;
733
			++yy_cp;
821
			}
734
			}
822
		while ( yy_base[yy_current_state] != 285 );
735
		while ( yy_base[yy_current_state] != 202 );
823
736
824
yy_find_action:
737
yy_find_action:
825
		yy_act = yy_accept[yy_current_state];
738
		yy_act = yy_accept[yy_current_state];
Lines 832-837 Link Here
832
745
833
		YY_DO_BEFORE_ACTION;
746
		YY_DO_BEFORE_ACTION;
834
747
748
		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
749
			{
750
			int yyl;
751
			for ( yyl = 0; yyl < yyleng; ++yyl )
752
				if ( yytext[yyl] == '\n' )
753
					   
754
    yylineno++;
755
;
756
			}
757
835
do_action:	/* This label is used only to access EOF actions. */
758
do_action:	/* This label is used only to access EOF actions. */
836
759
837
		switch ( yy_act )
760
		switch ( yy_act )
Lines 845-991 Link Here
845
768
846
case 1:
769
case 1:
847
YY_RULE_SETUP
770
YY_RULE_SETUP
848
#line 73 "qmake.ll"
771
#line 79 "qmake.ll"
849
{}
772
{}
850
	YY_BREAK
773
	YY_BREAK
851
case 2:
774
case 2:
852
YY_RULE_SETUP
775
YY_RULE_SETUP
853
#line 74 "qmake.ll"
776
#line 81 "qmake.ll"
854
{ yylval.value = yytext; return LIST_WS; }
777
{
778
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
779
    return Parser::token::token::LIST_WS;
780
}
855
	YY_BREAK
781
	YY_BREAK
856
case 3:
782
case 3:
857
YY_RULE_SETUP
783
YY_RULE_SETUP
858
#line 75 "qmake.ll"
784
#line 86 "qmake.ll"
859
{ 
785
{ 
860
    yylval.value = yytext;
786
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
861
    unput(char(yylval.value.at(yylval.value.length()-1).latin1()));
787
    unput(char(mylval->value.at(mylval->value.length()-1).latin1()));
862
    yylval.value = yylval.value.mid(0, yylval.value.length()-1);
788
    mylval->value = mylval->value.mid(0, mylval->value.length()-1);
863
    return INDENT;
789
    return Parser::token::token::INDENT;
864
}
790
}
865
	YY_BREAK
791
	YY_BREAK
866
case 4:
792
case 4:
867
/* rule 4 can match eol */
793
/* rule 4 can match eol */
868
YY_RULE_SETUP
794
YY_RULE_SETUP
869
#line 82 "qmake.ll"
795
#line 93 "qmake.ll"
870
{ BEGIN(list); return CONT; }
796
{
797
    BEGIN(list);
798
    return Parser::token::token::CONT;
799
}
871
	YY_BREAK
800
	YY_BREAK
872
case 5:
801
case 5:
873
YY_RULE_SETUP
802
YY_RULE_SETUP
874
#line 83 "qmake.ll"
803
#line 97 "qmake.ll"
875
{ yylval.value = yytext; return (ID_SIMPLE); }
804
{
805
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
806
    return (Parser::token::token::ID_SIMPLE);
807
}
876
	YY_BREAK
808
	YY_BREAK
877
case 6:
809
case 6:
878
YY_RULE_SETUP
810
YY_RULE_SETUP
879
#line 85 "qmake.ll"
811
#line 102 "qmake.ll"
880
{
812
{
881
    yylval.value = yytext;
813
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
882
    BEGIN(list);
814
    BEGIN(list);
883
    return (LIST_COMMENT_WITHOUT_NEWLINE);
815
    return (Parser::token::token::LIST_COMMENT_WITHOUT_NEWLINE);
884
}
816
}
885
	YY_BREAK
817
	YY_BREAK
886
case 7:
818
case 7:
887
/* rule 7 can match eol */
819
/* rule 7 can match eol */
888
YY_RULE_SETUP
820
YY_RULE_SETUP
889
#line 91 "qmake.ll"
821
#line 108 "qmake.ll"
890
{
822
{
891
    yylval.value = yytext;
823
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
892
    BEGIN(list);
824
    BEGIN(list);
893
    return (LIST_COMMENT);
825
    return (Parser::token::token::LIST_COMMENT);
894
    }
826
    }
895
	YY_BREAK
827
	YY_BREAK
896
case 8:
828
case 8:
897
YY_RULE_SETUP
829
YY_RULE_SETUP
898
#line 97 "qmake.ll"
830
#line 114 "qmake.ll"
899
{
831
{
900
    yylval.value = yytext;
832
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
901
    yylval.value = yylval.value.mid(0, yylval.value.length()-1);
833
    mylval->value = mylval->value.mid(0, mylval->value.length()-1);
902
    unput(')');
834
    unput(')');
903
    BEGIN(INITIAL);
835
    BEGIN(INITIAL);
904
    return (ID_ARGS);
836
    return (Parser::token::token::ID_ARGS);
905
    }
837
    }
906
	YY_BREAK
838
	YY_BREAK
907
case 9:
839
case 9:
908
YY_RULE_SETUP
840
YY_RULE_SETUP
909
#line 105 "qmake.ll"
841
#line 122 "qmake.ll"
910
{ BEGIN(list_with_comment); yylval.value = yytext; return VARIABLE_VALUE; }
842
{
843
    BEGIN(list_with_comment);
844
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
845
    return Parser::token::token::VARIABLE_VALUE;
846
}
911
	YY_BREAK
847
	YY_BREAK
912
case 10:
848
case 10:
913
YY_RULE_SETUP
849
YY_RULE_SETUP
914
#line 106 "qmake.ll"
850
#line 128 "qmake.ll"
915
{ BEGIN(list_with_comment); yylval.value = yytext; return QUOTED_VARIABLE_VALUE; }
851
{
852
    BEGIN(list_with_comment);
853
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
854
    return Parser::token::token::QUOTED_VARIABLE_VALUE;
855
}
916
	YY_BREAK
856
	YY_BREAK
917
case 11:
857
case 11:
918
YY_RULE_SETUP
858
YY_RULE_SETUP
919
#line 108 "qmake.ll"
859
#line 134 "qmake.ll"
920
{ BEGIN(list); yylval.value = yytext; return EQ; }
860
{
861
BEGIN(list);
862
mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
863
return Parser::token::token::EQ;
864
}
921
	YY_BREAK
865
	YY_BREAK
922
case 12:
866
case 12:
923
YY_RULE_SETUP
867
YY_RULE_SETUP
924
#line 109 "qmake.ll"
868
#line 140 "qmake.ll"
925
{ BEGIN(list); yylval.value = yytext; return PLUSEQ; }
869
{
870
    BEGIN(list);
871
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
872
    return Parser::token::token::PLUSEQ;
873
}
926
	YY_BREAK
874
	YY_BREAK
927
case 13:
875
case 13:
928
YY_RULE_SETUP
876
YY_RULE_SETUP
929
#line 110 "qmake.ll"
877
#line 146 "qmake.ll"
930
{ BEGIN(list); yylval.value = yytext; return MINUSQE; }
878
{
879
    BEGIN(list);
880
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
881
    return Parser::token::token::MINUSEQ;
882
}
931
	YY_BREAK
883
	YY_BREAK
932
case 14:
884
case 14:
933
YY_RULE_SETUP
885
YY_RULE_SETUP
934
#line 111 "qmake.ll"
886
#line 152 "qmake.ll"
935
{ BEGIN(list); yylval.value = yytext; return STAREQ; }
887
{
888
    BEGIN(list);
889
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
890
    return Parser::token::token::STAREQ;
891
}
936
	YY_BREAK
892
	YY_BREAK
937
case 15:
893
case 15:
938
YY_RULE_SETUP
894
YY_RULE_SETUP
939
#line 112 "qmake.ll"
895
#line 158 "qmake.ll"
940
{ BEGIN(list); yylval.value = yytext; return TILDEEQ; }
896
{
897
    BEGIN(list);
898
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
899
    return Parser::token::token::TILDEEQ;
900
}
941
	YY_BREAK
901
	YY_BREAK
942
case 16:
902
case 16:
943
YY_RULE_SETUP
903
YY_RULE_SETUP
944
#line 113 "qmake.ll"
904
#line 164 "qmake.ll"
945
{ return LCURLY; }
905
{
906
    return Parser::token::token::LCURLY;
907
}
946
	YY_BREAK
908
	YY_BREAK
947
case 17:
909
case 17:
948
YY_RULE_SETUP
910
YY_RULE_SETUP
949
#line 114 "qmake.ll"
911
#line 168 "qmake.ll"
950
{ return LCURLY; }
912
{
913
    return Parser::token::token::LCURLY;
914
}
951
	YY_BREAK
915
	YY_BREAK
952
case 18:
916
case 18:
953
YY_RULE_SETUP
917
YY_RULE_SETUP
954
#line 115 "qmake.ll"
918
#line 172 "qmake.ll"
955
{ return RCURLY; }
919
{
920
    return Parser::token::token::RCURLY;
921
}
956
	YY_BREAK
922
	YY_BREAK
957
case 19:
923
case 19:
958
YY_RULE_SETUP
924
YY_RULE_SETUP
959
#line 116 "qmake.ll"
925
#line 176 "qmake.ll"
960
{ BEGIN(funcargs); return LBRACE; }
926
{
927
    BEGIN(funcargs);
928
    return Parser::token::token::LBRACE;
929
}
961
	YY_BREAK
930
	YY_BREAK
962
case 20:
931
case 20:
963
YY_RULE_SETUP
932
YY_RULE_SETUP
964
#line 117 "qmake.ll"
933
#line 181 "qmake.ll"
965
{ BEGIN(INITIAL); return RBRACE; }
934
{
935
    BEGIN(INITIAL);
936
    return Parser::token::token::RBRACE;
937
}
966
	YY_BREAK
938
	YY_BREAK
967
case 21:
939
case 21:
968
YY_RULE_SETUP
940
YY_RULE_SETUP
969
#line 118 "qmake.ll"
941
#line 186 "qmake.ll"
970
{ yylval.value = yytext; return COLON; }
942
{
943
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
944
    return Parser::token::token::COLON;
945
}
971
	YY_BREAK
946
	YY_BREAK
972
case 22:
947
case 22:
973
/* rule 22 can match eol */
948
/* rule 22 can match eol */
974
YY_RULE_SETUP
949
YY_RULE_SETUP
975
#line 119 "qmake.ll"
950
#line 191 "qmake.ll"
976
{ BEGIN(INITIAL); return NEWLINE; }
951
{
952
    BEGIN(INITIAL);
953
    return Parser::token::token::NEWLINE;
954
}
977
	YY_BREAK
955
	YY_BREAK
978
case 23:
956
case 23:
979
YY_RULE_SETUP
957
YY_RULE_SETUP
980
#line 121 "qmake.ll"
958
#line 196 "qmake.ll"
981
{ yylval.value = yytext; return (COMMENT); }
959
{
960
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
961
    return (Parser::token::token::COMMENT);
962
}
982
	YY_BREAK
963
	YY_BREAK
983
case 24:
964
case 24:
984
YY_RULE_SETUP
965
YY_RULE_SETUP
985
#line 123 "qmake.ll"
966
#line 201 "qmake.ll"
986
ECHO;
967
ECHO;
987
	YY_BREAK
968
	YY_BREAK
988
#line 989 "qmake_lex.cpp"
969
#line 970 "qmake_lex.cpp"
989
case YY_STATE_EOF(INITIAL):
970
case YY_STATE_EOF(INITIAL):
990
case YY_STATE_EOF(list):
971
case YY_STATE_EOF(list):
991
case YY_STATE_EOF(list_with_comment):
972
case YY_STATE_EOF(list_with_comment):
Lines 1121-1126 Link Here
1121
		} /* end of scanning one token */
1102
		} /* end of scanning one token */
1122
} /* end of yylex */
1103
} /* end of yylex */
1123
1104
1105
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1106
{
1107
	yyin = arg_yyin;
1108
	yyout = arg_yyout;
1109
	yy_c_buf_p = 0;
1110
	yy_init = 0;
1111
	yy_start = 0;
1112
	yy_flex_debug = 0;
1113
	yylineno = 1;	// this will only get updated if %option yylineno
1114
1115
	yy_did_buffer_switch_on_eof = 0;
1116
1117
	yy_looking_for_trail_begin = 0;
1118
	yy_more_flag = 0;
1119
	yy_more_len = 0;
1120
	yy_more_offset = yy_prev_more_offset = 0;
1121
1122
	yy_start_stack_ptr = yy_start_stack_depth = 0;
1123
	yy_start_stack = NULL;
1124
1125
    (yy_buffer_stack) = 0;
1126
    (yy_buffer_stack_top) = 0;
1127
    (yy_buffer_stack_max) = 0;
1128
1129
	yy_state_buf = 0;
1130
1131
}
1132
1133
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1134
{
1135
	if ( new_in )
1136
		{
1137
		yy_delete_buffer( YY_CURRENT_BUFFER );
1138
		yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
1139
		}
1140
1141
	if ( new_out )
1142
		yyout = new_out;
1143
}
1144
1145
#ifdef YY_INTERACTIVE
1146
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1147
#else
1148
int yyFlexLexer::LexerInput( char* buf, int max_size )
1149
#endif
1150
{
1151
	if ( yyin->eof() || yyin->fail() )
1152
		return 0;
1153
1154
#ifdef YY_INTERACTIVE
1155
	yyin->get( buf[0] );
1156
1157
	if ( yyin->eof() )
1158
		return 0;
1159
1160
	if ( yyin->bad() )
1161
		return -1;
1162
1163
	return 1;
1164
1165
#else
1166
	(void) yyin->read( buf, max_size );
1167
1168
	if ( yyin->bad() )
1169
		return -1;
1170
	else
1171
		return yyin->gcount();
1172
#endif
1173
}
1174
1175
void yyFlexLexer::LexerOutput( const char* buf, int size )
1176
{
1177
	(void) yyout->write( buf, size );
1178
}
1179
1124
/* yy_get_next_buffer - try to read in a new buffer
1180
/* yy_get_next_buffer - try to read in a new buffer
1125
 *
1181
 *
1126
 * Returns a code representing an action:
1182
 * Returns a code representing an action:
Lines 1128-1134 Link Here
1128
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1184
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1129
 *	EOB_ACT_END_OF_FILE - end of file
1185
 *	EOB_ACT_END_OF_FILE - end of file
1130
 */
1186
 */
1131
static int yy_get_next_buffer (void)
1187
int yyFlexLexer::yy_get_next_buffer()
1132
{
1188
{
1133
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1189
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1134
	register char *source = (yytext_ptr);
1190
	register char *source = (yytext_ptr);
Lines 1229-1235 Link Here
1229
		if ( number_to_move == YY_MORE_ADJ )
1285
		if ( number_to_move == YY_MORE_ADJ )
1230
			{
1286
			{
1231
			ret_val = EOB_ACT_END_OF_FILE;
1287
			ret_val = EOB_ACT_END_OF_FILE;
1232
			yyrestart(yyin  );
1288
			yyrestart( yyin  );
1233
			}
1289
			}
1234
1290
1235
		else
1291
		else
Lines 1254-1260 Link Here
1254
1310
1255
/* yy_get_previous_state - get the state just before the EOB char was reached */
1311
/* yy_get_previous_state - get the state just before the EOB char was reached */
1256
1312
1257
    static yy_state_type yy_get_previous_state (void)
1313
    yy_state_type yyFlexLexer::yy_get_previous_state()
1258
{
1314
{
1259
	register yy_state_type yy_current_state;
1315
	register yy_state_type yy_current_state;
1260
	register char *yy_cp;
1316
	register char *yy_cp;
Lines 1273-1279 Link Here
1273
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1329
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1274
			{
1330
			{
1275
			yy_current_state = (int) yy_def[yy_current_state];
1331
			yy_current_state = (int) yy_def[yy_current_state];
1276
			if ( yy_current_state >= 79 )
1332
			if ( yy_current_state >= 82 )
1277
				yy_c = yy_meta[(unsigned int) yy_c];
1333
				yy_c = yy_meta[(unsigned int) yy_c];
1278
			}
1334
			}
1279
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1335
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Lines 1287-1293 Link Here
1287
 * synopsis
1343
 * synopsis
1288
 *	next_state = yy_try_NUL_trans( current_state );
1344
 *	next_state = yy_try_NUL_trans( current_state );
1289
 */
1345
 */
1290
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1346
    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1291
{
1347
{
1292
	register int yy_is_jam;
1348
	register int yy_is_jam;
1293
    	register char *yy_cp = (yy_c_buf_p);
1349
    	register char *yy_cp = (yy_c_buf_p);
Lines 1301-1316 Link Here
1301
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1357
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1302
		{
1358
		{
1303
		yy_current_state = (int) yy_def[yy_current_state];
1359
		yy_current_state = (int) yy_def[yy_current_state];
1304
		if ( yy_current_state >= 79 )
1360
		if ( yy_current_state >= 82 )
1305
			yy_c = yy_meta[(unsigned int) yy_c];
1361
			yy_c = yy_meta[(unsigned int) yy_c];
1306
		}
1362
		}
1307
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1363
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1308
	yy_is_jam = (yy_current_state == 78);
1364
	yy_is_jam = (yy_current_state == 81);
1309
1365
1310
	return yy_is_jam ? 0 : yy_current_state;
1366
	return yy_is_jam ? 0 : yy_current_state;
1311
}
1367
}
1312
1368
1313
    static void yyunput (int c, register char * yy_bp )
1369
    void yyFlexLexer::yyunput( int c, register char* yy_bp)
1314
{
1370
{
1315
	register char *yy_cp;
1371
	register char *yy_cp;
1316
    
1372
    
Lines 1342-1359 Link Here
1342
1398
1343
	*--yy_cp = (char) c;
1399
	*--yy_cp = (char) c;
1344
1400
1401
    if ( c == '\n' ){
1402
        --yylineno;
1403
    }
1404
1345
	(yytext_ptr) = yy_bp;
1405
	(yytext_ptr) = yy_bp;
1346
	(yy_hold_char) = *yy_cp;
1406
	(yy_hold_char) = *yy_cp;
1347
	(yy_c_buf_p) = yy_cp;
1407
	(yy_c_buf_p) = yy_cp;
1348
}
1408
}
1349
1409
1350
#ifndef YY_NO_INPUT
1410
    int yyFlexLexer::yyinput()
1351
#ifdef __cplusplus
1352
    static int yyinput (void)
1353
#else
1354
    static int input  (void)
1355
#endif
1356
1357
{
1411
{
1358
	int c;
1412
	int c;
1359
    
1413
    
Lines 1388-1394 Link Here
1388
					 */
1442
					 */
1389
1443
1390
					/* Reset buffer status. */
1444
					/* Reset buffer status. */
1391
					yyrestart(yyin );
1445
					yyrestart( yyin );
1392
1446
1393
					/*FALLTHROUGH*/
1447
					/*FALLTHROUGH*/
1394
1448
Lines 1418-1443 Link Here
1418
	(yy_hold_char) = *++(yy_c_buf_p);
1472
	(yy_hold_char) = *++(yy_c_buf_p);
1419
1473
1420
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1474
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1475
	if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol )
1476
		   
1477
    yylineno++;
1478
;
1421
1479
1422
	return c;
1480
	return c;
1423
}
1481
}
1424
#endif	/* ifndef YY_NO_INPUT */
1425
1482
1426
/** Immediately switch to a different input stream.
1483
/** Immediately switch to a different input stream.
1427
 * @param input_file A readable stream.
1484
 * @param input_file A readable stream.
1428
 * 
1485
 * 
1429
 * @note This function does not reset the start condition to @c INITIAL .
1486
 * @note This function does not reset the start condition to @c INITIAL .
1430
 */
1487
 */
1431
    void yyrestart  (FILE * input_file )
1488
    void yyFlexLexer::yyrestart( std::istream* input_file )
1432
{
1489
{
1433
    
1490
    
1434
	if ( ! YY_CURRENT_BUFFER ){
1491
	if ( ! YY_CURRENT_BUFFER ){
1435
        yyensure_buffer_stack ();
1492
        yyensure_buffer_stack ();
1436
		YY_CURRENT_BUFFER_LVALUE =
1493
		YY_CURRENT_BUFFER_LVALUE =
1437
            yy_create_buffer(yyin,YY_BUF_SIZE );
1494
            yy_create_buffer( yyin, YY_BUF_SIZE );
1438
	}
1495
	}
1439
1496
1440
	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1497
	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1441
	yy_load_buffer_state( );
1498
	yy_load_buffer_state( );
1442
}
1499
}
1443
1500
Lines 1445-1451 Link Here
1445
 * @param new_buffer The new input buffer.
1502
 * @param new_buffer The new input buffer.
1446
 * 
1503
 * 
1447
 */
1504
 */
1448
    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1505
    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1449
{
1506
{
1450
    
1507
    
1451
	/* TODO. We should be able to replace this entire function body
1508
	/* TODO. We should be able to replace this entire function body
Lines 1476-1482 Link Here
1476
	(yy_did_buffer_switch_on_eof) = 1;
1533
	(yy_did_buffer_switch_on_eof) = 1;
1477
}
1534
}
1478
1535
1479
static void yy_load_buffer_state  (void)
1536
    void yyFlexLexer::yy_load_buffer_state()
1480
{
1537
{
1481
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1538
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1482
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1539
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
Lines 1490-1496 Link Here
1490
 * 
1547
 * 
1491
 * @return the allocated buffer state.
1548
 * @return the allocated buffer state.
1492
 */
1549
 */
1493
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1550
    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1494
{
1551
{
1495
	YY_BUFFER_STATE b;
1552
	YY_BUFFER_STATE b;
1496
    
1553
    
Lines 1509-1515 Link Here
1509
1566
1510
	b->yy_is_our_buffer = 1;
1567
	b->yy_is_our_buffer = 1;
1511
1568
1512
	yy_init_buffer(b,file );
1569
	yy_init_buffer( b, file );
1513
1570
1514
	return b;
1571
	return b;
1515
}
1572
}
Lines 1518-1524 Link Here
1518
 * @param b a buffer created with yy_create_buffer()
1575
 * @param b a buffer created with yy_create_buffer()
1519
 * 
1576
 * 
1520
 */
1577
 */
1521
    void yy_delete_buffer (YY_BUFFER_STATE  b )
1578
    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1522
{
1579
{
1523
    
1580
    
1524
	if ( ! b )
1581
	if ( ! b )
Lines 1533-1552 Link Here
1533
	yyfree((void *) b  );
1590
	yyfree((void *) b  );
1534
}
1591
}
1535
1592
1536
#ifndef __cplusplus
1593
extern "C" int isatty (int );
1537
extern int isatty (int );
1538
#endif /* __cplusplus */
1539
    
1594
    
1540
/* Initializes or reinitializes a buffer.
1595
/* Initializes or reinitializes a buffer.
1541
 * This function is sometimes called more than once on the same buffer,
1596
 * This function is sometimes called more than once on the same buffer,
1542
 * such as during a yyrestart() or at EOF.
1597
 * such as during a yyrestart() or at EOF.
1543
 */
1598
 */
1544
    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1599
    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1545
1600
1546
{
1601
{
1547
	int oerrno = errno;
1602
	int oerrno = errno;
1548
    
1603
    
1549
	yy_flush_buffer(b );
1604
	yy_flush_buffer( b );
1550
1605
1551
	b->yy_input_file = file;
1606
	b->yy_input_file = file;
1552
	b->yy_fill_buffer = 1;
1607
	b->yy_fill_buffer = 1;
Lines 1560-1567 Link Here
1560
        b->yy_bs_column = 0;
1615
        b->yy_bs_column = 0;
1561
    }
1616
    }
1562
1617
1563
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1618
	b->yy_is_interactive = 0;
1564
    
1565
	errno = oerrno;
1619
	errno = oerrno;
1566
}
1620
}
1567
1621
Lines 1569-1575 Link Here
1569
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1623
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1570
 * 
1624
 * 
1571
 */
1625
 */
1572
    void yy_flush_buffer (YY_BUFFER_STATE  b )
1626
    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1573
{
1627
{
1574
    	if ( ! b )
1628
    	if ( ! b )
1575
		return;
1629
		return;
Lines 1598-1604 Link Here
1598
 *  @param new_buffer The new state.
1652
 *  @param new_buffer The new state.
1599
 *  
1653
 *  
1600
 */
1654
 */
1601
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1655
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1602
{
1656
{
1603
    	if (new_buffer == NULL)
1657
    	if (new_buffer == NULL)
1604
		return;
1658
		return;
Lines 1628-1634 Link Here
1628
 *  The next element becomes the new top.
1682
 *  The next element becomes the new top.
1629
 *  
1683
 *  
1630
 */
1684
 */
1631
void yypop_buffer_state (void)
1685
void yyFlexLexer::yypop_buffer_state (void)
1632
{
1686
{
1633
    	if (!YY_CURRENT_BUFFER)
1687
    	if (!YY_CURRENT_BUFFER)
1634
		return;
1688
		return;
Lines 1647-1653 Link Here
1647
/* Allocates the stack if it does not exist.
1701
/* Allocates the stack if it does not exist.
1648
 *  Guarantees space for at least one push.
1702
 *  Guarantees space for at least one push.
1649
 */
1703
 */
1650
static void yyensure_buffer_stack (void)
1704
void yyFlexLexer::yyensure_buffer_stack(void)
1651
{
1705
{
1652
	int num_to_alloc;
1706
	int num_to_alloc;
1653
    
1707
    
Lines 1686-1784 Link Here
1686
	}
1740
	}
1687
}
1741
}
1688
1742
1689
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1743
    void yyFlexLexer::yy_push_state( int new_state )
1690
 * @param base the character buffer
1691
 * @param size the size in bytes of the character buffer
1692
 * 
1693
 * @return the newly allocated buffer state object. 
1694
 */
1695
YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1696
{
1744
{
1697
	YY_BUFFER_STATE b;
1745
    	if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1746
		{
1747
		yy_size_t new_size;
1698
    
1748
    
1699
	if ( size < 2 ||
1749
		(yy_start_stack_depth) += YY_START_STACK_INCR;
1700
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
1750
		new_size = (yy_start_stack_depth) * sizeof( int );
1701
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
1702
		/* They forgot to leave room for the EOB's. */
1703
		return 0;
1704
1751
1705
	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1752
		if ( ! (yy_start_stack) )
1706
	if ( ! b )
1753
			(yy_start_stack) = (int *) yyalloc(new_size  );
1707
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1708
1754
1709
	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
1755
		else
1710
	b->yy_buf_pos = b->yy_ch_buf = base;
1756
			(yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size  );
1711
	b->yy_is_our_buffer = 0;
1757
1712
	b->yy_input_file = 0;
1758
		if ( ! (yy_start_stack) )
1713
	b->yy_n_chars = b->yy_buf_size;
1759
			YY_FATAL_ERROR(
1714
	b->yy_is_interactive = 0;
1760
			"out of memory expanding start-condition stack" );
1715
	b->yy_at_bol = 1;
1761
		}
1716
	b->yy_fill_buffer = 0;
1717
	b->yy_buffer_status = YY_BUFFER_NEW;
1718
1762
1719
	yy_switch_to_buffer(b  );
1763
	(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1720
1764
1721
	return b;
1765
	BEGIN(new_state);
1722
}
1766
}
1723
1767
1724
/** Setup the input buffer state to scan a string. The next call to yylex() will
1768
    void yyFlexLexer::yy_pop_state()
1725
 * scan from a @e copy of @a str.
1726
 * @param yystr a NUL-terminated string to scan
1727
 * 
1728
 * @return the newly allocated buffer state object.
1729
 * @note If you want to scan bytes that may contain NUL values, then use
1730
 *       yy_scan_bytes() instead.
1731
 */
1732
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1733
{
1769
{
1770
    	if ( --(yy_start_stack_ptr) < 0 )
1771
		YY_FATAL_ERROR( "start-condition stack underflow" );
1734
    
1772
    
1735
	return yy_scan_bytes(yystr,strlen(yystr) );
1773
	BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1736
}
1774
}
1737
1775
1738
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1776
    int yyFlexLexer::yy_top_state()
1739
 * scan from a @e copy of @a bytes.
1740
 * @param bytes the byte buffer to scan
1741
 * @param len the number of bytes in the buffer pointed to by @a bytes.
1742
 * 
1743
 * @return the newly allocated buffer state object.
1744
 */
1745
YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
1746
{
1777
{
1747
	YY_BUFFER_STATE b;
1778
    	return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1748
	char *buf;
1749
	yy_size_t n;
1750
	int i;
1751
    
1752
	/* Get memory for full buffer, including space for trailing EOB's. */
1753
	n = _yybytes_len + 2;
1754
	buf = (char *) yyalloc(n  );
1755
	if ( ! buf )
1756
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1757
1758
	for ( i = 0; i < _yybytes_len; ++i )
1759
		buf[i] = yybytes[i];
1760
1761
	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1762
1763
	b = yy_scan_buffer(buf,n );
1764
	if ( ! b )
1765
		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1766
1767
	/* It's okay to grow etc. this buffer, and we should throw it
1768
	 * away when we're done.
1769
	 */
1770
	b->yy_is_our_buffer = 1;
1771
1772
	return b;
1773
}
1779
}
1774
1780
1775
#ifndef YY_EXIT_FAILURE
1781
#ifndef YY_EXIT_FAILURE
1776
#define YY_EXIT_FAILURE 2
1782
#define YY_EXIT_FAILURE 2
1777
#endif
1783
#endif
1778
1784
1779
static void yy_fatal_error (yyconst char* msg )
1785
void yyFlexLexer::LexerError( yyconst char msg[] )
1780
{
1786
{
1781
    	(void) fprintf( stderr, "%s\n", msg );
1787
    	std::cerr << msg << std::endl;
1782
	exit( YY_EXIT_FAILURE );
1788
	exit( YY_EXIT_FAILURE );
1783
}
1789
}
1784
1790
Lines 1801-1919 Link Here
1801
1807
1802
/* Accessor  methods (get/set functions) to struct members. */
1808
/* Accessor  methods (get/set functions) to struct members. */
1803
1809
1804
/** Get the current line number.
1810
yyFlexLexer::~yyFlexLexer()
1805
 * 
1806
 */
1807
int yyget_lineno  (void)
1808
{
1809
        
1810
    return yylineno;
1811
}
1812
1813
/** Get the input stream.
1814
 * 
1815
 */
1816
FILE *yyget_in  (void)
1817
{
1818
        return yyin;
1819
}
1820
1821
/** Get the output stream.
1822
 * 
1823
 */
1824
FILE *yyget_out  (void)
1825
{
1826
        return yyout;
1827
}
1828
1829
/** Get the length of the current token.
1830
 * 
1831
 */
1832
int yyget_leng  (void)
1833
{
1834
        return yyleng;
1835
}
1836
1837
/** Get the current token.
1838
 * 
1839
 */
1840
1841
char *yyget_text  (void)
1842
{
1843
        return yytext;
1844
}
1845
1846
/** Set the current line number.
1847
 * @param line_number
1848
 * 
1849
 */
1850
void yyset_lineno (int  line_number )
1851
{
1852
    
1853
    yylineno = line_number;
1854
}
1855
1856
/** Set the input stream. This does not discard the current
1857
 * input buffer.
1858
 * @param in_str A readable stream.
1859
 * 
1860
 * @see yy_switch_to_buffer
1861
 */
1862
void yyset_in (FILE *  in_str )
1863
{
1864
        yyin = in_str ;
1865
}
1866
1867
void yyset_out (FILE *  out_str )
1868
{
1869
        yyout = out_str ;
1870
}
1871
1872
int yyget_debug  (void)
1873
{
1874
        return yy_flex_debug;
1875
}
1876
1877
void yyset_debug (int  bdebug )
1878
{
1879
        yy_flex_debug = bdebug ;
1880
}
1881
1882
static int yy_init_globals (void)
1883
{
1884
        /* Initialization is the same as for the non-reentrant scanner.
1885
     * This function is called from yylex_destroy(), so don't allocate here.
1886
     */
1887
1888
    (yy_buffer_stack) = 0;
1889
    (yy_buffer_stack_top) = 0;
1890
    (yy_buffer_stack_max) = 0;
1891
    (yy_c_buf_p) = (char *) 0;
1892
    (yy_init) = 0;
1893
    (yy_start) = 0;
1894
1895
/* Defined in main.c */
1896
#ifdef YY_STDINIT
1897
    yyin = stdin;
1898
    yyout = stdout;
1899
#else
1900
    yyin = (FILE *) 0;
1901
    yyout = (FILE *) 0;
1902
#endif
1903
1904
    /* For future reference: Set errno on error, since we are called by
1905
     * yylex_init()
1906
     */
1907
    return 0;
1908
}
1909
1910
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
1911
int yylex_destroy  (void)
1912
{
1811
{
1913
    
1812
    
1914
    /* Pop the buffer stack, destroying each element. */
1813
    /* Pop the buffer stack, destroying each element. */
1915
	while(YY_CURRENT_BUFFER){
1814
	while(YY_CURRENT_BUFFER){
1916
		yy_delete_buffer(YY_CURRENT_BUFFER  );
1815
		yy_delete_buffer( YY_CURRENT_BUFFER  );
1917
		YY_CURRENT_BUFFER_LVALUE = NULL;
1816
		YY_CURRENT_BUFFER_LVALUE = NULL;
1918
		yypop_buffer_state();
1817
		yypop_buffer_state();
1919
	}
1818
	}
Lines 1922-1932 Link Here
1922
	yyfree((yy_buffer_stack) );
1821
	yyfree((yy_buffer_stack) );
1923
	(yy_buffer_stack) = NULL;
1822
	(yy_buffer_stack) = NULL;
1924
1823
1925
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
1824
	delete [] (yy_state_buf);
1926
     * yylex() is called, initialization will occur. */
1825
	yyfree((yy_start_stack)  );
1927
    yy_init_globals( );
1928
1826
1929
    return 0;
1930
}
1827
}
1931
1828
1932
/*
1829
/*
Lines 1977-1983 Link Here
1977
1874
1978
#define YYTABLES_NAME "yytables"
1875
#define YYTABLES_NAME "yytables"
1979
1876
1980
#line 123 "qmake.ll"
1877
#line 201 "qmake.ll"
1878
1879
1880
namespace QMake
1881
{
1882
    Lexer::Lexer( std::istream* argin, std::ostream* argout )
1883
        : yyFlexLexer(argin, argout), mylval(0)
1884
    {
1885
    }
1981
1886
1887
    int Lexer::yylex( QMake::Parser::semantic_type* yylval )
1888
    {
1889
        mylval = yylval;
1890
        return yylex();
1891
    }
1892
}
1893
1894
int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer)
1895
{
1896
    return lexer->yylex( yylval );
1897
}
1982
1898
1983
1899
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake_lex.h (+45 lines)
Line 0 Link Here
1
/* KDevelop QMake Support
2
 *
3
 * Copyright 2007 Andreas Pakulat <apaku@gmx.de>
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
 * 02110-1301, USA.
19
 */
20
#ifndef QMAKE_LEX_H
21
#define QMAKE_LEX_H
22
23
#include "qmake_yacc.hpp"
24
#include <iostream>
25
26
#ifndef DONT_INCLUDE_FLEXLEXER
27
#include "FlexLexer.h"
28
#endif
29
30
namespace QMake
31
{
32
    class Lexer : public yyFlexLexer
33
    {
34
        public:
35
            Lexer( std::istream* argin = 0, std::ostream* argout = 0 );
36
            int yylex( QMake::Parser::semantic_type* yylval );
37
            int yylex();
38
        private:
39
            QMake::Parser::semantic_type* mylval;
40
    };
41
}
42
43
#endif
44
45
// kate: space-indent on; indent-width 4; tab-width: 4; replace-tabs on; auto-insert-doxygen on
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake.ll (-36 / +133 lines)
Lines 19-27 Link Here
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20
 ***************************************************************************/
20
 ***************************************************************************/
21
21
22
#include <qmake_yacc.h>
23
#include <stdlib.h>
22
#include <stdlib.h>
24
23
24
#define DONT_INCLUDE_FLEXLEXER
25
26
#include "qmake_lex.h"
27
25
/**
28
/**
26
@file qmake.ll
29
@file qmake.ll
27
QMake Lexer
30
QMake Lexer
Lines 48-53 Link Here
48
%}
51
%}
49
52
50
%option noyywrap
53
%option noyywrap
54
%option yylineno
55
%option c++
56
%option yyclass="QMake::Lexer"
51
57
52
%x list
58
%x list
53
%x list_with_comment
59
%x list_with_comment
Lines 55-123 Link Here
55
61
56
delim             [ \t]
62
delim             [ \t]
57
ws                {delim}+
63
ws                {delim}+
58
begin_ws          ^{delim}+[^\n\t ]
64
begin_ws          ^{delim}+[^\r\n\t ]
59
quote             "\""
65
quote             "\""
60
var_value         [^\n\t ]*[^\n\t \\]
66
var_value         [^\r\n\t ]*[^\r\n\t \\]
61
quoted_var_value  {quote}({var_value}|[\t ])({var_value}|[\t ])*{quote}
67
quoted_var_value  {quote}({var_value}|[\t ])({var_value}|[\t ])*{quote}
62
letter            [A-Za-z]
68
letter            [A-Za-z]
63
digit             [0-9]
69
digit             [0-9]
64
id_simple         ({digit}|{letter}|\!|-|_|\*|\$)({letter}|{digit}|\||\!|-|_|\*|\$|\.|\+|\-)*
70
id_simple         ({digit}|{letter}|\!|-|_|\*|\$)({letter}|{digit}|\||\!|-|_|\*|\$|\.)*
65
id_args           [^\n]*\)
71
id_args           [^\r\n]*\)
66
number            {digit}+
72
number            {digit}+
67
comment           #.*
73
comment           #.*
68
comment_cont      {ws}*#.*\n
74
comment_cont      {ws}*#.*(\n|\r|\r\n)
69
comment_cont_nn   {ws}*#.*
75
comment_cont_nn   {ws}*#.*
70
cont              \\{ws}*\n
76
cont              \\{ws}*(\n|\r|\r\n)
71
77
72
%%
78
%%
73
<INITIAL>{ws}  {}
79
<INITIAL>{ws}  {}
74
<list,list_with_comment>{ws}     { yylval.value = yytext; return LIST_WS; }
80
81
<list,list_with_comment>{ws} {
82
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
83
    return Parser::token::token::LIST_WS;
84
}
85
75
<list,list_with_comment>{begin_ws}       { 
86
<list,list_with_comment>{begin_ws}       { 
76
    yylval.value = yytext;
87
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
77
    unput(char(yylval.value.at(yylval.value.length()-1).latin1()));
88
    unput(char(mylval->value.at(mylval->value.length()-1).latin1()));
78
    yylval.value = yylval.value.mid(0, yylval.value.length()-1);
89
    mylval->value = mylval->value.mid(0, mylval->value.length()-1);
79
    return INDENT;
90
    return Parser::token::token::INDENT;
80
}
91
}
81
92
82
<list,list_with_comment,INITIAL>{cont}   { BEGIN(list); return CONT; }
93
<list,list_with_comment,INITIAL>{cont} {
83
{id_simple}            { yylval.value = yytext; return (ID_SIMPLE); }
94
    BEGIN(list);
95
    return Parser::token::token::CONT;
96
}
97
{id_simple} {
98
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
99
    return (Parser::token::token::ID_SIMPLE);
100
}
84
101
85
<list_with_comment>{comment_cont_nn} {
102
<list_with_comment>{comment_cont_nn} {
86
    yylval.value = yytext;
103
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
87
    BEGIN(list);
104
    BEGIN(list);
88
    return (LIST_COMMENT_WITHOUT_NEWLINE);
105
    return (Parser::token::token::LIST_COMMENT_WITHOUT_NEWLINE);
89
}
106
}
90
107
91
<list>{comment_cont} {
108
<list>{comment_cont} {
92
    yylval.value = yytext;
109
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
93
    BEGIN(list);
110
    BEGIN(list);
94
    return (LIST_COMMENT);
111
    return (Parser::token::token::LIST_COMMENT);
95
    }
112
    }
96
113
97
<funcargs>{id_args} {
114
<funcargs>{id_args} {
98
    yylval.value = yytext;
115
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
99
    yylval.value = yylval.value.mid(0, yylval.value.length()-1);
116
    mylval->value = mylval->value.mid(0, mylval->value.length()-1);
100
    unput(')');
117
    unput(')');
101
    BEGIN(INITIAL);
118
    BEGIN(INITIAL);
102
    return (ID_ARGS);
119
    return (Parser::token::token::ID_ARGS);
103
    }
120
    }
104
121
105
<list,list_with_comment>{var_value}        { BEGIN(list_with_comment); yylval.value = yytext; return VARIABLE_VALUE; }
122
<list,list_with_comment>{var_value} {
106
<list,list_with_comment>{quoted_var_value} { BEGIN(list_with_comment); yylval.value = yytext; return QUOTED_VARIABLE_VALUE; }
123
    BEGIN(list_with_comment);
124
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
125
    return Parser::token::token::VARIABLE_VALUE;
126
}
127
128
<list,list_with_comment>{quoted_var_value} {
129
    BEGIN(list_with_comment);
130
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
131
    return Parser::token::token::QUOTED_VARIABLE_VALUE;
132
}
133
134
"=" {
135
BEGIN(list);
136
mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
137
return Parser::token::token::EQ;
138
}
139
140
"+=" {
141
    BEGIN(list);
142
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
143
    return Parser::token::token::PLUSEQ;
144
}
145
146
"-=" {
147
    BEGIN(list);
148
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
149
    return Parser::token::token::MINUSEQ;
150
}
151
152
"*=" {
153
    BEGIN(list);
154
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
155
    return Parser::token::token::STAREQ;
156
}
157
158
"~=" {
159
    BEGIN(list);
160
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
161
    return Parser::token::token::TILDEEQ;
162
}
163
164
"{" {
165
    return Parser::token::token::LCURLY;
166
}
167
168
":"{delim}*"{" {
169
    return Parser::token::token::LCURLY;
170
}
171
172
"}" {
173
    return Parser::token::token::RCURLY;
174
}
175
176
"(" {
177
    BEGIN(funcargs);
178
    return Parser::token::token::LBRACE;
179
}
180
181
<funcargs,INITIAL>")" {
182
    BEGIN(INITIAL);
183
    return Parser::token::token::RBRACE;
184
}
185
186
":" {
187
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
188
    return Parser::token::token::COLON;
189
}
107
190
108
"="                      { BEGIN(list); yylval.value = yytext; return EQ; }
191
<list,list_with_comment,INITIAL>"\n" {
109
"+="                     { BEGIN(list); yylval.value = yytext; return PLUSEQ; }
192
    BEGIN(INITIAL);
110
"-="                     { BEGIN(list); yylval.value = yytext; return MINUSQE; }
193
    return Parser::token::token::NEWLINE;
111
"*="                     { BEGIN(list); yylval.value = yytext; return STAREQ; }
194
}
112
"~="                     { BEGIN(list); yylval.value = yytext; return TILDEEQ; }
113
"{"                      { return LCURLY; }
114
":"{delim}*"{"                      { return LCURLY; }
115
"}"                      { return RCURLY; }
116
"("                      { BEGIN(funcargs); return LBRACE; }
117
<funcargs,INITIAL>")"    { BEGIN(INITIAL); return RBRACE; }
118
":"                      { yylval.value = yytext; return COLON; }
119
<list,list_with_comment,INITIAL>"\n"       { BEGIN(INITIAL); return NEWLINE; }
120
195
121
{comment}                { yylval.value = yytext; return (COMMENT); }
196
{comment} {
197
    mylval->value = QString::fromLocal8Bit( YYText(), YYLeng() );
198
    return (Parser::token::token::COMMENT);
199
}
122
200
123
%%
201
%%
202
namespace QMake
203
{
204
    Lexer::Lexer( std::istream* argin, std::ostream* argout )
205
        : yyFlexLexer(argin, argout), mylval(0)
206
    {
207
    }
208
209
    int Lexer::yylex( QMake::Parser::semantic_type* yylval )
210
    {
211
        mylval = yylval;
212
        return yylex();
213
    }
214
}
215
216
int QMakelex( QMake::Parser::semantic_type* yylval, QMake::Lexer* lexer)
217
{
218
    return lexer->yylex( yylval );
219
}
220
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake_yacc.cpp (-1595 / +741 lines)
Lines 1-9 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
2
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
3
/* Skeleton implementation for Bison LALR(1) parsers in C++
4
4
5
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
5
   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
   Free Software Foundation, Inc.
7
6
8
   This program is free software; you can redistribute it and/or modify
7
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
8
   it under the terms of the GNU General Public License as published by
Lines 33-1508 Link Here
33
   This special exception was added by the Free Software Foundation in
32
   This special exception was added by the Free Software Foundation in
34
   version 2.2 of Bison.  */
33
   version 2.2 of Bison.  */
35
34
36
/* C LALR(1) parser skeleton written by Richard Stallman, by
35
// Take the name prefix into account.
37
   simplifying the original so-called "semantic" parser.  */
36
#define yylex   QMakelex
38
37
39
/* All symbols defined below should begin with yy or YY, to avoid
38
#include "qmake_yacc.hpp"
40
   infringing on user name space.  This should be done even for local
41
   variables, as they might otherwise be expanded by user macros.
42
   There are some unavoidable exceptions within include files to
43
   define necessary library symbols; they are noted "INFRINGES ON
44
   USER NAME SPACE" below.  */
45
46
/* Identify Bison output.  */
47
#define YYBISON 1
48
49
/* Bison version.  */
50
#define YYBISON_VERSION "2.3"
51
52
/* Skeleton name.  */
53
#define YYSKELETON_NAME "yacc.c"
54
55
/* Pure parsers.  */
56
#define YYPURE 0
57
58
/* Using locations.  */
59
#define YYLSP_NEEDED 0
60
39
40
/* User implementation prologue.  */
61
41
62
42
63
/* Tokens.  */
43
/* Line 317 of lalr1.cc.  */
64
#ifndef YYTOKENTYPE
44
#line 45 "qmake_yacc.cpp"
65
# define YYTOKENTYPE
66
   /* Put the tokens into the symbol table, so that GDB and other debuggers
67
      know about them.  */
68
   enum yytokentype {
69
     ID_SIMPLE = 258,
70
     EQ = 259,
71
     PLUSEQ = 260,
72
     MINUSQE = 261,
73
     STAREQ = 262,
74
     TILDEEQ = 263,
75
     LBRACE = 264,
76
     RBRACE = 265,
77
     COLON = 266,
78
     NUMSIGN = 267,
79
     NEWLINE = 268,
80
     NUMBER = 269,
81
     COMMENT = 270,
82
     CONT = 271,
83
     RCURLY = 272,
84
     LCURLY = 273,
85
     ID_ARGS = 274,
86
     LIST_COMMENT = 275,
87
     LIST_COMMENT_WITHOUT_NEWLINE = 276,
88
     QUOTED_VARIABLE_VALUE = 277,
89
     VARIABLE_VALUE = 278,
90
     INDENT = 279,
91
     LIST_WS = 280
92
   };
93
#endif
94
/* Tokens.  */
95
#define ID_SIMPLE 258
96
#define EQ 259
97
#define PLUSEQ 260
98
#define MINUSQE 261
99
#define STAREQ 262
100
#define TILDEEQ 263
101
#define LBRACE 264
102
#define RBRACE 265
103
#define COLON 266
104
#define NUMSIGN 267
105
#define NEWLINE 268
106
#define NUMBER 269
107
#define COMMENT 270
108
#define CONT 271
109
#define RCURLY 272
110
#define LCURLY 273
111
#define ID_ARGS 274
112
#define LIST_COMMENT 275
113
#define LIST_COMMENT_WITHOUT_NEWLINE 276
114
#define QUOTED_VARIABLE_VALUE 277
115
#define VARIABLE_VALUE 278
116
#define INDENT 279
117
#define LIST_WS 280
118
119
120
121
122
/* Copy the first part of user declarations.  */
123
#line 1 "qmake.yy"
124
125
/***************************************************************************
126
 *   Copyright (C) 2005 by Alexander Dymo                                  *
127
 *   adymo@kdevelop.org                                                    *
128
 *                                                                         *
129
 *   This program is free software; you can redistribute it and/or modify  *
130
 *   it under the terms of the GNU Library General Public License as       *
131
 *   published by the Free Software Foundation; either version 2 of the    *
132
 *   License, or (at your option) any later version.                       *
133
 *                                                                         *
134
 *   This program is distributed in the hope that it will be useful,       *
135
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
136
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
137
 *   GNU General Public License for more details.                          *
138
 *                                                                         *
139
 *   You should have received a copy of the GNU Library General Public     *
140
 *   License along with this program; if not, write to the                 *
141
 *   Free Software Foundation, Inc.,                                       *
142
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
143
 ***************************************************************************/
144
145
/**
146
@file qmake.yy
147
QMake Parser
148
149
Simple LALR parser which builds the syntax tree (see @ref QMake::AST).
150
151
@todo Recognize comments after statements like:
152
SOURCES = foo #regognize me
153
154
@fixme Parser fails on files that do not end with a newline
155
@fixme 1 shift/reduce conflict in "line_body" rule
156
*/
157
158
#include <qvaluestack.h>
159
#include "qmakeast.h"
160
#include <qregexp.h>
161
162
#define YYSTYPE_IS_DECLARED
163
164
using namespace QMake;
165
166
/**
167
The yylval type.
168
*/
169
struct Result {
170
    Result(): node(0) {}
171
172
    /**Type of semantic value for simple grammar rules.*/
173
    QString value;
174
    /**Type of semantic value for grammar rules which are parts of AST.*/
175
    AST *node;
176
    /**Type of semantic value for "multiline_values" grammar rule.
177
    Each line of multiline value is stored as a string in the list.
178
179
    For example we have in .pro file:
180
    @code
181
    SOURCE = foo1.cpp \
182
        foo2.cpp \
183
        foo3.cpp foo4.cpp
184
    @endcode
185
    The string list will be populated with three strings:
186
    <pre>
187
    foo1.cpp
188
    foo2.cpp
189
    foo3.cpp foo4.cpp
190
    </pre>
191
    */
192
    QStringList values;
193
    QString indent;
194
};
195
196
typedef Result YYSTYPE;
197
198
void yyerror(const char *str) {
199
    printf("%s\n", str);
200
}
201
202
int yylex();
203
204
/**
205
The stack to store ProjectAST pointers when a new child
206
ProjectAST is created and filled with statements.
207
208
Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
209
adding statements. Each statement is added as a child StatementAST to the ProjectAST
210
currently on the top in the stack.
211
212
When a scope or function scope statement is parsed, the child ProjectAST is created
213
and pushed onto the stack. Therefore all statements which belong to the scope
214
or function scope are added as childs to their direct parent (scope or function scope).
215
*/
216
QValueStack<ProjectAST*> projects;
217
218
/**
219
The current depth of AST node is stored here.
220
AST depth is important to know because automatic indentation can
221
be easily implemented (the parser itself looses all information
222
about indentation).
223
*/
224
int depth = 0;
225
226
/*
227
To debug this parser, put the line below into the next bison file section.
228
Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
229
%debug
230
*/
231
232
233
/* Enabling traces.  */
234
#ifndef YYDEBUG
235
# define YYDEBUG 0
236
#endif
237
238
/* Enabling verbose error messages.  */
239
#ifdef YYERROR_VERBOSE
240
# undef YYERROR_VERBOSE
241
# define YYERROR_VERBOSE 1
242
#else
243
# define YYERROR_VERBOSE 0
244
#endif
245
246
/* Enabling the token table.  */
247
#ifndef YYTOKEN_TABLE
248
# define YYTOKEN_TABLE 0
249
#endif
250
251
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
252
typedef int YYSTYPE;
253
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
254
# define YYSTYPE_IS_DECLARED 1
255
# define YYSTYPE_IS_TRIVIAL 1
256
#endif
257
258
259
260
/* Copy the second part of user declarations.  */
261
262
263
/* Line 216 of yacc.c.  */
264
#line 265 "qmake_yacc.cpp"
265
266
#ifdef short
267
# undef short
268
#endif
269
270
#ifdef YYTYPE_UINT8
271
typedef YYTYPE_UINT8 yytype_uint8;
272
#else
273
typedef unsigned char yytype_uint8;
274
#endif
275
276
#ifdef YYTYPE_INT8
277
typedef YYTYPE_INT8 yytype_int8;
278
#elif (defined __STDC__ || defined __C99__FUNC__ \
279
     || defined __cplusplus || defined _MSC_VER)
280
typedef signed char yytype_int8;
281
#else
282
typedef short int yytype_int8;
283
#endif
284
285
#ifdef YYTYPE_UINT16
286
typedef YYTYPE_UINT16 yytype_uint16;
287
#else
288
typedef unsigned short int yytype_uint16;
289
#endif
290
291
#ifdef YYTYPE_INT16
292
typedef YYTYPE_INT16 yytype_int16;
293
#else
294
typedef short int yytype_int16;
295
#endif
296
297
#ifndef YYSIZE_T
298
# ifdef __SIZE_TYPE__
299
#  define YYSIZE_T __SIZE_TYPE__
300
# elif defined size_t
301
#  define YYSIZE_T size_t
302
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
303
     || defined __cplusplus || defined _MSC_VER)
304
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
305
#  define YYSIZE_T size_t
306
# else
307
#  define YYSIZE_T unsigned int
308
# endif
309
#endif
310
311
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
312
45
313
#ifndef YY_
46
#ifndef YY_
314
# if YYENABLE_NLS
47
# if YYENABLE_NLS
315
#  if ENABLE_NLS
48
#  if ENABLE_NLS
316
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
49
#   include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
317
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
50
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
318
#  endif
51
#  endif
319
# endif
52
# endif
320
# ifndef YY_
53
# ifndef YY_
321
#  define YY_(msgid) msgid
54
#  define YY_(msgid) msgid
322
# endif
55
# endif
323
#endif
324
325
/* Suppress unused-variable warnings by "using" E.  */
326
#if ! defined lint || defined __GNUC__
327
# define YYUSE(e) ((void) (e))
328
#else
329
# define YYUSE(e) /* empty */
330
#endif
331
332
/* Identity function, used to suppress warnings about constant conditions.  */
333
#ifndef lint
334
# define YYID(n) (n)
335
#else
336
#if (defined __STDC__ || defined __C99__FUNC__ \
337
     || defined __cplusplus || defined _MSC_VER)
338
static int
339
YYID (int i)
340
#else
341
static int
342
YYID (i)
343
    int i;
344
#endif
345
{
346
  return i;
347
}
348
#endif
349
350
#if ! defined yyoverflow || YYERROR_VERBOSE
351
352
/* The parser invokes alloca or malloc; define the necessary symbols.  */
353
354
# ifdef YYSTACK_USE_ALLOCA
355
#  if YYSTACK_USE_ALLOCA
356
#   ifdef __GNUC__
357
#    define YYSTACK_ALLOC __builtin_alloca
358
#   elif defined __BUILTIN_VA_ARG_INCR
359
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
360
#   elif defined _AIX
361
#    define YYSTACK_ALLOC __alloca
362
#   elif defined _MSC_VER
363
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
364
#    define alloca _alloca
365
#   else
366
#    define YYSTACK_ALLOC alloca
367
#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
368
     || defined __cplusplus || defined _MSC_VER)
369
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
370
#     ifndef _STDLIB_H
371
#      define _STDLIB_H 1
372
#     endif
373
#    endif
374
#   endif
375
#  endif
376
# endif
377
378
# ifdef YYSTACK_ALLOC
379
   /* Pacify GCC's `empty if-body' warning.  */
380
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
381
#  ifndef YYSTACK_ALLOC_MAXIMUM
382
    /* The OS might guarantee only one guard page at the bottom of the stack,
383
       and a page size can be as small as 4096 bytes.  So we cannot safely
384
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
385
       to allow for a few compiler-allocated temporary stack slots.  */
386
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
387
#  endif
388
# else
389
#  define YYSTACK_ALLOC YYMALLOC
390
#  define YYSTACK_FREE YYFREE
391
#  ifndef YYSTACK_ALLOC_MAXIMUM
392
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
393
#  endif
394
#  if (defined __cplusplus && ! defined _STDLIB_H \
395
       && ! ((defined YYMALLOC || defined malloc) \
396
	     && (defined YYFREE || defined free)))
397
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
398
#   ifndef _STDLIB_H
399
#    define _STDLIB_H 1
400
#   endif
401
#  endif
402
#  ifndef YYMALLOC
403
#   define YYMALLOC malloc
404
#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
405
     || defined __cplusplus || defined _MSC_VER)
406
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
407
#   endif
408
#  endif
409
#  ifndef YYFREE
410
#   define YYFREE free
411
#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
412
     || defined __cplusplus || defined _MSC_VER)
413
void free (void *); /* INFRINGES ON USER NAME SPACE */
414
#   endif
415
#  endif
416
# endif
417
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
418
419
420
#if (! defined yyoverflow \
421
     && (! defined __cplusplus \
422
	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
423
424
/* A type that is properly aligned for any stack member.  */
425
union yyalloc
426
{
427
  yytype_int16 yyss;
428
  YYSTYPE yyvs;
429
  };
430
431
/* The size of the maximum gap between one aligned stack and the next.  */
432
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
433
434
/* The size of an array large to enough to hold all stacks, each with
435
   N elements.  */
436
# define YYSTACK_BYTES(N) \
437
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
438
      + YYSTACK_GAP_MAXIMUM)
439
440
/* Copy COUNT objects from FROM to TO.  The source and destination do
441
   not overlap.  */
442
# ifndef YYCOPY
443
#  if defined __GNUC__ && 1 < __GNUC__
444
#   define YYCOPY(To, From, Count) \
445
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
446
#  else
447
#   define YYCOPY(To, From, Count)		\
448
      do					\
449
	{					\
450
	  YYSIZE_T yyi;				\
451
	  for (yyi = 0; yyi < (Count); yyi++)	\
452
	    (To)[yyi] = (From)[yyi];		\
453
	}					\
454
      while (YYID (0))
455
#  endif
456
# endif
457
458
/* Relocate STACK from its old location to the new one.  The
459
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
460
   elements in the stack, and YYPTR gives the new location of the
461
   stack.  Advance YYPTR to a properly aligned location for the next
462
   stack.  */
463
# define YYSTACK_RELOCATE(Stack)					\
464
    do									\
465
      {									\
466
	YYSIZE_T yynewbytes;						\
467
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
468
	Stack = &yyptr->Stack;						\
469
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
470
	yyptr += yynewbytes / sizeof (*yyptr);				\
471
      }									\
472
    while (YYID (0))
473
474
#endif
475
476
/* YYFINAL -- State number of the termination state.  */
477
#define YYFINAL  3
478
/* YYLAST -- Last index in YYTABLE.  */
479
#define YYLAST   37
480
481
/* YYNTOKENS -- Number of terminals.  */
482
#define YYNTOKENS  27
483
/* YYNNTS -- Number of nonterminals.  */
484
#define YYNNTS  21
485
/* YYNRULES -- Number of rules.  */
486
#define YYNRULES  44
487
/* YYNRULES -- Number of states.  */
488
#define YYNSTATES  54
489
490
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
491
#define YYUNDEFTOK  2
492
#define YYMAXUTOK   281
493
494
#define YYTRANSLATE(YYX)						\
495
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
496
497
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
498
static const yytype_uint8 yytranslate[] =
499
{
500
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
501
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
502
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
503
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
504
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
505
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
506
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
507
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
508
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
509
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
510
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
511
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
512
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
513
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
514
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
515
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
516
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
517
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
518
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
519
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
520
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
521
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
522
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
523
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
524
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
525
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
526
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
527
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
528
      25,    26
529
};
530
531
#if YYDEBUG
532
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
533
   YYRHS.  */
534
static const yytype_uint8 yyprhs[] =
535
{
536
       0,     0,     3,     4,     7,    10,    11,    13,    15,    17,
537
      19,    21,    25,    29,    30,    33,    35,    37,    39,    41,
538
      43,    45,    47,    49,    50,    52,    54,    56,    58,    60,
539
      62,    64,    65,    69,    70,    78,    80,    81,    85,    88,
540
      89,    90,    96,    97,   100
541
};
542
543
/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
544
static const yytype_int8 yyrhs[] =
545
{
546
      28,     0,    -1,    -1,    29,    30,    -1,    30,    31,    -1,
547
      -1,    32,    -1,    38,    -1,    40,    -1,    46,    -1,    47,
548
      -1,     3,    37,    33,    -1,    33,    34,    35,    -1,    -1,
549
      34,    36,    -1,    36,    -1,    16,    -1,    13,    -1,    25,
550
      -1,    24,    -1,    20,    -1,    10,    -1,    21,    -1,    -1,
551
      23,    -1,    22,    -1,     4,    -1,     5,    -1,     6,    -1,
552
       7,    -1,     8,    -1,    -1,     3,    39,    43,    -1,    -1,
553
       3,     9,    42,    10,    41,    43,    44,    -1,    19,    -1,
554
      -1,    18,    30,    17,    -1,    11,    31,    -1,    -1,    -1,
555
      26,    18,    45,    43,    17,    -1,    -1,    15,    13,    -1,
556
      13,    -1
557
};
558
559
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
560
static const yytype_uint16 yyrline[] =
561
{
562
       0,   136,   136,   136,   143,   148,   151,   155,   159,   163,
563
     167,   173,   185,   193,   200,   201,   202,   203,   204,   205,
564
     211,   212,   215,   222,   227,   228,   231,   231,   231,   231,
565
     231,   235,   234,   249,   248,   273,   274,   277,   278,   283,
566
     287,   286,   300,   305,   313
567
};
568
#endif
569
570
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
571
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
572
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
573
static const char *const yytname[] =
574
{
575
  "$end", "error", "$undefined", "ID_SIMPLE", "EQ", "PLUSEQ", "MINUSQE",
576
  "STAREQ", "TILDEEQ", "LBRACE", "RBRACE", "COLON", "NUMSIGN", "NEWLINE",
577
  "NUMBER", "COMMENT", "CONT", "RCURLY", "LCURLY", "ID_ARGS",
578
  "LIST_COMMENT", "LIST_COMMENT_WITHOUT_NEWLINE", "QUOTED_VARIABLE_VALUE",
579
  "VARIABLE_VALUE", "INDENT", "LIST_WS", "\"else\"", "$accept", "project",
580
  "@1", "statements", "statement", "variable_assignment",
581
  "multiline_values", "line_body", "opt_comment", "variable_value",
582
  "operator", "scope", "@2", "function_call", "@3", "function_args",
583
  "scope_body", "else_statement", "@4", "comment", "emptyline", 0
584
};
585
#endif
586
587
# ifdef YYPRINT
588
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
589
   token YYLEX-NUM.  */
590
static const yytype_uint16 yytoknum[] =
591
{
592
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
593
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
594
     275,   276,   277,   278,   279,   280,   281
595
};
596
# endif
597
598
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
599
static const yytype_uint8 yyr1[] =
600
{
601
       0,    27,    29,    28,    30,    30,    31,    31,    31,    31,
602
      31,    32,    33,    33,    34,    34,    34,    34,    34,    34,
603
      34,    34,    35,    35,    36,    36,    37,    37,    37,    37,
604
      37,    39,    38,    41,    40,    42,    42,    43,    43,    43,
605
      45,    44,    44,    46,    47
606
};
607
608
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
609
static const yytype_uint8 yyr2[] =
610
{
611
       0,     2,     0,     2,     2,     0,     1,     1,     1,     1,
612
       1,     3,     3,     0,     2,     1,     1,     1,     1,     1,
613
       1,     1,     1,     0,     1,     1,     1,     1,     1,     1,
614
       1,     0,     3,     0,     7,     1,     0,     3,     2,     0,
615
       0,     5,     0,     2,     1
616
};
617
618
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
619
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
620
   means the default is an error.  */
621
static const yytype_uint8 yydefact[] =
622
{
623
       2,     0,     5,     1,     3,    31,    44,     0,     4,     6,
624
       7,     8,     9,    10,    26,    27,    28,    29,    30,    36,
625
      13,    39,    43,    35,     0,    11,     0,     5,    32,    33,
626
      21,    17,    16,    20,    25,    24,    19,    18,    23,    15,
627
      38,     0,    39,    22,    12,    14,    37,    42,     0,    34,
628
      40,    39,     0,    41
629
};
630
631
/* YYDEFGOTO[NTERM-NUM].  */
632
static const yytype_int8 yydefgoto[] =
633
{
634
      -1,     1,     2,     4,     8,     9,    25,    38,    44,    39,
635
      20,    10,    21,    11,    42,    24,    28,    49,    51,    12,
636
      13
637
};
638
639
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
640
   STATE-NUM.  */
641
#define YYPACT_NINF -41
642
static const yytype_int8 yypact[] =
643
{
644
     -41,     1,   -41,   -41,     5,    18,   -41,    -9,   -41,   -41,
645
     -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,   -14,
646
     -41,    -2,   -41,   -41,    21,   -10,     5,   -41,   -41,   -41,
647
     -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,     7,   -41,
648
     -41,     4,    -2,   -41,   -41,   -41,   -41,     6,    15,   -41,
649
     -41,    -2,    17,   -41
650
};
651
652
/* YYPGOTO[NTERM-NUM].  */
653
static const yytype_int8 yypgoto[] =
654
{
655
     -41,   -41,   -41,     8,    10,   -41,   -41,   -41,   -41,    -1,
656
     -41,   -41,   -41,   -41,   -41,   -41,   -40,   -41,   -41,   -41,
657
     -41
658
};
659
660
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
661
   positive, shift that token.  If negative, reduce the rule which
662
   number is the opposite.  If zero, do what YYDEFACT says.
663
   If YYTABLE_NINF, syntax error.  */
664
#define YYTABLE_NINF -1
665
static const yytype_uint8 yytable[] =
666
{
667
      30,     3,    47,    31,    22,    23,    32,     5,     5,    26,
668
      33,    52,    34,    35,    36,    37,    27,     6,     6,     7,
669
       7,    46,    14,    15,    16,    17,    18,    19,    43,    34,
670
      35,    29,    48,    50,    53,    41,    40,    45
671
};
672
673
static const yytype_uint8 yycheck[] =
674
{
675
      10,     0,    42,    13,    13,    19,    16,     3,     3,    11,
676
      20,    51,    22,    23,    24,    25,    18,    13,    13,    15,
677
      15,    17,     4,     5,     6,     7,     8,     9,    21,    22,
678
      23,    10,    26,    18,    17,    27,    26,    38
679
};
680
681
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
682
   symbol of state STATE-NUM.  */
683
static const yytype_uint8 yystos[] =
684
{
685
       0,    28,    29,     0,    30,     3,    13,    15,    31,    32,
686
      38,    40,    46,    47,     4,     5,     6,     7,     8,     9,
687
      37,    39,    13,    19,    42,    33,    11,    18,    43,    10,
688
      10,    13,    16,    20,    22,    23,    24,    25,    34,    36,
689
      31,    30,    41,    21,    35,    36,    17,    43,    26,    44,
690
      18,    45,    43,    17
691
};
692
693
#define yyerrok		(yyerrstatus = 0)
694
#define yyclearin	(yychar = YYEMPTY)
695
#define YYEMPTY		(-2)
696
#define YYEOF		0
697
698
#define YYACCEPT	goto yyacceptlab
699
#define YYABORT		goto yyabortlab
700
#define YYERROR		goto yyerrorlab
701
702
703
/* Like YYERROR except do call yyerror.  This remains here temporarily
704
   to ease the transition to the new meaning of YYERROR, for GCC.
705
   Once GCC version 2 has supplanted version 1, this can go.  */
706
707
#define YYFAIL		goto yyerrlab
708
709
#define YYRECOVERING()  (!!yyerrstatus)
710
711
#define YYBACKUP(Token, Value)					\
712
do								\
713
  if (yychar == YYEMPTY && yylen == 1)				\
714
    {								\
715
      yychar = (Token);						\
716
      yylval = (Value);						\
717
      yytoken = YYTRANSLATE (yychar);				\
718
      YYPOPSTACK (1);						\
719
      goto yybackup;						\
720
    }								\
721
  else								\
722
    {								\
723
      yyerror (YY_("syntax error: cannot back up")); \
724
      YYERROR;							\
725
    }								\
726
while (YYID (0))
727
728
729
#define YYTERROR	1
730
#define YYERRCODE	256
731
732
733
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
734
   If N is 0, then set CURRENT to the empty location which ends
735
   the previous symbol: RHS[0] (always defined).  */
736
737
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
738
#ifndef YYLLOC_DEFAULT
739
# define YYLLOC_DEFAULT(Current, Rhs, N)				\
740
    do									\
741
      if (YYID (N))                                                    \
742
	{								\
743
	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
744
	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
745
	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
746
	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
747
	}								\
748
      else								\
749
	{								\
750
	  (Current).first_line   = (Current).last_line   =		\
751
	    YYRHSLOC (Rhs, 0).last_line;				\
752
	  (Current).first_column = (Current).last_column =		\
753
	    YYRHSLOC (Rhs, 0).last_column;				\
754
	}								\
755
    while (YYID (0))
756
#endif
757
758
759
/* YY_LOCATION_PRINT -- Print the location on the stream.
760
   This macro was not mandated originally: define only if we know
761
   we won't break user code: when these are the locations we know.  */
762
763
#ifndef YY_LOCATION_PRINT
764
# if YYLTYPE_IS_TRIVIAL
765
#  define YY_LOCATION_PRINT(File, Loc)			\
766
     fprintf (File, "%d.%d-%d.%d",			\
767
	      (Loc).first_line, (Loc).first_column,	\
768
	      (Loc).last_line,  (Loc).last_column)
769
# else
770
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
771
# endif
772
#endif
773
774
775
/* YYLEX -- calling `yylex' with the right arguments.  */
776
777
#ifdef YYLEX_PARAM
778
# define YYLEX yylex (YYLEX_PARAM)
779
#else
780
# define YYLEX yylex ()
781
#endif
782
783
/* Enable debugging if requested.  */
784
#if YYDEBUG
785
786
# ifndef YYFPRINTF
787
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
788
#  define YYFPRINTF fprintf
789
# endif
790
791
# define YYDPRINTF(Args)			\
792
do {						\
793
  if (yydebug)					\
794
    YYFPRINTF Args;				\
795
} while (YYID (0))
796
797
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
798
do {									  \
799
  if (yydebug)								  \
800
    {									  \
801
      YYFPRINTF (stderr, "%s ", Title);					  \
802
      yy_symbol_print (stderr,						  \
803
		  Type, Value); \
804
      YYFPRINTF (stderr, "\n");						  \
805
    }									  \
806
} while (YYID (0))
807
808
809
/*--------------------------------.
810
| Print this symbol on YYOUTPUT.  |
811
`--------------------------------*/
812
813
/*ARGSUSED*/
814
#if (defined __STDC__ || defined __C99__FUNC__ \
815
     || defined __cplusplus || defined _MSC_VER)
816
static void
817
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
818
#else
819
static void
820
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
821
    FILE *yyoutput;
822
    int yytype;
823
    YYSTYPE const * const yyvaluep;
824
#endif
825
{
826
  if (!yyvaluep)
827
    return;
828
# ifdef YYPRINT
829
  if (yytype < YYNTOKENS)
830
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
831
# else
832
  YYUSE (yyoutput);
833
# endif
834
  switch (yytype)
835
    {
836
      default:
837
	break;
838
    }
839
}
840
841
842
/*--------------------------------.
843
| Print this symbol on YYOUTPUT.  |
844
`--------------------------------*/
845
846
#if (defined __STDC__ || defined __C99__FUNC__ \
847
     || defined __cplusplus || defined _MSC_VER)
848
static void
849
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
850
#else
851
static void
852
yy_symbol_print (yyoutput, yytype, yyvaluep)
853
    FILE *yyoutput;
854
    int yytype;
855
    YYSTYPE const * const yyvaluep;
856
#endif
857
{
858
  if (yytype < YYNTOKENS)
859
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
860
  else
861
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
862
863
  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
864
  YYFPRINTF (yyoutput, ")");
865
}
866
867
/*------------------------------------------------------------------.
868
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
869
| TOP (included).                                                   |
870
`------------------------------------------------------------------*/
871
872
#if (defined __STDC__ || defined __C99__FUNC__ \
873
     || defined __cplusplus || defined _MSC_VER)
874
static void
875
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
876
#else
877
static void
878
yy_stack_print (bottom, top)
879
    yytype_int16 *bottom;
880
    yytype_int16 *top;
881
#endif
882
{
883
  YYFPRINTF (stderr, "Stack now");
884
  for (; bottom <= top; ++bottom)
885
    YYFPRINTF (stderr, " %d", *bottom);
886
  YYFPRINTF (stderr, "\n");
887
}
888
889
# define YY_STACK_PRINT(Bottom, Top)				\
890
do {								\
891
  if (yydebug)							\
892
    yy_stack_print ((Bottom), (Top));				\
893
} while (YYID (0))
894
895
896
/*------------------------------------------------.
897
| Report that the YYRULE is going to be reduced.  |
898
`------------------------------------------------*/
899
900
#if (defined __STDC__ || defined __C99__FUNC__ \
901
     || defined __cplusplus || defined _MSC_VER)
902
static void
903
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
904
#else
905
static void
906
yy_reduce_print (yyvsp, yyrule)
907
    YYSTYPE *yyvsp;
908
    int yyrule;
909
#endif
910
{
911
  int yynrhs = yyr2[yyrule];
912
  int yyi;
913
  unsigned long int yylno = yyrline[yyrule];
914
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
915
	     yyrule - 1, yylno);
916
  /* The symbols being reduced.  */
917
  for (yyi = 0; yyi < yynrhs; yyi++)
918
    {
919
      fprintf (stderr, "   $%d = ", yyi + 1);
920
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
921
		       &(yyvsp[(yyi + 1) - (yynrhs)])
922
		       		       );
923
      fprintf (stderr, "\n");
924
    }
925
}
926
927
# define YY_REDUCE_PRINT(Rule)		\
928
do {					\
929
  if (yydebug)				\
930
    yy_reduce_print (yyvsp, Rule); \
931
} while (YYID (0))
932
933
/* Nonzero means print parse trace.  It is left uninitialized so that
934
   multiple parsers can coexist.  */
935
int yydebug;
936
#else /* !YYDEBUG */
937
# define YYDPRINTF(Args)
938
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
939
# define YY_STACK_PRINT(Bottom, Top)
940
# define YY_REDUCE_PRINT(Rule)
941
#endif /* !YYDEBUG */
942
943
944
/* YYINITDEPTH -- initial size of the parser's stacks.  */
945
#ifndef	YYINITDEPTH
946
# define YYINITDEPTH 200
947
#endif
948
949
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
950
   if the built-in stack extension method is used).
951
952
   Do not make this value too large; the results are undefined if
953
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
954
   evaluated with infinite-precision integer arithmetic.  */
955
956
#ifndef YYMAXDEPTH
957
# define YYMAXDEPTH 10000
958
#endif
959
960
961
962
#if YYERROR_VERBOSE
963
964
# ifndef yystrlen
965
#  if defined __GLIBC__ && defined _STRING_H
966
#   define yystrlen strlen
967
#  else
968
/* Return the length of YYSTR.  */
969
#if (defined __STDC__ || defined __C99__FUNC__ \
970
     || defined __cplusplus || defined _MSC_VER)
971
static YYSIZE_T
972
yystrlen (const char *yystr)
973
#else
974
static YYSIZE_T
975
yystrlen (yystr)
976
    const char *yystr;
977
#endif
978
{
979
  YYSIZE_T yylen;
980
  for (yylen = 0; yystr[yylen]; yylen++)
981
    continue;
982
  return yylen;
983
}
984
#  endif
985
# endif
986
987
# ifndef yystpcpy
988
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
989
#   define yystpcpy stpcpy
990
#  else
991
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
992
   YYDEST.  */
993
#if (defined __STDC__ || defined __C99__FUNC__ \
994
     || defined __cplusplus || defined _MSC_VER)
995
static char *
996
yystpcpy (char *yydest, const char *yysrc)
997
#else
998
static char *
999
yystpcpy (yydest, yysrc)
1000
    char *yydest;
1001
    const char *yysrc;
1002
#endif
1003
{
1004
  char *yyd = yydest;
1005
  const char *yys = yysrc;
1006
1007
  while ((*yyd++ = *yys++) != '\0')
1008
    continue;
1009
1010
  return yyd - 1;
1011
}
1012
#  endif
1013
# endif
1014
1015
# ifndef yytnamerr
1016
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1017
   quotes and backslashes, so that it's suitable for yyerror.  The
1018
   heuristic is that double-quoting is unnecessary unless the string
1019
   contains an apostrophe, a comma, or backslash (other than
1020
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1021
   null, do not copy; instead, return the length of what the result
1022
   would have been.  */
1023
static YYSIZE_T
1024
yytnamerr (char *yyres, const char *yystr)
1025
{
1026
  if (*yystr == '"')
1027
    {
1028
      YYSIZE_T yyn = 0;
1029
      char const *yyp = yystr;
1030
1031
      for (;;)
1032
	switch (*++yyp)
1033
	  {
1034
	  case '\'':
1035
	  case ',':
1036
	    goto do_not_strip_quotes;
1037
1038
	  case '\\':
1039
	    if (*++yyp != '\\')
1040
	      goto do_not_strip_quotes;
1041
	    /* Fall through.  */
1042
	  default:
1043
	    if (yyres)
1044
	      yyres[yyn] = *yyp;
1045
	    yyn++;
1046
	    break;
1047
1048
	  case '"':
1049
	    if (yyres)
1050
	      yyres[yyn] = '\0';
1051
	    return yyn;
1052
	  }
1053
    do_not_strip_quotes: ;
1054
    }
1055
1056
  if (! yyres)
1057
    return yystrlen (yystr);
1058
1059
  return yystpcpy (yyres, yystr) - yyres;
1060
}
1061
# endif
1062
1063
/* Copy into YYRESULT an error message about the unexpected token
1064
   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1065
   including the terminating null byte.  If YYRESULT is null, do not
1066
   copy anything; just return the number of bytes that would be
1067
   copied.  As a special case, return 0 if an ordinary "syntax error"
1068
   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1069
   size calculation.  */
1070
static YYSIZE_T
1071
yysyntax_error (char *yyresult, int yystate, int yychar)
1072
{
1073
  int yyn = yypact[yystate];
1074
1075
  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1076
    return 0;
1077
  else
1078
    {
1079
      int yytype = YYTRANSLATE (yychar);
1080
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1081
      YYSIZE_T yysize = yysize0;
1082
      YYSIZE_T yysize1;
1083
      int yysize_overflow = 0;
1084
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1085
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1086
      int yyx;
1087
1088
# if 0
1089
      /* This is so xgettext sees the translatable formats that are
1090
	 constructed on the fly.  */
1091
      YY_("syntax error, unexpected %s");
1092
      YY_("syntax error, unexpected %s, expecting %s");
1093
      YY_("syntax error, unexpected %s, expecting %s or %s");
1094
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1095
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1096
# endif
1097
      char *yyfmt;
1098
      char const *yyf;
1099
      static char const yyunexpected[] = "syntax error, unexpected %s";
1100
      static char const yyexpecting[] = ", expecting %s";
1101
      static char const yyor[] = " or %s";
1102
      char yyformat[sizeof yyunexpected
1103
		    + sizeof yyexpecting - 1
1104
		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1105
		       * (sizeof yyor - 1))];
1106
      char const *yyprefix = yyexpecting;
1107
1108
      /* Start YYX at -YYN if negative to avoid negative indexes in
1109
	 YYCHECK.  */
1110
      int yyxbegin = yyn < 0 ? -yyn : 0;
1111
1112
      /* Stay within bounds of both yycheck and yytname.  */
1113
      int yychecklim = YYLAST - yyn + 1;
1114
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1115
      int yycount = 1;
1116
1117
      yyarg[0] = yytname[yytype];
1118
      yyfmt = yystpcpy (yyformat, yyunexpected);
1119
1120
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1121
	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1122
	  {
1123
	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1124
	      {
1125
		yycount = 1;
1126
		yysize = yysize0;
1127
		yyformat[sizeof yyunexpected - 1] = '\0';
1128
		break;
1129
	      }
1130
	    yyarg[yycount++] = yytname[yyx];
1131
	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1132
	    yysize_overflow |= (yysize1 < yysize);
1133
	    yysize = yysize1;
1134
	    yyfmt = yystpcpy (yyfmt, yyprefix);
1135
	    yyprefix = yyor;
1136
	  }
1137
1138
      yyf = YY_(yyformat);
1139
      yysize1 = yysize + yystrlen (yyf);
1140
      yysize_overflow |= (yysize1 < yysize);
1141
      yysize = yysize1;
1142
1143
      if (yysize_overflow)
1144
	return YYSIZE_MAXIMUM;
1145
1146
      if (yyresult)
1147
	{
1148
	  /* Avoid sprintf, as that infringes on the user's name space.
1149
	     Don't have undefined behavior even if the translation
1150
	     produced a string with the wrong number of "%s"s.  */
1151
	  char *yyp = yyresult;
1152
	  int yyi = 0;
1153
	  while ((*yyp = *yyf) != '\0')
1154
	    {
1155
	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1156
		{
1157
		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1158
		  yyf += 2;
1159
		}
1160
	      else
1161
		{
1162
		  yyp++;
1163
		  yyf++;
1164
		}
1165
	    }
1166
	}
1167
      return yysize;
1168
    }
1169
}
1170
#endif /* YYERROR_VERBOSE */
1171
1172
1173
/*-----------------------------------------------.
1174
| Release the memory associated to this symbol.  |
1175
`-----------------------------------------------*/
1176
1177
/*ARGSUSED*/
1178
#if (defined __STDC__ || defined __C99__FUNC__ \
1179
     || defined __cplusplus || defined _MSC_VER)
1180
static void
1181
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1182
#else
1183
static void
1184
yydestruct (yymsg, yytype, yyvaluep)
1185
    const char *yymsg;
1186
    int yytype;
1187
    YYSTYPE *yyvaluep;
1188
#endif
1189
{
1190
  YYUSE (yyvaluep);
1191
1192
  if (!yymsg)
1193
    yymsg = "Deleting";
1194
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1195
1196
  switch (yytype)
1197
    {
1198
1199
      default:
1200
	break;
1201
    }
1202
}
1203
1204
1205
/* Prevent warnings from -Wmissing-prototypes.  */
1206
1207
#ifdef YYPARSE_PARAM
1208
#if defined __STDC__ || defined __cplusplus
1209
int yyparse (void *YYPARSE_PARAM);
1210
#else
1211
int yyparse ();
1212
#endif
1213
#else /* ! YYPARSE_PARAM */
1214
#if defined __STDC__ || defined __cplusplus
1215
int yyparse (void);
1216
#else
1217
int yyparse ();
1218
#endif
1219
#endif /* ! YYPARSE_PARAM */
1220
1221
1222
1223
/* The look-ahead symbol.  */
1224
int yychar;
1225
1226
/* The semantic value of the look-ahead symbol.  */
1227
YYSTYPE yylval;
1228
1229
/* Number of syntax errors so far.  */
1230
int yynerrs;
1231
1232
1233
1234
/*----------.
1235
| yyparse.  |
1236
`----------*/
1237
1238
#ifdef YYPARSE_PARAM
1239
#if (defined __STDC__ || defined __C99__FUNC__ \
1240
     || defined __cplusplus || defined _MSC_VER)
1241
int
1242
yyparse (void *YYPARSE_PARAM)
1243
#else
1244
int
1245
yyparse (YYPARSE_PARAM)
1246
    void *YYPARSE_PARAM;
1247
#endif
1248
#else /* ! YYPARSE_PARAM */
1249
#if (defined __STDC__ || defined __C99__FUNC__ \
1250
     || defined __cplusplus || defined _MSC_VER)
1251
int
1252
yyparse (void)
1253
#else
1254
int
1255
yyparse ()
1256
1257
#endif
1258
#endif
1259
{
1260
  
1261
  int yystate;
1262
  int yyn;
1263
  int yyresult;
1264
  /* Number of tokens to shift before error messages enabled.  */
1265
  int yyerrstatus;
1266
  /* Look-ahead token as an internal (translated) token number.  */
1267
  int yytoken = 0;
1268
#if YYERROR_VERBOSE
1269
  /* Buffer for error messages, and its allocated size.  */
1270
  char yymsgbuf[128];
1271
  char *yymsg = yymsgbuf;
1272
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1273
#endif
56
#endif
1274
57
1275
  /* Three stacks and their tools:
58
/* Suppress unused-variable warnings by "using" E.  */
1276
     `yyss': related to states,
59
#define YYUSE(e) ((void) (e))
1277
     `yyvs': related to semantic values,
1278
     `yyls': related to locations.
1279
1280
     Refer to the stacks thru separate pointers, to allow yyoverflow
1281
     to reallocate them elsewhere.  */
1282
60
1283
  /* The state stack.  */
61
/* A pseudo ostream that takes yydebug_ into account.  */
1284
  yytype_int16 yyssa[YYINITDEPTH];
62
# define YYCDEBUG							\
1285
  yytype_int16 *yyss = yyssa;
63
  for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false)	\
1286
  yytype_int16 *yyssp;
64
    (*yycdebug_)
1287
65
1288
  /* The semantic value stack.  */
66
/* Enable debugging if requested.  */
1289
  YYSTYPE yyvsa[YYINITDEPTH];
67
#if YYDEBUG
1290
  YYSTYPE *yyvs = yyvsa;
1291
  YYSTYPE *yyvsp;
1292
68
69
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
70
do {									  \
71
  if (yydebug_)						\
72
    {									  \
73
      *yycdebug_ << Title << ' ';			\
74
      yy_symbol_print_ ((Type), (Value), (Location));	\
75
      *yycdebug_ << std::endl;				\
76
    }									  \
77
} while (false)
1293
78
79
# define YY_REDUCE_PRINT(Rule)		\
80
do {								\
81
  if (yydebug_)				\
82
    yy_reduce_print_ (Rule);		\
83
} while (false)
1294
84
1295
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
85
# define YY_STACK_PRINT()		\
86
do {					\
87
  if (yydebug_)				\
88
    yystack_print_ ();			\
89
} while (false)
1296
90
1297
  YYSIZE_T yystacksize = YYINITDEPTH;
91
#else /* !YYDEBUG */
1298
92
1299
  /* The variables used to return semantic value and location from the
93
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1300
     action routines.  */
94
# define YY_REDUCE_PRINT(Rule)
1301
  YYSTYPE yyval;
95
# define YY_STACK_PRINT()
1302
96
97
#endif /* !YYDEBUG */
1303
98
1304
  /* The number of symbols on the RHS of the reduced rule.
99
#define YYACCEPT	goto yyacceptlab
1305
     Keep to zero when no symbol should be popped.  */
100
#define YYABORT		goto yyabortlab
1306
  int yylen = 0;
101
#define YYERROR		goto yyerrorlab
1307
102
1308
  YYDPRINTF ((stderr, "Starting parse\n"));
103
namespace QMake
104
{
105
#if YYERROR_VERBOSE
1309
106
1310
  yystate = 0;
107
  /* Return YYSTR after stripping away unnecessary quotes and
1311
  yyerrstatus = 0;
108
     backslashes, so that it's suitable for yyerror.  The heuristic is
1312
  yynerrs = 0;
109
     that double-quoting is unnecessary unless the string contains an
1313
  yychar = YYEMPTY;		/* Cause a token to be read.  */
110
     apostrophe, a comma, or backslash (other than backslash-backslash).
111
     YYSTR is taken from yytname.  */
112
  std::string
113
  Parser::yytnamerr_ (const char *yystr)
114
  {
115
  if (*yystr == '"')
116
    {
117
        std::string yyr = "";
118
      char const *yyp = yystr;
1314
119
1315
  /* Initialize stack pointers.
120
      for (;;)
1316
     Waste one element of value and location stack
121
	switch (*++yyp)
1317
     so that they stay on the same level as the state stack.
122
	  {
1318
     The wasted elements are never initialized.  */
123
	  case '\'':
124
	  case ',':
125
	    goto do_not_strip_quotes;
1319
126
1320
  yyssp = yyss;
127
	  case '\\':
1321
  yyvsp = yyvs;
128
	    if (*++yyp != '\\')
129
	      goto do_not_strip_quotes;
130
	    /* Fall through.  */
131
	  default:
132
              yyr += *yyp;
133
	    break;
1322
134
1323
  goto yysetstate;
135
	  case '"':
136
              return yyr;
137
	  }
138
    do_not_strip_quotes: ;
139
    }
1324
140
1325
/*------------------------------------------------------------.
141
    return yystr;
1326
| yynewstate -- Push a new state, which is found in yystate.  |
142
  }
1327
`------------------------------------------------------------*/
1328
 yynewstate:
1329
  /* In all cases, when you get here, the value and location stacks
1330
     have just been pushed.  So pushing a state here evens the stacks.  */
1331
  yyssp++;
1332
143
1333
 yysetstate:
144
#endif
1334
  *yyssp = yystate;
1335
145
1336
  if (yyss + yystacksize - 1 <= yyssp)
146
  /// Build a parser object.
147
  Parser::Parser (QMake::Lexer* lexer_yyarg, QValueStack<ProjectAST*>& projects_yyarg, int depth_yyarg)
148
    : yydebug_ (false),
149
      yycdebug_ (&std::cerr),
150
      lexer (lexer_yyarg),
151
      projects (projects_yyarg),
152
      depth (depth_yyarg)
1337
    {
153
    {
1338
      /* Get the current used size of the three stacks, in elements.  */
154
  }
1339
      YYSIZE_T yysize = yyssp - yyss + 1;
1340
155
1341
#ifdef yyoverflow
156
  Parser::~Parser ()
1342
      {
157
	      {
1343
	/* Give user a chance to reallocate the stack.  Use copies of
158
	      }
1344
	   these so that the &'s don't force the real ones into
1345
	   memory.  */
1346
	YYSTYPE *yyvs1 = yyvs;
1347
	yytype_int16 *yyss1 = yyss;
1348
1349
1350
	/* Each stack pointer address is followed by the size of the
1351
	   data in use in that stack, in bytes.  This used to be a
1352
	   conditional around just the two extra args, but that might
1353
	   be undefined if yyoverflow is a macro.  */
1354
	yyoverflow (YY_("memory exhausted"),
1355
		    &yyss1, yysize * sizeof (*yyssp),
1356
		    &yyvs1, yysize * sizeof (*yyvsp),
1357
1358
		    &yystacksize);
1359
1360
	yyss = yyss1;
1361
	yyvs = yyvs1;
1362
      }
1363
#else /* no yyoverflow */
1364
# ifndef YYSTACK_RELOCATE
1365
      goto yyexhaustedlab;
1366
# else
1367
      /* Extend the stack our own way.  */
1368
      if (YYMAXDEPTH <= yystacksize)
1369
	goto yyexhaustedlab;
1370
      yystacksize *= 2;
1371
      if (YYMAXDEPTH < yystacksize)
1372
	yystacksize = YYMAXDEPTH;
1373
159
1374
      {
160
#if YYDEBUG
1375
	yytype_int16 *yyss1 = yyss;
161
  /*--------------------------------.
1376
	union yyalloc *yyptr =
162
  | Print this symbol on YYOUTPUT.  |
1377
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
163
  `--------------------------------*/
1378
	if (! yyptr)
164
1379
	  goto yyexhaustedlab;
165
  inline void
1380
	YYSTACK_RELOCATE (yyss);
166
  Parser::yy_symbol_value_print_ (int yytype,
1381
	YYSTACK_RELOCATE (yyvs);
167
			   const semantic_type* yyvaluep, const location_type* yylocationp)
1382
168
		{
1383
#  undef YYSTACK_RELOCATE
169
    YYUSE (yylocationp);
1384
	if (yyss1 != yyssa)
170
    YYUSE (yyvaluep);
1385
	  YYSTACK_FREE (yyss1);
171
    switch (yytype)
1386
      }
172
		{
1387
# endif
173
         default:
1388
#endif /* no yyoverflow */
174
	  break;
175
	}
176
    }
177
1389
178
1390
      yyssp = yyss + yysize - 1;
179
  void
1391
      yyvsp = yyvs + yysize - 1;
180
  Parser::yy_symbol_print_ (int yytype,
181
			   const semantic_type* yyvaluep, const location_type* yylocationp)
182
  {
183
    *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
184
	       << ' ' << yytname_[yytype] << " ("
185
	       << *yylocationp << ": ";
186
    yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
187
    *yycdebug_ << ')';
188
  }
189
#endif /* ! YYDEBUG */
190
191
  void
192
  Parser::yydestruct_ (const char* yymsg,
193
			   int yytype, semantic_type* yyvaluep, location_type* yylocationp)
194
  {
195
    YYUSE (yylocationp);
196
    YYUSE (yymsg);
197
  YYUSE (yyvaluep);
1392
198
199
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1393
200
1394
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
201
  switch (yytype)
1395
		  (unsigned long int) yystacksize));
202
    {
1396
203
1397
      if (yyss + yystacksize - 1 <= yyssp)
204
      default:
1398
	YYABORT;
205
	break;
1399
    }
206
    }
207
  }
1400
208
1401
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
209
  void
210
  Parser::yypop_ (unsigned int n)
211
  {
212
    yystate_stack_.pop (n);
213
    yysemantic_stack_.pop (n);
214
    yylocation_stack_.pop (n);
215
  }
216
217
  std::ostream&
218
  Parser::debug_stream () const
219
  {
220
    return *yycdebug_;
221
  }
222
223
  void
224
  Parser::set_debug_stream (std::ostream& o)
225
  {
226
    yycdebug_ = &o;
227
  }
228
229
230
  Parser::debug_level_type
231
  Parser::debug_level () const
232
  {
233
    return yydebug_;
234
  }
235
236
  void
237
  Parser::set_debug_level (debug_level_type l)
238
  {
239
    yydebug_ = l;
240
  }
241
242
243
  int
244
  Parser::parse ()
245
  {
246
    /// Look-ahead and look-ahead in internal form.
247
    int yychar = yyempty_;
248
    int yytoken = 0;
249
250
    /* State.  */
251
    int yyn;
252
  int yylen = 0;
253
    int yystate = 0;
1402
254
255
    /* Error handling.  */
256
    int yynerrs_ = 0;
257
    int yyerrstatus_ = 0;
258
259
    /// Semantic value of the look-ahead.
260
    semantic_type yylval;
261
    /// Location of the look-ahead.
262
    location_type yylloc;
263
    /// The locations where the error started and ended.
264
    location yyerror_range[2];
265
266
    /// $$.
267
    semantic_type yyval;
268
    /// @$.
269
    location_type yyloc;
270
271
    int yyresult;
272
273
    YYCDEBUG << "Starting parse" << std::endl;
274
275
276
    /* Initialize the stacks.  The initial state will be pushed in
277
       yynewstate, since the latter expects the semantical and the
278
       location values to have been already stored, initialize these
279
       stacks with a primary value.  */
280
    yystate_stack_ = state_stack_type (0);
281
    yysemantic_stack_ = semantic_stack_type (0);
282
    yylocation_stack_ = location_stack_type (0);
283
    yysemantic_stack_.push (yylval);
284
    yylocation_stack_.push (yylloc);
285
286
    /* New state.  */
287
  yynewstate:
288
    yystate_stack_.push (yystate);
289
    YYCDEBUG << "Entering state " << yystate << std::endl;
1403
  goto yybackup;
290
  goto yybackup;
1404
291
1405
/*-----------.
292
    /* Backup.  */
1406
| yybackup.  |
293
  yybackup:
1407
`-----------*/
1408
yybackup:
1409
1410
  /* Do appropriate processing given the current state.  Read a
1411
     look-ahead token if we need one and don't already have one.  */
1412
1413
  /* First try to decide what to do without reference to look-ahead token.  */
1414
  yyn = yypact[yystate];
1415
  if (yyn == YYPACT_NINF)
1416
    goto yydefault;
1417
294
1418
  /* Not known => get a look-ahead token if don't already have one.  */
295
    /* Try to take a decision without look-ahead.  */
296
    yyn = yypact_[yystate];
297
    if (yyn == yypact_ninf_)
298
      goto yydefault;
1419
299
1420
  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
300
    /* Read a look-ahead token.  */
1421
  if (yychar == YYEMPTY)
301
    if (yychar == yyempty_)
1422
    {
302
    {
1423
      YYDPRINTF ((stderr, "Reading a token: "));
303
	YYCDEBUG << "Reading a token: ";
1424
      yychar = YYLEX;
304
	yychar = yylex (&yylval, lexer);
1425
    }
305
    }
1426
306
1427
  if (yychar <= YYEOF)
307
308
    /* Convert token to internal form.  */
309
    if (yychar <= yyeof_)
1428
    {
310
    {
1429
      yychar = yytoken = YYEOF;
311
	yychar = yytoken = yyeof_;
1430
      YYDPRINTF ((stderr, "Now at end of input.\n"));
312
	YYCDEBUG << "Now at end of input." << std::endl;
1431
    }
313
    }
1432
  else
314
  else
1433
    {
315
    {
1434
      yytoken = YYTRANSLATE (yychar);
316
	yytoken = yytranslate_ (yychar);
1435
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
317
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1436
    }
318
    }
1437
319
1438
  /* If the proper action on seeing token YYTOKEN is to reduce or to
320
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1439
     detect an error, take that action.  */
321
     detect an error, take that action.  */
1440
  yyn += yytoken;
322
  yyn += yytoken;
1441
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
323
    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
1442
    goto yydefault;
324
    goto yydefault;
1443
  yyn = yytable[yyn];
325
326
    /* Reduce or error.  */
327
    yyn = yytable_[yyn];
1444
  if (yyn <= 0)
328
  if (yyn <= 0)
1445
    {
329
    {
1446
      if (yyn == 0 || yyn == YYTABLE_NINF)
330
	if (yyn == 0 || yyn == yytable_ninf_)
1447
	goto yyerrlab;
331
	goto yyerrlab;
1448
      yyn = -yyn;
332
      yyn = -yyn;
1449
      goto yyreduce;
333
      goto yyreduce;
1450
    }
334
    }
1451
335
1452
  if (yyn == YYFINAL)
336
    /* Accept?  */
1453
    YYACCEPT;
337
    if (yyn == yyfinal_)
1454
338
      goto yyacceptlab;
1455
  /* Count tokens shifted since error; after three, turn off error
1456
     status.  */
1457
  if (yyerrstatus)
1458
    yyerrstatus--;
1459
339
1460
  /* Shift the look-ahead token.  */
340
  /* Shift the look-ahead token.  */
1461
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
341
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1462
342
1463
  /* Discard the shifted token unless it is eof.  */
343
    /* Discard the token being shifted unless it is eof.  */
1464
  if (yychar != YYEOF)
344
    if (yychar != yyeof_)
1465
    yychar = YYEMPTY;
345
      yychar = yyempty_;
1466
346
1467
  yystate = yyn;
347
    yysemantic_stack_.push (yylval);
1468
  *++yyvsp = yylval;
348
    yylocation_stack_.push (yylloc);
1469
349
1470
  goto yynewstate;
350
    /* Count tokens shifted since error; after three, turn off error
1471
351
       status.  */
1472
352
    if (yyerrstatus_)
1473
/*-----------------------------------------------------------.
353
      --yyerrstatus_;
1474
| yydefault -- do the default action for the current state.  |
354
1475
`-----------------------------------------------------------*/
355
    yystate = yyn;
1476
yydefault:
356
    goto yynewstate;
1477
  yyn = yydefact[yystate];
357
358
  /*-----------------------------------------------------------.
359
  | yydefault -- do the default action for the current state.  |
360
  `-----------------------------------------------------------*/
361
  yydefault:
362
    yyn = yydefact_[yystate];
1478
  if (yyn == 0)
363
  if (yyn == 0)
1479
    goto yyerrlab;
364
    goto yyerrlab;
1480
  goto yyreduce;
365
  goto yyreduce;
1481
366
1482
367
  /*-----------------------------.
1483
/*-----------------------------.
368
  | yyreduce -- Do a reduction.  |
1484
| yyreduce -- Do a reduction.  |
369
  `-----------------------------*/
1485
`-----------------------------*/
370
  yyreduce:
1486
yyreduce:
371
    yylen = yyr2_[yyn];
1487
  /* yyn is the number of a rule to reduce with.  */
1488
  yylen = yyr2[yyn];
1489
1490
  /* If YYLEN is nonzero, implement the default value of the action:
372
  /* If YYLEN is nonzero, implement the default value of the action:
1491
     `$$ = $1'.
373
       `$$ = $1'.  Otherwise, use the top of the stack.
1492
374
1493
     Otherwise, the following line sets YYVAL to garbage.
375
     Otherwise, the following line sets YYVAL to garbage.
1494
     This behavior is undocumented and Bison
376
     This behavior is undocumented and Bison
1495
     users should not rely upon it.  Assigning to YYVAL
377
       users should not rely upon it.  */
1496
     unconditionally makes the parser a bit smaller, and it avoids a
378
    if (yylen)
1497
     GCC warning that YYVAL may be used uninitialized.  */
379
      yyval = yysemantic_stack_[yylen - 1];
1498
  yyval = yyvsp[1-yylen];
380
    else
1499
381
      yyval = yysemantic_stack_[0];
1500
382
383
    {
384
      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
385
      YYLLOC_DEFAULT (yyloc, slice, yylen);
386
    }
1501
  YY_REDUCE_PRINT (yyn);
387
  YY_REDUCE_PRINT (yyn);
1502
  switch (yyn)
388
  switch (yyn)
1503
    {
389
    {
1504
        case 2:
390
        case 2:
1505
#line 136 "qmake.yy"
391
#line 147 "qmake.yy"
1506
    {
392
    {
1507
        ProjectAST *projectAST = new ProjectAST();
393
        ProjectAST *projectAST = new ProjectAST();
1508
        projects.push(projectAST);
394
        projects.push(projectAST);
Lines 1510-1582 Link Here
1510
    break;
396
    break;
1511
397
1512
  case 4:
398
  case 4:
1513
#line 144 "qmake.yy"
399
#line 155 "qmake.yy"
1514
    {
400
    {
1515
            projects.top()->addChildAST((yyvsp[(2) - (2)].node));
401
            projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
1516
            (yyvsp[(2) - (2)].node)->setDepth(depth);
402
            (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
1517
        ;}
403
        ;}
1518
    break;
404
    break;
1519
405
1520
  case 6:
406
  case 6:
1521
#line 152 "qmake.yy"
407
#line 163 "qmake.yy"
1522
    {
408
    {
1523
            (yyval.node) = (yyvsp[(1) - (1)].node);
409
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
1524
        ;}
410
        ;}
1525
    break;
411
    break;
1526
412
1527
  case 7:
413
  case 7:
1528
#line 156 "qmake.yy"
414
#line 167 "qmake.yy"
1529
    {
415
    {
1530
            (yyval.node) = (yyvsp[(1) - (1)].node);
416
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
1531
        ;}
417
        ;}
1532
    break;
418
    break;
1533
419
1534
  case 8:
420
  case 8:
1535
#line 160 "qmake.yy"
421
#line 171 "qmake.yy"
1536
    {
422
    {
1537
            (yyval.node) = (yyvsp[(1) - (1)].node);
423
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
1538
        ;}
424
        ;}
1539
    break;
425
    break;
1540
426
1541
  case 9:
427
  case 9:
1542
#line 164 "qmake.yy"
428
#line 175 "qmake.yy"
1543
    {
429
    {
1544
            (yyval.node) = (yyvsp[(1) - (1)].node);
430
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
1545
        ;}
431
        ;}
1546
    break;
432
    break;
1547
433
1548
  case 10:
434
  case 10:
1549
#line 168 "qmake.yy"
435
#line 179 "qmake.yy"
1550
    {
436
    {
1551
            (yyval.node) = new NewLineAST();
437
            (yyval.node) = new NewLineAST();
1552
        ;}
438
        ;}
1553
    break;
439
    break;
1554
440
1555
  case 11:
441
  case 11:
1556
#line 174 "qmake.yy"
442
#line 185 "qmake.yy"
1557
    {
443
    {
1558
            AssignmentAST *node = new AssignmentAST();
444
            AssignmentAST *node = new AssignmentAST();
1559
            node->scopedID = (yyvsp[(1) - (3)].value);
445
            node->scopedID = (yysemantic_stack_[(3) - (1)].value);
1560
            node->op = (yyvsp[(2) - (3)].value);
446
            node->op = (yysemantic_stack_[(3) - (2)].value);
1561
            node->values = (yyvsp[(3) - (3)].values);
447
            node->values = (yysemantic_stack_[(3) - (3)].values);
1562
            node->indent = (yyvsp[(3) - (3)].indent);
448
            node->indent = (yysemantic_stack_[(3) - (3)].indent);
1563
	        node->commentnode = (yyvsp[(3) - (3)].node);
449
	        node->commentnode = (yysemantic_stack_[(3) - (3)].node);
1564
            (yyval.node) = node;
450
            (yyval.node) = node;
1565
        ;}
451
        ;}
1566
    break;
452
    break;
1567
453
1568
  case 12:
454
  case 12:
1569
#line 186 "qmake.yy"
455
#line 197 "qmake.yy"
1570
    {
456
    {
1571
            (yyval.values) += (yyvsp[(2) - (3)].values);
457
            (yyval.values) += (yysemantic_stack_[(3) - (2)].values);
1572
            if( (yyvsp[(2) - (3)].indent) != "" && (yyval.indent) == "" )
458
            if( (yysemantic_stack_[(3) - (2)].indent) != "" && (yyval.indent) == "" )
1573
                (yyval.indent) = (yyvsp[(2) - (3)].indent);
459
                (yyval.indent) = (yysemantic_stack_[(3) - (2)].indent);
1574
            (yyval.node) = (yyvsp[(3) - (3)].node);
460
            (yyval.node) = (yysemantic_stack_[(3) - (3)].node);
1575
        ;}
461
        ;}
1576
    break;
462
    break;
1577
463
1578
  case 13:
464
  case 13:
1579
#line 193 "qmake.yy"
465
#line 204 "qmake.yy"
1580
    {
466
    {
1581
            (yyval.values).clear();
467
            (yyval.values).clear();
1582
            (yyval.indent) = "";
468
            (yyval.indent) = "";
Lines 1585-1661 Link Here
1585
    break;
471
    break;
1586
472
1587
  case 14:
473
  case 14:
1588
#line 200 "qmake.yy"
474
#line 211 "qmake.yy"
1589
    { (yyval.values).append( (yyvsp[(2) - (2)].value) ); ;}
475
    { (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) ); ;}
1590
    break;
476
    break;
1591
477
1592
  case 15:
478
  case 15:
1593
#line 201 "qmake.yy"
479
#line 212 "qmake.yy"
1594
    { (yyval.values).append( (yyvsp[(1) - (1)].value) ); ;}
480
    { (yyval.values).append( (yysemantic_stack_[(1) - (1)].value) ); ;}
1595
    break;
481
    break;
1596
482
1597
  case 16:
483
  case 16:
1598
#line 202 "qmake.yy"
484
#line 213 "qmake.yy"
1599
    { (yyval.values).append("\\\n"); ;}
485
    { (yyval.values).append("\\\n"); ;}
1600
    break;
486
    break;
1601
487
1602
  case 17:
488
  case 17:
1603
#line 203 "qmake.yy"
489
#line 214 "qmake.yy"
1604
    { (yyval.values).append("\n"); ;}
490
    { (yyval.values).append("\n"); ;}
1605
    break;
491
    break;
1606
492
1607
  case 18:
493
  case 18:
1608
#line 204 "qmake.yy"
494
#line 215 "qmake.yy"
1609
    { (yyval.values).append((yyvsp[(1) - (1)].value)); ;}
495
    { (yyval.values).append((yysemantic_stack_[(1) - (1)].value)); ;}
1610
    break;
496
    break;
1611
497
1612
  case 19:
498
  case 19:
1613
#line 206 "qmake.yy"
499
#line 217 "qmake.yy"
1614
    {
500
    {
1615
            (yyval.values).append((yyvsp[(1) - (1)].value));
501
            (yyval.values).append((yysemantic_stack_[(1) - (1)].value));
1616
            if( (yyval.indent) == "" && (yyvsp[(1) - (1)].value) != "" )
502
            if( (yyval.indent) == "" && (yysemantic_stack_[(1) - (1)].value) != "" )
1617
                (yyval.indent) = (yyvsp[(1) - (1)].value);
503
                (yyval.indent) = (yysemantic_stack_[(1) - (1)].value);
1618
        ;}
504
        ;}
1619
    break;
505
    break;
1620
506
1621
  case 22:
507
  case 22:
1622
#line 216 "qmake.yy"
508
#line 227 "qmake.yy"
1623
    {
509
    {
1624
            CommentAST* node = new CommentAST();
510
            CommentAST* node = new CommentAST();
1625
            node->comment = (yyvsp[(1) - (1)].value) + "\n";
511
            node->comment = (yysemantic_stack_[(1) - (1)].value) + "\n";
1626
	        (yyval.node) = node;
512
	        (yyval.node) = node;
1627
        ;}
513
        ;}
1628
    break;
514
    break;
1629
515
1630
  case 23:
516
  case 23:
1631
#line 222 "qmake.yy"
517
#line 233 "qmake.yy"
1632
    {
518
    {
1633
            (yyval.node) = 0;
519
            (yyval.node) = 0;
1634
        ;}
520
        ;}
1635
    break;
521
    break;
1636
522
1637
  case 24:
523
  case 24:
1638
#line 227 "qmake.yy"
524
#line 238 "qmake.yy"
1639
    { (yyval.value) = (yyvsp[(1) - (1)].value); ;}
525
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
1640
    break;
526
    break;
1641
527
1642
  case 25:
528
  case 25:
1643
#line 228 "qmake.yy"
529
#line 239 "qmake.yy"
1644
    { (yyval.value) = (yyvsp[(1) - (1)].value); ;}
530
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
1645
    break;
531
    break;
1646
532
1647
  case 31:
533
  case 31:
1648
#line 235 "qmake.yy"
534
#line 246 "qmake.yy"
1649
    {
535
    {
1650
            ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope);
536
            ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope);
1651
            projects.push(projectAST);
537
            projects.push(projectAST);
1652
            projects.top()->scopedID = (yyvsp[(1) - (1)].value);
538
            projects.top()->scopedID = (yysemantic_stack_[(1) - (1)].value);
1653
            depth++;
539
            depth++;
1654
        ;}
540
        ;}
1655
    break;
541
    break;
1656
542
1657
  case 32:
543
  case 32:
1658
#line 242 "qmake.yy"
544
#line 253 "qmake.yy"
1659
    {
545
    {
1660
            (yyval.node) = projects.pop();
546
            (yyval.node) = projects.pop();
1661
            depth--;
547
            depth--;
Lines 1663-1681 Link Here
1663
    break;
549
    break;
1664
550
1665
  case 33:
551
  case 33:
1666
#line 249 "qmake.yy"
552
#line 260 "qmake.yy"
1667
    {
553
    {
1668
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
554
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
1669
            projects.push(projectAST);
555
            projects.push(projectAST);
1670
            projects.top()->scopedID = (yyvsp[(1) - (4)].value);
556
            projects.top()->scopedID = (yysemantic_stack_[(4) - (1)].value);
1671
            projects.top()->args = (yyvsp[(3) - (4)].value);
557
            projects.top()->args = (yysemantic_stack_[(4) - (3)].value);
1672
            depth++;
558
            depth++;
1673
559
1674
            //qWarning("%s", $<value>1.ascii());
560
            //qWarning("%s", $<value>1.ascii());
1675
            if ((yyvsp[(1) - (4)].value).contains("include"))
561
            if ((yysemantic_stack_[(4) - (1)].value).contains("include"))
1676
            {
562
            {
1677
                IncludeAST *includeAST = new IncludeAST();
563
                IncludeAST *includeAST = new IncludeAST();
1678
                includeAST->projectName = (yyvsp[(3) - (4)].value);
564
                includeAST->projectName = (yysemantic_stack_[(4) - (3)].value);
1679
                projects.top()->addChildAST(includeAST);
565
                projects.top()->addChildAST(includeAST);
1680
                includeAST->setDepth(depth);
566
                includeAST->setDepth(depth);
1681
            }
567
            }
Lines 1683-1689 Link Here
1683
    break;
569
    break;
1684
570
1685
  case 34:
571
  case 34:
1686
#line 267 "qmake.yy"
572
#line 278 "qmake.yy"
1687
    {
573
    {
1688
            (yyval.node) = projects.pop();
574
            (yyval.node) = projects.pop();
1689
            depth--;
575
            depth--;
Lines 1691-1715 Link Here
1691
    break;
577
    break;
1692
578
1693
  case 35:
579
  case 35:
1694
#line 273 "qmake.yy"
580
#line 284 "qmake.yy"
1695
    { (yyval.value) = (yyvsp[(1) - (1)].value); ;}
581
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
1696
    break;
582
    break;
1697
583
1698
  case 36:
584
  case 36:
1699
#line 274 "qmake.yy"
585
#line 285 "qmake.yy"
1700
    { (yyval.value) = ""; ;}
586
    { (yyval.value) = ""; ;}
1701
    break;
587
    break;
1702
588
1703
  case 38:
589
  case 38:
1704
#line 279 "qmake.yy"
590
#line 290 "qmake.yy"
1705
    {
591
    {
1706
            projects.top()->addChildAST((yyvsp[(2) - (2)].node));
592
            projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
1707
            (yyvsp[(2) - (2)].node)->setDepth(depth);
593
            (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
1708
        ;}
594
        ;}
1709
    break;
595
    break;
1710
596
1711
  case 40:
597
  case 40:
1712
#line 287 "qmake.yy"
598
#line 298 "qmake.yy"
1713
    {
599
    {
1714
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
600
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
1715
            projects.push(projectAST);
601
            projects.push(projectAST);
Lines 1720-1726 Link Here
1720
    break;
606
    break;
1721
607
1722
  case 41:
608
  case 41:
1723
#line 295 "qmake.yy"
609
#line 306 "qmake.yy"
1724
    {
610
    {
1725
            (yyval.node) = projects.pop();
611
            (yyval.node) = projects.pop();
1726
            depth--;
612
            depth--;
Lines 1728-1840 Link Here
1728
    break;
614
    break;
1729
615
1730
  case 42:
616
  case 42:
1731
#line 300 "qmake.yy"
617
#line 311 "qmake.yy"
1732
    {
618
    {
1733
            (yyval.node) = new ProjectAST();
619
            (yyval.node) = new ProjectAST();
1734
        ;}
620
        ;}
1735
    break;
621
    break;
1736
622
1737
  case 43:
623
  case 43:
1738
#line 306 "qmake.yy"
624
#line 317 "qmake.yy"
1739
    {
625
    {
1740
            CommentAST *node = new CommentAST();
626
            CommentAST *node = new CommentAST();
1741
            node->comment = (yyvsp[(1) - (2)].value) + "\n";
627
            node->comment = (yysemantic_stack_[(2) - (1)].value) + "\n";
1742
            (yyval.node) = node;
628
            (yyval.node) = node;
1743
        ;}
629
        ;}
1744
    break;
630
    break;
1745
631
1746
632
1747
/* Line 1267 of yacc.c.  */
633
    /* Line 675 of lalr1.cc.  */
1748
#line 1749 "qmake_yacc.cpp"
634
#line 635 "qmake_yacc.cpp"
1749
      default: break;
635
      default: break;
1750
    }
636
    }
1751
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
637
    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
1752
638
1753
  YYPOPSTACK (yylen);
639
    yypop_ (yylen);
1754
  yylen = 0;
640
  yylen = 0;
1755
  YY_STACK_PRINT (yyss, yyssp);
641
    YY_STACK_PRINT ();
1756
1757
  *++yyvsp = yyval;
1758
1759
1760
  /* Now `shift' the result of the reduction.  Determine what state
1761
     that goes to, based on the state we popped back to and the rule
1762
     number reduced by.  */
1763
642
1764
  yyn = yyr1[yyn];
643
    yysemantic_stack_.push (yyval);
644
    yylocation_stack_.push (yyloc);
1765
645
1766
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
646
    /* Shift the result of the reduction.  */
1767
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
647
    yyn = yyr1_[yyn];
1768
    yystate = yytable[yystate];
648
    yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
649
    if (0 <= yystate && yystate <= yylast_
650
	&& yycheck_[yystate] == yystate_stack_[0])
651
      yystate = yytable_[yystate];
1769
  else
652
  else
1770
    yystate = yydefgoto[yyn - YYNTOKENS];
653
      yystate = yydefgoto_[yyn - yyntokens_];
1771
1772
  goto yynewstate;
654
  goto yynewstate;
1773
655
1774
656
  /*------------------------------------.
1775
/*------------------------------------.
657
  | yyerrlab -- here on detecting error |
1776
| yyerrlab -- here on detecting error |
658
  `------------------------------------*/
1777
`------------------------------------*/
659
  yyerrlab:
1778
yyerrlab:
1779
  /* If not already recovering from an error, report this error.  */
660
  /* If not already recovering from an error, report this error.  */
1780
  if (!yyerrstatus)
661
    if (!yyerrstatus_)
1781
    {
1782
      ++yynerrs;
1783
#if ! YYERROR_VERBOSE
1784
      yyerror (YY_("syntax error"));
1785
#else
1786
      {
1787
	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1788
	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1789
	  {
662
	  {
1790
	    YYSIZE_T yyalloc = 2 * yysize;
663
	++yynerrs_;
1791
	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
664
	error (yylloc, yysyntax_error_ (yystate));
1792
	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
1793
	    if (yymsg != yymsgbuf)
1794
	      YYSTACK_FREE (yymsg);
1795
	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1796
	    if (yymsg)
1797
	      yymsg_alloc = yyalloc;
1798
	    else
1799
	      {
1800
		yymsg = yymsgbuf;
1801
		yymsg_alloc = sizeof yymsgbuf;
1802
	      }
1803
	  }
1804
1805
	if (0 < yysize && yysize <= yymsg_alloc)
1806
	  {
1807
	    (void) yysyntax_error (yymsg, yystate, yychar);
1808
	    yyerror (yymsg);
1809
	  }
1810
	else
1811
	  {
1812
	    yyerror (YY_("syntax error"));
1813
	    if (yysize != 0)
1814
	      goto yyexhaustedlab;
1815
	  }
665
	  }
1816
      }
1817
#endif
1818
    }
1819
1820
1821
666
1822
  if (yyerrstatus == 3)
667
    yyerror_range[0] = yylloc;
668
    if (yyerrstatus_ == 3)
1823
    {
669
    {
1824
      /* If just tried and failed to reuse look-ahead token after an
670
      /* If just tried and failed to reuse look-ahead token after an
1825
	 error, discard it.  */
671
	 error, discard it.  */
1826
672
1827
      if (yychar <= YYEOF)
673
	if (yychar <= yyeof_)
1828
	{
674
	{
1829
	  /* Return failure if at end of input.  */
675
	  /* Return failure if at end of input.  */
1830
	  if (yychar == YYEOF)
676
	  if (yychar == yyeof_)
1831
	    YYABORT;
677
	    YYABORT;
1832
	}
678
	}
1833
      else
679
      else
1834
	{
680
	{
1835
	  yydestruct ("Error: discarding",
681
	    yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
1836
		      yytoken, &yylval);
682
	    yychar = yyempty_;
1837
	  yychar = YYEMPTY;
1838
	}
683
	}
1839
    }
684
    }
1840
685
Lines 1843-1966 Link Here
1843
  goto yyerrlab1;
688
  goto yyerrlab1;
1844
689
1845
690
1846
/*---------------------------------------------------.
691
  /*---------------------------------------------------.
1847
| yyerrorlab -- error raised explicitly by YYERROR.  |
692
  | yyerrorlab -- error raised explicitly by YYERROR.  |
1848
`---------------------------------------------------*/
693
  `---------------------------------------------------*/
1849
yyerrorlab:
694
  yyerrorlab:
1850
695
1851
  /* Pacify compilers like GCC when the user code never invokes
696
  /* Pacify compilers like GCC when the user code never invokes
1852
     YYERROR and the label yyerrorlab therefore never appears in user
697
     YYERROR and the label yyerrorlab therefore never appears in user
1853
     code.  */
698
     code.  */
1854
  if (/*CONSTCOND*/ 0)
699
    if (false)
1855
     goto yyerrorlab;
700
     goto yyerrorlab;
1856
701
702
    yyerror_range[0] = yylocation_stack_[yylen - 1];
1857
  /* Do not reclaim the symbols of the rule which action triggered
703
  /* Do not reclaim the symbols of the rule which action triggered
1858
     this YYERROR.  */
704
     this YYERROR.  */
1859
  YYPOPSTACK (yylen);
705
    yypop_ (yylen);
1860
  yylen = 0;
706
  yylen = 0;
1861
  YY_STACK_PRINT (yyss, yyssp);
707
    yystate = yystate_stack_[0];
1862
  yystate = *yyssp;
1863
  goto yyerrlab1;
708
  goto yyerrlab1;
1864
709
1865
710
  /*-------------------------------------------------------------.
1866
/*-------------------------------------------------------------.
711
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1867
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
712
  `-------------------------------------------------------------*/
1868
`-------------------------------------------------------------*/
713
  yyerrlab1:
1869
yyerrlab1:
714
    yyerrstatus_ = 3;	/* Each real token shifted decrements this.  */
1870
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1871
715
1872
  for (;;)
716
  for (;;)
1873
    {
717
    {
1874
      yyn = yypact[yystate];
718
	yyn = yypact_[yystate];
1875
      if (yyn != YYPACT_NINF)
719
	if (yyn != yypact_ninf_)
1876
	{
720
	{
1877
	  yyn += YYTERROR;
721
	  yyn += yyterror_;
1878
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
722
	  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
1879
	    {
723
	    {
1880
	      yyn = yytable[yyn];
724
	      yyn = yytable_[yyn];
1881
	      if (0 < yyn)
725
	      if (0 < yyn)
1882
		break;
726
		break;
1883
	    }
727
	    }
1884
	}
728
	}
1885
729
1886
      /* Pop the current state because it cannot handle the error token.  */
730
      /* Pop the current state because it cannot handle the error token.  */
1887
      if (yyssp == yyss)
731
	if (yystate_stack_.height () == 1)
1888
	YYABORT;
732
	YYABORT;
1889
733
734
	yyerror_range[0] = yylocation_stack_[0];
735
	yydestruct_ ("Error: popping",
736
		     yystos_[yystate],
737
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
738
	yypop_ ();
739
	yystate = yystate_stack_[0];
740
	YY_STACK_PRINT ();
741
      }
1890
742
1891
      yydestruct ("Error: popping",
743
    if (yyn == yyfinal_)
1892
		  yystos[yystate], yyvsp);
744
      goto yyacceptlab;
1893
      YYPOPSTACK (1);
1894
      yystate = *yyssp;
1895
      YY_STACK_PRINT (yyss, yyssp);
1896
    }
1897
1898
  if (yyn == YYFINAL)
1899
    YYACCEPT;
1900
1901
  *++yyvsp = yylval;
1902
745
746
    yyerror_range[1] = yylloc;
747
    // Using YYLLOC is tempting, but would change the location of
748
    // the look-ahead.  YYLOC is available though.
749
    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
750
    yysemantic_stack_.push (yylval);
751
    yylocation_stack_.push (yyloc);
1903
752
1904
  /* Shift the error token.  */
753
  /* Shift the error token.  */
1905
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
754
    YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
755
		   &yysemantic_stack_[0], &yylocation_stack_[0]);
1906
756
1907
  yystate = yyn;
757
  yystate = yyn;
1908
  goto yynewstate;
758
  goto yynewstate;
1909
759
1910
760
    /* Accept.  */
1911
/*-------------------------------------.
761
  yyacceptlab:
1912
| yyacceptlab -- YYACCEPT comes here.  |
1913
`-------------------------------------*/
1914
yyacceptlab:
1915
  yyresult = 0;
762
  yyresult = 0;
1916
  goto yyreturn;
763
  goto yyreturn;
1917
764
1918
/*-----------------------------------.
765
    /* Abort.  */
1919
| yyabortlab -- YYABORT comes here.  |
766
  yyabortlab:
1920
`-----------------------------------*/
1921
yyabortlab:
1922
  yyresult = 1;
767
  yyresult = 1;
1923
  goto yyreturn;
768
  goto yyreturn;
1924
769
1925
#ifndef yyoverflow
770
  yyreturn:
1926
/*-------------------------------------------------.
771
    if (yychar != yyeof_ && yychar != yyempty_)
1927
| yyexhaustedlab -- memory exhaustion comes here.  |
772
      yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
1928
`-------------------------------------------------*/
1929
yyexhaustedlab:
1930
  yyerror (YY_("memory exhausted"));
1931
  yyresult = 2;
1932
  /* Fall through.  */
1933
#endif
1934
773
1935
yyreturn:
1936
  if (yychar != YYEOF && yychar != YYEMPTY)
1937
     yydestruct ("Cleanup: discarding lookahead",
1938
		 yytoken, &yylval);
1939
  /* Do not reclaim the symbols of the rule which action triggered
774
  /* Do not reclaim the symbols of the rule which action triggered
1940
     this YYABORT or YYACCEPT.  */
775
     this YYABORT or YYACCEPT.  */
1941
  YYPOPSTACK (yylen);
776
    yypop_ (yylen);
1942
  YY_STACK_PRINT (yyss, yyssp);
777
    while (yystate_stack_.height () != 1)
1943
  while (yyssp != yyss)
778
      {
1944
    {
779
	yydestruct_ ("Cleanup: popping",
1945
      yydestruct ("Cleanup: popping",
780
		   yystos_[yystate_stack_[0]],
1946
		  yystos[*yyssp], yyvsp);
781
		   &yysemantic_stack_[0],
1947
      YYPOPSTACK (1);
782
		   &yylocation_stack_[0]);
1948
    }
783
	yypop_ ();
1949
#ifndef yyoverflow
784
      }
1950
  if (yyss != yyssa)
785
1951
    YYSTACK_FREE (yyss);
786
    return yyresult;
1952
#endif
787
  }
788
789
  // Generate an error message.
790
  std::string
791
  Parser::yysyntax_error_ (int yystate)
792
  {
793
    std::string res;
794
    YYUSE (yystate);
1953
#if YYERROR_VERBOSE
795
#if YYERROR_VERBOSE
1954
  if (yymsg != yymsgbuf)
796
    int yyn = yypact_[yystate];
1955
    YYSTACK_FREE (yymsg);
797
    if (yypact_ninf_ < yyn && yyn <= yylast_)
798
      {
799
	/* Start YYX at -YYN if negative to avoid negative indexes in
800
	   YYCHECK.  */
801
	int yyxbegin = yyn < 0 ? -yyn : 0;
802
803
	/* Stay within bounds of both yycheck and yytname.  */
804
	int yychecklim = yylast_ - yyn + 1;
805
	int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
806
	int count = 0;
807
	for (int x = yyxbegin; x < yyxend; ++x)
808
	  if (yycheck_[x + yyn] == x && x != yyterror_)
809
	    ++count;
810
811
	// FIXME: This method of building the message is not compatible
812
	// with internationalization.  It should work like yacc.c does it.
813
	// That is, first build a string that looks like this:
814
	// "syntax error, unexpected %s or %s or %s"
815
	// Then, invoke YY_ on this string.
816
	// Finally, use the string as a format to output
817
	// yytname_[tok], etc.
818
	// Until this gets fixed, this message appears in English only.
819
	res = "syntax error, unexpected ";
820
	res += yytnamerr_ (yytname_[tok]);
821
	if (count < 5)
822
	  {
823
	    count = 0;
824
	    for (int x = yyxbegin; x < yyxend; ++x)
825
	      if (yycheck_[x + yyn] == x && x != yyterror_)
826
		{
827
		  res += (!count++) ? ", expecting " : " or ";
828
		  res += yytnamerr_ (yytname_[x]);
829
		}
830
	  }
831
      }
832
    else
1956
#endif
833
#endif
1957
  /* Make sure YYID is used.  */
834
      res = YY_("syntax error");
1958
  return YYID (yyresult);
835
    return res;
1959
}
836
  }
1960
837
1961
838
1962
#line 316 "qmake.yy"
839
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
840
     STATE-NUM.  */
841
  const signed char Parser::yypact_ninf_ = -41;
842
  const signed char
843
  Parser::yypact_[] =
844
  {
845
       -41,     1,   -41,   -41,     5,    18,   -41,    -9,   -41,   -41,
846
     -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,   -14,
847
     -41,    -2,   -41,   -41,    21,   -10,     5,   -41,   -41,   -41,
848
     -41,   -41,   -41,   -41,   -41,   -41,   -41,   -41,     7,   -41,
849
     -41,     4,    -2,   -41,   -41,   -41,   -41,     6,    15,   -41,
850
     -41,    -2,    17,   -41
851
  };
852
853
  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
854
     doesn't specify something else to do.  Zero means the default is an
855
     error.  */
856
  const unsigned char
857
  Parser::yydefact_[] =
858
  {
859
         2,     0,     5,     1,     3,    31,    44,     0,     4,     6,
860
       7,     8,     9,    10,    26,    27,    28,    29,    30,    36,
861
      13,    39,    43,    35,     0,    11,     0,     5,    32,    33,
862
      21,    17,    16,    20,    25,    24,    19,    18,    23,    15,
863
      38,     0,    39,    22,    12,    14,    37,    42,     0,    34,
864
      40,    39,     0,    41
865
  };
866
867
  /* YYPGOTO[NTERM-NUM].  */
868
  const signed char
869
  Parser::yypgoto_[] =
870
  {
871
       -41,   -41,   -41,     8,    10,   -41,   -41,   -41,   -41,    -1,
872
     -41,   -41,   -41,   -41,   -41,   -41,   -40,   -41,   -41,   -41,
873
     -41
874
  };
875
876
  /* YYDEFGOTO[NTERM-NUM].  */
877
  const signed char
878
  Parser::yydefgoto_[] =
879
  {
880
        -1,     1,     2,     4,     8,     9,    25,    38,    44,    39,
881
      20,    10,    21,    11,    42,    24,    28,    49,    51,    12,
882
      13
883
  };
884
885
  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
886
     positive, shift that token.  If negative, reduce the rule which
887
     number is the opposite.  If zero, do what YYDEFACT says.  */
888
  const signed char Parser::yytable_ninf_ = -1;
889
  const unsigned char
890
  Parser::yytable_[] =
891
  {
892
        30,     3,    47,    31,    22,    23,    32,     5,     5,    26,
893
      33,    52,    34,    35,    36,    37,    27,     6,     6,     7,
894
       7,    46,    14,    15,    16,    17,    18,    19,    43,    34,
895
      35,    29,    48,    50,    53,    41,    40,    45
896
  };
897
898
  /* YYCHECK.  */
899
  const unsigned char
900
  Parser::yycheck_[] =
901
  {
902
        10,     0,    42,    13,    13,    19,    16,     3,     3,    11,
903
      20,    51,    22,    23,    24,    25,    18,    13,    13,    15,
904
      15,    17,     4,     5,     6,     7,     8,     9,    21,    22,
905
      23,    10,    26,    18,    17,    27,    26,    38
906
  };
907
908
  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
909
     symbol of state STATE-NUM.  */
910
  const unsigned char
911
  Parser::yystos_[] =
912
  {
913
         0,    28,    29,     0,    30,     3,    13,    15,    31,    32,
914
      38,    40,    46,    47,     4,     5,     6,     7,     8,     9,
915
      37,    39,    13,    19,    42,    33,    11,    18,    43,    10,
916
      10,    13,    16,    20,    22,    23,    24,    25,    34,    36,
917
      31,    30,    41,    21,    35,    36,    17,    43,    26,    44,
918
      18,    45,    43,    17
919
  };
920
921
#if YYDEBUG
922
  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
923
     to YYLEX-NUM.  */
924
  const unsigned short int
925
  Parser::yytoken_number_[] =
926
  {
927
         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
928
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
929
     275,   276,   277,   278,   279,   280,   281
930
  };
931
#endif
932
933
  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
934
  const unsigned char
935
  Parser::yyr1_[] =
936
  {
937
         0,    27,    29,    28,    30,    30,    31,    31,    31,    31,
938
      31,    32,    33,    33,    34,    34,    34,    34,    34,    34,
939
      34,    34,    35,    35,    36,    36,    37,    37,    37,    37,
940
      37,    39,    38,    41,    40,    42,    42,    43,    43,    43,
941
      45,    44,    44,    46,    47
942
  };
943
944
  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
945
  const unsigned char
946
  Parser::yyr2_[] =
947
  {
948
         0,     2,     0,     2,     2,     0,     1,     1,     1,     1,
949
       1,     3,     3,     0,     2,     1,     1,     1,     1,     1,
950
       1,     1,     1,     0,     1,     1,     1,     1,     1,     1,
951
       1,     0,     3,     0,     7,     1,     0,     3,     2,     0,
952
       0,     5,     0,     2,     1
953
  };
954
955
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
956
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
957
     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
958
  const char*
959
  const Parser::yytname_[] =
960
  {
961
    "$end", "error", "$undefined", "ID_SIMPLE", "EQ", "PLUSEQ", "MINUSEQ",
962
  "STAREQ", "TILDEEQ", "LBRACE", "RBRACE", "COLON", "NUMSIGN", "NEWLINE",
963
  "NUMBER", "COMMENT", "CONT", "RCURLY", "LCURLY", "ID_ARGS",
964
  "LIST_COMMENT", "LIST_COMMENT_WITHOUT_NEWLINE", "QUOTED_VARIABLE_VALUE",
965
  "VARIABLE_VALUE", "INDENT", "LIST_WS", "\"else\"", "$accept", "project",
966
  "@1", "statements", "statement", "variable_assignment",
967
  "multiline_values", "line_body", "opt_comment", "variable_value",
968
  "operator", "scope", "@2", "function_call", "@3", "function_args",
969
  "scope_body", "else_statement", "@4", "comment", "emptyline", 0
970
  };
971
#endif
972
973
#if YYDEBUG
974
  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
975
  const Parser::rhs_number_type
976
  Parser::yyrhs_[] =
977
  {
978
        28,     0,    -1,    -1,    29,    30,    -1,    30,    31,    -1,
979
      -1,    32,    -1,    38,    -1,    40,    -1,    46,    -1,    47,
980
      -1,     3,    37,    33,    -1,    33,    34,    35,    -1,    -1,
981
      34,    36,    -1,    36,    -1,    16,    -1,    13,    -1,    25,
982
      -1,    24,    -1,    20,    -1,    10,    -1,    21,    -1,    -1,
983
      23,    -1,    22,    -1,     4,    -1,     5,    -1,     6,    -1,
984
       7,    -1,     8,    -1,    -1,     3,    39,    43,    -1,    -1,
985
       3,     9,    42,    10,    41,    43,    44,    -1,    19,    -1,
986
      -1,    18,    30,    17,    -1,    11,    31,    -1,    -1,    -1,
987
      26,    18,    45,    43,    17,    -1,    -1,    15,    13,    -1,
988
      13,    -1
989
  };
990
991
  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
992
     YYRHS.  */
993
  const unsigned char
994
  Parser::yyprhs_[] =
995
  {
996
         0,     0,     3,     4,     7,    10,    11,    13,    15,    17,
997
      19,    21,    25,    29,    30,    33,    35,    37,    39,    41,
998
      43,    45,    47,    49,    50,    52,    54,    56,    58,    60,
999
      62,    64,    65,    69,    70,    78,    80,    81,    85,    88,
1000
      89,    90,    96,    97,   100
1001
  };
1002
1003
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
1004
  const unsigned short int
1005
  Parser::yyrline_[] =
1006
  {
1007
         0,   147,   147,   147,   154,   159,   162,   166,   170,   174,
1008
     178,   184,   196,   204,   211,   212,   213,   214,   215,   216,
1009
     222,   223,   226,   233,   238,   239,   242,   242,   242,   242,
1010
     242,   246,   245,   260,   259,   284,   285,   288,   289,   294,
1011
     298,   297,   311,   316,   324
1012
  };
1013
1014
  // Print the state stack on the debug stream.
1015
  void
1016
  Parser::yystack_print_ ()
1017
  {
1018
    *yycdebug_ << "Stack now";
1019
    for (state_stack_type::const_iterator i = yystate_stack_.begin ();
1020
	 i != yystate_stack_.end (); ++i)
1021
      *yycdebug_ << ' ' << *i;
1022
    *yycdebug_ << std::endl;
1023
  }
1024
1025
  // Report on the debug stream that the rule \a yyrule is going to be reduced.
1026
  void
1027
  Parser::yy_reduce_print_ (int yyrule)
1028
  {
1029
    unsigned int yylno = yyrline_[yyrule];
1030
    int yynrhs = yyr2_[yyrule];
1031
    /* Print the symbols being reduced, and their result.  */
1032
    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1033
	       << " (line " << yylno << "), ";
1034
    /* The symbols being reduced.  */
1035
    for (int yyi = 0; yyi < yynrhs; yyi++)
1036
      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
1037
		       yyrhs_[yyprhs_[yyrule] + yyi],
1038
		       &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
1039
		       &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
1040
  }
1041
#endif // YYDEBUG
1042
1043
  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
1044
  Parser::token_number_type
1045
  Parser::yytranslate_ (int t)
1046
  {
1047
    static
1048
    const token_number_type
1049
    translate_table[] =
1050
    {
1051
           0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1052
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1053
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1054
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1055
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1056
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1057
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1058
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1059
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1060
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1061
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1062
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1063
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1064
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1065
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1066
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1067
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1068
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1069
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1070
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1071
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1072
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1073
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1074
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1075
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1076
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1077
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1078
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1079
      25,    26
1080
    };
1081
    if ((unsigned int) t <= yyuser_token_number_max_)
1082
      return translate_table[t];
1083
    else
1084
      return yyundef_token_;
1085
  }
1086
1087
  const int Parser::yyeof_ = 0;
1088
  const int Parser::yylast_ = 37;
1089
  const int Parser::yynnts_ = 21;
1090
  const int Parser::yyempty_ = -2;
1091
  const int Parser::yyfinal_ = 3;
1092
  const int Parser::yyterror_ = 1;
1093
  const int Parser::yyerrcode_ = 256;
1094
  const int Parser::yyntokens_ = 27;
1963
1095
1096
  const unsigned int Parser::yyuser_token_number_max_ = 281;
1097
  const Parser::token_number_type Parser::yyundef_token_ = 2;
1964
1098
1965
#include "qmake_lex.cpp"
1099
} // namespace QMake
1100
1101
#line 327 "qmake.yy"
1102
1103
1104
1105
namespace QMake
1106
{
1107
    void Parser::error(const location_type& /*l*/, const std::string& m)
1108
    {
1109
        std::cerr << m << std::endl;
1110
    }
1111
}
1966
1112
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake_yacc.h (-103 lines)
Lines 1-103 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
3
/* Skeleton interface for Bison's Yacc-like parsers in C
4
5
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
   Free Software Foundation, Inc.
7
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2, or (at your option)
11
   any later version.
12
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
   Boston, MA 02110-1301, USA.  */
22
23
/* As a special exception, you may create a larger work that contains
24
   part or all of the Bison parser skeleton and distribute that work
25
   under terms of your choice, so long as that work isn't itself a
26
   parser generator using the skeleton or a modified version thereof
27
   as a parser skeleton.  Alternatively, if you modify or redistribute
28
   the parser skeleton itself, you may (at your option) remove this
29
   special exception, which will cause the skeleton and the resulting
30
   Bison output files to be licensed under the GNU General Public
31
   License without this special exception.
32
33
   This special exception was added by the Free Software Foundation in
34
   version 2.2 of Bison.  */
35
36
/* Tokens.  */
37
#ifndef YYTOKENTYPE
38
# define YYTOKENTYPE
39
   /* Put the tokens into the symbol table, so that GDB and other debuggers
40
      know about them.  */
41
   enum yytokentype {
42
     ID_SIMPLE = 258,
43
     EQ = 259,
44
     PLUSEQ = 260,
45
     MINUSQE = 261,
46
     STAREQ = 262,
47
     TILDEEQ = 263,
48
     LBRACE = 264,
49
     RBRACE = 265,
50
     COLON = 266,
51
     NUMSIGN = 267,
52
     NEWLINE = 268,
53
     NUMBER = 269,
54
     COMMENT = 270,
55
     CONT = 271,
56
     RCURLY = 272,
57
     LCURLY = 273,
58
     ID_ARGS = 274,
59
     LIST_COMMENT = 275,
60
     LIST_COMMENT_WITHOUT_NEWLINE = 276,
61
     QUOTED_VARIABLE_VALUE = 277,
62
     VARIABLE_VALUE = 278,
63
     INDENT = 279,
64
     LIST_WS = 280
65
   };
66
#endif
67
/* Tokens.  */
68
#define ID_SIMPLE 258
69
#define EQ 259
70
#define PLUSEQ 260
71
#define MINUSQE 261
72
#define STAREQ 262
73
#define TILDEEQ 263
74
#define LBRACE 264
75
#define RBRACE 265
76
#define COLON 266
77
#define NUMSIGN 267
78
#define NEWLINE 268
79
#define NUMBER 269
80
#define COMMENT 270
81
#define CONT 271
82
#define RCURLY 272
83
#define LCURLY 273
84
#define ID_ARGS 274
85
#define LIST_COMMENT 275
86
#define LIST_COMMENT_WITHOUT_NEWLINE 276
87
#define QUOTED_VARIABLE_VALUE 277
88
#define VARIABLE_VALUE 278
89
#define INDENT 279
90
#define LIST_WS 280
91
92
93
94
95
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
96
typedef int YYSTYPE;
97
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
98
# define YYSTYPE_IS_DECLARED 1
99
# define YYSTYPE_IS_TRIVIAL 1
100
#endif
101
102
extern YYSTYPE yylval;
103
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake_yacc.hpp (+421 lines)
Line 0 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
3
/* Skeleton interface for Bison LALR(1) parsers in C++
4
5
   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 2, or (at your option)
10
   any later version.
11
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
22
/* As a special exception, you may create a larger work that contains
23
   part or all of the Bison parser skeleton and distribute that work
24
   under terms of your choice, so long as that work isn't itself a
25
   parser generator using the skeleton or a modified version thereof
26
   as a parser skeleton.  Alternatively, if you modify or redistribute
27
   the parser skeleton itself, you may (at your option) remove this
28
   special exception, which will cause the skeleton and the resulting
29
   Bison output files to be licensed under the GNU General Public
30
   License without this special exception.
31
32
   This special exception was added by the Free Software Foundation in
33
   version 2.2 of Bison.  */
34
35
/* C++ LALR(1) parser skeleton written by Akim Demaille.  */
36
37
#ifndef PARSER_HEADER_H
38
# define PARSER_HEADER_H
39
40
#include <string>
41
#include <iostream>
42
#include "stack.hh"
43
44
namespace QMake
45
{
46
  class position;
47
  class location;
48
}
49
50
/* First part of user declarations.  */
51
#line 1 "qmake.yy"
52
53
/***************************************************************************
54
 *   Copyright (C) 2005 by Alexander Dymo                                  *
55
 *   adymo@kdevelop.org                                                    *
56
 *   Copyright (C) 2006 by Andreas Pakulat                                 *
57
 *   apaku@gmx.de                                                          *
58
 *                                                                         *
59
 *   This program is free software; you can redistribute it and/or modify  *
60
 *   it under the terms of the GNU Library General Public License as       *
61
 *   published by the Free Software Foundation; either version 2 of the    *
62
 *   License, or (at your option) any later version.                       *
63
 *                                                                         *
64
 *   This program is distributed in the hope that it will be useful,       *
65
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
66
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
67
 *   GNU General Public License for more details.                          *
68
 *                                                                         *
69
 *   You should have received a copy of the GNU Library General Public     *
70
 *   License along with this program; if not, write to the                 *
71
 *   Free Software Foundation, Inc.,                                       *
72
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
73
 ***************************************************************************/
74
75
/**
76
@file qmake.yy
77
QMake Parser
78
79
Simple LALR parser which builds the syntax tree (see @ref QMake::AST).
80
81
@todo Recognize comments after statements like:
82
SOURCES = foo #regognize me
83
84
@fixme Parser fails on files that do not end with a newline
85
@fixme 1 shift/reduce conflict in "line_body" rule
86
*/
87
88
#include <qvaluestack.h>
89
#include "qmakeast.h"
90
#include <qregexp.h>
91
92
#define YYSTYPE_IS_DECLARED
93
94
namespace QMake
95
{
96
    class Lexer;
97
98
/**
99
The yylval type.
100
*/
101
struct Result {
102
    Result(): node(0) {}
103
104
    /**Type of semantic value for simple grammar rules.*/
105
    QString value;
106
    /**Type of semantic value for grammar rules which are parts of AST.*/
107
    AST *node;
108
    /**Type of semantic value for "multiline_values" grammar rule.
109
    Each line of multiline value is stored as a string in the list.
110
111
    For example we have in .pro file:
112
    @code
113
    SOURCE = foo1.cpp \
114
        foo2.cpp \
115
        foo3.cpp foo4.cpp
116
    @endcode
117
    The string list will be populated with three strings:
118
    <pre>
119
    foo1.cpp
120
    foo2.cpp
121
    foo3.cpp foo4.cpp
122
    </pre>
123
    */
124
    QStringList values;
125
    QString indent;
126
};
127
128
#define YYSTYPE Result
129
typedef Result YYSTYPE;
130
}
131
132
extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer );
133
134
/**
135
The stack to store ProjectAST pointers when a new child
136
ProjectAST is created and filled with statements.
137
138
Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts
139
adding statements. Each statement is added as a child StatementAST to the ProjectAST
140
currently on the top in the stack.
141
142
When a scope or function scope statement is parsed, the child ProjectAST is created
143
and pushed onto the stack. Therefore all statements which belong to the scope
144
or function scope are added as childs to their direct parent (scope or function scope).
145
*/
146
//QValueStack<ProjectAST*> projects;
147
148
/**
149
The current depth of AST node is stored here.
150
AST depth is important to know because automatic indentation can
151
be easily implemented (the parser itself looses all information
152
about indentation).
153
*/
154
// int depth = 0;
155
156
/*
157
To debug this parser, put the line below into the next bison file section.
158
Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp.
159
%debug
160
*/
161
162
163
/* Line 35 of lalr1.cc.  */
164
#line 165 "qmake_yacc.hpp"
165
166
#include "location.hh"
167
168
/* Enabling traces.  */
169
#ifndef YYDEBUG
170
# define YYDEBUG 0
171
#endif
172
173
/* Enabling verbose error messages.  */
174
#ifdef YYERROR_VERBOSE
175
# undef YYERROR_VERBOSE
176
# define YYERROR_VERBOSE 1
177
#else
178
# define YYERROR_VERBOSE 0
179
#endif
180
181
/* Enabling the token table.  */
182
#ifndef YYTOKEN_TABLE
183
# define YYTOKEN_TABLE 0
184
#endif
185
186
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
187
   If N is 0, then set CURRENT to the empty location which ends
188
   the previous symbol: RHS[0] (always defined).  */
189
190
#ifndef YYLLOC_DEFAULT
191
# define YYLLOC_DEFAULT(Current, Rhs, N)		\
192
do {							\
193
  if (N)						\
194
    {							\
195
      (Current).begin = (Rhs)[1].begin;			\
196
      (Current).end   = (Rhs)[N].end;			\
197
    }							\
198
  else							\
199
    {							\
200
      (Current).begin = (Current).end = (Rhs)[0].end;	\
201
    }							\
202
} while (false)
203
#endif
204
205
namespace QMake
206
{
207
208
  /// A Bison parser.
209
  class Parser
210
  {
211
  public:
212
    /// Symbol semantic values.
213
#ifndef YYSTYPE
214
    typedef int semantic_type;
215
#else
216
    typedef YYSTYPE semantic_type;
217
#endif
218
    /// Symbol locations.
219
    typedef location location_type;
220
    /// Tokens.
221
    struct token
222
    {
223
      /* Tokens.  */
224
   enum yytokentype {
225
     ID_SIMPLE = 258,
226
     EQ = 259,
227
     PLUSEQ = 260,
228
     MINUSEQ = 261,
229
     STAREQ = 262,
230
     TILDEEQ = 263,
231
     LBRACE = 264,
232
     RBRACE = 265,
233
     COLON = 266,
234
     NUMSIGN = 267,
235
     NEWLINE = 268,
236
     NUMBER = 269,
237
     COMMENT = 270,
238
     CONT = 271,
239
     RCURLY = 272,
240
     LCURLY = 273,
241
     ID_ARGS = 274,
242
     LIST_COMMENT = 275,
243
     LIST_COMMENT_WITHOUT_NEWLINE = 276,
244
     QUOTED_VARIABLE_VALUE = 277,
245
     VARIABLE_VALUE = 278,
246
     INDENT = 279,
247
     LIST_WS = 280
248
   };
249
250
    };
251
    /// Token type.
252
    typedef token::yytokentype token_type;
253
254
    /// Build a parser object.
255
    Parser (QMake::Lexer* lexer_yyarg, QValueStack<ProjectAST*>& projects_yyarg, int depth_yyarg);
256
    virtual ~Parser ();
257
258
    /// Parse.
259
    /// \returns  0 iff parsing succeeded.
260
    virtual int parse ();
261
262
    /// The current debugging stream.
263
    std::ostream& debug_stream () const;
264
    /// Set the current debugging stream.
265
    void set_debug_stream (std::ostream &);
266
267
    /// Type for debugging levels.
268
    typedef int debug_level_type;
269
    /// The current debugging level.
270
    debug_level_type debug_level () const;
271
    /// Set the current debugging level.
272
    void set_debug_level (debug_level_type l);
273
274
  private:
275
    /// Report a syntax error.
276
    /// \param loc    where the syntax error is found.
277
    /// \param msg    a description of the syntax error.
278
    virtual void error (const location_type& loc, const std::string& msg);
279
280
    /// Generate an error message.
281
    /// \param state   the state where the error occurred.
282
    /// \param tok     the look-ahead token.
283
    virtual std::string yysyntax_error_ (int yystate);
284
285
#if YYDEBUG
286
    /// \brief Report a symbol value on the debug stream.
287
    /// \param yytype       The token type.
288
    /// \param yyvaluep     Its semantic value.
289
    /// \param yylocationp  Its location.
290
    virtual void yy_symbol_value_print_ (int yytype,
291
					 const semantic_type* yyvaluep,
292
					 const location_type* yylocationp);
293
    /// \brief Report a symbol on the debug stream.
294
    /// \param yytype       The token type.
295
    /// \param yyvaluep     Its semantic value.
296
    /// \param yylocationp  Its location.
297
    virtual void yy_symbol_print_ (int yytype,
298
				   const semantic_type* yyvaluep,
299
				   const location_type* yylocationp);
300
#endif /* ! YYDEBUG */
301
302
303
    /// State numbers.
304
    typedef int state_type;
305
    /// State stack type.
306
    typedef stack<state_type>    state_stack_type;
307
    /// Semantic value stack type.
308
    typedef stack<semantic_type> semantic_stack_type;
309
    /// location stack type.
310
    typedef stack<location_type> location_stack_type;
311
312
    /// The state stack.
313
    state_stack_type yystate_stack_;
314
    /// The semantic value stack.
315
    semantic_stack_type yysemantic_stack_;
316
    /// The location stack.
317
    location_stack_type yylocation_stack_;
318
319
    /// Internal symbol numbers.
320
    typedef unsigned char token_number_type;
321
    /* Tables.  */
322
    /// For a state, the index in \a yytable_ of its portion.
323
    static const signed char yypact_[];
324
    static const signed char yypact_ninf_;
325
326
    /// For a state, default rule to reduce.
327
    /// Unless\a  yytable_ specifies something else to do.
328
    /// Zero means the default is an error.
329
    static const unsigned char yydefact_[];
330
331
    static const signed char yypgoto_[];
332
    static const signed char yydefgoto_[];
333
334
    /// What to do in a state.
335
    /// \a yytable_[yypact_[s]]: what to do in state \a s.
336
    /// - if positive, shift that token.
337
    /// - if negative, reduce the rule which number is the opposite.
338
    /// - if zero, do what YYDEFACT says.
339
    static const unsigned char yytable_[];
340
    static const signed char yytable_ninf_;
341
342
    static const unsigned char yycheck_[];
343
344
    /// For a state, its accessing symbol.
345
    static const unsigned char yystos_[];
346
347
    /// For a rule, its LHS.
348
    static const unsigned char yyr1_[];
349
    /// For a rule, its RHS length.
350
    static const unsigned char yyr2_[];
351
352
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
353
    /// For a symbol, its name in clear.
354
    static const char* const yytname_[];
355
#endif
356
357
#if YYERROR_VERBOSE
358
    /// Convert the symbol name \a n to a form suitable for a diagnostic.
359
    virtual std::string yytnamerr_ (const char *n);
360
#endif
361
362
#if YYDEBUG
363
    /// A type to store symbol numbers and -1.
364
    typedef signed char rhs_number_type;
365
    /// A `-1'-separated list of the rules' RHS.
366
    static const rhs_number_type yyrhs_[];
367
    /// For each rule, the index of the first RHS symbol in \a yyrhs_.
368
    static const unsigned char yyprhs_[];
369
    /// For each rule, its source line number.
370
    static const unsigned short int yyrline_[];
371
    /// For each scanner token number, its symbol number.
372
    static const unsigned short int yytoken_number_[];
373
    /// Report on the debug stream that the rule \a r is going to be reduced.
374
    virtual void yy_reduce_print_ (int r);
375
    /// Print the state stack on the debug stream.
376
    virtual void yystack_print_ ();
377
#endif
378
379
    /// Convert a scanner token number \a t to a symbol number.
380
    token_number_type yytranslate_ (int t);
381
382
    /// \brief Reclaim the memory associated to a symbol.
383
    /// \param yymsg        Why this token is reclaimed.
384
    /// \param yytype       The symbol type.
385
    /// \param yyvaluep     Its semantic value.
386
    /// \param yylocationp  Its location.
387
    inline void yydestruct_ (const char* yymsg,
388
			     int yytype,
389
			     semantic_type* yyvaluep,
390
			     location_type* yylocationp);
391
392
    /// Pop \a n symbols the three stacks.
393
    inline void yypop_ (unsigned int n = 1);
394
395
    /* Constants.  */
396
    static const int yyeof_;
397
    /* LAST_ -- Last index in TABLE_.  */
398
    static const int yylast_;
399
    static const int yynnts_;
400
    static const int yyempty_;
401
    static const int yyfinal_;
402
    static const int yyterror_;
403
    static const int yyerrcode_;
404
    static const int yyntokens_;
405
    static const unsigned int yyuser_token_number_max_;
406
    static const token_number_type yyundef_token_;
407
408
    /* Debugging.  */
409
    int yydebug_;
410
    std::ostream* yycdebug_;
411
412
413
    /* User arguments.  */
414
    QMake::Lexer* lexer;
415
    QValueStack<ProjectAST*>& projects;
416
    int depth;
417
  };
418
}
419
420
421
#endif /* ! defined PARSER_HEADER_H */
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/qmake.yy (-10 / +28 lines)
Lines 2-7 Link Here
2
/***************************************************************************
2
/***************************************************************************
3
 *   Copyright (C) 2005 by Alexander Dymo                                  *
3
 *   Copyright (C) 2005 by Alexander Dymo                                  *
4
 *   adymo@kdevelop.org                                                    *
4
 *   adymo@kdevelop.org                                                    *
5
 *   Copyright (C) 2006 by Andreas Pakulat                                 *
6
 *   apaku@gmx.de                                                          *
5
 *                                                                         *
7
 *                                                                         *
6
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   This program is free software; you can redistribute it and/or modify  *
7
 *   it under the terms of the GNU Library General Public License as       *
9
 *   it under the terms of the GNU Library General Public License as       *
Lines 38-44 Link Here
38
40
39
#define YYSTYPE_IS_DECLARED
41
#define YYSTYPE_IS_DECLARED
40
42
41
using namespace QMake;
43
namespace QMake
44
{
45
    class Lexer;
42
46
43
/**
47
/**
44
The yylval type.
48
The yylval type.
Lines 70-82 Link Here
70
    QString indent;
74
    QString indent;
71
};
75
};
72
76
77
#define YYSTYPE Result
73
typedef Result YYSTYPE;
78
typedef Result YYSTYPE;
74
75
void yyerror(const char *str) {
76
    printf("%s\n", str);
77
}
79
}
78
80
79
int yylex();
81
extern int QMakelex( QMake::Result* yylval, QMake::Lexer* lexer );
80
82
81
/**
83
/**
82
The stack to store ProjectAST pointers when a new child
84
The stack to store ProjectAST pointers when a new child
Lines 90-96 Link Here
90
and pushed onto the stack. Therefore all statements which belong to the scope
92
and pushed onto the stack. Therefore all statements which belong to the scope
91
or function scope are added as childs to their direct parent (scope or function scope).
93
or function scope are added as childs to their direct parent (scope or function scope).
92
*/
94
*/
93
QValueStack<ProjectAST*> projects;
95
//QValueStack<ProjectAST*> projects;
94
96
95
/**
97
/**
96
The current depth of AST node is stored here.
98
The current depth of AST node is stored here.
Lines 98-104 Link Here
98
be easily implemented (the parser itself looses all information
100
be easily implemented (the parser itself looses all information
99
about indentation).
101
about indentation).
100
*/
102
*/
101
int depth = 0;
103
// int depth = 0;
102
104
103
/*
105
/*
104
To debug this parser, put the line below into the next bison file section.
106
To debug this parser, put the line below into the next bison file section.
Lines 107-116 Link Here
107
*/
109
*/
108
%}
110
%}
109
111
112
%skeleton "lalr1.cc"
113
%define "parser_class_name" "Parser"
114
%name-prefix="QMake"
115
%parse-param { QMake::Lexer* lexer }
116
%parse-param { QValueStack<ProjectAST*>& projects }
117
%parse-param { int depth }
118
%lex-param   { QMake::Lexer* lexer }
119
%start project
120
110
%token ID_SIMPLE
121
%token ID_SIMPLE
111
%token EQ
122
%token EQ
112
%token PLUSEQ
123
%token PLUSEQ
113
%token MINUSQE
124
%token MINUSEQ
114
%token STAREQ
125
%token STAREQ
115
%token TILDEEQ
126
%token TILDEEQ
116
%token LBRACE
127
%token LBRACE
Lines 228-234 Link Here
228
    | QUOTED_VARIABLE_VALUE  { $<value>$ = $<value>1; }
239
    | QUOTED_VARIABLE_VALUE  { $<value>$ = $<value>1; }
229
    ;
240
    ;
230
241
231
operator : EQ | PLUSEQ | MINUSQE | STAREQ | TILDEEQ
242
operator : EQ | PLUSEQ | MINUSEQ | STAREQ | TILDEEQ
232
    ;
243
    ;
233
244
234
scope : ID_SIMPLE
245
scope : ID_SIMPLE
Lines 315-318 Link Here
315
326
316
%%
327
%%
317
328
318
#include "qmake_lex.cpp"
329
330
namespace QMake
331
{
332
    void Parser::error(const location_type& /*l*/, const std::string& m)
333
    {
334
        std::cerr << m << std::endl;
335
    }
336
}
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/stack.hh (+129 lines)
Line 0 Link Here
1
/* A Bison parser, made by GNU Bison 2.3.  */
2
3
/* Stack handling for Bison parsers in C++
4
5
   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 2, or (at your option)
10
   any later version.
11
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
22
/* As a special exception, you may create a larger work that contains
23
   part or all of the Bison parser skeleton and distribute that work
24
   under terms of your choice, so long as that work isn't itself a
25
   parser generator using the skeleton or a modified version thereof
26
   as a parser skeleton.  Alternatively, if you modify or redistribute
27
   the parser skeleton itself, you may (at your option) remove this
28
   special exception, which will cause the skeleton and the resulting
29
   Bison output files to be licensed under the GNU General Public
30
   License without this special exception.
31
32
   This special exception was added by the Free Software Foundation in
33
   version 2.2 of Bison.  */
34
35
#ifndef BISON_STACK_HH
36
# define BISON_STACK_HH
37
38
#include <deque>
39
40
namespace QMake
41
{
42
  template <class T, class S = std::deque<T> >
43
  class stack
44
  {
45
  public:
46
47
    // Hide our reversed order.
48
    typedef typename S::reverse_iterator iterator;
49
    typedef typename S::const_reverse_iterator const_iterator;
50
51
    stack () : seq_ ()
52
    {
53
    }
54
55
    stack (unsigned int n) : seq_ (n)
56
    {
57
    }
58
59
    inline
60
    T&
61
    operator [] (unsigned int i)
62
    {
63
      return seq_[i];
64
    }
65
66
    inline
67
    const T&
68
    operator [] (unsigned int i) const
69
    {
70
      return seq_[i];
71
    }
72
73
    inline
74
    void
75
    push (const T& t)
76
    {
77
      seq_.push_front (t);
78
    }
79
80
    inline
81
    void
82
    pop (unsigned int n = 1)
83
    {
84
      for (; n; --n)
85
	seq_.pop_front ();
86
    }
87
88
    inline
89
    unsigned int
90
    height () const
91
    {
92
      return seq_.size ();
93
    }
94
95
    inline const_iterator begin () const { return seq_.rbegin (); }
96
    inline const_iterator end () const { return seq_.rend (); }
97
98
  private:
99
100
    S seq_;
101
  };
102
103
  /// Present a slice of the top of a stack.
104
  template <class T, class S = stack<T> >
105
  class slice
106
  {
107
  public:
108
109
    slice (const S& stack,
110
	   unsigned int range) : stack_ (stack),
111
				 range_ (range)
112
    {
113
    }
114
115
    inline
116
    const T&
117
    operator [] (unsigned int i) const
118
    {
119
      return stack_[range_ - i];
120
    }
121
122
  private:
123
124
    const S& stack_;
125
    unsigned int range_;
126
  };
127
}
128
129
#endif // not BISON_STACK_HH
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/tests/runner.cpp (-9 / +40 lines)
Lines 17-26 Link Here
17
 *   Free Software Foundation, Inc.,                                       *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
19
 ***************************************************************************/
20
#include <qmakeast.h>
20
21
#include <qmakeastvisitor.h>
21
#include <cstdlib>
22
#include <qmakedriver.h>
22
#include <iostream>
23
#include <stdio.h>
24
#include "qmakedriver.h"
25
#include "qmakeastvisitor.h"
26
27
#include <qstring.h>
28
23
#include <kdebug.h>
29
#include <kdebug.h>
30
#include <kcmdlineargs.h>
31
#include <kurl.h>
32
33
static const KCmdLineOptions options[] =
34
{
35
    {"silent", "Enable Parser debug output", 0},
36
    {"!debug", "Disable output of the generated AST", 0},
37
    {"!+files", "QMake project files", 0}
38
};
39
24
40
25
class PrintAST : QMake::ASTVisitor
41
class PrintAST : QMake::ASTVisitor
26
{
42
{
Lines 120-133 Link Here
120
};
136
};
121
int main(int argc, char *argv[])
137
int main(int argc, char *argv[])
122
{
138
{
123
    QMake::ProjectAST *projectAST;
139
  KCmdLineArgs::init( argc, argv, "QMake Parser", "qmake-parser", "Parse QMake project files", "1.0.0");
124
    int ret;
140
    KCmdLineArgs::addCmdLineOptions(options);
125
    if (argc > 1)
141
142
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
143
144
    if( args->count() < 1 )
145
    {
146
        KCmdLineArgs::usage(0);
147
    }
148
149
    int debug = 0;
150
    bool silent = false;
151
152
    if( args->isSet("silent") )
153
        silent = true;
154
    if( args->isSet("debug") )
155
        debug = 1;
156
    for( int i = 0 ; i < args->count() ; i++ )
126
    {
157
    {
127
        ret = QMake::Driver::parseFile(argv[1], &projectAST);
158
        QMake::ProjectAST *projectAST;
159
        int ret = QMake::Driver::parseFile(argv[1], &projectAST, debug);
128
        PrintAST pa;
160
        PrintAST pa;
129
        if ( ret == 0 )
161
        if ( ret == 0 )
130
            if ((argc < 3) || ((argc == 3) && (strcmp(argv[2], "--silent") != 0)))
162
            if ( !silent )
131
            {
163
            {
132
                pa.processProject(projectAST);
164
                pa.processProject(projectAST);
133
                QString profile;
165
                QString profile;
Lines 136-141 Link Here
136
            }
168
            }
137
        return ret;
169
        return ret;
138
    }
170
    }
139
    else
140
        return 0;
171
        return 0;
141
}
172
}
(-)kdevelop-3.4.0.orig/buildtools/lib/parsers/qmake/tests/viewer.cpp (-1 / +1 lines)
Lines 78-84 Link Here
78
    source->setText(str.read());
78
    source->setText(str.read());
79
    f.close();
79
    f.close();
80
80
81
    int result = QMake::Driver::parseFile(item->text().ascii(), &projectAST);
81
    int result = QMake::Driver::parseFile(item->text().ascii(), &projectAST, 0);
82
    if (projectAST && (result == 0))
82
    if (projectAST && (result == 0))
83
    {
83
    {
84
        processAST(projectAST);
84
        processAST(projectAST);
(-)kdevelop-3.4.0.orig/buildtools/qmake/scope.cpp (-1 / +1 lines)
Lines 147-153 Link Here
147
147
148
bool Scope::loadFromFile( const QString& filename )
148
bool Scope::loadFromFile( const QString& filename )
149
{
149
{
150
    if ( !QFileInfo(filename).exists() || QMake::Driver::parseFile( filename, &m_root ) != 0 )
150
    if ( !QFileInfo(filename).exists() || QMake::Driver::parseFile( filename, &m_root, 0 ) != 0 )
151
    {
151
    {
152
        kdDebug( 9024 ) << "Couldn't parse project: " << filename << endl;
152
        kdDebug( 9024 ) << "Couldn't parse project: " << filename << endl;
153
        m_root = 0;
153
        m_root = 0;

Return to bug 165526