summaryrefslogtreecommitdiffstats
path: root/buildtools/lib/parsers/qmake/qmake_yacc.cpp
blob: 9cd09ebef0fcf2f2ac11b4cb54b3d7226cb4262f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
/* A Bison parser, made by GNU Bison 2.3.  */

/* Skeleton implementation for Bison LALR(1) parsers in C++

   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

// Take the name prefix into account.
#define yylex   QMakelex

#include "qmake_yacc.hpp"

/* User implementation prologue.  */


/* Line 317 of lalr1.cc.  */
#line 45 "qmake_yacc.cpp"

#ifndef YY_
# if YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#define YYUSE(e) ((void) (e))

/* A pseudo ostream that takes yydebug_ into account.  */
# define YYCDEBUG							\
  for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false)	\
    (*yycdebug_)

/* Enable debugging if requested.  */
#if YYDEBUG

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)	\
do {							\
  if (yydebug_)						\
    {							\
      *yycdebug_ << Title << ' ';			\
      yy_symbol_print_ ((Type), (Value), (Location));	\
      *yycdebug_ << std::endl;				\
    }							\
} while (false)

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug_)				\
    yy_reduce_print_ (Rule);		\
} while (false)

# define YY_STACK_PRINT()		\
do {					\
  if (yydebug_)				\
    yystack_print_ ();			\
} while (false)

#else /* !YYDEBUG */

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_REDUCE_PRINT(Rule)
# define YY_STACK_PRINT()

#endif /* !YYDEBUG */

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab

namespace QMake
{
#if YYERROR_VERBOSE

  /* Return YYSTR after stripping away unnecessary quotes and
     backslashes, so that it's suitable for yyerror.  The heuristic is
     that double-quoting is unnecessary unless the string contains an
     apostrophe, a comma, or backslash (other than backslash-backslash).
     YYSTR is taken from yytname.  */
  std::string
  Parser::yytnamerr_ (const char *yystr)
  {
    if (*yystr == '"')
      {
        std::string yyr = "";
        char const *yyp = yystr;

        for (;;)
          switch (*++yyp)
            {
            case '\'':
            case ',':
              goto do_not_strip_quotes;

            case '\\':
              if (*++yyp != '\\')
                goto do_not_strip_quotes;
              /* Fall through.  */
            default:
              yyr += *yyp;
              break;

            case '"':
              return yyr;
            }
      do_not_strip_quotes: ;
      }

    return yystr;
  }

#endif

  /// Build a parser object.
  Parser::Parser (QMake::Lexer* lexer_yyarg, QValueStack<ProjectAST*>& projects_yyarg, int depth_yyarg)
    : yydebug_ (false),
      yycdebug_ (&std::cerr),
      lexer (lexer_yyarg),
      projects (projects_yyarg),
      depth (depth_yyarg)
  {
  }

  Parser::~Parser ()
  {
  }

#if YYDEBUG
  /*--------------------------------.
  | Print this symbol on YYOUTPUT.  |
  `--------------------------------*/

  inline void
  Parser::yy_symbol_value_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yyvaluep);
    switch (yytype)
      {
         default:
	  break;
      }
  }


  void
  Parser::yy_symbol_print_ (int yytype,
			   const semantic_type* yyvaluep, const location_type* yylocationp)
  {
    *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
	       << ' ' << yytname_[yytype] << " ("
	       << *yylocationp << ": ";
    yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
    *yycdebug_ << ')';
  }
#endif /* ! YYDEBUG */

  void
  Parser::yydestruct_ (const char* yymsg,
			   int yytype, semantic_type* yyvaluep, location_type* yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yymsg);
    YYUSE (yyvaluep);

    YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

    switch (yytype)
      {
  
	default:
	  break;
      }
  }

  void
  Parser::yypop_ (unsigned int n)
  {
    yystate_stack_.pop (n);
    yysemantic_stack_.pop (n);
    yylocation_stack_.pop (n);
  }

  std::ostream&
  Parser::debug_stream () const
  {
    return *yycdebug_;
  }

  void
  Parser::set_debug_stream (std::ostream& o)
  {
    yycdebug_ = &o;
  }


  Parser::debug_level_type
  Parser::debug_level () const
  {
    return yydebug_;
  }

  void
  Parser::set_debug_level (debug_level_type l)
  {
    yydebug_ = l;
  }


  int
  Parser::parse ()
  {
    /// Look-ahead and look-ahead in internal form.
    int yychar = yyempty_;
    int yytoken = 0;

    /* State.  */
    int yyn;
    int yylen = 0;
    int yystate = 0;

    /* Error handling.  */
    int yynerrs_ = 0;
    int yyerrstatus_ = 0;

    /// Semantic value of the look-ahead.
    semantic_type yylval;
    /// Location of the look-ahead.
    location_type yylloc;
    /// The locations where the error started and ended.
    location yyerror_range[2];

    /// $$.
    semantic_type yyval;
    /// @$.
    location_type yyloc;

    int yyresult;

    YYCDEBUG << "Starting parse" << std::endl;


    /* Initialize the stacks.  The initial state will be pushed in
       yynewstate, since the latter expects the semantical and the
       location values to have been already stored, initialize these
       stacks with a primary value.  */
    yystate_stack_ = state_stack_type (0);
    yysemantic_stack_ = semantic_stack_type (0);
    yylocation_stack_ = location_stack_type (0);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

    /* New state.  */
  yynewstate:
    yystate_stack_.push (yystate);
    YYCDEBUG << "Entering state " << yystate << std::endl;
    goto yybackup;

    /* Backup.  */
  yybackup:

    /* Try to take a decision without look-ahead.  */
    yyn = yypact_[yystate];
    if (yyn == yypact_ninf_)
      goto yydefault;

    /* Read a look-ahead token.  */
    if (yychar == yyempty_)
      {
	YYCDEBUG << "Reading a token: ";
	yychar = yylex (&yylval, lexer);
      }


    /* Convert token to internal form.  */
    if (yychar <= yyeof_)
      {
	yychar = yytoken = yyeof_;
	YYCDEBUG << "Now at end of input." << std::endl;
      }
    else
      {
	yytoken = yytranslate_ (yychar);
	YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
      }

    /* If the proper action on seeing token YYTOKEN is to reduce or to
       detect an error, take that action.  */
    yyn += yytoken;
    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
      goto yydefault;

    /* Reduce or error.  */
    yyn = yytable_[yyn];
    if (yyn <= 0)
      {
	if (yyn == 0 || yyn == yytable_ninf_)
	goto yyerrlab;
	yyn = -yyn;
	goto yyreduce;
      }

    /* Accept?  */
    if (yyn == yyfinal_)
      goto yyacceptlab;

    /* Shift the look-ahead token.  */
    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

    /* Discard the token being shifted unless it is eof.  */
    if (yychar != yyeof_)
      yychar = yyempty_;

    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yylloc);

    /* Count tokens shifted since error; after three, turn off error
       status.  */
    if (yyerrstatus_)
      --yyerrstatus_;

    yystate = yyn;
    goto yynewstate;

  /*-----------------------------------------------------------.
  | yydefault -- do the default action for the current state.  |
  `-----------------------------------------------------------*/
  yydefault:
    yyn = yydefact_[yystate];
    if (yyn == 0)
      goto yyerrlab;
    goto yyreduce;

  /*-----------------------------.
  | yyreduce -- Do a reduction.  |
  `-----------------------------*/
  yyreduce:
    yylen = yyr2_[yyn];
    /* If YYLEN is nonzero, implement the default value of the action:
       `$$ = $1'.  Otherwise, use the top of the stack.

       Otherwise, the following line sets YYVAL to garbage.
       This behavior is undocumented and Bison
       users should not rely upon it.  */
    if (yylen)
      yyval = yysemantic_stack_[yylen - 1];
    else
      yyval = yysemantic_stack_[0];

    {
      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
      YYLLOC_DEFAULT (yyloc, slice, yylen);
    }
    YY_REDUCE_PRINT (yyn);
    switch (yyn)
      {
	  case 2:
#line 144 "qmake.yy"
    {
        ProjectAST *projectAST = new ProjectAST();
        projects.push(projectAST);
    ;}
    break;

  case 4:
#line 152 "qmake.yy"
    {
            projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
            (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
        ;}
    break;

  case 6:
#line 160 "qmake.yy"
    {
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
        ;}
    break;

  case 7:
#line 164 "qmake.yy"
    {
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
        ;}
    break;

  case 8:
#line 168 "qmake.yy"
    {
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
        ;}
    break;

  case 9:
#line 172 "qmake.yy"
    {
            (yyval.node) = (yysemantic_stack_[(1) - (1)].node);
        ;}
    break;

  case 10:
#line 176 "qmake.yy"
    {
            (yyval.node) = new NewLineAST();
        ;}
    break;

  case 11:
#line 182 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(5) - (1)].value);
            node->op = (yysemantic_stack_[(5) - (2)].value);
            node->values = (yysemantic_stack_[(5) - (3)].values) ;
            node->values.append( (yysemantic_stack_[(5) - (4)].value) );
            node->values.append( (yysemantic_stack_[(5) - (5)].value) );
            node->indent = (yysemantic_stack_[(5) - (3)].indent);
            (yyval.node) = node;
        ;}
    break;

  case 12:
#line 193 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(5) - (1)].value);
            node->op = (yysemantic_stack_[(5) - (2)].value);
            node->values = (yysemantic_stack_[(5) - (3)].values) ;
            node->values.append( (yysemantic_stack_[(5) - (4)].value) );
            node->indent = (yysemantic_stack_[(5) - (3)].indent);
            (yyval.node) = node;
        ;}
    break;

  case 13:
#line 203 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(5) - (1)].value);
            node->op = (yysemantic_stack_[(5) - (2)].value);
            node->values = (yysemantic_stack_[(5) - (3)].values) ;
            node->values.append( (yysemantic_stack_[(5) - (4)].value) );
            node->values.append( (yysemantic_stack_[(5) - (5)].value) );
            node->indent = (yysemantic_stack_[(5) - (3)].indent);
            (yyval.node) = node;
        ;}
    break;

  case 14:
#line 214 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(5) - (1)].value);
            node->op = (yysemantic_stack_[(5) - (2)].value);
            node->values = (yysemantic_stack_[(5) - (3)].values) ;
            node->values.append( (yysemantic_stack_[(5) - (4)].value) );
            node->values.append( (yysemantic_stack_[(5) - (5)].value) );
            node->indent = (yysemantic_stack_[(5) - (3)].indent);
            (yyval.node) = node;
        ;}
    break;

  case 15:
#line 225 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(4) - (1)].value);
            node->op = (yysemantic_stack_[(4) - (2)].value);
            node->values.append( (yysemantic_stack_[(4) - (3)].value) );
            node->values.append( (yysemantic_stack_[(4) - (4)].value) );
            (yyval.node) = node;
        ;}
    break;

  case 16:
#line 234 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(4) - (1)].value);
            node->op = (yysemantic_stack_[(4) - (2)].value);
            node->values.append( (yysemantic_stack_[(4) - (3)].value) );
            (yyval.node) = node;
        ;}
    break;

  case 17:
#line 242 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(4) - (1)].value);
            node->op = (yysemantic_stack_[(4) - (2)].value);
            node->values.append( (yysemantic_stack_[(4) - (3)].value) );
            node->values.append( (yysemantic_stack_[(4) - (4)].value) );
            (yyval.node) = node;
        ;}
    break;

  case 18:
#line 251 "qmake.yy"
    {
            AssignmentAST *node = new AssignmentAST();
            node->scopedID = (yysemantic_stack_[(5) - (1)].value);
            node->op = (yysemantic_stack_[(5) - (2)].value);
            node->values = (yysemantic_stack_[(5) - (3)].values);
            node->values.append( (yysemantic_stack_[(5) - (4)].value) );
            node->values.append( (yysemantic_stack_[(5) - (5)].value) );
            node->indent = (yysemantic_stack_[(5) - (3)].indent);
            (yyval.node) = node;
        ;}
    break;

  case 22:
#line 266 "qmake.yy"
    {
            (yyval.values).append( (yysemantic_stack_[(3) - (2)].value) );
            (yyval.values).append( (yysemantic_stack_[(3) - (3)].value) );
        ;}
    break;

  case 23:
#line 271 "qmake.yy"
    {
            (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) );
        ;}
    break;

  case 24:
#line 275 "qmake.yy"
    {
            (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) );
            if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" )
                (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent);
        ;}
    break;

  case 25:
#line 284 "qmake.yy"
    {
            (yyval.values).append( (yysemantic_stack_[(5) - (2)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (3)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (4)].value) );
            (yyval.values).append( (yysemantic_stack_[(5) - (5)].value) );
            if( (yysemantic_stack_[(5) - (4)].indent) != "" && (yyval.indent) == "" )
                (yyval.indent) = (yysemantic_stack_[(5) - (4)].indent);
        ;}
    break;

  case 26:
#line 293 "qmake.yy"
    {
            (yyval.values) = QStringList();
            (yyval.values).append( (yysemantic_stack_[(2) - (1)].value) );
            (yyval.values).append( (yysemantic_stack_[(2) - (2)].value) );
        ;}
    break;

  case 27:
#line 301 "qmake.yy"
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
    break;

  case 28:
#line 302 "qmake.yy"
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
    break;

  case 29:
#line 307 "qmake.yy"
    {
            (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
            (yyval.indent) = (yysemantic_stack_[(1) - (1)].value);
        ;}
    break;

  case 30:
#line 312 "qmake.yy"
    {
            (yyval.value) = QString();
            (yyval.indent) = QString();
        ;}
    break;

  case 31:
#line 318 "qmake.yy"
    {
        (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
    ;}
    break;

  case 32:
#line 322 "qmake.yy"
    {
        (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
    ;}
    break;

  case 33:
#line 326 "qmake.yy"
    {
        (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
    ;}
    break;

  case 34:
#line 330 "qmake.yy"
    {
        (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
    ;}
    break;

  case 35:
#line 334 "qmake.yy"
    {
        (yyval.value) = (yysemantic_stack_[(1) - (1)].value);
    ;}
    break;

  case 36:
#line 340 "qmake.yy"
    {
            ProjectAST *projectAST = new ProjectAST(ProjectAST::Scope);
            projects.push(projectAST);
            projects.top()->scopedID = (yysemantic_stack_[(1) - (1)].value);
            depth++;
        ;}
    break;

  case 37:
#line 347 "qmake.yy"
    {
            (yyval.node) = projects.pop();
            depth--;
        ;}
    break;

  case 38:
#line 354 "qmake.yy"
    {
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
            projects.push(projectAST);
            projects.top()->scopedID = (yysemantic_stack_[(4) - (1)].value);
            projects.top()->args = (yysemantic_stack_[(4) - (3)].value);
            depth++;

            //qWarning("%s", $<value>1.ascii());
            if ((yysemantic_stack_[(4) - (1)].value).contains("include"))
            {
                IncludeAST *includeAST = new IncludeAST();
                includeAST->projectName = (yysemantic_stack_[(4) - (3)].value);
                projects.top()->addChildAST(includeAST);
                includeAST->setDepth(depth);
            }
        ;}
    break;

  case 39:
#line 372 "qmake.yy"
    {
            (yyval.node) = projects.pop();
            depth--;
        ;}
    break;

  case 40:
#line 378 "qmake.yy"
    { (yyval.value) = (yysemantic_stack_[(1) - (1)].value); ;}
    break;

  case 41:
#line 379 "qmake.yy"
    { (yyval.value) = ""; ;}
    break;

  case 43:
#line 384 "qmake.yy"
    {
            projects.top()->addChildAST((yysemantic_stack_[(2) - (2)].node));
            (yysemantic_stack_[(2) - (2)].node)->setDepth(depth);
        ;}
    break;

  case 45:
#line 392 "qmake.yy"
    {
            ProjectAST *projectAST = new ProjectAST(ProjectAST::FunctionScope);
            projects.push(projectAST);
            projects.top()->scopedID = "else";
            projects.top()->args = "";
            depth++;
        ;}
    break;

  case 46:
#line 400 "qmake.yy"
    {
            (yyval.node) = projects.pop();
            depth--;
        ;}
    break;

  case 47:
#line 405 "qmake.yy"
    {
            (yyval.node) = new ProjectAST();
        ;}
    break;

  case 48:
#line 411 "qmake.yy"
    {
            CommentAST *node = new CommentAST();
            node->comment = (yysemantic_stack_[(1) - (1)].value);
            (yyval.node) = node;
        ;}
    break;


    /* Line 675 of lalr1.cc.  */
#line 756 "qmake_yacc.cpp"
	default: break;
      }
    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);

    yypop_ (yylen);
    yylen = 0;
    YY_STACK_PRINT ();

    yysemantic_stack_.push (yyval);
    yylocation_stack_.push (yyloc);

    /* Shift the result of the reduction.  */
    yyn = yyr1_[yyn];
    yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
    if (0 <= yystate && yystate <= yylast_
	&& yycheck_[yystate] == yystate_stack_[0])
      yystate = yytable_[yystate];
    else
      yystate = yydefgoto_[yyn - yyntokens_];
    goto yynewstate;

  /*------------------------------------.
  | yyerrlab -- here on detecting error |
  `------------------------------------*/
  yyerrlab:
    /* If not already recovering from an error, report this error.  */
    if (!yyerrstatus_)
      {
	++yynerrs_;
	error (yylloc, yysyntax_error_ (yystate));
      }

    yyerror_range[0] = yylloc;
    if (yyerrstatus_ == 3)
      {
	/* If just tried and failed to reuse look-ahead token after an
	 error, discard it.  */

	if (yychar <= yyeof_)
	  {
	  /* Return failure if at end of input.  */
	  if (yychar == yyeof_)
	    YYABORT;
	  }
	else
	  {
	    yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
	    yychar = yyempty_;
	  }
      }

    /* Else will try to reuse look-ahead token after shifting the error
       token.  */
    goto yyerrlab1;


  /*---------------------------------------------------.
  | yyerrorlab -- error raised explicitly by YYERROR.  |
  `---------------------------------------------------*/
  yyerrorlab:

    /* Pacify compilers like GCC when the user code never invokes
       YYERROR and the label yyerrorlab therefore never appears in user
       code.  */
    if (false)
      goto yyerrorlab;

    yyerror_range[0] = yylocation_stack_[yylen - 1];
    /* Do not reclaim the symbols of the rule which action triggered
       this YYERROR.  */
    yypop_ (yylen);
    yylen = 0;
    yystate = yystate_stack_[0];
    goto yyerrlab1;

  /*-------------------------------------------------------------.
  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  `-------------------------------------------------------------*/
  yyerrlab1:
    yyerrstatus_ = 3;	/* Each real token shifted decrements this.  */

    for (;;)
      {
	yyn = yypact_[yystate];
	if (yyn != yypact_ninf_)
	{
	  yyn += yyterror_;
	  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
	    {
	      yyn = yytable_[yyn];
	      if (0 < yyn)
		break;
	    }
	}

	/* Pop the current state because it cannot handle the error token.  */
	if (yystate_stack_.height () == 1)
	YYABORT;

	yyerror_range[0] = yylocation_stack_[0];
	yydestruct_ ("Error: popping",
		     yystos_[yystate],
		     &yysemantic_stack_[0], &yylocation_stack_[0]);
	yypop_ ();
	yystate = yystate_stack_[0];
	YY_STACK_PRINT ();
      }

    if (yyn == yyfinal_)
      goto yyacceptlab;

    yyerror_range[1] = yylloc;
    // Using YYLLOC is tempting, but would change the location of
    // the look-ahead.  YYLOC is available though.
    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
    yysemantic_stack_.push (yylval);
    yylocation_stack_.push (yyloc);

    /* Shift the error token.  */
    YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
		   &yysemantic_stack_[0], &yylocation_stack_[0]);

    yystate = yyn;
    goto yynewstate;

    /* Accept.  */
  yyacceptlab:
    yyresult = 0;
    goto yyreturn;

    /* Abort.  */
  yyabortlab:
    yyresult = 1;
    goto yyreturn;

  yyreturn:
    if (yychar != yyeof_ && yychar != yyempty_)
      yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);

    /* Do not reclaim the symbols of the rule which action triggered
       this YYABORT or YYACCEPT.  */
    yypop_ (yylen);
    while (yystate_stack_.height () != 1)
      {
	yydestruct_ ("Cleanup: popping",
		   yystos_[yystate_stack_[0]],
		   &yysemantic_stack_[0],
		   &yylocation_stack_[0]);
	yypop_ ();
      }

    return yyresult;
  }

  // Generate an error message.
  std::string
  Parser::yysyntax_error_ (int yystate)
  {
    std::string res;
    YYUSE (yystate);
#if YYERROR_VERBOSE
    int yyn = yypact_[yystate];
    if (yypact_ninf_ < yyn && yyn <= yylast_)
      {
	/* Start YYX at -YYN if negative to avoid negative indexes in
	   YYCHECK.  */
	int yyxbegin = yyn < 0 ? -yyn : 0;

	/* Stay within bounds of both yycheck and yytname.  */
	int yychecklim = yylast_ - yyn + 1;
	int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
	int count = 0;
	for (int x = yyxbegin; x < yyxend; ++x)
	  if (yycheck_[x + yyn] == x && x != yyterror_)
	    ++count;

	// FIXME: This method of building the message is not compatible
	// with internationalization.  It should work like yacc.c does it.
	// That is, first build a string that looks like this:
	// "syntax error, unexpected %s or %s or %s"
	// Then, invoke YY_ on this string.
	// Finally, use the string as a format to output
	// yytname_[tok], etc.
	// Until this gets fixed, this message appears in English only.
	res = "syntax error, unexpected ";
	res += yytnamerr_ (yytname_[tok]);
	if (count < 5)
	  {
	    count = 0;
	    for (int x = yyxbegin; x < yyxend; ++x)
	      if (yycheck_[x + yyn] == x && x != yyterror_)
		{
		  res += (!count++) ? ", expecting " : " or ";
		  res += yytnamerr_ (yytname_[x]);
		}
	  }
      }
    else
#endif
      res = YY_("syntax error");
    return res;
  }


  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
  const signed char Parser::yypact_ninf_ = -44;
  const signed char
  Parser::yypact_[] =
  {
       -44,    19,   -44,   -44,     8,    45,   -44,   -44,   -44,   -44,
     -44,   -44,   -44,   -44,   -44,   -44,   -44,   -44,   -44,    12,
      10,    31,   -44,    24,   -44,   -15,    -5,     8,   -44,   -44,
     -44,   -44,   -44,    26,   -44,    14,   -44,   -44,   -44,   -44,
     -44,   -44,   -44,   -44,     0,    31,   -44,   -44,   -44,    18,
      18,   -44,   -44,    20,    26,    26,    27,   -44,   -44,   -44,
     -44,    31,    39,   -44
  };

  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
     doesn't specify something else to do.  Zero means the default is an
     error.  */
  const unsigned char
  Parser::yydefact_[] =
  {
         2,     0,     5,     1,     3,    36,    49,    48,     4,     6,
       7,     8,     9,    10,    31,    32,    33,    34,    35,    41,
      30,    44,    40,     0,    29,    30,     0,     0,     5,    37,
      38,    28,    27,    29,    23,     0,    15,    17,    21,    20,
      16,    26,    19,    43,     0,    44,    22,    11,    18,    13,
      14,    12,    42,    47,     0,     0,     0,    39,    24,    25,
      45,    44,     0,    46
  };

  /* YYPGOTO[NTERM-NUM].  */
  const signed char
  Parser::yypgoto_[] =
  {
       -44,   -44,   -44,     7,    29,   -44,   -32,   -44,    22,   -25,
     -44,   -44,   -44,   -44,   -44,   -44,   -43,   -44,   -44,   -44,
     -44
  };

  /* YYDEFGOTO[NTERM-NUM].  */
  const signed char
  Parser::yydefgoto_[] =
  {
        -1,     1,     2,     4,     8,     9,    41,    25,    42,    26,
      20,    10,    21,    11,    45,    23,    29,    57,    61,    12,
      13
  };

  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule which
     number is the opposite.  If zero, do what YYDEFACT says.  */
  const signed char Parser::yytable_ninf_ = -31;
  const signed char
  Parser::yytable_[] =
  {
        35,    46,    53,     5,    31,    32,    33,    36,    37,    38,
      39,     5,     6,     7,    31,    32,    52,    40,    62,     3,
       6,     7,    58,    59,    54,    55,    47,    48,    49,    50,
      22,    24,   -30,   -30,    30,    44,    51,   -30,   -30,    24,
      38,    39,    27,    56,    60,    31,    32,    34,    28,    14,
      15,    16,    17,    18,    19,    63,    43
  };

  /* YYCHECK.  */
  const unsigned char
  Parser::yycheck_[] =
  {
        25,    33,    45,     3,    19,    20,    21,    12,    13,    14,
      15,     3,    12,    13,    19,    20,    16,    22,    61,     0,
      12,    13,    54,    55,    49,    50,    12,    13,    14,    15,
      18,    21,    14,    15,    10,    28,    22,    19,    20,    21,
      14,    15,    11,    23,    17,    19,    20,    25,    17,     4,
       5,     6,     7,     8,     9,    16,    27
  };

  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
  const unsigned char
  Parser::yystos_[] =
  {
         0,    25,    26,     0,    27,     3,    12,    13,    28,    29,
      35,    37,    43,    44,     4,     5,     6,     7,     8,     9,
      34,    36,    18,    39,    21,    31,    33,    11,    17,    40,
      10,    19,    20,    21,    32,    33,    12,    13,    14,    15,
      22,    30,    32,    28,    27,    38,    30,    12,    13,    14,
      15,    22,    16,    40,    33,    33,    23,    41,    30,    30,
      17,    42,    40,    16
  };

#if YYDEBUG
  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
     to YYLEX-NUM.  */
  const unsigned short int
  Parser::yytoken_number_[] =
  {
         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278
  };
#endif

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  const unsigned char
  Parser::yyr1_[] =
  {
         0,    24,    26,    25,    27,    27,    28,    28,    28,    28,
      28,    29,    29,    29,    29,    29,    29,    29,    29,    30,
      30,    30,    31,    31,    31,    31,    31,    32,    32,    33,
      33,    34,    34,    34,    34,    34,    36,    35,    38,    37,
      39,    39,    40,    40,    40,    42,    41,    41,    43,    44
  };

  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
  const unsigned char
  Parser::yyr2_[] =
  {
         0,     2,     0,     2,     2,     0,     1,     1,     1,     1,
       1,     5,     5,     5,     5,     4,     4,     4,     5,     1,
       1,     1,     3,     2,     5,     5,     2,     1,     1,     1,
       0,     1,     1,     1,     1,     1,     0,     3,     0,     7,
       1,     0,     3,     2,     0,     0,     5,     0,     1,     1
  };

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
  const char*
  const Parser::yytname_[] =
  {
    "$end", "error", "$undefined", "ID_SIMPLE", "EQ", "PLUSEQ", "MINUSEQ",
  "STAREQ", "TILDEEQ", "LBRACE", "RBRACE", "COLON", "NEWLINE", "COMMENT",
  "CONT", "COMMENT_CONT", "RCURLY", "LCURLY", "ID_ARGS",
  "QUOTED_VARIABLE_VALUE", "VARIABLE_VALUE", "LIST_WS", "ENDOFFILE",
  "\"else\"", "$accept", "project", "@1", "statements", "statement",
  "variable_assignment", "possible_value", "multiline_values",
  "variable_value", "listws", "operator", "scope", "@2", "function_call",
  "@3", "function_args", "scope_body", "else_statement", "@4", "comment",
  "emptyline", 0
  };
#endif

#if YYDEBUG
  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
  const Parser::rhs_number_type
  Parser::yyrhs_[] =
  {
        25,     0,    -1,    -1,    26,    27,    -1,    27,    28,    -1,
      -1,    29,    -1,    35,    -1,    37,    -1,    43,    -1,    44,
      -1,     3,    34,    31,    33,    12,    -1,     3,    34,    31,
      33,    22,    -1,     3,    34,    31,    33,    14,    -1,     3,
      34,    31,    33,    15,    -1,     3,    34,    33,    12,    -1,
       3,    34,    33,    22,    -1,     3,    34,    33,    13,    -1,
       3,    34,    31,    33,    13,    -1,    32,    -1,    15,    -1,
      14,    -1,    31,    21,    30,    -1,    31,    32,    -1,    31,
      33,    14,    33,    30,    -1,    31,    33,    15,    33,    30,
      -1,    33,    30,    -1,    20,    -1,    19,    -1,    21,    -1,
      -1,     4,    -1,     5,    -1,     6,    -1,     7,    -1,     8,
      -1,    -1,     3,    36,    40,    -1,    -1,     3,     9,    39,
      10,    38,    40,    41,    -1,    18,    -1,    -1,    17,    27,
      16,    -1,    11,    28,    -1,    -1,    -1,    23,    17,    42,
      40,    16,    -1,    -1,    13,    -1,    12,    -1
  };

  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
     YYRHS.  */
  const unsigned char
  Parser::yyprhs_[] =
  {
         0,     0,     3,     4,     7,    10,    11,    13,    15,    17,
      19,    21,    27,    33,    39,    45,    50,    55,    60,    66,
      68,    70,    72,    76,    79,    85,    91,    94,    96,    98,
     100,   101,   103,   105,   107,   109,   111,   112,   116,   117,
     125,   127,   128,   132,   135,   136,   137,   143,   144,   146
  };

  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  const unsigned short int
  Parser::yyrline_[] =
  {
         0,   144,   144,   144,   151,   156,   159,   163,   167,   171,
     175,   181,   192,   202,   213,   224,   233,   241,   250,   263,
     263,   263,   265,   270,   274,   283,   292,   301,   302,   306,
     312,   317,   321,   325,   329,   333,   340,   339,   354,   353,
     378,   379,   382,   383,   388,   392,   391,   405,   410,   418
  };

  // Print the state stack on the debug stream.
  void
  Parser::yystack_print_ ()
  {
    *yycdebug_ << "Stack now";
    for (state_stack_type::const_iterator i = yystate_stack_.begin ();
	 i != yystate_stack_.end (); ++i)
      *yycdebug_ << ' ' << *i;
    *yycdebug_ << std::endl;
  }

  // Report on the debug stream that the rule \a yyrule is going to be reduced.
  void
  Parser::yy_reduce_print_ (int yyrule)
  {
    unsigned int yylno = yyrline_[yyrule];
    int yynrhs = yyr2_[yyrule];
    /* Print the symbols being reduced, and their result.  */
    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
	       << " (line " << yylno << "), ";
    /* The symbols being reduced.  */
    for (int yyi = 0; yyi < yynrhs; yyi++)
      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
		       yyrhs_[yyprhs_[yyrule] + yyi],
		       &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
		       &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
  }
#endif // YYDEBUG

  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
  Parser::token_number_type
  Parser::yytranslate_ (int t)
  {
    static
    const token_number_type
    translate_table[] =
    {
           0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23
    };
    if ((unsigned int) t <= yyuser_token_number_max_)
      return translate_table[t];
    else
      return yyundef_token_;
  }

  const int Parser::yyeof_ = 0;
  const int Parser::yylast_ = 56;
  const int Parser::yynnts_ = 21;
  const int Parser::yyempty_ = -2;
  const int Parser::yyfinal_ = 3;
  const int Parser::yyterror_ = 1;
  const int Parser::yyerrcode_ = 256;
  const int Parser::yyntokens_ = 24;

  const unsigned int Parser::yyuser_token_number_max_ = 278;
  const Parser::token_number_type Parser::yyundef_token_ = 2;

} // namespace QMake

#line 421 "qmake.yy"



namespace QMake
{
    void Parser::error(const location_type& /*l*/, const std::string& m)
    {
        std::cerr << m << std::endl;
    }
}