OLD | NEW |
1 /* A Bison parser, made by GNU Bison 2.5. */ | 1 /* A Bison parser, made by GNU Bison 2.7. */ |
2 | 2 |
3 /* Bison implementation for Yacc-like parsers in C | 3 /* Bison implementation for Yacc-like parsers in C |
4 ··· | 4 ··· |
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. | 5 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. |
6 ··· | 6 ··· |
7 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 |
8 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 |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
11 ··· | 11 ··· |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
(...skipping 21 matching lines...) Expand all Loading... |
37 infringing on user name space. This should be done even for local | 37 infringing on user name space. This should be done even for local |
38 variables, as they might otherwise be expanded by user macros. | 38 variables, as they might otherwise be expanded by user macros. |
39 There are some unavoidable exceptions within include files to | 39 There are some unavoidable exceptions within include files to |
40 define necessary library symbols; they are noted "INFRINGES ON | 40 define necessary library symbols; they are noted "INFRINGES ON |
41 USER NAME SPACE" below. */ | 41 USER NAME SPACE" below. */ |
42 | 42 |
43 /* Identify Bison output. */ | 43 /* Identify Bison output. */ |
44 #define YYBISON 1 | 44 #define YYBISON 1 |
45 | 45 |
46 /* Bison version. */ | 46 /* Bison version. */ |
47 #define YYBISON_VERSION "2.5" | 47 #define YYBISON_VERSION "2.7" |
48 | 48 |
49 /* Skeleton name. */ | 49 /* Skeleton name. */ |
50 #define YYSKELETON_NAME "yacc.c" | 50 #define YYSKELETON_NAME "yacc.c" |
51 | 51 |
52 /* Pure parsers. */ | 52 /* Pure parsers. */ |
53 #define YYPURE 0 | 53 #define YYPURE 0 |
54 | 54 |
55 /* Push parsers. */ | 55 /* Push parsers. */ |
56 #define YYPUSH 0 | 56 #define YYPUSH 0 |
57 | 57 |
58 /* Pull parsers. */ | 58 /* Pull parsers. */ |
59 #define YYPULL 1 | 59 #define YYPULL 1 |
60 | 60 |
61 /* Using locations. */ | |
62 #define YYLSP_NEEDED 0 | |
63 | 61 |
64 | 62 |
65 | 63 |
66 /* Copy the first part of user declarations. */ | 64 /* Copy the first part of user declarations. */ |
67 | 65 /* Line 371 of yacc.c */ |
68 /* Line 268 of yacc.c */ | |
69 #line 20 "go.y" | 66 #line 20 "go.y" |
70 | 67 |
71 #include <u.h> | 68 #include <u.h> |
72 #include <stdio.h> /* if we don't, bison will, and go.h re-#defines getc */ | 69 #include <stdio.h> /* if we don't, bison will, and go.h re-#defines getc */ |
73 #include <libc.h> | 70 #include <libc.h> |
74 #include "go.h" | 71 #include "go.h" |
75 | 72 |
76 static void fixlbrace(int); | 73 static void fixlbrace(int); |
77 | 74 |
| 75 /* Line 371 of yacc.c */ |
| 76 #line 77 "y.tab.c" |
78 | 77 |
79 /* Line 268 of yacc.c */ | 78 # ifndef YY_NULL |
80 #line 81 "y.tab.c" | 79 # if defined __cplusplus && 201103L <= __cplusplus |
81 | 80 # define YY_NULL nullptr |
82 /* Enabling traces. */ | 81 # else |
83 #ifndef YYDEBUG | 82 # define YY_NULL 0 |
84 # define YYDEBUG 0 | 83 # endif |
85 #endif | 84 # endif |
86 | 85 |
87 /* Enabling verbose error messages. */ | 86 /* Enabling verbose error messages. */ |
88 #ifdef YYERROR_VERBOSE | 87 #ifdef YYERROR_VERBOSE |
89 # undef YYERROR_VERBOSE | 88 # undef YYERROR_VERBOSE |
90 # define YYERROR_VERBOSE 1 | 89 # define YYERROR_VERBOSE 1 |
91 #else | 90 #else |
92 # define YYERROR_VERBOSE 1 | 91 # define YYERROR_VERBOSE 1 |
93 #endif | 92 #endif |
94 | 93 |
95 /* Enabling the token table. */ | 94 /* In a future release of Bison, this section will be replaced |
96 #ifndef YYTOKEN_TABLE | 95 by #include "y.tab.h". */ |
97 # define YYTOKEN_TABLE 0 | 96 #ifndef YY_YY_Y_TAB_H_INCLUDED |
| 97 # define YY_YY_Y_TAB_H_INCLUDED |
| 98 /* Enabling traces. */ |
| 99 #ifndef YYDEBUG |
| 100 # define YYDEBUG 0 |
98 #endif | 101 #endif |
99 | 102 #if YYDEBUG |
| 103 extern int yydebug; |
| 104 #endif |
100 | 105 |
101 /* Tokens. */ | 106 /* Tokens. */ |
102 #ifndef YYTOKENTYPE | 107 #ifndef YYTOKENTYPE |
103 # define YYTOKENTYPE | 108 # define YYTOKENTYPE |
104 /* Put the tokens into the symbol table, so that GDB and other debuggers | 109 /* Put the tokens into the symbol table, so that GDB and other debuggers |
105 know about them. */ | 110 know about them. */ |
106 enum yytokentype { | 111 enum yytokentype { |
107 LLITERAL = 258, | 112 LLITERAL = 258, |
108 LASOP = 259, | 113 LASOP = 259, |
109 LCOLAS = 260, | 114 LCOLAS = 260, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 #define LLT 300 | 206 #define LLT 300 |
202 #define LNE 301 | 207 #define LNE 301 |
203 #define LOROR 302 | 208 #define LOROR 302 |
204 #define LRSH 303 | 209 #define LRSH 303 |
205 #define NotPackage 304 | 210 #define NotPackage 304 |
206 #define NotParen 305 | 211 #define NotParen 305 |
207 #define PreferToRightParen 306 | 212 #define PreferToRightParen 306 |
208 | 213 |
209 | 214 |
210 | 215 |
211 | |
212 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 216 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
213 typedef union YYSTYPE | 217 typedef union YYSTYPE |
214 { | 218 { |
215 | 219 /* Line 387 of yacc.c */ |
216 /* Line 293 of yacc.c */ | |
217 #line 28 "go.y" | 220 #line 28 "go.y" |
218 | 221 |
219 Node* node; | 222 Node* node; |
220 NodeList* list; | 223 NodeList* list; |
| 224 Field* field; |
| 225 FieldList* flist; |
221 Type* type; | 226 Type* type; |
222 Sym* sym; | 227 Sym* sym; |
223 struct Val val; | 228 struct Val val; |
224 int i; | 229 int i; |
225 | 230 |
226 | 231 |
227 | 232 /* Line 387 of yacc.c */ |
228 /* Line 293 of yacc.c */ | 233 #line 234 "y.tab.c" |
229 #line 230 "y.tab.c" | |
230 } YYSTYPE; | 234 } YYSTYPE; |
231 # define YYSTYPE_IS_TRIVIAL 1 | 235 # define YYSTYPE_IS_TRIVIAL 1 |
232 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 236 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
233 # define YYSTYPE_IS_DECLARED 1 | 237 # define YYSTYPE_IS_DECLARED 1 |
234 #endif | 238 #endif |
235 | 239 |
| 240 extern YYSTYPE yylval; |
| 241 |
| 242 #ifdef YYPARSE_PARAM |
| 243 #if defined __STDC__ || defined __cplusplus |
| 244 int yyparse (void *YYPARSE_PARAM); |
| 245 #else |
| 246 int yyparse (); |
| 247 #endif |
| 248 #else /* ! YYPARSE_PARAM */ |
| 249 #if defined __STDC__ || defined __cplusplus |
| 250 int yyparse (void); |
| 251 #else |
| 252 int yyparse (); |
| 253 #endif |
| 254 #endif /* ! YYPARSE_PARAM */ |
| 255 |
| 256 #endif /* !YY_YY_Y_TAB_H_INCLUDED */ |
236 | 257 |
237 /* Copy the second part of user declarations. */ | 258 /* Copy the second part of user declarations. */ |
238 | 259 |
239 | 260 /* Line 390 of yacc.c */ |
240 /* Line 343 of yacc.c */ | 261 #line 262 "y.tab.c" |
241 #line 242 "y.tab.c" | |
242 | 262 |
243 #ifdef short | 263 #ifdef short |
244 # undef short | 264 # undef short |
245 #endif | 265 #endif |
246 | 266 |
247 #ifdef YYTYPE_UINT8 | 267 #ifdef YYTYPE_UINT8 |
248 typedef YYTYPE_UINT8 yytype_uint8; | 268 typedef YYTYPE_UINT8 yytype_uint8; |
249 #else | 269 #else |
250 typedef unsigned char yytype_uint8; | 270 typedef unsigned char yytype_uint8; |
251 #endif | 271 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 # define YYSIZE_T unsigned int | 304 # define YYSIZE_T unsigned int |
285 # endif | 305 # endif |
286 #endif | 306 #endif |
287 | 307 |
288 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 308 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
289 | 309 |
290 #ifndef YY_ | 310 #ifndef YY_ |
291 # if defined YYENABLE_NLS && YYENABLE_NLS | 311 # if defined YYENABLE_NLS && YYENABLE_NLS |
292 # if ENABLE_NLS | 312 # if ENABLE_NLS |
293 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 313 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
294 # define YY_(msgid) dgettext ("bison-runtime", msgid) | 314 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
295 # endif | 315 # endif |
296 # endif | 316 # endif |
297 # ifndef YY_ | 317 # ifndef YY_ |
298 # define YY_(msgid) msgid | 318 # define YY_(Msgid) Msgid |
299 # endif | 319 # endif |
300 #endif | 320 #endif |
301 | 321 |
302 /* Suppress unused-variable warnings by "using" E. */ | 322 /* Suppress unused-variable warnings by "using" E. */ |
303 #if ! defined lint || defined __GNUC__ | 323 #if ! defined lint || defined __GNUC__ |
304 # define YYUSE(e) ((void) (e)) | 324 # define YYUSE(E) ((void) (E)) |
305 #else | 325 #else |
306 # define YYUSE(e) /* empty */ | 326 # define YYUSE(E) /* empty */ |
307 #endif | 327 #endif |
308 | 328 |
309 /* Identity function, used to suppress warnings about constant conditions. */ | 329 /* Identity function, used to suppress warnings about constant conditions. */ |
310 #ifndef lint | 330 #ifndef lint |
311 # define YYID(n) (n) | 331 # define YYID(N) (N) |
312 #else | 332 #else |
313 #if (defined __STDC__ || defined __C99__FUNC__ \ | 333 #if (defined __STDC__ || defined __C99__FUNC__ \ |
314 || defined __cplusplus || defined _MSC_VER) | 334 || defined __cplusplus || defined _MSC_VER) |
315 static int | 335 static int |
316 YYID (int yyi) | 336 YYID (int yyi) |
317 #else | 337 #else |
318 static int | 338 static int |
319 YYID (yyi) | 339 YYID (yyi) |
320 int yyi; | 340 int yyi; |
321 #endif | 341 #endif |
(...skipping 15 matching lines...) Expand all Loading... |
337 # elif defined _AIX | 357 # elif defined _AIX |
338 # define YYSTACK_ALLOC __alloca | 358 # define YYSTACK_ALLOC __alloca |
339 # elif defined _MSC_VER | 359 # elif defined _MSC_VER |
340 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ | 360 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
341 # define alloca _alloca | 361 # define alloca _alloca |
342 # else | 362 # else |
343 # define YYSTACK_ALLOC alloca | 363 # define YYSTACK_ALLOC alloca |
344 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || de
fined __C99__FUNC__ \ | 364 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || de
fined __C99__FUNC__ \ |
345 || defined __cplusplus || defined _MSC_VER) | 365 || defined __cplusplus || defined _MSC_VER) |
346 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 366 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 367 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
347 # ifndef EXIT_SUCCESS | 368 # ifndef EXIT_SUCCESS |
348 # define EXIT_SUCCESS 0 | 369 # define EXIT_SUCCESS 0 |
349 # endif | 370 # endif |
350 # endif | 371 # endif |
351 # endif | 372 # endif |
352 # endif | 373 # endif |
353 # endif | 374 # endif |
354 | 375 |
355 # ifdef YYSTACK_ALLOC | 376 # ifdef YYSTACK_ALLOC |
356 /* Pacify GCC's `empty if-body' warning. */ | 377 /* Pacify GCC's `empty if-body' warning. */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | 449 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
429 Stack = &yyptr->Stack_alloc; \ | 450 Stack = &yyptr->Stack_alloc; \ |
430 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 451 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
431 yyptr += yynewbytes / sizeof (*yyptr); \ | 452 yyptr += yynewbytes / sizeof (*yyptr); \ |
432 } \ | 453 } \ |
433 while (YYID (0)) | 454 while (YYID (0)) |
434 | 455 |
435 #endif | 456 #endif |
436 | 457 |
437 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED | 458 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
438 /* Copy COUNT objects from FROM to TO. The source and destination do | 459 /* Copy COUNT objects from SRC to DST. The source and destination do |
439 not overlap. */ | 460 not overlap. */ |
440 # ifndef YYCOPY | 461 # ifndef YYCOPY |
441 # if defined __GNUC__ && 1 < __GNUC__ | 462 # if defined __GNUC__ && 1 < __GNUC__ |
442 # define YYCOPY(To, From, Count) \ | 463 # define YYCOPY(Dst, Src, Count) \ |
443 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | 464 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
444 # else | 465 # else |
445 # define YYCOPY(To, From, Count)» » \ | 466 # define YYCOPY(Dst, Src, Count) \ |
446 do» » » » » \ | 467 do \ |
447 » {» » » » » \ | 468 { \ |
448 » YYSIZE_T yyi;»» » » \ | 469 YYSIZE_T yyi; \ |
449 » for (yyi = 0; yyi < (Count); yyi++)» \ | 470 for (yyi = 0; yyi < (Count); yyi++) \ |
450 » (To)[yyi] = (From)[yyi];» » \ | 471 (Dst)[yyi] = (Src)[yyi]; \ |
451 » }» » » » » \ | 472 } \ |
452 while (YYID (0)) | 473 while (YYID (0)) |
453 # endif | 474 # endif |
454 # endif | 475 # endif |
455 #endif /* !YYCOPY_NEEDED */ | 476 #endif /* !YYCOPY_NEEDED */ |
456 | 477 |
457 /* YYFINAL -- State number of the termination state. */ | 478 /* YYFINAL -- State number of the termination state. */ |
458 #define YYFINAL 4 | 479 #define YYFINAL 4 |
459 /* YYLAST -- Last index in YYTABLE. */ | 480 /* YYLAST -- Last index in YYTABLE. */ |
460 #define YYLAST 2144 | 481 #define YYLAST 2144 |
461 | 482 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 195, 60, -1, 202, -1, 3, -1, 50, 3, -1, | 687 195, 60, -1, 202, -1, 3, -1, 50, 3, -1, |
667 141, -1, 212, -1, 59, 212, 49, 212, 60, -1, | 688 141, -1, 212, -1, 59, 212, 49, 212, 60, -1, |
668 -1, 214, 199, -1, 207, -1, 215, 75, 207, -1, | 689 -1, 214, 199, -1, 207, -1, 215, 75, 207, -1, |
669 208, -1, 216, 62, 208, -1, 209, -1, 217, 62, | 690 208, -1, 216, 62, 208, -1, 209, -1, 217, 62, |
670 209, -1 | 691 209, -1 |
671 }; | 692 }; |
672 | 693 |
673 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 694 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
674 static const yytype_uint16 yyrline[] = | 695 static const yytype_uint16 yyrline[] = |
675 { | 696 { |
676 0, 124, 124, 133, 140, 151, 151, 166, 167, 170, | 697 0, 127, 127, 136, 143, 154, 154, 169, 170, 173, |
677 171, 172, 175, 208, 219, 220, 223, 230, 237, 246, | 698 174, 175, 178, 211, 222, 223, 226, 233, 240, 249, |
678 259, 260, 267, 267, 280, 284, 285, 289, 294, 300, | 699 262, 263, 270, 270, 283, 287, 288, 292, 297, 303, |
679 304, 308, 312, 318, 324, 330, 335, 339, 343, 349, | 700 307, 311, 315, 321, 327, 333, 338, 342, 346, 352, |
680 355, 359, 363, 369, 373, 379, 380, 384, 390, 399, | 701 358, 362, 366, 372, 376, 382, 383, 387, 393, 402, |
681 405, 409, 414, 426, 442, 447, 454, 474, 492, 501, | 702 408, 412, 417, 429, 445, 450, 457, 477, 495, 504, |
682 520, 519, 531, 530, 561, 564, 571, 570, 581, 587, | 703 523, 522, 534, 533, 564, 567, 574, 573, 584, 590, |
683 596, 607, 613, 616, 624, 623, 634, 640, 652, 656, | 704 599, 610, 616, 619, 627, 626, 637, 643, 655, 659, |
684 661, 651, 682, 681, 694, 697, 703, 706, 718, 722, | 705 664, 654, 685, 684, 697, 700, 706, 709, 721, 725, |
685 717, 740, 739, 755, 756, 760, 764, 768, 772, 776, | 706 720, 743, 742, 758, 759, 763, 767, 771, 775, 779, |
686 780, 784, 788, 792, 796, 800, 804, 808, 812, 816, | 707 783, 787, 791, 795, 799, 803, 807, 811, 815, 819, |
687 820, 824, 828, 833, 839, 840, 844, 855, 859, 863, | 708 823, 827, 831, 836, 842, 843, 847, 858, 862, 866, |
688 867, 872, 876, 886, 890, 895, 903, 907, 908, 919, | 709 870, 875, 879, 889, 893, 898, 906, 910, 911, 922, |
689 923, 927, 931, 935, 936, 942, 949, 955, 962, 965, | 710 926, 930, 934, 938, 939, 945, 952, 958, 965, 968, |
690 972, 978, 994, 1001, 1002, 1009, 1010, 1029, 1030, 1033, | 711 975, 981, 997, 1004, 1005, 1012, 1013, 1032, 1033, 1036, |
691 1036, 1040, 1051, 1060, 1066, 1069, 1072, 1079, 1080, 1086, | 712 1039, 1043, 1054, 1063, 1069, 1072, 1075, 1082, 1083, 1089, |
692 1101, 1109, 1121, 1126, 1132, 1133, 1134, 1135, 1136, 1137, | 713 1104, 1112, 1124, 1129, 1135, 1136, 1137, 1138, 1139, 1140, |
693 1143, 1144, 1145, 1146, 1152, 1153, 1154, 1155, 1156, 1162, | 714 1146, 1147, 1148, 1149, 1155, 1156, 1157, 1158, 1159, 1165, |
694 1163, 1166, 1169, 1170, 1171, 1172, 1173, 1176, 1177, 1190, | 715 1166, 1169, 1172, 1173, 1174, 1175, 1176, 1179, 1180, 1193, |
695 1194, 1199, 1204, 1209, 1213, 1214, 1217, 1223, 1230, 1236, | 716 1197, 1202, 1207, 1212, 1216, 1217, 1220, 1226, 1233, 1239, |
696 1243, 1249, 1260, 1271, 1300, 1340, 1365, 1383, 1392, 1395, | 717 1246, 1252, 1263, 1274, 1303, 1343, 1368, 1391, 1400, 1403, |
697 1403, 1407, 1411, 1418, 1424, 1429, 1441, 1444, 1453, 1454, | 718 1411, 1415, 1419, 1426, 1432, 1437, 1449, 1452, 1461, 1462, |
698 1460, 1461, 1467, 1471, 1477, 1478, 1484, 1488, 1494, 1517, | 719 1468, 1469, 1475, 1479, 1485, 1486, 1492, 1496, 1502, 1525, |
699 1522, 1528, 1534, 1541, 1550, 1559, 1574, 1580, 1585, 1589, | 720 1530, 1536, 1542, 1549, 1558, 1567, 1582, 1588, 1593, 1597, |
700 1596, 1609, 1610, 1616, 1622, 1625, 1629, 1635, 1638, 1647, | 721 1604, 1617, 1618, 1624, 1630, 1633, 1637, 1643, 1646, 1655, |
701 1650, 1651, 1655, 1656, 1662, 1663, 1664, 1665, 1666, 1668, | 722 1658, 1659, 1663, 1664, 1670, 1671, 1672, 1673, 1674, 1676, |
702 1667, 1682, 1687, 1691, 1695, 1699, 1703, 1708, 1727, 1733, | 723 1675, 1690, 1695, 1699, 1703, 1707, 1711, 1716, 1735, 1741, |
703 1741, 1745, 1751, 1755, 1761, 1765, 1771, 1775, 1784, 1788, | 724 1749, 1753, 1759, 1763, 1769, 1773, 1779, 1783, 1792, 1796, |
704 1792, 1796, 1802, 1805, 1813, 1814, 1816, 1817, 1820, 1823, | 725 1800, 1804, 1810, 1813, 1821, 1822, 1824, 1825, 1828, 1831, |
705 1826, 1829, 1832, 1835, 1838, 1841, 1844, 1847, 1850, 1853, | 726 1834, 1837, 1840, 1843, 1846, 1849, 1852, 1855, 1858, 1861, |
706 1856, 1859, 1865, 1869, 1873, 1877, 1881, 1885, 1905, 1912, | 727 1864, 1867, 1873, 1877, 1881, 1885, 1889, 1893, 1913, 1920, |
707 1923, 1924, 1925, 1928, 1929, 1932, 1936, 1946, 1950, 1954, | 728 1931, 1932, 1933, 1936, 1937, 1940, 1944, 1954, 1958, 1962, |
708 1958, 1962, 1966, 1970, 1976, 1982, 1990, 1998, 2004, 2011, | 729 1966, 1970, 1974, 1978, 1984, 1990, 1998, 2006, 2012, 2017, |
709 2027, 2045, 2049, 2055, 2058, 2061, 2065, 2075, 2079, 2094, | 730 2031, 2049, 2053, 2059, 2062, 2065, 2069, 2079, 2083, 2098, |
710 2102, 2103, 2115, 2116, 2119, 2123, 2129, 2133, 2139, 2143 | 731 2106, 2107, 2119, 2120, 2123, 2127, 2133, 2137, 2143, 2147 |
711 }; | 732 }; |
712 #endif | 733 #endif |
713 | 734 |
714 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | 735 #if YYDEBUG || YYERROR_VERBOSE || 1 |
715 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | 736 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
716 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | 737 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
717 const char *yytname[] = | 738 const char *yytname[] = |
718 { | 739 { |
719 "$end", "error", "$undefined", "LLITERAL", "LASOP", "LCOLAS", "LBREAK", | 740 "$end", "error", "$undefined", "LLITERAL", "LASOP", "LCOLAS", "LBREAK", |
720 "LCASE", "LCHAN", "LCONST", "LCONTINUE", "LDDD", "LDEFAULT", "LDEFER", | 741 "LCASE", "LCHAN", "LCONST", "LCONTINUE", "LDDD", "LDEFAULT", "LDEFER", |
721 "LELSE", "LFALL", "LFOR", "LFUNC", "LGO", "LGOTO", "LIF", "LIMPORT", | 742 "LELSE", "LFALL", "LFOR", "LFUNC", "LGO", "LGOTO", "LIF", "LIMPORT", |
722 "LINTERFACE", "LMAP", "LNAME", "LPACKAGE", "LRANGE", "LRETURN", | 743 "LINTERFACE", "LMAP", "LNAME", "LPACKAGE", "LRANGE", "LRETURN", |
723 "LSELECT", "LSTRUCT", "LSWITCH", "LTYPE", "LVAR", "LANDAND", "LANDNOT", | 744 "LSELECT", "LSTRUCT", "LSWITCH", "LTYPE", "LVAR", "LANDAND", "LANDNOT", |
724 "LBODY", "LCOMM", "LDEC", "LEQ", "LGE", "LGT", "LIGNORE", "LINC", "LLE", | 745 "LBODY", "LCOMM", "LDEC", "LEQ", "LGE", "LGT", "LIGNORE", "LINC", "LLE", |
(...skipping 24 matching lines...) Expand all Loading... |
749 "expr_list", "expr_or_type_list", "keyval_list", "braced_keyval_list", | 770 "expr_list", "expr_or_type_list", "keyval_list", "braced_keyval_list", |
750 "osemi", "ocomma", "oexpr", "oexpr_list", "osimple_stmt", | 771 "osemi", "ocomma", "oexpr", "oexpr_list", "osimple_stmt", |
751 "ohidden_funarg_list", "ohidden_structdcl_list", | 772 "ohidden_funarg_list", "ohidden_structdcl_list", |
752 "ohidden_interfacedcl_list", "oliteral", "hidden_import", | 773 "ohidden_interfacedcl_list", "oliteral", "hidden_import", |
753 "hidden_pkg_importsym", "hidden_pkgtype", "hidden_type", | 774 "hidden_pkg_importsym", "hidden_pkgtype", "hidden_type", |
754 "hidden_type_non_recv_chan", "hidden_type_misc", "hidden_type_recv_chan", | 775 "hidden_type_non_recv_chan", "hidden_type_misc", "hidden_type_recv_chan", |
755 "hidden_type_func", "hidden_funarg", "hidden_structdcl", | 776 "hidden_type_func", "hidden_funarg", "hidden_structdcl", |
756 "hidden_interfacedcl", "ohidden_funres", "hidden_funres", | 777 "hidden_interfacedcl", "ohidden_funres", "hidden_funres", |
757 "hidden_literal", "hidden_constant", "hidden_import_list", | 778 "hidden_literal", "hidden_constant", "hidden_import_list", |
758 "hidden_funarg_list", "hidden_structdcl_list", | 779 "hidden_funarg_list", "hidden_structdcl_list", |
759 "hidden_interfacedcl_list", 0 | 780 "hidden_interfacedcl_list", YY_NULL |
760 }; | 781 }; |
761 #endif | 782 #endif |
762 | 783 |
763 # ifdef YYPRINT | 784 # ifdef YYPRINT |
764 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | 785 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
765 token YYLEX-NUM. */ | 786 token YYLEX-NUM. */ |
766 static const yytype_uint16 yytoknum[] = | 787 static const yytype_uint16 yytoknum[] = |
767 { | 788 { |
768 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 789 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
769 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 790 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 196, 197, 0, 176, 177, 434, 178, 0, 180, 181, | 1281 196, 197, 0, 176, 177, 434, 178, 0, 180, 181, |
1261 182, 0, 0, 184, 185, 186, 187, 188, 189, 190, | 1282 182, 0, 0, 184, 185, 186, 187, 188, 189, 190, |
1262 191, 192, 193, 194, 195, 196, 197, 176, 177, 0, | 1283 191, 192, 193, 194, 195, 196, 197, 176, 177, 0, |
1263 0, 0, 180, 181, 182, 0, 0, 184, 185, 186, | 1284 0, 0, 180, 181, 182, 0, 0, 184, 185, 186, |
1264 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, | 1285 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, |
1265 197, 176, 177, 0, 0, 0, 180, 181, 182, 0, | 1286 197, 176, 177, 0, 0, 0, 180, 181, 182, 0, |
1266 0, 184, 185, 186, 187, 0, 189, 190, 191, 192, | 1287 0, 184, 185, 186, 187, 0, 189, 190, 191, 192, |
1267 193, 194, 195, 196, 197 | 1288 193, 194, 195, 196, 197 |
1268 }; | 1289 }; |
1269 | 1290 |
1270 #define yypact_value_is_default(yystate) \ | 1291 #define yypact_value_is_default(Yystate) \ |
1271 ((yystate) == (-467)) | 1292 (!!((Yystate) == (-467))) |
1272 | 1293 |
1273 #define yytable_value_is_error(yytable_value) \ | 1294 #define yytable_value_is_error(Yytable_value) \ |
1274 YYID (0) | 1295 YYID (0) |
1275 | 1296 |
1276 static const yytype_int16 yycheck[] = | 1297 static const yytype_int16 yycheck[] = |
1277 { | 1298 { |
1278 5, 67, 142, 204, 37, 126, 37, 61, 377, 223, | 1299 5, 67, 142, 204, 37, 126, 37, 61, 377, 223, |
1279 36, 132, 323, 39, 126, 20, 143, 22, 201, 45, | 1300 36, 132, 323, 39, 126, 20, 143, 22, 201, 45, |
1280 258, 142, 28, 28, 147, 485, 135, 250, 452, 267, | 1301 258, 142, 28, 28, 147, 485, 135, 250, 452, 267, |
1281 444, 36, 263, 264, 39, 249, 61, 275, 43, 321, | 1302 444, 36, 263, 264, 39, 249, 61, 275, 43, 321, |
1282 45, 279, 316, 67, 31, 24, 59, 24, 53, 54, | 1303 45, 279, 316, 67, 31, 24, 59, 24, 53, 54, |
1283 5, 289, 3, 0, 62, 37, 24, 3, 24, 11, | 1304 5, 289, 3, 0, 62, 37, 24, 3, 24, 11, |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 #define YYFAIL goto yyerrlab | 1606 #define YYFAIL goto yyerrlab |
1586 #if defined YYFAIL | 1607 #if defined YYFAIL |
1587 /* This is here to suppress warnings from the GCC cpp's | 1608 /* This is here to suppress warnings from the GCC cpp's |
1588 -Wunused-macros. Normally we don't worry about that warning, but | 1609 -Wunused-macros. Normally we don't worry about that warning, but |
1589 some users do, and we want to make it easy for users to remove | 1610 some users do, and we want to make it easy for users to remove |
1590 YYFAIL uses, which will produce warnings from Bison 2.5. */ | 1611 YYFAIL uses, which will produce warnings from Bison 2.5. */ |
1591 #endif | 1612 #endif |
1592 | 1613 |
1593 #define YYRECOVERING() (!!yyerrstatus) | 1614 #define YYRECOVERING() (!!yyerrstatus) |
1594 | 1615 |
1595 #define YYBACKUP(Token, Value)» » » » » \ | 1616 #define YYBACKUP(Token, Value) \ |
1596 do» » » » » » » » \ | 1617 do \ |
1597 if (yychar == YYEMPTY && yylen == 1)» » » » \ | 1618 if (yychar == YYEMPTY) \ |
1598 {» » » » » » » » \ | 1619 { \ |
1599 yychar = (Token);»» » » » » \ | 1620 yychar = (Token); \ |
1600 yylval = (Value);»» » » » » \ | 1621 yylval = (Value); \ |
1601 YYPOPSTACK (1);» » » » » » \ | 1622 YYPOPSTACK (yylen); \ |
1602 goto yybackup;» » » » » » \ | 1623 yystate = *yyssp; \ |
1603 }» » » » » » » » \ | 1624 goto yybackup; \ |
1604 else» » » » » » » » \ | 1625 } \ |
1605 {» » » » » » » » \ | 1626 else \ |
| 1627 { \ |
1606 yyerror (YY_("syntax error: cannot back up")); \ | 1628 yyerror (YY_("syntax error: cannot back up")); \ |
1607 YYERROR; \ | 1629 YYERROR; \ |
1608 } \ | 1630 } \ |
1609 while (YYID (0)) | 1631 while (YYID (0)) |
1610 | 1632 |
1611 | 1633 /* Error token number */ |
1612 #define YYTERROR 1 | 1634 #define YYTERROR 1 |
1613 #define YYERRCODE 256 | 1635 #define YYERRCODE 256 |
1614 | 1636 |
1615 | 1637 |
1616 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |
1617 If N is 0, then set CURRENT to the empty location which ends | |
1618 the previous symbol: RHS[0] (always defined). */ | |
1619 | |
1620 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | |
1621 #ifndef YYLLOC_DEFAULT | |
1622 # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |
1623 do \ | |
1624 if (YYID (N)) \ | |
1625 { \ | |
1626 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | |
1627 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | |
1628 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | |
1629 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | |
1630 } \ | |
1631 else \ | |
1632 { \ | |
1633 (Current).first_line = (Current).last_line = \ | |
1634 YYRHSLOC (Rhs, 0).last_line; \ | |
1635 (Current).first_column = (Current).last_column = \ | |
1636 YYRHSLOC (Rhs, 0).last_column; \ | |
1637 } \ | |
1638 while (YYID (0)) | |
1639 #endif | |
1640 | |
1641 | |
1642 /* This macro is provided for backward compatibility. */ | 1638 /* This macro is provided for backward compatibility. */ |
1643 | |
1644 #ifndef YY_LOCATION_PRINT | 1639 #ifndef YY_LOCATION_PRINT |
1645 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | 1640 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
1646 #endif | 1641 #endif |
1647 | 1642 |
1648 | 1643 |
1649 /* YYLEX -- calling `yylex' with the right arguments. */ | 1644 /* YYLEX -- calling `yylex' with the right arguments. */ |
1650 | |
1651 #ifdef YYLEX_PARAM | 1645 #ifdef YYLEX_PARAM |
1652 # define YYLEX yylex (YYLEX_PARAM) | 1646 # define YYLEX yylex (YYLEX_PARAM) |
1653 #else | 1647 #else |
1654 # define YYLEX yylex () | 1648 # define YYLEX yylex () |
1655 #endif | 1649 #endif |
1656 | 1650 |
1657 /* Enable debugging if requested. */ | 1651 /* Enable debugging if requested. */ |
1658 #if YYDEBUG | 1652 #if YYDEBUG |
1659 | 1653 |
1660 # ifndef YYFPRINTF | 1654 # ifndef YYFPRINTF |
(...skipping 29 matching lines...) Expand all Loading... |
1690 static void | 1684 static void |
1691 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
p) | 1685 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
p) |
1692 #else | 1686 #else |
1693 static void | 1687 static void |
1694 yy_symbol_value_print (yyoutput, yytype, yyvaluep) | 1688 yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
1695 FILE *yyoutput; | 1689 FILE *yyoutput; |
1696 int yytype; | 1690 int yytype; |
1697 YYSTYPE const * const yyvaluep; | 1691 YYSTYPE const * const yyvaluep; |
1698 #endif | 1692 #endif |
1699 { | 1693 { |
| 1694 FILE *yyo = yyoutput; |
| 1695 YYUSE (yyo); |
1700 if (!yyvaluep) | 1696 if (!yyvaluep) |
1701 return; | 1697 return; |
1702 # ifdef YYPRINT | 1698 # ifdef YYPRINT |
1703 if (yytype < YYNTOKENS) | 1699 if (yytype < YYNTOKENS) |
1704 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | 1700 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
1705 # else | 1701 # else |
1706 YYUSE (yyoutput); | 1702 YYUSE (yyoutput); |
1707 # endif | 1703 # endif |
1708 switch (yytype) | 1704 switch (yytype) |
1709 { | 1705 { |
1710 default: | 1706 default: |
1711 » break; | 1707 break; |
1712 } | 1708 } |
1713 } | 1709 } |
1714 | 1710 |
1715 | 1711 |
1716 /*--------------------------------. | 1712 /*--------------------------------. |
1717 | Print this symbol on YYOUTPUT. | | 1713 | Print this symbol on YYOUTPUT. | |
1718 `--------------------------------*/ | 1714 `--------------------------------*/ |
1719 | 1715 |
1720 #if (defined __STDC__ || defined __C99__FUNC__ \ | 1716 #if (defined __STDC__ || defined __C99__FUNC__ \ |
1721 || defined __cplusplus || defined _MSC_VER) | 1717 || defined __cplusplus || defined _MSC_VER) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 YYSSP. | 1937 YYSSP. |
1942 | 1938 |
1943 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is | 1939 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1944 not large enough to hold the message. In that case, also set | 1940 not large enough to hold the message. In that case, also set |
1945 *YYMSG_ALLOC to the required number of bytes. Return 2 if the | 1941 *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1946 required number of bytes is too large to store. */ | 1942 required number of bytes is too large to store. */ |
1947 static int | 1943 static int |
1948 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | 1944 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
1949 yytype_int16 *yyssp, int yytoken) | 1945 yytype_int16 *yyssp, int yytoken) |
1950 { | 1946 { |
1951 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); | 1947 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); |
1952 YYSIZE_T yysize = yysize0; | 1948 YYSIZE_T yysize = yysize0; |
1953 YYSIZE_T yysize1; | |
1954 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1949 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1955 /* Internationalized format string. */ | 1950 /* Internationalized format string. */ |
1956 const char *yyformat = 0; | 1951 const char *yyformat = YY_NULL; |
1957 /* Arguments of yyformat. */ | 1952 /* Arguments of yyformat. */ |
1958 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1953 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1959 /* Number of reported tokens (one for the "unexpected", one per | 1954 /* Number of reported tokens (one for the "unexpected", one per |
1960 "expected"). */ | 1955 "expected"). */ |
1961 int yycount = 0; | 1956 int yycount = 0; |
1962 | 1957 |
1963 /* There are many possibilities here to consider: | 1958 /* There are many possibilities here to consider: |
1964 - Assume YYFAIL is not used. It's too flawed to consider. See | 1959 - Assume YYFAIL is not used. It's too flawed to consider. See |
1965 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | 1960 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> |
1966 for details. YYERROR is fine as it does not invoke this | 1961 for details. YYERROR is fine as it does not invoke this |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR | 2001 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
2007 && !yytable_value_is_error (yytable[yyx + yyn])) | 2002 && !yytable_value_is_error (yytable[yyx + yyn])) |
2008 { | 2003 { |
2009 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | 2004 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
2010 { | 2005 { |
2011 yycount = 1; | 2006 yycount = 1; |
2012 yysize = yysize0; | 2007 yysize = yysize0; |
2013 break; | 2008 break; |
2014 } | 2009 } |
2015 yyarg[yycount++] = yytname[yyx]; | 2010 yyarg[yycount++] = yytname[yyx]; |
2016 yysize1 = yysize + yytnamerr (0, yytname[yyx]); | 2011 { |
2017 if (! (yysize <= yysize1 | 2012 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); |
2018 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | 2013 if (! (yysize <= yysize1 |
2019 return 2; | 2014 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
2020 yysize = yysize1; | 2015 return 2; |
| 2016 yysize = yysize1; |
| 2017 } |
2021 } | 2018 } |
2022 } | 2019 } |
2023 } | 2020 } |
2024 | 2021 |
2025 switch (yycount) | 2022 switch (yycount) |
2026 { | 2023 { |
2027 # define YYCASE_(N, S) \ | 2024 # define YYCASE_(N, S) \ |
2028 case N: \ | 2025 case N: \ |
2029 yyformat = S; \ | 2026 yyformat = S; \ |
2030 break | 2027 break |
2031 YYCASE_(0, YY_("syntax error")); | 2028 YYCASE_(0, YY_("syntax error")); |
2032 YYCASE_(1, YY_("syntax error, unexpected %s")); | 2029 YYCASE_(1, YY_("syntax error, unexpected %s")); |
2033 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | 2030 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
2034 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | 2031 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
2035 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | 2032 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
2036 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %
s")); | 2033 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %
s")); |
2037 # undef YYCASE_ | 2034 # undef YYCASE_ |
2038 } | 2035 } |
2039 | 2036 |
2040 yysize1 = yysize + yystrlen (yyformat); | 2037 { |
2041 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | 2038 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); |
2042 return 2; | 2039 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
2043 yysize = yysize1; | 2040 return 2; |
| 2041 yysize = yysize1; |
| 2042 } |
2044 | 2043 |
2045 if (*yymsg_alloc < yysize) | 2044 if (*yymsg_alloc < yysize) |
2046 { | 2045 { |
2047 *yymsg_alloc = 2 * yysize; | 2046 *yymsg_alloc = 2 * yysize; |
2048 if (! (yysize <= *yymsg_alloc | 2047 if (! (yysize <= *yymsg_alloc |
2049 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) | 2048 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
2050 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; | 2049 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
2051 return 1; | 2050 return 1; |
2052 } | 2051 } |
2053 | 2052 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 YYUSE (yyvaluep); | 2092 YYUSE (yyvaluep); |
2094 | 2093 |
2095 if (!yymsg) | 2094 if (!yymsg) |
2096 yymsg = "Deleting"; | 2095 yymsg = "Deleting"; |
2097 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | 2096 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
2098 | 2097 |
2099 switch (yytype) | 2098 switch (yytype) |
2100 { | 2099 { |
2101 | 2100 |
2102 default: | 2101 default: |
2103 » break; | 2102 break; |
2104 } | 2103 } |
2105 } | 2104 } |
2106 | 2105 |
2107 | 2106 |
2108 /* Prevent warnings from -Wmissing-prototypes. */ | |
2109 #ifdef YYPARSE_PARAM | |
2110 #if defined __STDC__ || defined __cplusplus | |
2111 int yyparse (void *YYPARSE_PARAM); | |
2112 #else | |
2113 int yyparse (); | |
2114 #endif | |
2115 #else /* ! YYPARSE_PARAM */ | |
2116 #if defined __STDC__ || defined __cplusplus | |
2117 int yyparse (void); | |
2118 #else | |
2119 int yyparse (); | |
2120 #endif | |
2121 #endif /* ! YYPARSE_PARAM */ | |
2122 | 2107 |
2123 | 2108 |
2124 /* The lookahead symbol. */ | 2109 /* The lookahead symbol. */ |
2125 int yychar, yystate; | 2110 int yychar, yystate; |
2126 | 2111 |
| 2112 |
| 2113 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 2114 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 2115 # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 2116 #endif |
| 2117 #ifndef YY_INITIAL_VALUE |
| 2118 # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
| 2119 #endif |
| 2120 |
2127 /* The semantic value of the lookahead symbol. */ | 2121 /* The semantic value of the lookahead symbol. */ |
2128 YYSTYPE yylval; | 2122 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); |
2129 | 2123 |
2130 /* Number of syntax errors so far. */ | 2124 /* Number of syntax errors so far. */ |
2131 int yynerrs; | 2125 int yynerrs; |
2132 | 2126 |
2133 | 2127 |
2134 /*----------. | 2128 /*----------. |
2135 | yyparse. | | 2129 | yyparse. | |
2136 `----------*/ | 2130 `----------*/ |
2137 | 2131 |
2138 #ifdef YYPARSE_PARAM | 2132 #ifdef YYPARSE_PARAM |
(...skipping 18 matching lines...) Expand all Loading... |
2157 #endif | 2151 #endif |
2158 #endif | 2152 #endif |
2159 { | 2153 { |
2160 /* Number of tokens to shift before error messages enabled. */ | 2154 /* Number of tokens to shift before error messages enabled. */ |
2161 int yyerrstatus; | 2155 int yyerrstatus; |
2162 | 2156 |
2163 /* The stacks and their tools: | 2157 /* The stacks and their tools: |
2164 `yyss': related to states. | 2158 `yyss': related to states. |
2165 `yyvs': related to semantic values. | 2159 `yyvs': related to semantic values. |
2166 | 2160 |
2167 Refer to the stacks thru separate pointers, to allow yyoverflow | 2161 Refer to the stacks through separate pointers, to allow yyoverflow |
2168 to reallocate them elsewhere. */ | 2162 to reallocate them elsewhere. */ |
2169 | 2163 |
2170 /* The state stack. */ | 2164 /* The state stack. */ |
2171 yytype_int16 yyssa[YYINITDEPTH]; | 2165 yytype_int16 yyssa[YYINITDEPTH]; |
2172 yytype_int16 *yyss; | 2166 yytype_int16 *yyss; |
2173 yytype_int16 *yyssp; | 2167 yytype_int16 *yyssp; |
2174 | 2168 |
2175 /* The semantic value stack. */ | 2169 /* The semantic value stack. */ |
2176 YYSTYPE yyvsa[YYINITDEPTH]; | 2170 YYSTYPE yyvsa[YYINITDEPTH]; |
2177 YYSTYPE *yyvs; | 2171 YYSTYPE *yyvs; |
2178 YYSTYPE *yyvsp; | 2172 YYSTYPE *yyvsp; |
2179 | 2173 |
2180 YYSIZE_T yystacksize; | 2174 YYSIZE_T yystacksize; |
2181 | 2175 |
2182 int yyn; | 2176 int yyn; |
2183 int yyresult; | 2177 int yyresult; |
2184 /* Lookahead token as an internal (translated) token number. */ | 2178 /* Lookahead token as an internal (translated) token number. */ |
2185 int yytoken; | 2179 int yytoken = 0; |
2186 /* The variables used to return semantic value and location from the | 2180 /* The variables used to return semantic value and location from the |
2187 action routines. */ | 2181 action routines. */ |
2188 YYSTYPE yyval; | 2182 YYSTYPE yyval; |
2189 | 2183 |
2190 #if YYERROR_VERBOSE | 2184 #if YYERROR_VERBOSE |
2191 /* Buffer for error messages, and its allocated size. */ | 2185 /* Buffer for error messages, and its allocated size. */ |
2192 char yymsgbuf[128]; | 2186 char yymsgbuf[128]; |
2193 char *yymsg = yymsgbuf; | 2187 char *yymsg = yymsgbuf; |
2194 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | 2188 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
2195 #endif | 2189 #endif |
2196 | 2190 |
2197 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 2191 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
2198 | 2192 |
2199 /* The number of symbols on the RHS of the reduced rule. | 2193 /* The number of symbols on the RHS of the reduced rule. |
2200 Keep to zero when no symbol should be popped. */ | 2194 Keep to zero when no symbol should be popped. */ |
2201 int yylen = 0; | 2195 int yylen = 0; |
2202 | 2196 |
2203 yytoken = 0; | 2197 yyssp = yyss = yyssa; |
2204 yyss = yyssa; | 2198 yyvsp = yyvs = yyvsa; |
2205 yyvs = yyvsa; | |
2206 yystacksize = YYINITDEPTH; | 2199 yystacksize = YYINITDEPTH; |
2207 | 2200 |
2208 YYDPRINTF ((stderr, "Starting parse\n")); | 2201 YYDPRINTF ((stderr, "Starting parse\n")); |
2209 | 2202 |
2210 yystate = 0; | 2203 yystate = 0; |
2211 yyerrstatus = 0; | 2204 yyerrstatus = 0; |
2212 yynerrs = 0; | 2205 yynerrs = 0; |
2213 yychar = YYEMPTY; /* Cause a token to be read. */ | 2206 yychar = YYEMPTY; /* Cause a token to be read. */ |
2214 | |
2215 /* Initialize stack pointers. | |
2216 Waste one element of value and location stack | |
2217 so that they stay on the same level as the state stack. | |
2218 The wasted elements are never initialized. */ | |
2219 yyssp = yyss; | |
2220 yyvsp = yyvs; | |
2221 | |
2222 goto yysetstate; | 2207 goto yysetstate; |
2223 | 2208 |
2224 /*------------------------------------------------------------. | 2209 /*------------------------------------------------------------. |
2225 | yynewstate -- Push a new state, which is found in yystate. | | 2210 | yynewstate -- Push a new state, which is found in yystate. | |
2226 `------------------------------------------------------------*/ | 2211 `------------------------------------------------------------*/ |
2227 yynewstate: | 2212 yynewstate: |
2228 /* In all cases, when you get here, the value and location stacks | 2213 /* In all cases, when you get here, the value and location stacks |
2229 have just been pushed. So pushing a state here evens the stacks. */ | 2214 have just been pushed. So pushing a state here evens the stacks. */ |
2230 yyssp++; | 2215 yyssp++; |
2231 | 2216 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 if (yyerrstatus) | 2337 if (yyerrstatus) |
2353 yyerrstatus--; | 2338 yyerrstatus--; |
2354 | 2339 |
2355 /* Shift the lookahead token. */ | 2340 /* Shift the lookahead token. */ |
2356 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 2341 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
2357 | 2342 |
2358 /* Discard the shifted token. */ | 2343 /* Discard the shifted token. */ |
2359 yychar = YYEMPTY; | 2344 yychar = YYEMPTY; |
2360 | 2345 |
2361 yystate = yyn; | 2346 yystate = yyn; |
| 2347 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
2362 *++yyvsp = yylval; | 2348 *++yyvsp = yylval; |
| 2349 YY_IGNORE_MAYBE_UNINITIALIZED_END |
2363 | 2350 |
2364 goto yynewstate; | 2351 goto yynewstate; |
2365 | 2352 |
2366 | 2353 |
2367 /*-----------------------------------------------------------. | 2354 /*-----------------------------------------------------------. |
2368 | yydefault -- do the default action for the current state. | | 2355 | yydefault -- do the default action for the current state. | |
2369 `-----------------------------------------------------------*/ | 2356 `-----------------------------------------------------------*/ |
2370 yydefault: | 2357 yydefault: |
2371 yyn = yydefact[yystate]; | 2358 yyn = yydefact[yystate]; |
2372 if (yyn == 0) | 2359 if (yyn == 0) |
(...skipping 16 matching lines...) Expand all Loading... |
2389 users should not rely upon it. Assigning to YYVAL | 2376 users should not rely upon it. Assigning to YYVAL |
2390 unconditionally makes the parser a bit smaller, and it avoids a | 2377 unconditionally makes the parser a bit smaller, and it avoids a |
2391 GCC warning that YYVAL may be used uninitialized. */ | 2378 GCC warning that YYVAL may be used uninitialized. */ |
2392 yyval = yyvsp[1-yylen]; | 2379 yyval = yyvsp[1-yylen]; |
2393 | 2380 |
2394 | 2381 |
2395 YY_REDUCE_PRINT (yyn); | 2382 YY_REDUCE_PRINT (yyn); |
2396 switch (yyn) | 2383 switch (yyn) |
2397 { | 2384 { |
2398 case 2: | 2385 case 2: |
2399 | 2386 /* Line 1792 of yacc.c */ |
2400 /* Line 1806 of yacc.c */ | 2387 #line 131 "go.y" |
2401 #line 128 "go.y" | |
2402 { | 2388 { |
2403 xtop = concat(xtop, (yyvsp[(4) - (4)].list)); | 2389 xtop = concat(xtop, (yyvsp[(4) - (4)].list)); |
2404 } | 2390 } |
2405 break; | 2391 break; |
2406 | 2392 |
2407 case 3: | 2393 case 3: |
2408 | 2394 /* Line 1792 of yacc.c */ |
2409 /* Line 1806 of yacc.c */ | 2395 #line 137 "go.y" |
2410 #line 134 "go.y" | |
2411 { | 2396 { |
2412 prevlineno = lineno; | 2397 prevlineno = lineno; |
2413 yyerror("package statement must be first"); | 2398 yyerror("package statement must be first"); |
2414 flusherrors(); | 2399 flusherrors(); |
2415 mkpackage("main"); | 2400 mkpackage("main"); |
2416 } | 2401 } |
2417 break; | 2402 break; |
2418 | 2403 |
2419 case 4: | 2404 case 4: |
2420 | 2405 /* Line 1792 of yacc.c */ |
2421 /* Line 1806 of yacc.c */ | 2406 #line 144 "go.y" |
2422 #line 141 "go.y" | |
2423 { | 2407 { |
2424 mkpackage((yyvsp[(2) - (3)].sym)->name); | 2408 mkpackage((yyvsp[(2) - (3)].sym)->name); |
2425 } | 2409 } |
2426 break; | 2410 break; |
2427 | 2411 |
2428 case 5: | 2412 case 5: |
2429 | 2413 /* Line 1792 of yacc.c */ |
2430 /* Line 1806 of yacc.c */ | 2414 #line 154 "go.y" |
2431 #line 151 "go.y" | |
2432 { | 2415 { |
2433 importpkg = runtimepkg; | 2416 importpkg = runtimepkg; |
2434 | 2417 |
2435 if(debug['A']) | 2418 if(debug['A']) |
2436 cannedimports("runtime.builtin", "package runtime\n\n$$\
n\n"); | 2419 cannedimports("runtime.builtin", "package runtime\n\n$$\
n\n"); |
2437 else | 2420 else |
2438 cannedimports("runtime.builtin", runtimeimport); | 2421 cannedimports("runtime.builtin", runtimeimport); |
2439 curio.importsafe = 1; | 2422 curio.importsafe = 1; |
2440 } | 2423 } |
2441 break; | 2424 break; |
2442 | 2425 |
2443 case 6: | 2426 case 6: |
2444 | 2427 /* Line 1792 of yacc.c */ |
2445 /* Line 1806 of yacc.c */ | 2428 #line 165 "go.y" |
2446 #line 162 "go.y" | |
2447 { | 2429 { |
2448 importpkg = nil; | 2430 importpkg = nil; |
2449 } | 2431 } |
2450 break; | 2432 break; |
2451 | 2433 |
2452 case 12: | 2434 case 12: |
2453 | 2435 /* Line 1792 of yacc.c */ |
2454 /* Line 1806 of yacc.c */ | 2436 #line 179 "go.y" |
2455 #line 176 "go.y" | |
2456 { | 2437 { |
2457 Pkg *ipkg; | 2438 Pkg *ipkg; |
2458 Sym *my; | 2439 Sym *my; |
2459 Node *pack; | 2440 Node *pack; |
2460 ················ | 2441 ················ |
2461 ipkg = importpkg; | 2442 ipkg = importpkg; |
2462 my = importmyname; | 2443 my = importmyname; |
2463 importpkg = nil; | 2444 importpkg = nil; |
2464 importmyname = S; | 2445 importmyname = S; |
2465 | 2446 |
(...skipping 15 matching lines...) Expand all Loading... |
2481 lineno = (yyvsp[(1) - (3)].i); | 2462 lineno = (yyvsp[(1) - (3)].i); |
2482 redeclare(my, "as imported package name"); | 2463 redeclare(my, "as imported package name"); |
2483 } | 2464 } |
2484 my->def = pack; | 2465 my->def = pack; |
2485 my->lastlineno = (yyvsp[(1) - (3)].i); | 2466 my->lastlineno = (yyvsp[(1) - (3)].i); |
2486 my->block = 1; // at top level | 2467 my->block = 1; // at top level |
2487 } | 2468 } |
2488 break; | 2469 break; |
2489 | 2470 |
2490 case 13: | 2471 case 13: |
2491 | 2472 /* Line 1792 of yacc.c */ |
2492 /* Line 1806 of yacc.c */ | 2473 #line 212 "go.y" |
2493 #line 209 "go.y" | |
2494 { | 2474 { |
2495 // When an invalid import path is passed to importfile, | 2475 // When an invalid import path is passed to importfile, |
2496 // it calls yyerror and then sets up a fake import with | 2476 // it calls yyerror and then sets up a fake import with |
2497 // no package statement. This allows us to test more | 2477 // no package statement. This allows us to test more |
2498 // than one invalid import statement in a single file. | 2478 // than one invalid import statement in a single file. |
2499 if(nerrors == 0) | 2479 if(nerrors == 0) |
2500 fatal("phase error in import"); | 2480 fatal("phase error in import"); |
2501 } | 2481 } |
2502 break; | 2482 break; |
2503 | 2483 |
2504 case 16: | 2484 case 16: |
2505 | 2485 /* Line 1792 of yacc.c */ |
2506 /* Line 1806 of yacc.c */ | 2486 #line 227 "go.y" |
2507 #line 224 "go.y" | |
2508 { | 2487 { |
2509 // import with original name | 2488 // import with original name |
2510 (yyval.i) = parserline(); | 2489 (yyval.i) = parserline(); |
2511 importmyname = S; | 2490 importmyname = S; |
2512 importfile(&(yyvsp[(1) - (1)].val), (yyval.i)); | 2491 importfile(&(yyvsp[(1) - (1)].val), (yyval.i)); |
2513 } | 2492 } |
2514 break; | 2493 break; |
2515 | 2494 |
2516 case 17: | 2495 case 17: |
2517 | 2496 /* Line 1792 of yacc.c */ |
2518 /* Line 1806 of yacc.c */ | 2497 #line 234 "go.y" |
2519 #line 231 "go.y" | |
2520 { | 2498 { |
2521 // import with given name | 2499 // import with given name |
2522 (yyval.i) = parserline(); | 2500 (yyval.i) = parserline(); |
2523 importmyname = (yyvsp[(1) - (2)].sym); | 2501 importmyname = (yyvsp[(1) - (2)].sym); |
2524 importfile(&(yyvsp[(2) - (2)].val), (yyval.i)); | 2502 importfile(&(yyvsp[(2) - (2)].val), (yyval.i)); |
2525 } | 2503 } |
2526 break; | 2504 break; |
2527 | 2505 |
2528 case 18: | 2506 case 18: |
2529 | 2507 /* Line 1792 of yacc.c */ |
2530 /* Line 1806 of yacc.c */ | 2508 #line 241 "go.y" |
2531 #line 238 "go.y" | |
2532 { | 2509 { |
2533 // import into my name space | 2510 // import into my name space |
2534 (yyval.i) = parserline(); | 2511 (yyval.i) = parserline(); |
2535 importmyname = lookup("."); | 2512 importmyname = lookup("."); |
2536 importfile(&(yyvsp[(2) - (2)].val), (yyval.i)); | 2513 importfile(&(yyvsp[(2) - (2)].val), (yyval.i)); |
2537 } | 2514 } |
2538 break; | 2515 break; |
2539 | 2516 |
2540 case 19: | 2517 case 19: |
2541 | 2518 /* Line 1792 of yacc.c */ |
2542 /* Line 1806 of yacc.c */ | 2519 #line 250 "go.y" |
2543 #line 247 "go.y" | |
2544 { | 2520 { |
2545 if(importpkg->name == nil) { | 2521 if(importpkg->name == nil) { |
2546 importpkg->name = (yyvsp[(2) - (4)].sym)->name; | 2522 importpkg->name = (yyvsp[(2) - (4)].sym)->name; |
2547 pkglookup((yyvsp[(2) - (4)].sym)->name, nil)->npkg++; | 2523 pkglookup((yyvsp[(2) - (4)].sym)->name, nil)->npkg++; |
2548 } else if(strcmp(importpkg->name, (yyvsp[(2) - (4)].sym)->name)
!= 0) | 2524 } else if(strcmp(importpkg->name, (yyvsp[(2) - (4)].sym)->name)
!= 0) |
2549 yyerror("conflicting names %s and %s for package \"%Z\""
, importpkg->name, (yyvsp[(2) - (4)].sym)->name, importpkg->path); | 2525 yyerror("conflicting names %s and %s for package \"%Z\""
, importpkg->name, (yyvsp[(2) - (4)].sym)->name, importpkg->path); |
2550 importpkg->direct = 1; | 2526 importpkg->direct = 1; |
2551 ················ | 2527 ················ |
2552 if(safemode && !curio.importsafe) | 2528 if(safemode && !curio.importsafe) |
2553 yyerror("cannot import unsafe package \"%Z\"", importpkg
->path); | 2529 yyerror("cannot import unsafe package \"%Z\"", importpkg
->path); |
2554 } | 2530 } |
2555 break; | 2531 break; |
2556 | 2532 |
2557 case 21: | 2533 case 21: |
2558 | 2534 /* Line 1792 of yacc.c */ |
2559 /* Line 1806 of yacc.c */ | 2535 #line 264 "go.y" |
2560 #line 261 "go.y" | |
2561 { | 2536 { |
2562 if(strcmp((yyvsp[(1) - (1)].sym)->name, "safe") == 0) | 2537 if(strcmp((yyvsp[(1) - (1)].sym)->name, "safe") == 0) |
2563 curio.importsafe = 1; | 2538 curio.importsafe = 1; |
2564 } | 2539 } |
2565 break; | 2540 break; |
2566 | 2541 |
2567 case 22: | 2542 case 22: |
2568 | 2543 /* Line 1792 of yacc.c */ |
2569 /* Line 1806 of yacc.c */ | 2544 #line 270 "go.y" |
2570 #line 267 "go.y" | |
2571 { | 2545 { |
2572 defercheckwidth(); | 2546 defercheckwidth(); |
2573 } | 2547 } |
2574 break; | 2548 break; |
2575 | 2549 |
2576 case 23: | 2550 case 23: |
2577 | 2551 /* Line 1792 of yacc.c */ |
2578 /* Line 1806 of yacc.c */ | 2552 #line 274 "go.y" |
2579 #line 271 "go.y" | |
2580 { | 2553 { |
2581 resumecheckwidth(); | 2554 resumecheckwidth(); |
2582 unimportfile(); | 2555 unimportfile(); |
2583 } | 2556 } |
2584 break; | 2557 break; |
2585 | 2558 |
2586 case 24: | 2559 case 24: |
2587 | 2560 /* Line 1792 of yacc.c */ |
2588 /* Line 1806 of yacc.c */ | 2561 #line 283 "go.y" |
2589 #line 280 "go.y" | |
2590 { | 2562 { |
2591 yyerror("empty top-level declaration"); | 2563 yyerror("empty top-level declaration"); |
2592 (yyval.list) = nil; | 2564 (yyval.list) = nil; |
2593 } | 2565 } |
2594 break; | 2566 break; |
2595 | 2567 |
2596 case 26: | 2568 case 26: |
2597 | 2569 /* Line 1792 of yacc.c */ |
2598 /* Line 1806 of yacc.c */ | 2570 #line 289 "go.y" |
2599 #line 286 "go.y" | |
2600 { | 2571 { |
2601 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 2572 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
2602 } | 2573 } |
2603 break; | 2574 break; |
2604 | 2575 |
2605 case 27: | 2576 case 27: |
2606 | 2577 /* Line 1792 of yacc.c */ |
2607 /* Line 1806 of yacc.c */ | 2578 #line 293 "go.y" |
2608 #line 290 "go.y" | |
2609 { | 2579 { |
2610 yyerror("non-declaration statement outside function body"); | 2580 yyerror("non-declaration statement outside function body"); |
2611 (yyval.list) = nil; | 2581 (yyval.list) = nil; |
2612 } | 2582 } |
2613 break; | 2583 break; |
2614 | 2584 |
2615 case 28: | 2585 case 28: |
2616 | 2586 /* Line 1792 of yacc.c */ |
2617 /* Line 1806 of yacc.c */ | 2587 #line 298 "go.y" |
2618 #line 295 "go.y" | |
2619 { | 2588 { |
2620 (yyval.list) = nil; | 2589 (yyval.list) = nil; |
2621 } | 2590 } |
2622 break; | 2591 break; |
2623 | 2592 |
2624 case 29: | 2593 case 29: |
2625 | 2594 /* Line 1792 of yacc.c */ |
2626 /* Line 1806 of yacc.c */ | 2595 #line 304 "go.y" |
2627 #line 301 "go.y" | |
2628 { | 2596 { |
2629 (yyval.list) = (yyvsp[(2) - (2)].list); | 2597 (yyval.list) = (yyvsp[(2) - (2)].list); |
2630 } | 2598 } |
2631 break; | 2599 break; |
2632 | 2600 |
2633 case 30: | 2601 case 30: |
2634 | 2602 /* Line 1792 of yacc.c */ |
2635 /* Line 1806 of yacc.c */ | 2603 #line 308 "go.y" |
2636 #line 305 "go.y" | |
2637 { | 2604 { |
2638 (yyval.list) = (yyvsp[(3) - (5)].list); | 2605 (yyval.list) = (yyvsp[(3) - (5)].list); |
2639 } | 2606 } |
2640 break; | 2607 break; |
2641 | 2608 |
2642 case 31: | 2609 case 31: |
2643 | 2610 /* Line 1792 of yacc.c */ |
2644 /* Line 1806 of yacc.c */ | 2611 #line 312 "go.y" |
2645 #line 309 "go.y" | |
2646 { | 2612 { |
2647 (yyval.list) = nil; | 2613 (yyval.list) = nil; |
2648 } | 2614 } |
2649 break; | 2615 break; |
2650 | 2616 |
2651 case 32: | 2617 case 32: |
2652 | 2618 /* Line 1792 of yacc.c */ |
2653 /* Line 1806 of yacc.c */ | 2619 #line 316 "go.y" |
2654 #line 313 "go.y" | |
2655 { | 2620 { |
2656 (yyval.list) = (yyvsp[(2) - (2)].list); | 2621 (yyval.list) = (yyvsp[(2) - (2)].list); |
2657 iota = -100000; | 2622 iota = -100000; |
2658 lastconst = nil; | 2623 lastconst = nil; |
2659 } | 2624 } |
2660 break; | 2625 break; |
2661 | 2626 |
2662 case 33: | 2627 case 33: |
2663 | 2628 /* Line 1792 of yacc.c */ |
2664 /* Line 1806 of yacc.c */ | 2629 #line 322 "go.y" |
2665 #line 319 "go.y" | |
2666 { | 2630 { |
2667 (yyval.list) = (yyvsp[(3) - (5)].list); | 2631 (yyval.list) = (yyvsp[(3) - (5)].list); |
2668 iota = -100000; | 2632 iota = -100000; |
2669 lastconst = nil; | 2633 lastconst = nil; |
2670 } | 2634 } |
2671 break; | 2635 break; |
2672 | 2636 |
2673 case 34: | 2637 case 34: |
2674 | 2638 /* Line 1792 of yacc.c */ |
2675 /* Line 1806 of yacc.c */ | 2639 #line 328 "go.y" |
2676 #line 325 "go.y" | |
2677 { | 2640 { |
2678 (yyval.list) = concat((yyvsp[(3) - (7)].list), (yyvsp[(5) - (7)]
.list)); | 2641 (yyval.list) = concat((yyvsp[(3) - (7)].list), (yyvsp[(5) - (7)]
.list)); |
2679 iota = -100000; | 2642 iota = -100000; |
2680 lastconst = nil; | 2643 lastconst = nil; |
2681 } | 2644 } |
2682 break; | 2645 break; |
2683 | 2646 |
2684 case 35: | 2647 case 35: |
2685 | 2648 /* Line 1792 of yacc.c */ |
2686 /* Line 1806 of yacc.c */ | 2649 #line 334 "go.y" |
2687 #line 331 "go.y" | |
2688 { | 2650 { |
2689 (yyval.list) = nil; | 2651 (yyval.list) = nil; |
2690 iota = -100000; | 2652 iota = -100000; |
2691 } | 2653 } |
2692 break; | 2654 break; |
2693 | 2655 |
2694 case 36: | 2656 case 36: |
2695 | 2657 /* Line 1792 of yacc.c */ |
2696 /* Line 1806 of yacc.c */ | 2658 #line 339 "go.y" |
2697 #line 336 "go.y" | |
2698 { | 2659 { |
2699 (yyval.list) = list1((yyvsp[(2) - (2)].node)); | 2660 (yyval.list) = list1((yyvsp[(2) - (2)].node)); |
2700 } | 2661 } |
2701 break; | 2662 break; |
2702 | 2663 |
2703 case 37: | 2664 case 37: |
2704 | 2665 /* Line 1792 of yacc.c */ |
2705 /* Line 1806 of yacc.c */ | 2666 #line 343 "go.y" |
2706 #line 340 "go.y" | |
2707 { | 2667 { |
2708 (yyval.list) = (yyvsp[(3) - (5)].list); | 2668 (yyval.list) = (yyvsp[(3) - (5)].list); |
2709 } | 2669 } |
2710 break; | 2670 break; |
2711 | 2671 |
2712 case 38: | 2672 case 38: |
2713 | 2673 /* Line 1792 of yacc.c */ |
2714 /* Line 1806 of yacc.c */ | 2674 #line 347 "go.y" |
2715 #line 344 "go.y" | |
2716 { | 2675 { |
2717 (yyval.list) = nil; | 2676 (yyval.list) = nil; |
2718 } | 2677 } |
2719 break; | 2678 break; |
2720 | 2679 |
2721 case 39: | 2680 case 39: |
2722 | 2681 /* Line 1792 of yacc.c */ |
2723 /* Line 1806 of yacc.c */ | 2682 #line 353 "go.y" |
2724 #line 350 "go.y" | |
2725 { | 2683 { |
2726 iota = 0; | 2684 iota = 0; |
2727 } | 2685 } |
2728 break; | 2686 break; |
2729 | 2687 |
2730 case 40: | 2688 case 40: |
2731 | 2689 /* Line 1792 of yacc.c */ |
2732 /* Line 1806 of yacc.c */ | 2690 #line 359 "go.y" |
2733 #line 356 "go.y" | |
2734 { | 2691 { |
2735 (yyval.list) = variter((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)
].node), nil); | 2692 (yyval.list) = variter((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)
].node), nil); |
2736 } | 2693 } |
2737 break; | 2694 break; |
2738 | 2695 |
2739 case 41: | 2696 case 41: |
2740 | 2697 /* Line 1792 of yacc.c */ |
2741 /* Line 1806 of yacc.c */ | 2698 #line 363 "go.y" |
2742 #line 360 "go.y" | |
2743 { | 2699 { |
2744 (yyval.list) = variter((yyvsp[(1) - (4)].list), (yyvsp[(2) - (4)
].node), (yyvsp[(4) - (4)].list)); | 2700 (yyval.list) = variter((yyvsp[(1) - (4)].list), (yyvsp[(2) - (4)
].node), (yyvsp[(4) - (4)].list)); |
2745 } | 2701 } |
2746 break; | 2702 break; |
2747 | 2703 |
2748 case 42: | 2704 case 42: |
2749 | 2705 /* Line 1792 of yacc.c */ |
2750 /* Line 1806 of yacc.c */ | 2706 #line 367 "go.y" |
2751 #line 364 "go.y" | |
2752 { | 2707 { |
2753 (yyval.list) = variter((yyvsp[(1) - (3)].list), nil, (yyvsp[(3)
- (3)].list)); | 2708 (yyval.list) = variter((yyvsp[(1) - (3)].list), nil, (yyvsp[(3)
- (3)].list)); |
2754 } | 2709 } |
2755 break; | 2710 break; |
2756 | 2711 |
2757 case 43: | 2712 case 43: |
2758 | 2713 /* Line 1792 of yacc.c */ |
2759 /* Line 1806 of yacc.c */ | 2714 #line 373 "go.y" |
2760 #line 370 "go.y" | |
2761 { | 2715 { |
2762 (yyval.list) = constiter((yyvsp[(1) - (4)].list), (yyvsp[(2) - (
4)].node), (yyvsp[(4) - (4)].list)); | 2716 (yyval.list) = constiter((yyvsp[(1) - (4)].list), (yyvsp[(2) - (
4)].node), (yyvsp[(4) - (4)].list)); |
2763 } | 2717 } |
2764 break; | 2718 break; |
2765 | 2719 |
2766 case 44: | 2720 case 44: |
2767 | 2721 /* Line 1792 of yacc.c */ |
2768 /* Line 1806 of yacc.c */ | 2722 #line 377 "go.y" |
2769 #line 374 "go.y" | |
2770 { | 2723 { |
2771 (yyval.list) = constiter((yyvsp[(1) - (3)].list), N, (yyvsp[(3)
- (3)].list)); | 2724 (yyval.list) = constiter((yyvsp[(1) - (3)].list), N, (yyvsp[(3)
- (3)].list)); |
2772 } | 2725 } |
2773 break; | 2726 break; |
2774 | 2727 |
2775 case 46: | 2728 case 46: |
2776 | 2729 /* Line 1792 of yacc.c */ |
2777 /* Line 1806 of yacc.c */ | 2730 #line 384 "go.y" |
2778 #line 381 "go.y" | |
2779 { | 2731 { |
2780 (yyval.list) = constiter((yyvsp[(1) - (2)].list), (yyvsp[(2) - (
2)].node), nil); | 2732 (yyval.list) = constiter((yyvsp[(1) - (2)].list), (yyvsp[(2) - (
2)].node), nil); |
2781 } | 2733 } |
2782 break; | 2734 break; |
2783 | 2735 |
2784 case 47: | 2736 case 47: |
2785 | 2737 /* Line 1792 of yacc.c */ |
2786 /* Line 1806 of yacc.c */ | 2738 #line 388 "go.y" |
2787 #line 385 "go.y" | |
2788 { | 2739 { |
2789 (yyval.list) = constiter((yyvsp[(1) - (1)].list), N, nil); | 2740 (yyval.list) = constiter((yyvsp[(1) - (1)].list), N, nil); |
2790 } | 2741 } |
2791 break; | 2742 break; |
2792 | 2743 |
2793 case 48: | 2744 case 48: |
2794 | 2745 /* Line 1792 of yacc.c */ |
2795 /* Line 1806 of yacc.c */ | 2746 #line 394 "go.y" |
2796 #line 391 "go.y" | |
2797 { | 2747 { |
2798 // different from dclname because the name | 2748 // different from dclname because the name |
2799 // becomes visible right here, not at the end | 2749 // becomes visible right here, not at the end |
2800 // of the declaration. | 2750 // of the declaration. |
2801 (yyval.node) = typedcl0((yyvsp[(1) - (1)].sym)); | 2751 (yyval.node) = typedcl0((yyvsp[(1) - (1)].sym)); |
2802 } | 2752 } |
2803 break; | 2753 break; |
2804 | 2754 |
2805 case 49: | 2755 case 49: |
2806 | 2756 /* Line 1792 of yacc.c */ |
2807 /* Line 1806 of yacc.c */ | 2757 #line 403 "go.y" |
2808 #line 400 "go.y" | |
2809 { | 2758 { |
2810 (yyval.node) = typedcl1((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2
)].node), 1); | 2759 (yyval.node) = typedcl1((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2
)].node), 1); |
2811 } | 2760 } |
2812 break; | 2761 break; |
2813 | 2762 |
2814 case 50: | 2763 case 50: |
2815 | 2764 /* Line 1792 of yacc.c */ |
2816 /* Line 1806 of yacc.c */ | 2765 #line 409 "go.y" |
2817 #line 406 "go.y" | |
2818 { | 2766 { |
2819 (yyval.node) = (yyvsp[(1) - (1)].node); | 2767 (yyval.node) = (yyvsp[(1) - (1)].node); |
2820 } | 2768 } |
2821 break; | 2769 break; |
2822 | 2770 |
2823 case 51: | 2771 case 51: |
2824 | 2772 /* Line 1792 of yacc.c */ |
2825 /* Line 1806 of yacc.c */ | 2773 #line 413 "go.y" |
2826 #line 410 "go.y" | |
2827 { | 2774 { |
2828 (yyval.node) = nod(OASOP, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); | 2775 (yyval.node) = nod(OASOP, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); |
2829 (yyval.node)->etype = (yyvsp[(2) - (3)].i);
// rathole to pass opcode | 2776 (yyval.node)->etype = (yyvsp[(2) - (3)].i);
// rathole to pass opcode |
2830 } | 2777 } |
2831 break; | 2778 break; |
2832 | 2779 |
2833 case 52: | 2780 case 52: |
2834 | 2781 /* Line 1792 of yacc.c */ |
2835 /* Line 1806 of yacc.c */ | 2782 #line 418 "go.y" |
2836 #line 415 "go.y" | |
2837 { | 2783 { |
2838 if((yyvsp[(1) - (3)].list)->next == nil && (yyvsp[(3) - (3)].lis
t)->next == nil) { | 2784 if((yyvsp[(1) - (3)].list)->next == nil && (yyvsp[(3) - (3)].lis
t)->next == nil) { |
2839 // simple | 2785 // simple |
2840 (yyval.node) = nod(OAS, (yyvsp[(1) - (3)].list)->n, (yyv
sp[(3) - (3)].list)->n); | 2786 (yyval.node) = nod(OAS, (yyvsp[(1) - (3)].list)->n, (yyv
sp[(3) - (3)].list)->n); |
2841 break; | 2787 break; |
2842 } | 2788 } |
2843 // multiple | 2789 // multiple |
2844 (yyval.node) = nod(OAS2, N, N); | 2790 (yyval.node) = nod(OAS2, N, N); |
2845 (yyval.node)->list = (yyvsp[(1) - (3)].list); | 2791 (yyval.node)->list = (yyvsp[(1) - (3)].list); |
2846 (yyval.node)->rlist = (yyvsp[(3) - (3)].list); | 2792 (yyval.node)->rlist = (yyvsp[(3) - (3)].list); |
2847 } | 2793 } |
2848 break; | 2794 break; |
2849 | 2795 |
2850 case 53: | 2796 case 53: |
2851 | 2797 /* Line 1792 of yacc.c */ |
2852 /* Line 1806 of yacc.c */ | 2798 #line 430 "go.y" |
2853 #line 427 "go.y" | |
2854 { | 2799 { |
2855 if((yyvsp[(3) - (3)].list)->n->op == OTYPESW) { | 2800 if((yyvsp[(3) - (3)].list)->n->op == OTYPESW) { |
2856 (yyval.node) = nod(OTYPESW, N, (yyvsp[(3) - (3)].list)->
n->right); | 2801 (yyval.node) = nod(OTYPESW, N, (yyvsp[(3) - (3)].list)->
n->right); |
2857 if((yyvsp[(3) - (3)].list)->next != nil) | 2802 if((yyvsp[(3) - (3)].list)->next != nil) |
2858 yyerror("expr.(type) must be alone in list"); | 2803 yyerror("expr.(type) must be alone in list"); |
2859 if((yyvsp[(1) - (3)].list)->next != nil) | 2804 if((yyvsp[(1) - (3)].list)->next != nil) |
2860 yyerror("argument count mismatch: %d = %d", coun
t((yyvsp[(1) - (3)].list)), 1); | 2805 yyerror("argument count mismatch: %d = %d", coun
t((yyvsp[(1) - (3)].list)), 1); |
2861 else if(((yyvsp[(1) - (3)].list)->n->op != ONAME && (yyv
sp[(1) - (3)].list)->n->op != OTYPE && (yyvsp[(1) - (3)].list)->n->op != ONONAME
) || isblank((yyvsp[(1) - (3)].list)->n)) | 2806 else if(((yyvsp[(1) - (3)].list)->n->op != ONAME && (yyv
sp[(1) - (3)].list)->n->op != OTYPE && (yyvsp[(1) - (3)].list)->n->op != ONONAME
) || isblank((yyvsp[(1) - (3)].list)->n)) |
2862 yyerror("invalid variable name %N in type switch
", (yyvsp[(1) - (3)].list)->n); | 2807 yyerror("invalid variable name %N in type switch
", (yyvsp[(1) - (3)].list)->n); |
2863 else | 2808 else |
2864 (yyval.node)->left = dclname((yyvsp[(1) - (3)].l
ist)->n->sym); // it's a colas, so must not re-use an oldname. | 2809 (yyval.node)->left = dclname((yyvsp[(1) - (3)].l
ist)->n->sym); // it's a colas, so must not re-use an oldname. |
2865 break; | 2810 break; |
2866 } | 2811 } |
2867 (yyval.node) = colas((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].
list), (yyvsp[(2) - (3)].i)); | 2812 (yyval.node) = colas((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].
list), (yyvsp[(2) - (3)].i)); |
2868 } | 2813 } |
2869 break; | 2814 break; |
2870 | 2815 |
2871 case 54: | 2816 case 54: |
2872 | 2817 /* Line 1792 of yacc.c */ |
2873 /* Line 1806 of yacc.c */ | 2818 #line 446 "go.y" |
2874 #line 443 "go.y" | |
2875 { | 2819 { |
2876 (yyval.node) = nod(OASOP, (yyvsp[(1) - (2)].node), nodintconst(1
)); | 2820 (yyval.node) = nod(OASOP, (yyvsp[(1) - (2)].node), nodintconst(1
)); |
2877 (yyval.node)->etype = OADD; | 2821 (yyval.node)->etype = OADD; |
2878 } | 2822 } |
2879 break; | 2823 break; |
2880 | 2824 |
2881 case 55: | 2825 case 55: |
2882 | 2826 /* Line 1792 of yacc.c */ |
2883 /* Line 1806 of yacc.c */ | 2827 #line 451 "go.y" |
2884 #line 448 "go.y" | |
2885 { | 2828 { |
2886 (yyval.node) = nod(OASOP, (yyvsp[(1) - (2)].node), nodintconst(1
)); | 2829 (yyval.node) = nod(OASOP, (yyvsp[(1) - (2)].node), nodintconst(1
)); |
2887 (yyval.node)->etype = OSUB; | 2830 (yyval.node)->etype = OSUB; |
2888 } | 2831 } |
2889 break; | 2832 break; |
2890 | 2833 |
2891 case 56: | 2834 case 56: |
2892 | 2835 /* Line 1792 of yacc.c */ |
2893 /* Line 1806 of yacc.c */ | 2836 #line 458 "go.y" |
2894 #line 455 "go.y" | |
2895 { | 2837 { |
2896 Node *n, *nn; | 2838 Node *n, *nn; |
2897 | 2839 |
2898 // will be converted to OCASE | 2840 // will be converted to OCASE |
2899 // right will point to next case | 2841 // right will point to next case |
2900 // done in casebody() | 2842 // done in casebody() |
2901 markdcl(); | 2843 markdcl(); |
2902 (yyval.node) = nod(OXCASE, N, N); | 2844 (yyval.node) = nod(OXCASE, N, N); |
2903 (yyval.node)->list = (yyvsp[(2) - (3)].list); | 2845 (yyval.node)->list = (yyvsp[(2) - (3)].list); |
2904 if(typesw != N && typesw->right != N && (n=typesw->right->left)
!= N) { | 2846 if(typesw != N && typesw->right != N && (n=typesw->right->left)
!= N) { |
2905 // type switch - declare variable | 2847 // type switch - declare variable |
2906 nn = newname(n->sym); | 2848 nn = newname(n->sym); |
2907 declare(nn, dclcontext); | 2849 declare(nn, dclcontext); |
2908 (yyval.node)->nname = nn; | 2850 (yyval.node)->nname = nn; |
2909 | 2851 |
2910 // keep track of the instances for reporting unused | 2852 // keep track of the instances for reporting unused |
2911 nn->defn = typesw->right; | 2853 nn->defn = typesw->right; |
2912 } | 2854 } |
2913 } | 2855 } |
2914 break; | 2856 break; |
2915 | 2857 |
2916 case 57: | 2858 case 57: |
2917 | 2859 /* Line 1792 of yacc.c */ |
2918 /* Line 1806 of yacc.c */ | 2860 #line 478 "go.y" |
2919 #line 475 "go.y" | |
2920 { | 2861 { |
2921 Node *n; | 2862 Node *n; |
2922 | 2863 |
2923 // will be converted to OCASE | 2864 // will be converted to OCASE |
2924 // right will point to next case | 2865 // right will point to next case |
2925 // done in casebody() | 2866 // done in casebody() |
2926 markdcl(); | 2867 markdcl(); |
2927 (yyval.node) = nod(OXCASE, N, N); | 2868 (yyval.node) = nod(OXCASE, N, N); |
2928 if((yyvsp[(2) - (5)].list)->next == nil) | 2869 if((yyvsp[(2) - (5)].list)->next == nil) |
2929 n = nod(OAS, (yyvsp[(2) - (5)].list)->n, (yyvsp[(4) - (5
)].node)); | 2870 n = nod(OAS, (yyvsp[(2) - (5)].list)->n, (yyvsp[(4) - (5
)].node)); |
2930 else { | 2871 else { |
2931 n = nod(OAS2, N, N); | 2872 n = nod(OAS2, N, N); |
2932 n->list = (yyvsp[(2) - (5)].list); | 2873 n->list = (yyvsp[(2) - (5)].list); |
2933 n->rlist = list1((yyvsp[(4) - (5)].node)); | 2874 n->rlist = list1((yyvsp[(4) - (5)].node)); |
2934 } | 2875 } |
2935 (yyval.node)->list = list1(n); | 2876 (yyval.node)->list = list1(n); |
2936 } | 2877 } |
2937 break; | 2878 break; |
2938 | 2879 |
2939 case 58: | 2880 case 58: |
2940 | 2881 /* Line 1792 of yacc.c */ |
2941 /* Line 1806 of yacc.c */ | 2882 #line 496 "go.y" |
2942 #line 493 "go.y" | |
2943 { | 2883 { |
2944 // will be converted to OCASE | 2884 // will be converted to OCASE |
2945 // right will point to next case | 2885 // right will point to next case |
2946 // done in casebody() | 2886 // done in casebody() |
2947 markdcl(); | 2887 markdcl(); |
2948 (yyval.node) = nod(OXCASE, N, N); | 2888 (yyval.node) = nod(OXCASE, N, N); |
2949 (yyval.node)->list = list1(colas((yyvsp[(2) - (5)].list), list1(
(yyvsp[(4) - (5)].node)), (yyvsp[(3) - (5)].i))); | 2889 (yyval.node)->list = list1(colas((yyvsp[(2) - (5)].list), list1(
(yyvsp[(4) - (5)].node)), (yyvsp[(3) - (5)].i))); |
2950 } | 2890 } |
2951 break; | 2891 break; |
2952 | 2892 |
2953 case 59: | 2893 case 59: |
2954 | 2894 /* Line 1792 of yacc.c */ |
2955 /* Line 1806 of yacc.c */ | 2895 #line 505 "go.y" |
2956 #line 502 "go.y" | |
2957 { | 2896 { |
2958 Node *n, *nn; | 2897 Node *n, *nn; |
2959 | 2898 |
2960 markdcl(); | 2899 markdcl(); |
2961 (yyval.node) = nod(OXCASE, N, N); | 2900 (yyval.node) = nod(OXCASE, N, N); |
2962 if(typesw != N && typesw->right != N && (n=typesw->right->left)
!= N) { | 2901 if(typesw != N && typesw->right != N && (n=typesw->right->left)
!= N) { |
2963 // type switch - declare variable | 2902 // type switch - declare variable |
2964 nn = newname(n->sym); | 2903 nn = newname(n->sym); |
2965 declare(nn, dclcontext); | 2904 declare(nn, dclcontext); |
2966 (yyval.node)->nname = nn; | 2905 (yyval.node)->nname = nn; |
2967 | 2906 |
2968 // keep track of the instances for reporting unused | 2907 // keep track of the instances for reporting unused |
2969 nn->defn = typesw->right; | 2908 nn->defn = typesw->right; |
2970 } | 2909 } |
2971 } | 2910 } |
2972 break; | 2911 break; |
2973 | 2912 |
2974 case 60: | 2913 case 60: |
2975 | 2914 /* Line 1792 of yacc.c */ |
2976 /* Line 1806 of yacc.c */ | 2915 #line 523 "go.y" |
2977 #line 520 "go.y" | |
2978 { | 2916 { |
2979 markdcl(); | 2917 markdcl(); |
2980 } | 2918 } |
2981 break; | 2919 break; |
2982 | 2920 |
2983 case 61: | 2921 case 61: |
2984 | 2922 /* Line 1792 of yacc.c */ |
2985 /* Line 1806 of yacc.c */ | 2923 #line 527 "go.y" |
2986 #line 524 "go.y" | |
2987 { | 2924 { |
2988 (yyval.node) = liststmt((yyvsp[(3) - (4)].list)); | 2925 (yyval.node) = liststmt((yyvsp[(3) - (4)].list)); |
2989 popdcl(); | 2926 popdcl(); |
2990 } | 2927 } |
2991 break; | 2928 break; |
2992 | 2929 |
2993 case 62: | 2930 case 62: |
2994 | 2931 /* Line 1792 of yacc.c */ |
2995 /* Line 1806 of yacc.c */ | 2932 #line 534 "go.y" |
2996 #line 531 "go.y" | |
2997 { | 2933 { |
2998 // If the last token read by the lexer was consumed | 2934 // If the last token read by the lexer was consumed |
2999 // as part of the case, clear it (parser has cleared yychar). | 2935 // as part of the case, clear it (parser has cleared yychar). |
3000 // If the last token read by the lexer was the lookahead | 2936 // If the last token read by the lexer was the lookahead |
3001 // leave it alone (parser has it cached in yychar). | 2937 // leave it alone (parser has it cached in yychar). |
3002 // This is so that the stmt_list action doesn't look at | 2938 // This is so that the stmt_list action doesn't look at |
3003 // the case tokens if the stmt_list is empty. | 2939 // the case tokens if the stmt_list is empty. |
3004 yylast = yychar; | 2940 yylast = yychar; |
3005 } | 2941 } |
3006 break; | 2942 break; |
3007 | 2943 |
3008 case 63: | 2944 case 63: |
3009 | 2945 /* Line 1792 of yacc.c */ |
3010 /* Line 1806 of yacc.c */ | 2946 #line 544 "go.y" |
3011 #line 541 "go.y" | |
3012 { | 2947 { |
3013 int last; | 2948 int last; |
3014 | 2949 |
3015 // This is the only place in the language where a statement | 2950 // This is the only place in the language where a statement |
3016 // list is not allowed to drop the final semicolon, because | 2951 // list is not allowed to drop the final semicolon, because |
3017 // it's the only place where a statement list is not followed· | 2952 // it's the only place where a statement list is not followed· |
3018 // by a closing brace. Handle the error for pedantry. | 2953 // by a closing brace. Handle the error for pedantry. |
3019 | 2954 |
3020 // Find the final token of the statement list. | 2955 // Find the final token of the statement list. |
3021 // yylast is lookahead; yyprev is last of stmt_list | 2956 // yylast is lookahead; yyprev is last of stmt_list |
3022 last = yyprev; | 2957 last = yyprev; |
3023 | 2958 |
3024 if(last > 0 && last != ';' && yychar != '}') | 2959 if(last > 0 && last != ';' && yychar != '}') |
3025 yyerror("missing statement after label"); | 2960 yyerror("missing statement after label"); |
3026 (yyval.node) = (yyvsp[(1) - (3)].node); | 2961 (yyval.node) = (yyvsp[(1) - (3)].node); |
3027 (yyval.node)->nbody = (yyvsp[(3) - (3)].list); | 2962 (yyval.node)->nbody = (yyvsp[(3) - (3)].list); |
3028 popdcl(); | 2963 popdcl(); |
3029 } | 2964 } |
3030 break; | 2965 break; |
3031 | 2966 |
3032 case 64: | 2967 case 64: |
3033 | 2968 /* Line 1792 of yacc.c */ |
3034 /* Line 1806 of yacc.c */ | 2969 #line 564 "go.y" |
3035 #line 561 "go.y" | |
3036 { | 2970 { |
3037 (yyval.list) = nil; | 2971 (yyval.list) = nil; |
3038 } | 2972 } |
3039 break; | 2973 break; |
3040 | 2974 |
3041 case 65: | 2975 case 65: |
3042 | 2976 /* Line 1792 of yacc.c */ |
3043 /* Line 1806 of yacc.c */ | 2977 #line 568 "go.y" |
3044 #line 565 "go.y" | |
3045 { | 2978 { |
3046 (yyval.list) = list((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].n
ode)); | 2979 (yyval.list) = list((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].n
ode)); |
3047 } | 2980 } |
3048 break; | 2981 break; |
3049 | 2982 |
3050 case 66: | 2983 case 66: |
3051 | 2984 /* Line 1792 of yacc.c */ |
3052 /* Line 1806 of yacc.c */ | 2985 #line 574 "go.y" |
3053 #line 571 "go.y" | |
3054 { | 2986 { |
3055 markdcl(); | 2987 markdcl(); |
3056 } | 2988 } |
3057 break; | 2989 break; |
3058 | 2990 |
3059 case 67: | 2991 case 67: |
3060 | 2992 /* Line 1792 of yacc.c */ |
3061 /* Line 1806 of yacc.c */ | 2993 #line 578 "go.y" |
3062 #line 575 "go.y" | |
3063 { | 2994 { |
3064 (yyval.list) = (yyvsp[(3) - (4)].list); | 2995 (yyval.list) = (yyvsp[(3) - (4)].list); |
3065 popdcl(); | 2996 popdcl(); |
3066 } | 2997 } |
3067 break; | 2998 break; |
3068 | 2999 |
3069 case 68: | 3000 case 68: |
3070 | 3001 /* Line 1792 of yacc.c */ |
3071 /* Line 1806 of yacc.c */ | 3002 #line 585 "go.y" |
3072 #line 582 "go.y" | |
3073 { | 3003 { |
3074 (yyval.node) = nod(ORANGE, N, (yyvsp[(4) - (4)].node)); | 3004 (yyval.node) = nod(ORANGE, N, (yyvsp[(4) - (4)].node)); |
3075 (yyval.node)->list = (yyvsp[(1) - (4)].list); | 3005 (yyval.node)->list = (yyvsp[(1) - (4)].list); |
3076 (yyval.node)->etype = 0; // := flag | 3006 (yyval.node)->etype = 0; // := flag |
3077 } | 3007 } |
3078 break; | 3008 break; |
3079 | 3009 |
3080 case 69: | 3010 case 69: |
3081 | 3011 /* Line 1792 of yacc.c */ |
3082 /* Line 1806 of yacc.c */ | 3012 #line 591 "go.y" |
3083 #line 588 "go.y" | |
3084 { | 3013 { |
3085 (yyval.node) = nod(ORANGE, N, (yyvsp[(4) - (4)].node)); | 3014 (yyval.node) = nod(ORANGE, N, (yyvsp[(4) - (4)].node)); |
3086 (yyval.node)->list = (yyvsp[(1) - (4)].list); | 3015 (yyval.node)->list = (yyvsp[(1) - (4)].list); |
3087 (yyval.node)->colas = 1; | 3016 (yyval.node)->colas = 1; |
3088 colasdefn((yyvsp[(1) - (4)].list), (yyval.node)); | 3017 colasdefn((yyvsp[(1) - (4)].list), (yyval.node)); |
3089 } | 3018 } |
3090 break; | 3019 break; |
3091 | 3020 |
3092 case 70: | 3021 case 70: |
3093 | 3022 /* Line 1792 of yacc.c */ |
3094 /* Line 1806 of yacc.c */ | 3023 #line 600 "go.y" |
3095 #line 597 "go.y" | |
3096 { | 3024 { |
3097 // init ; test ; incr | 3025 // init ; test ; incr |
3098 if((yyvsp[(5) - (5)].node) != N && (yyvsp[(5) - (5)].node)->cola
s != 0) | 3026 if((yyvsp[(5) - (5)].node) != N && (yyvsp[(5) - (5)].node)->cola
s != 0) |
3099 yyerror("cannot declare in the for-increment"); | 3027 yyerror("cannot declare in the for-increment"); |
3100 (yyval.node) = nod(OFOR, N, N); | 3028 (yyval.node) = nod(OFOR, N, N); |
3101 if((yyvsp[(1) - (5)].node) != N) | 3029 if((yyvsp[(1) - (5)].node) != N) |
3102 (yyval.node)->ninit = list1((yyvsp[(1) - (5)].node)); | 3030 (yyval.node)->ninit = list1((yyvsp[(1) - (5)].node)); |
3103 (yyval.node)->ntest = (yyvsp[(3) - (5)].node); | 3031 (yyval.node)->ntest = (yyvsp[(3) - (5)].node); |
3104 (yyval.node)->nincr = (yyvsp[(5) - (5)].node); | 3032 (yyval.node)->nincr = (yyvsp[(5) - (5)].node); |
3105 } | 3033 } |
3106 break; | 3034 break; |
3107 | 3035 |
3108 case 71: | 3036 case 71: |
3109 | 3037 /* Line 1792 of yacc.c */ |
3110 /* Line 1806 of yacc.c */ | 3038 #line 611 "go.y" |
3111 #line 608 "go.y" | |
3112 { | 3039 { |
3113 // normal test | 3040 // normal test |
3114 (yyval.node) = nod(OFOR, N, N); | 3041 (yyval.node) = nod(OFOR, N, N); |
3115 (yyval.node)->ntest = (yyvsp[(1) - (1)].node); | 3042 (yyval.node)->ntest = (yyvsp[(1) - (1)].node); |
3116 } | 3043 } |
3117 break; | 3044 break; |
3118 | 3045 |
3119 case 73: | 3046 case 73: |
3120 | 3047 /* Line 1792 of yacc.c */ |
3121 /* Line 1806 of yacc.c */ | 3048 #line 620 "go.y" |
3122 #line 617 "go.y" | |
3123 { | 3049 { |
3124 (yyval.node) = (yyvsp[(1) - (2)].node); | 3050 (yyval.node) = (yyvsp[(1) - (2)].node); |
3125 (yyval.node)->nbody = concat((yyval.node)->nbody, (yyvsp[(2) - (
2)].list)); | 3051 (yyval.node)->nbody = concat((yyval.node)->nbody, (yyvsp[(2) - (
2)].list)); |
3126 } | 3052 } |
3127 break; | 3053 break; |
3128 | 3054 |
3129 case 74: | 3055 case 74: |
3130 | 3056 /* Line 1792 of yacc.c */ |
3131 /* Line 1806 of yacc.c */ | 3057 #line 627 "go.y" |
3132 #line 624 "go.y" | |
3133 { | 3058 { |
3134 markdcl(); | 3059 markdcl(); |
3135 } | 3060 } |
3136 break; | 3061 break; |
3137 | 3062 |
3138 case 75: | 3063 case 75: |
3139 | 3064 /* Line 1792 of yacc.c */ |
3140 /* Line 1806 of yacc.c */ | 3065 #line 631 "go.y" |
3141 #line 628 "go.y" | |
3142 { | 3066 { |
3143 (yyval.node) = (yyvsp[(3) - (3)].node); | 3067 (yyval.node) = (yyvsp[(3) - (3)].node); |
3144 popdcl(); | 3068 popdcl(); |
3145 } | 3069 } |
3146 break; | 3070 break; |
3147 | 3071 |
3148 case 76: | 3072 case 76: |
3149 | 3073 /* Line 1792 of yacc.c */ |
3150 /* Line 1806 of yacc.c */ | 3074 #line 638 "go.y" |
3151 #line 635 "go.y" | |
3152 { | 3075 { |
3153 // test | 3076 // test |
3154 (yyval.node) = nod(OIF, N, N); | 3077 (yyval.node) = nod(OIF, N, N); |
3155 (yyval.node)->ntest = (yyvsp[(1) - (1)].node); | 3078 (yyval.node)->ntest = (yyvsp[(1) - (1)].node); |
3156 } | 3079 } |
3157 break; | 3080 break; |
3158 | 3081 |
3159 case 77: | 3082 case 77: |
3160 | 3083 /* Line 1792 of yacc.c */ |
3161 /* Line 1806 of yacc.c */ | 3084 #line 644 "go.y" |
3162 #line 641 "go.y" | |
3163 { | 3085 { |
3164 // init ; test | 3086 // init ; test |
3165 (yyval.node) = nod(OIF, N, N); | 3087 (yyval.node) = nod(OIF, N, N); |
3166 if((yyvsp[(1) - (3)].node) != N) | 3088 if((yyvsp[(1) - (3)].node) != N) |
3167 (yyval.node)->ninit = list1((yyvsp[(1) - (3)].node)); | 3089 (yyval.node)->ninit = list1((yyvsp[(1) - (3)].node)); |
3168 (yyval.node)->ntest = (yyvsp[(3) - (3)].node); | 3090 (yyval.node)->ntest = (yyvsp[(3) - (3)].node); |
3169 } | 3091 } |
3170 break; | 3092 break; |
3171 | 3093 |
3172 case 78: | 3094 case 78: |
3173 | 3095 /* Line 1792 of yacc.c */ |
3174 /* Line 1806 of yacc.c */ | 3096 #line 655 "go.y" |
3175 #line 652 "go.y" | |
3176 { | 3097 { |
3177 markdcl(); | 3098 markdcl(); |
3178 } | 3099 } |
3179 break; | 3100 break; |
3180 | 3101 |
3181 case 79: | 3102 case 79: |
3182 | 3103 /* Line 1792 of yacc.c */ |
3183 /* Line 1806 of yacc.c */ | 3104 #line 659 "go.y" |
3184 #line 656 "go.y" | |
3185 { | 3105 { |
3186 if((yyvsp[(3) - (3)].node)->ntest == N) | 3106 if((yyvsp[(3) - (3)].node)->ntest == N) |
3187 yyerror("missing condition in if statement"); | 3107 yyerror("missing condition in if statement"); |
3188 } | 3108 } |
3189 break; | 3109 break; |
3190 | 3110 |
3191 case 80: | 3111 case 80: |
3192 | 3112 /* Line 1792 of yacc.c */ |
3193 /* Line 1806 of yacc.c */ | 3113 #line 664 "go.y" |
3194 #line 661 "go.y" | |
3195 { | 3114 { |
3196 (yyvsp[(3) - (5)].node)->nbody = (yyvsp[(5) - (5)].list); | 3115 (yyvsp[(3) - (5)].node)->nbody = (yyvsp[(5) - (5)].list); |
3197 } | 3116 } |
3198 break; | 3117 break; |
3199 | 3118 |
3200 case 81: | 3119 case 81: |
3201 | 3120 /* Line 1792 of yacc.c */ |
3202 /* Line 1806 of yacc.c */ | 3121 #line 668 "go.y" |
3203 #line 665 "go.y" | |
3204 { | 3122 { |
3205 Node *n; | 3123 Node *n; |
3206 NodeList *nn; | 3124 NodeList *nn; |
3207 | 3125 |
3208 (yyval.node) = (yyvsp[(3) - (8)].node); | 3126 (yyval.node) = (yyvsp[(3) - (8)].node); |
3209 n = (yyvsp[(3) - (8)].node); | 3127 n = (yyvsp[(3) - (8)].node); |
3210 popdcl(); | 3128 popdcl(); |
3211 for(nn = concat((yyvsp[(7) - (8)].list), (yyvsp[(8) - (8)].list)
); nn; nn = nn->next) { | 3129 for(nn = concat((yyvsp[(7) - (8)].list), (yyvsp[(8) - (8)].list)
); nn; nn = nn->next) { |
3212 if(nn->n->op == OIF) | 3130 if(nn->n->op == OIF) |
3213 popdcl(); | 3131 popdcl(); |
3214 n->nelse = list1(nn->n); | 3132 n->nelse = list1(nn->n); |
3215 n = nn->n; | 3133 n = nn->n; |
3216 } | 3134 } |
3217 } | 3135 } |
3218 break; | 3136 break; |
3219 | 3137 |
3220 case 82: | 3138 case 82: |
3221 | 3139 /* Line 1792 of yacc.c */ |
3222 /* Line 1806 of yacc.c */ | 3140 #line 685 "go.y" |
3223 #line 682 "go.y" | |
3224 { | 3141 { |
3225 markdcl(); | 3142 markdcl(); |
3226 } | 3143 } |
3227 break; | 3144 break; |
3228 | 3145 |
3229 case 83: | 3146 case 83: |
3230 | 3147 /* Line 1792 of yacc.c */ |
3231 /* Line 1806 of yacc.c */ | 3148 #line 689 "go.y" |
3232 #line 686 "go.y" | |
3233 { | 3149 { |
3234 if((yyvsp[(4) - (5)].node)->ntest == N) | 3150 if((yyvsp[(4) - (5)].node)->ntest == N) |
3235 yyerror("missing condition in if statement"); | 3151 yyerror("missing condition in if statement"); |
3236 (yyvsp[(4) - (5)].node)->nbody = (yyvsp[(5) - (5)].list); | 3152 (yyvsp[(4) - (5)].node)->nbody = (yyvsp[(5) - (5)].list); |
3237 (yyval.list) = list1((yyvsp[(4) - (5)].node)); | 3153 (yyval.list) = list1((yyvsp[(4) - (5)].node)); |
3238 } | 3154 } |
3239 break; | 3155 break; |
3240 | 3156 |
3241 case 84: | 3157 case 84: |
3242 | 3158 /* Line 1792 of yacc.c */ |
3243 /* Line 1806 of yacc.c */ | 3159 #line 697 "go.y" |
3244 #line 694 "go.y" | |
3245 { | 3160 { |
3246 (yyval.list) = nil; | 3161 (yyval.list) = nil; |
3247 } | 3162 } |
3248 break; | 3163 break; |
3249 | 3164 |
3250 case 85: | 3165 case 85: |
3251 | 3166 /* Line 1792 of yacc.c */ |
3252 /* Line 1806 of yacc.c */ | 3167 #line 701 "go.y" |
3253 #line 698 "go.y" | |
3254 { | 3168 { |
3255 (yyval.list) = concat((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)]
.list)); | 3169 (yyval.list) = concat((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)]
.list)); |
3256 } | 3170 } |
3257 break; | 3171 break; |
3258 | 3172 |
3259 case 86: | 3173 case 86: |
3260 | 3174 /* Line 1792 of yacc.c */ |
3261 /* Line 1806 of yacc.c */ | 3175 #line 706 "go.y" |
3262 #line 703 "go.y" | |
3263 { | 3176 { |
3264 (yyval.list) = nil; | 3177 (yyval.list) = nil; |
3265 } | 3178 } |
3266 break; | 3179 break; |
3267 | 3180 |
3268 case 87: | 3181 case 87: |
3269 | 3182 /* Line 1792 of yacc.c */ |
3270 /* Line 1806 of yacc.c */ | 3183 #line 710 "go.y" |
3271 #line 707 "go.y" | |
3272 { | 3184 { |
3273 NodeList *node; | 3185 NodeList *node; |
3274 ················ | 3186 ················ |
3275 node = mal(sizeof *node); | 3187 node = mal(sizeof *node); |
3276 node->n = (yyvsp[(2) - (2)].node); | 3188 node->n = (yyvsp[(2) - (2)].node); |
3277 node->end = node; | 3189 node->end = node; |
3278 (yyval.list) = node; | 3190 (yyval.list) = node; |
3279 } | 3191 } |
3280 break; | 3192 break; |
3281 | 3193 |
3282 case 88: | 3194 case 88: |
3283 | 3195 /* Line 1792 of yacc.c */ |
3284 /* Line 1806 of yacc.c */ | 3196 #line 721 "go.y" |
3285 #line 718 "go.y" | |
3286 { | 3197 { |
3287 markdcl(); | 3198 markdcl(); |
3288 } | 3199 } |
3289 break; | 3200 break; |
3290 | 3201 |
3291 case 89: | 3202 case 89: |
3292 | 3203 /* Line 1792 of yacc.c */ |
3293 /* Line 1806 of yacc.c */ | 3204 #line 725 "go.y" |
3294 #line 722 "go.y" | |
3295 { | 3205 { |
3296 Node *n; | 3206 Node *n; |
3297 n = (yyvsp[(3) - (3)].node)->ntest; | 3207 n = (yyvsp[(3) - (3)].node)->ntest; |
3298 if(n != N && n->op != OTYPESW) | 3208 if(n != N && n->op != OTYPESW) |
3299 n = N; | 3209 n = N; |
3300 typesw = nod(OXXX, typesw, n); | 3210 typesw = nod(OXXX, typesw, n); |
3301 } | 3211 } |
3302 break; | 3212 break; |
3303 | 3213 |
3304 case 90: | 3214 case 90: |
3305 | 3215 /* Line 1792 of yacc.c */ |
3306 /* Line 1806 of yacc.c */ | 3216 #line 733 "go.y" |
3307 #line 730 "go.y" | |
3308 { | 3217 { |
3309 (yyval.node) = (yyvsp[(3) - (7)].node); | 3218 (yyval.node) = (yyvsp[(3) - (7)].node); |
3310 (yyval.node)->op = OSWITCH; | 3219 (yyval.node)->op = OSWITCH; |
3311 (yyval.node)->list = (yyvsp[(6) - (7)].list); | 3220 (yyval.node)->list = (yyvsp[(6) - (7)].list); |
3312 typesw = typesw->left; | 3221 typesw = typesw->left; |
3313 popdcl(); | 3222 popdcl(); |
3314 } | 3223 } |
3315 break; | 3224 break; |
3316 | 3225 |
3317 case 91: | 3226 case 91: |
3318 | 3227 /* Line 1792 of yacc.c */ |
3319 /* Line 1806 of yacc.c */ | 3228 #line 743 "go.y" |
3320 #line 740 "go.y" | |
3321 { | 3229 { |
3322 typesw = nod(OXXX, typesw, N); | 3230 typesw = nod(OXXX, typesw, N); |
3323 } | 3231 } |
3324 break; | 3232 break; |
3325 | 3233 |
3326 case 92: | 3234 case 92: |
3327 | 3235 /* Line 1792 of yacc.c */ |
3328 /* Line 1806 of yacc.c */ | 3236 #line 747 "go.y" |
3329 #line 744 "go.y" | |
3330 { | 3237 { |
3331 (yyval.node) = nod(OSELECT, N, N); | 3238 (yyval.node) = nod(OSELECT, N, N); |
3332 (yyval.node)->lineno = typesw->lineno; | 3239 (yyval.node)->lineno = typesw->lineno; |
3333 (yyval.node)->list = (yyvsp[(4) - (5)].list); | 3240 (yyval.node)->list = (yyvsp[(4) - (5)].list); |
3334 typesw = typesw->left; | 3241 typesw = typesw->left; |
3335 } | 3242 } |
3336 break; | 3243 break; |
3337 | 3244 |
3338 case 94: | 3245 case 94: |
3339 | 3246 /* Line 1792 of yacc.c */ |
3340 /* Line 1806 of yacc.c */ | 3247 #line 760 "go.y" |
3341 #line 757 "go.y" | |
3342 { | 3248 { |
3343 (yyval.node) = nod(OOROR, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); | 3249 (yyval.node) = nod(OOROR, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); |
3344 } | 3250 } |
3345 break; | 3251 break; |
3346 | 3252 |
3347 case 95: | 3253 case 95: |
3348 | 3254 /* Line 1792 of yacc.c */ |
3349 /* Line 1806 of yacc.c */ | 3255 #line 764 "go.y" |
3350 #line 761 "go.y" | |
3351 { | 3256 { |
3352 (yyval.node) = nod(OANDAND, (yyvsp[(1) - (3)].node), (yyvsp[(3)
- (3)].node)); | 3257 (yyval.node) = nod(OANDAND, (yyvsp[(1) - (3)].node), (yyvsp[(3)
- (3)].node)); |
3353 } | 3258 } |
3354 break; | 3259 break; |
3355 | 3260 |
3356 case 96: | 3261 case 96: |
3357 | 3262 /* Line 1792 of yacc.c */ |
3358 /* Line 1806 of yacc.c */ | 3263 #line 768 "go.y" |
3359 #line 765 "go.y" | |
3360 { | 3264 { |
3361 (yyval.node) = nod(OEQ, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3265 (yyval.node) = nod(OEQ, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3362 } | 3266 } |
3363 break; | 3267 break; |
3364 | 3268 |
3365 case 97: | 3269 case 97: |
3366 | 3270 /* Line 1792 of yacc.c */ |
3367 /* Line 1806 of yacc.c */ | 3271 #line 772 "go.y" |
3368 #line 769 "go.y" | |
3369 { | 3272 { |
3370 (yyval.node) = nod(ONE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3273 (yyval.node) = nod(ONE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3371 } | 3274 } |
3372 break; | 3275 break; |
3373 | 3276 |
3374 case 98: | 3277 case 98: |
3375 | 3278 /* Line 1792 of yacc.c */ |
3376 /* Line 1806 of yacc.c */ | 3279 #line 776 "go.y" |
3377 #line 773 "go.y" | |
3378 { | 3280 { |
3379 (yyval.node) = nod(OLT, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3281 (yyval.node) = nod(OLT, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3380 } | 3282 } |
3381 break; | 3283 break; |
3382 | 3284 |
3383 case 99: | 3285 case 99: |
3384 | 3286 /* Line 1792 of yacc.c */ |
3385 /* Line 1806 of yacc.c */ | 3287 #line 780 "go.y" |
3386 #line 777 "go.y" | |
3387 { | 3288 { |
3388 (yyval.node) = nod(OLE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3289 (yyval.node) = nod(OLE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3389 } | 3290 } |
3390 break; | 3291 break; |
3391 | 3292 |
3392 case 100: | 3293 case 100: |
3393 | 3294 /* Line 1792 of yacc.c */ |
3394 /* Line 1806 of yacc.c */ | 3295 #line 784 "go.y" |
3395 #line 781 "go.y" | |
3396 { | 3296 { |
3397 (yyval.node) = nod(OGE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3297 (yyval.node) = nod(OGE, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3398 } | 3298 } |
3399 break; | 3299 break; |
3400 | 3300 |
3401 case 101: | 3301 case 101: |
3402 | 3302 /* Line 1792 of yacc.c */ |
3403 /* Line 1806 of yacc.c */ | 3303 #line 788 "go.y" |
3404 #line 785 "go.y" | |
3405 { | 3304 { |
3406 (yyval.node) = nod(OGT, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3305 (yyval.node) = nod(OGT, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3407 } | 3306 } |
3408 break; | 3307 break; |
3409 | 3308 |
3410 case 102: | 3309 case 102: |
3411 | 3310 /* Line 1792 of yacc.c */ |
3412 /* Line 1806 of yacc.c */ | 3311 #line 792 "go.y" |
3413 #line 789 "go.y" | |
3414 { | 3312 { |
3415 (yyval.node) = nod(OADD, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3313 (yyval.node) = nod(OADD, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3416 } | 3314 } |
3417 break; | 3315 break; |
3418 | 3316 |
3419 case 103: | 3317 case 103: |
3420 | 3318 /* Line 1792 of yacc.c */ |
3421 /* Line 1806 of yacc.c */ | 3319 #line 796 "go.y" |
3422 #line 793 "go.y" | |
3423 { | 3320 { |
3424 (yyval.node) = nod(OSUB, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3321 (yyval.node) = nod(OSUB, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3425 } | 3322 } |
3426 break; | 3323 break; |
3427 | 3324 |
3428 case 104: | 3325 case 104: |
3429 | 3326 /* Line 1792 of yacc.c */ |
3430 /* Line 1806 of yacc.c */ | 3327 #line 800 "go.y" |
3431 #line 797 "go.y" | |
3432 { | 3328 { |
3433 (yyval.node) = nod(OOR, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); | 3329 (yyval.node) = nod(OOR, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3
)].node)); |
3434 } | 3330 } |
3435 break; | 3331 break; |
3436 | 3332 |
3437 case 105: | 3333 case 105: |
3438 | 3334 /* Line 1792 of yacc.c */ |
3439 /* Line 1806 of yacc.c */ | 3335 #line 804 "go.y" |
3440 #line 801 "go.y" | |
3441 { | 3336 { |
3442 (yyval.node) = nod(OXOR, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3337 (yyval.node) = nod(OXOR, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3443 } | 3338 } |
3444 break; | 3339 break; |
3445 | 3340 |
3446 case 106: | 3341 case 106: |
3447 | 3342 /* Line 1792 of yacc.c */ |
3448 /* Line 1806 of yacc.c */ | 3343 #line 808 "go.y" |
3449 #line 805 "go.y" | |
3450 { | 3344 { |
3451 (yyval.node) = nod(OMUL, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3345 (yyval.node) = nod(OMUL, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3452 } | 3346 } |
3453 break; | 3347 break; |
3454 | 3348 |
3455 case 107: | 3349 case 107: |
3456 | 3350 /* Line 1792 of yacc.c */ |
3457 /* Line 1806 of yacc.c */ | 3351 #line 812 "go.y" |
3458 #line 809 "go.y" | |
3459 { | 3352 { |
3460 (yyval.node) = nod(ODIV, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3353 (yyval.node) = nod(ODIV, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3461 } | 3354 } |
3462 break; | 3355 break; |
3463 | 3356 |
3464 case 108: | 3357 case 108: |
3465 | 3358 /* Line 1792 of yacc.c */ |
3466 /* Line 1806 of yacc.c */ | 3359 #line 816 "go.y" |
3467 #line 813 "go.y" | |
3468 { | 3360 { |
3469 (yyval.node) = nod(OMOD, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3361 (yyval.node) = nod(OMOD, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3470 } | 3362 } |
3471 break; | 3363 break; |
3472 | 3364 |
3473 case 109: | 3365 case 109: |
3474 | 3366 /* Line 1792 of yacc.c */ |
3475 /* Line 1806 of yacc.c */ | 3367 #line 820 "go.y" |
3476 #line 817 "go.y" | |
3477 { | 3368 { |
3478 (yyval.node) = nod(OAND, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3369 (yyval.node) = nod(OAND, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3479 } | 3370 } |
3480 break; | 3371 break; |
3481 | 3372 |
3482 case 110: | 3373 case 110: |
3483 | 3374 /* Line 1792 of yacc.c */ |
3484 /* Line 1806 of yacc.c */ | 3375 #line 824 "go.y" |
3485 #line 821 "go.y" | |
3486 { | 3376 { |
3487 (yyval.node) = nod(OANDNOT, (yyvsp[(1) - (3)].node), (yyvsp[(3)
- (3)].node)); | 3377 (yyval.node) = nod(OANDNOT, (yyvsp[(1) - (3)].node), (yyvsp[(3)
- (3)].node)); |
3488 } | 3378 } |
3489 break; | 3379 break; |
3490 | 3380 |
3491 case 111: | 3381 case 111: |
3492 | 3382 /* Line 1792 of yacc.c */ |
3493 /* Line 1806 of yacc.c */ | 3383 #line 828 "go.y" |
3494 #line 825 "go.y" | |
3495 { | 3384 { |
3496 (yyval.node) = nod(OLSH, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3385 (yyval.node) = nod(OLSH, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3497 } | 3386 } |
3498 break; | 3387 break; |
3499 | 3388 |
3500 case 112: | 3389 case 112: |
3501 | 3390 /* Line 1792 of yacc.c */ |
3502 /* Line 1806 of yacc.c */ | 3391 #line 832 "go.y" |
3503 #line 829 "go.y" | |
3504 { | 3392 { |
3505 (yyval.node) = nod(ORSH, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3393 (yyval.node) = nod(ORSH, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3506 } | 3394 } |
3507 break; | 3395 break; |
3508 | 3396 |
3509 case 113: | 3397 case 113: |
3510 | 3398 /* Line 1792 of yacc.c */ |
3511 /* Line 1806 of yacc.c */ | 3399 #line 837 "go.y" |
3512 #line 834 "go.y" | |
3513 { | 3400 { |
3514 (yyval.node) = nod(OSEND, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); | 3401 (yyval.node) = nod(OSEND, (yyvsp[(1) - (3)].node), (yyvsp[(3) -
(3)].node)); |
3515 } | 3402 } |
3516 break; | 3403 break; |
3517 | 3404 |
3518 case 115: | 3405 case 115: |
3519 | 3406 /* Line 1792 of yacc.c */ |
3520 /* Line 1806 of yacc.c */ | 3407 #line 844 "go.y" |
3521 #line 841 "go.y" | |
3522 { | 3408 { |
3523 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); | 3409 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); |
3524 } | 3410 } |
3525 break; | 3411 break; |
3526 | 3412 |
3527 case 116: | 3413 case 116: |
3528 | 3414 /* Line 1792 of yacc.c */ |
3529 /* Line 1806 of yacc.c */ | 3415 #line 848 "go.y" |
3530 #line 845 "go.y" | |
3531 { | 3416 { |
3532 if((yyvsp[(2) - (2)].node)->op == OCOMPLIT) { | 3417 if((yyvsp[(2) - (2)].node)->op == OCOMPLIT) { |
3533 // Special case for &T{...}: turn into (*T){...}. | 3418 // Special case for &T{...}: turn into (*T){...}. |
3534 (yyval.node) = (yyvsp[(2) - (2)].node); | 3419 (yyval.node) = (yyvsp[(2) - (2)].node); |
3535 (yyval.node)->right = nod(OIND, (yyval.node)->right, N); | 3420 (yyval.node)->right = nod(OIND, (yyval.node)->right, N); |
3536 (yyval.node)->right->implicit = 1; | 3421 (yyval.node)->right->implicit = 1; |
3537 } else { | 3422 } else { |
3538 (yyval.node) = nod(OADDR, (yyvsp[(2) - (2)].node), N); | 3423 (yyval.node) = nod(OADDR, (yyvsp[(2) - (2)].node), N); |
3539 } | 3424 } |
3540 } | 3425 } |
3541 break; | 3426 break; |
3542 | 3427 |
3543 case 117: | 3428 case 117: |
3544 | 3429 /* Line 1792 of yacc.c */ |
3545 /* Line 1806 of yacc.c */ | 3430 #line 859 "go.y" |
3546 #line 856 "go.y" | |
3547 { | 3431 { |
3548 (yyval.node) = nod(OPLUS, (yyvsp[(2) - (2)].node), N); | 3432 (yyval.node) = nod(OPLUS, (yyvsp[(2) - (2)].node), N); |
3549 } | 3433 } |
3550 break; | 3434 break; |
3551 | 3435 |
3552 case 118: | 3436 case 118: |
3553 | 3437 /* Line 1792 of yacc.c */ |
3554 /* Line 1806 of yacc.c */ | 3438 #line 863 "go.y" |
3555 #line 860 "go.y" | |
3556 { | 3439 { |
3557 (yyval.node) = nod(OMINUS, (yyvsp[(2) - (2)].node), N); | 3440 (yyval.node) = nod(OMINUS, (yyvsp[(2) - (2)].node), N); |
3558 } | 3441 } |
3559 break; | 3442 break; |
3560 | 3443 |
3561 case 119: | 3444 case 119: |
3562 | 3445 /* Line 1792 of yacc.c */ |
3563 /* Line 1806 of yacc.c */ | 3446 #line 867 "go.y" |
3564 #line 864 "go.y" | |
3565 { | 3447 { |
3566 (yyval.node) = nod(ONOT, (yyvsp[(2) - (2)].node), N); | 3448 (yyval.node) = nod(ONOT, (yyvsp[(2) - (2)].node), N); |
3567 } | 3449 } |
3568 break; | 3450 break; |
3569 | 3451 |
3570 case 120: | 3452 case 120: |
3571 | 3453 /* Line 1792 of yacc.c */ |
3572 /* Line 1806 of yacc.c */ | 3454 #line 871 "go.y" |
3573 #line 868 "go.y" | |
3574 { | 3455 { |
3575 yyerror("the bitwise complement operator is ^"); | 3456 yyerror("the bitwise complement operator is ^"); |
3576 (yyval.node) = nod(OCOM, (yyvsp[(2) - (2)].node), N); | 3457 (yyval.node) = nod(OCOM, (yyvsp[(2) - (2)].node), N); |
3577 } | 3458 } |
3578 break; | 3459 break; |
3579 | 3460 |
3580 case 121: | 3461 case 121: |
3581 | 3462 /* Line 1792 of yacc.c */ |
3582 /* Line 1806 of yacc.c */ | 3463 #line 876 "go.y" |
3583 #line 873 "go.y" | |
3584 { | 3464 { |
3585 (yyval.node) = nod(OCOM, (yyvsp[(2) - (2)].node), N); | 3465 (yyval.node) = nod(OCOM, (yyvsp[(2) - (2)].node), N); |
3586 } | 3466 } |
3587 break; | 3467 break; |
3588 | 3468 |
3589 case 122: | 3469 case 122: |
3590 | 3470 /* Line 1792 of yacc.c */ |
3591 /* Line 1806 of yacc.c */ | 3471 #line 880 "go.y" |
3592 #line 877 "go.y" | |
3593 { | 3472 { |
3594 (yyval.node) = nod(ORECV, (yyvsp[(2) - (2)].node), N); | 3473 (yyval.node) = nod(ORECV, (yyvsp[(2) - (2)].node), N); |
3595 } | 3474 } |
3596 break; | 3475 break; |
3597 | 3476 |
3598 case 123: | 3477 case 123: |
3599 | 3478 /* Line 1792 of yacc.c */ |
3600 /* Line 1806 of yacc.c */ | 3479 #line 890 "go.y" |
3601 #line 887 "go.y" | |
3602 { | 3480 { |
3603 (yyval.node) = nod(OCALL, (yyvsp[(1) - (3)].node), N); | 3481 (yyval.node) = nod(OCALL, (yyvsp[(1) - (3)].node), N); |
3604 } | 3482 } |
3605 break; | 3483 break; |
3606 | 3484 |
3607 case 124: | 3485 case 124: |
3608 | 3486 /* Line 1792 of yacc.c */ |
3609 /* Line 1806 of yacc.c */ | 3487 #line 894 "go.y" |
3610 #line 891 "go.y" | |
3611 { | 3488 { |
3612 (yyval.node) = nod(OCALL, (yyvsp[(1) - (5)].node), N); | 3489 (yyval.node) = nod(OCALL, (yyvsp[(1) - (5)].node), N); |
3613 (yyval.node)->list = (yyvsp[(3) - (5)].list); | 3490 (yyval.node)->list = (yyvsp[(3) - (5)].list); |
3614 } | 3491 } |
3615 break; | 3492 break; |
3616 | 3493 |
3617 case 125: | 3494 case 125: |
3618 | 3495 /* Line 1792 of yacc.c */ |
3619 /* Line 1806 of yacc.c */ | 3496 #line 899 "go.y" |
3620 #line 896 "go.y" | |
3621 { | 3497 { |
3622 (yyval.node) = nod(OCALL, (yyvsp[(1) - (6)].node), N); | 3498 (yyval.node) = nod(OCALL, (yyvsp[(1) - (6)].node), N); |
3623 (yyval.node)->list = (yyvsp[(3) - (6)].list); | 3499 (yyval.node)->list = (yyvsp[(3) - (6)].list); |
3624 (yyval.node)->isddd = 1; | 3500 (yyval.node)->isddd = 1; |
3625 } | 3501 } |
3626 break; | 3502 break; |
3627 | 3503 |
3628 case 126: | 3504 case 126: |
3629 | 3505 /* Line 1792 of yacc.c */ |
3630 /* Line 1806 of yacc.c */ | 3506 #line 907 "go.y" |
3631 #line 904 "go.y" | |
3632 { | 3507 { |
3633 (yyval.node) = nodlit((yyvsp[(1) - (1)].val)); | 3508 (yyval.node) = nodlit((yyvsp[(1) - (1)].val)); |
3634 } | 3509 } |
3635 break; | 3510 break; |
3636 | 3511 |
3637 case 128: | 3512 case 128: |
3638 | 3513 /* Line 1792 of yacc.c */ |
3639 /* Line 1806 of yacc.c */ | 3514 #line 912 "go.y" |
3640 #line 909 "go.y" | |
3641 { | 3515 { |
3642 if((yyvsp[(1) - (3)].node)->op == OPACK) { | 3516 if((yyvsp[(1) - (3)].node)->op == OPACK) { |
3643 Sym *s; | 3517 Sym *s; |
3644 s = restrictlookup((yyvsp[(3) - (3)].sym)->name, (yyvsp[
(1) - (3)].node)->pkg); | 3518 s = restrictlookup((yyvsp[(3) - (3)].sym)->name, (yyvsp[
(1) - (3)].node)->pkg); |
3645 (yyvsp[(1) - (3)].node)->used = 1; | 3519 (yyvsp[(1) - (3)].node)->used = 1; |
3646 (yyval.node) = oldname(s); | 3520 (yyval.node) = oldname(s); |
3647 break; | 3521 break; |
3648 } | 3522 } |
3649 (yyval.node) = nod(OXDOT, (yyvsp[(1) - (3)].node), newname((yyvs
p[(3) - (3)].sym))); | 3523 (yyval.node) = nod(OXDOT, (yyvsp[(1) - (3)].node), newname((yyvs
p[(3) - (3)].sym))); |
3650 } | 3524 } |
3651 break; | 3525 break; |
3652 | 3526 |
3653 case 129: | 3527 case 129: |
3654 | 3528 /* Line 1792 of yacc.c */ |
3655 /* Line 1806 of yacc.c */ | 3529 #line 923 "go.y" |
3656 #line 920 "go.y" | |
3657 { | 3530 { |
3658 (yyval.node) = nod(ODOTTYPE, (yyvsp[(1) - (5)].node), (yyvsp[(4)
- (5)].node)); | 3531 (yyval.node) = nod(ODOTTYPE, (yyvsp[(1) - (5)].node), (yyvsp[(4)
- (5)].node)); |
3659 } | 3532 } |
3660 break; | 3533 break; |
3661 | 3534 |
3662 case 130: | 3535 case 130: |
3663 | 3536 /* Line 1792 of yacc.c */ |
3664 /* Line 1806 of yacc.c */ | 3537 #line 927 "go.y" |
3665 #line 924 "go.y" | |
3666 { | 3538 { |
3667 (yyval.node) = nod(OTYPESW, N, (yyvsp[(1) - (5)].node)); | 3539 (yyval.node) = nod(OTYPESW, N, (yyvsp[(1) - (5)].node)); |
3668 } | 3540 } |
3669 break; | 3541 break; |
3670 | 3542 |
3671 case 131: | 3543 case 131: |
3672 | 3544 /* Line 1792 of yacc.c */ |
3673 /* Line 1806 of yacc.c */ | 3545 #line 931 "go.y" |
3674 #line 928 "go.y" | |
3675 { | 3546 { |
3676 (yyval.node) = nod(OINDEX, (yyvsp[(1) - (4)].node), (yyvsp[(3) -
(4)].node)); | 3547 (yyval.node) = nod(OINDEX, (yyvsp[(1) - (4)].node), (yyvsp[(3) -
(4)].node)); |
3677 } | 3548 } |
3678 break; | 3549 break; |
3679 | 3550 |
3680 case 132: | 3551 case 132: |
3681 | 3552 /* Line 1792 of yacc.c */ |
3682 /* Line 1806 of yacc.c */ | 3553 #line 935 "go.y" |
3683 #line 932 "go.y" | |
3684 { | 3554 { |
3685 (yyval.node) = nod(OSLICE, (yyvsp[(1) - (6)].node), nod(OKEY, (y
yvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node))); | 3555 (yyval.node) = nod(OSLICE, (yyvsp[(1) - (6)].node), nod(OKEY, (y
yvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node))); |
3686 } | 3556 } |
3687 break; | 3557 break; |
3688 | 3558 |
3689 case 134: | 3559 case 134: |
3690 | 3560 /* Line 1792 of yacc.c */ |
3691 /* Line 1806 of yacc.c */ | 3561 #line 940 "go.y" |
3692 #line 937 "go.y" | |
3693 { | 3562 { |
3694 // conversion | 3563 // conversion |
3695 (yyval.node) = nod(OCALL, (yyvsp[(1) - (4)].node), N); | 3564 (yyval.node) = nod(OCALL, (yyvsp[(1) - (4)].node), N); |
3696 (yyval.node)->list = list1((yyvsp[(3) - (4)].node)); | 3565 (yyval.node)->list = list1((yyvsp[(3) - (4)].node)); |
3697 } | 3566 } |
3698 break; | 3567 break; |
3699 | 3568 |
3700 case 135: | 3569 case 135: |
3701 | 3570 /* Line 1792 of yacc.c */ |
3702 /* Line 1806 of yacc.c */ | 3571 #line 946 "go.y" |
3703 #line 943 "go.y" | |
3704 { | 3572 { |
3705 (yyval.node) = (yyvsp[(3) - (5)].node); | 3573 (yyval.node) = (yyvsp[(3) - (5)].node); |
3706 (yyval.node)->right = (yyvsp[(1) - (5)].node); | 3574 (yyval.node)->right = (yyvsp[(1) - (5)].node); |
3707 (yyval.node)->list = (yyvsp[(4) - (5)].list); | 3575 (yyval.node)->list = (yyvsp[(4) - (5)].list); |
3708 fixlbrace((yyvsp[(2) - (5)].i)); | 3576 fixlbrace((yyvsp[(2) - (5)].i)); |
3709 } | 3577 } |
3710 break; | 3578 break; |
3711 | 3579 |
3712 case 136: | 3580 case 136: |
3713 | 3581 /* Line 1792 of yacc.c */ |
3714 /* Line 1806 of yacc.c */ | 3582 #line 953 "go.y" |
3715 #line 950 "go.y" | |
3716 { | 3583 { |
3717 (yyval.node) = (yyvsp[(3) - (5)].node); | 3584 (yyval.node) = (yyvsp[(3) - (5)].node); |
3718 (yyval.node)->right = (yyvsp[(1) - (5)].node); | 3585 (yyval.node)->right = (yyvsp[(1) - (5)].node); |
3719 (yyval.node)->list = (yyvsp[(4) - (5)].list); | 3586 (yyval.node)->list = (yyvsp[(4) - (5)].list); |
3720 } | 3587 } |
3721 break; | 3588 break; |
3722 | 3589 |
3723 case 137: | 3590 case 137: |
3724 | 3591 /* Line 1792 of yacc.c */ |
3725 /* Line 1806 of yacc.c */ | 3592 #line 959 "go.y" |
3726 #line 956 "go.y" | |
3727 { | 3593 { |
3728 yyerror("cannot parenthesize type in composite literal"); | 3594 yyerror("cannot parenthesize type in composite literal"); |
3729 (yyval.node) = (yyvsp[(5) - (7)].node); | 3595 (yyval.node) = (yyvsp[(5) - (7)].node); |
3730 (yyval.node)->right = (yyvsp[(2) - (7)].node); | 3596 (yyval.node)->right = (yyvsp[(2) - (7)].node); |
3731 (yyval.node)->list = (yyvsp[(6) - (7)].list); | 3597 (yyval.node)->list = (yyvsp[(6) - (7)].list); |
3732 } | 3598 } |
3733 break; | 3599 break; |
3734 | 3600 |
3735 case 139: | 3601 case 139: |
3736 | 3602 /* Line 1792 of yacc.c */ |
3737 /* Line 1806 of yacc.c */ | 3603 #line 968 "go.y" |
3738 #line 965 "go.y" | |
3739 { | 3604 { |
3740 // composite expression. | 3605 // composite expression. |
3741 // make node early so we get the right line number. | 3606 // make node early so we get the right line number. |
3742 (yyval.node) = nod(OCOMPLIT, N, N); | 3607 (yyval.node) = nod(OCOMPLIT, N, N); |
3743 } | 3608 } |
3744 break; | 3609 break; |
3745 | 3610 |
3746 case 140: | 3611 case 140: |
3747 | 3612 /* Line 1792 of yacc.c */ |
3748 /* Line 1806 of yacc.c */ | 3613 #line 976 "go.y" |
3749 #line 973 "go.y" | |
3750 { | 3614 { |
3751 (yyval.node) = nod(OKEY, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); | 3615 (yyval.node) = nod(OKEY, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (
3)].node)); |
3752 } | 3616 } |
3753 break; | 3617 break; |
3754 | 3618 |
3755 case 141: | 3619 case 141: |
3756 | 3620 /* Line 1792 of yacc.c */ |
3757 /* Line 1806 of yacc.c */ | 3621 #line 982 "go.y" |
3758 #line 979 "go.y" | |
3759 { | 3622 { |
3760 // These nodes do not carry line numbers. | 3623 // These nodes do not carry line numbers. |
3761 // Since a composite literal commonly spans several lines, | 3624 // Since a composite literal commonly spans several lines, |
3762 // the line number on errors may be misleading. | 3625 // the line number on errors may be misleading. |
3763 // Introduce a wrapper node to give the correct line. | 3626 // Introduce a wrapper node to give the correct line. |
3764 (yyval.node) = (yyvsp[(1) - (1)].node); | 3627 (yyval.node) = (yyvsp[(1) - (1)].node); |
3765 switch((yyval.node)->op) { | 3628 switch((yyval.node)->op) { |
3766 case ONAME: | 3629 case ONAME: |
3767 case ONONAME: | 3630 case ONONAME: |
3768 case OTYPE: | 3631 case OTYPE: |
3769 case OPACK: | 3632 case OPACK: |
3770 case OLITERAL: | 3633 case OLITERAL: |
3771 (yyval.node) = nod(OPAREN, (yyval.node), N); | 3634 (yyval.node) = nod(OPAREN, (yyval.node), N); |
3772 } | 3635 } |
3773 } | 3636 } |
3774 break; | 3637 break; |
3775 | 3638 |
3776 case 142: | 3639 case 142: |
3777 | 3640 /* Line 1792 of yacc.c */ |
3778 /* Line 1806 of yacc.c */ | 3641 #line 998 "go.y" |
3779 #line 995 "go.y" | |
3780 { | 3642 { |
3781 (yyval.node) = (yyvsp[(2) - (4)].node); | 3643 (yyval.node) = (yyvsp[(2) - (4)].node); |
3782 (yyval.node)->list = (yyvsp[(3) - (4)].list); | 3644 (yyval.node)->list = (yyvsp[(3) - (4)].list); |
3783 } | 3645 } |
3784 break; | 3646 break; |
3785 | 3647 |
3786 case 144: | 3648 case 144: |
3787 | 3649 /* Line 1792 of yacc.c */ |
3788 /* Line 1806 of yacc.c */ | 3650 #line 1006 "go.y" |
3789 #line 1003 "go.y" | |
3790 { | 3651 { |
3791 (yyval.node) = (yyvsp[(2) - (4)].node); | 3652 (yyval.node) = (yyvsp[(2) - (4)].node); |
3792 (yyval.node)->list = (yyvsp[(3) - (4)].list); | 3653 (yyval.node)->list = (yyvsp[(3) - (4)].list); |
3793 } | 3654 } |
3794 break; | 3655 break; |
3795 | 3656 |
3796 case 146: | 3657 case 146: |
3797 | 3658 /* Line 1792 of yacc.c */ |
3798 /* Line 1806 of yacc.c */ | 3659 #line 1014 "go.y" |
3799 #line 1011 "go.y" | |
3800 { | 3660 { |
3801 (yyval.node) = (yyvsp[(2) - (3)].node); | 3661 (yyval.node) = (yyvsp[(2) - (3)].node); |
3802 ················ | 3662 ················ |
3803 // Need to know on lhs of := whether there are ( ). | 3663 // Need to know on lhs of := whether there are ( ). |
3804 // Don't bother with the OPAREN in other cases: | 3664 // Don't bother with the OPAREN in other cases: |
3805 // it's just a waste of memory and time. | 3665 // it's just a waste of memory and time. |
3806 switch((yyval.node)->op) { | 3666 switch((yyval.node)->op) { |
3807 case ONAME: | 3667 case ONAME: |
3808 case ONONAME: | 3668 case ONONAME: |
3809 case OPACK: | 3669 case OPACK: |
3810 case OTYPE: | 3670 case OTYPE: |
3811 case OLITERAL: | 3671 case OLITERAL: |
3812 case OTYPESW: | 3672 case OTYPESW: |
3813 (yyval.node) = nod(OPAREN, (yyval.node), N); | 3673 (yyval.node) = nod(OPAREN, (yyval.node), N); |
3814 } | 3674 } |
3815 } | 3675 } |
3816 break; | 3676 break; |
3817 | 3677 |
3818 case 150: | 3678 case 150: |
3819 | 3679 /* Line 1792 of yacc.c */ |
3820 /* Line 1806 of yacc.c */ | 3680 #line 1040 "go.y" |
3821 #line 1037 "go.y" | |
3822 { | 3681 { |
3823 (yyval.i) = LBODY; | 3682 (yyval.i) = LBODY; |
3824 } | 3683 } |
3825 break; | 3684 break; |
3826 | 3685 |
3827 case 151: | 3686 case 151: |
3828 | 3687 /* Line 1792 of yacc.c */ |
3829 /* Line 1806 of yacc.c */ | 3688 #line 1044 "go.y" |
3830 #line 1041 "go.y" | |
3831 { | 3689 { |
3832 (yyval.i) = '{'; | 3690 (yyval.i) = '{'; |
3833 } | 3691 } |
3834 break; | 3692 break; |
3835 | 3693 |
3836 case 152: | 3694 case 152: |
3837 | 3695 /* Line 1792 of yacc.c */ |
3838 /* Line 1806 of yacc.c */ | 3696 #line 1055 "go.y" |
3839 #line 1052 "go.y" | |
3840 { | 3697 { |
3841 if((yyvsp[(1) - (1)].sym) == S) | 3698 if((yyvsp[(1) - (1)].sym) == S) |
3842 (yyval.node) = N; | 3699 (yyval.node) = N; |
3843 else | 3700 else |
3844 (yyval.node) = newname((yyvsp[(1) - (1)].sym)); | 3701 (yyval.node) = newname((yyvsp[(1) - (1)].sym)); |
3845 } | 3702 } |
3846 break; | 3703 break; |
3847 | 3704 |
3848 case 153: | 3705 case 153: |
3849 | 3706 /* Line 1792 of yacc.c */ |
3850 /* Line 1806 of yacc.c */ | 3707 #line 1064 "go.y" |
3851 #line 1061 "go.y" | |
3852 { | 3708 { |
3853 (yyval.node) = dclname((yyvsp[(1) - (1)].sym)); | 3709 (yyval.node) = dclname((yyvsp[(1) - (1)].sym)); |
3854 } | 3710 } |
3855 break; | 3711 break; |
3856 | 3712 |
3857 case 154: | 3713 case 154: |
3858 | 3714 /* Line 1792 of yacc.c */ |
3859 /* Line 1806 of yacc.c */ | 3715 #line 1069 "go.y" |
3860 #line 1066 "go.y" | |
3861 { | 3716 { |
3862 (yyval.node) = N; | 3717 (yyval.node) = N; |
3863 } | 3718 } |
3864 break; | 3719 break; |
3865 | 3720 |
3866 case 156: | 3721 case 156: |
3867 | 3722 /* Line 1792 of yacc.c */ |
3868 /* Line 1806 of yacc.c */ | 3723 #line 1076 "go.y" |
3869 #line 1073 "go.y" | |
3870 { | 3724 { |
3871 (yyval.sym) = (yyvsp[(1) - (1)].sym); | 3725 (yyval.sym) = (yyvsp[(1) - (1)].sym); |
3872 // during imports, unqualified non-exported identifiers are from
builtinpkg | 3726 // during imports, unqualified non-exported identifiers are from
builtinpkg |
3873 if(importpkg != nil && !exportname((yyvsp[(1) - (1)].sym)->name)
) | 3727 if(importpkg != nil && !exportname((yyvsp[(1) - (1)].sym)->name)
) |
3874 (yyval.sym) = pkglookup((yyvsp[(1) - (1)].sym)->name, bu
iltinpkg); | 3728 (yyval.sym) = pkglookup((yyvsp[(1) - (1)].sym)->name, bu
iltinpkg); |
3875 } | 3729 } |
3876 break; | 3730 break; |
3877 | 3731 |
3878 case 158: | 3732 case 158: |
3879 | 3733 /* Line 1792 of yacc.c */ |
3880 /* Line 1806 of yacc.c */ | 3734 #line 1084 "go.y" |
3881 #line 1081 "go.y" | |
3882 { | 3735 { |
3883 (yyval.sym) = S; | 3736 (yyval.sym) = S; |
3884 } | 3737 } |
3885 break; | 3738 break; |
3886 | 3739 |
3887 case 159: | 3740 case 159: |
3888 | 3741 /* Line 1792 of yacc.c */ |
3889 /* Line 1806 of yacc.c */ | 3742 #line 1090 "go.y" |
3890 #line 1087 "go.y" | |
3891 { | 3743 { |
3892 Pkg *p; | 3744 Pkg *p; |
3893 | 3745 |
3894 if((yyvsp[(2) - (4)].val).u.sval->len == 0) | 3746 if((yyvsp[(2) - (4)].val).u.sval->len == 0) |
3895 p = importpkg; | 3747 p = importpkg; |
3896 else { | 3748 else { |
3897 if(isbadimport((yyvsp[(2) - (4)].val).u.sval)) | 3749 if(isbadimport((yyvsp[(2) - (4)].val).u.sval)) |
3898 errorexit(); | 3750 errorexit(); |
3899 p = mkpkg((yyvsp[(2) - (4)].val).u.sval); | 3751 p = mkpkg((yyvsp[(2) - (4)].val).u.sval); |
3900 } | 3752 } |
3901 (yyval.sym) = pkglookup((yyvsp[(4) - (4)].sym)->name, p); | 3753 (yyval.sym) = pkglookup((yyvsp[(4) - (4)].sym)->name, p); |
3902 } | 3754 } |
3903 break; | 3755 break; |
3904 | 3756 |
3905 case 160: | 3757 case 160: |
3906 | 3758 /* Line 1792 of yacc.c */ |
3907 /* Line 1806 of yacc.c */ | 3759 #line 1105 "go.y" |
3908 #line 1102 "go.y" | |
3909 { | 3760 { |
3910 (yyval.node) = oldname((yyvsp[(1) - (1)].sym)); | 3761 (yyval.node) = oldname((yyvsp[(1) - (1)].sym)); |
3911 if((yyval.node)->pack != N) | 3762 if((yyval.node)->pack != N) |
3912 (yyval.node)->pack->used = 1; | 3763 (yyval.node)->pack->used = 1; |
3913 } | 3764 } |
3914 break; | 3765 break; |
3915 | 3766 |
3916 case 162: | 3767 case 162: |
3917 | 3768 /* Line 1792 of yacc.c */ |
3918 /* Line 1806 of yacc.c */ | 3769 #line 1125 "go.y" |
3919 #line 1122 "go.y" | |
3920 { | 3770 { |
3921 yyerror("final argument in variadic function missing type"); | 3771 yyerror("final argument in variadic function missing type"); |
3922 (yyval.node) = nod(ODDD, typenod(typ(TINTER)), N); | 3772 (yyval.node) = nod(ODDD, typenod(typ(TINTER)), N); |
3923 } | 3773 } |
3924 break; | 3774 break; |
3925 | 3775 |
3926 case 163: | 3776 case 163: |
3927 | 3777 /* Line 1792 of yacc.c */ |
3928 /* Line 1806 of yacc.c */ | 3778 #line 1130 "go.y" |
3929 #line 1127 "go.y" | |
3930 { | 3779 { |
3931 (yyval.node) = nod(ODDD, (yyvsp[(2) - (2)].node), N); | 3780 (yyval.node) = nod(ODDD, (yyvsp[(2) - (2)].node), N); |
3932 } | 3781 } |
3933 break; | 3782 break; |
3934 | 3783 |
3935 case 169: | 3784 case 169: |
3936 | 3785 /* Line 1792 of yacc.c */ |
3937 /* Line 1806 of yacc.c */ | 3786 #line 1141 "go.y" |
3938 #line 1138 "go.y" | |
3939 { | 3787 { |
3940 (yyval.node) = nod(OTPAREN, (yyvsp[(2) - (3)].node), N); | 3788 (yyval.node) = nod(OTPAREN, (yyvsp[(2) - (3)].node), N); |
3941 } | 3789 } |
3942 break; | 3790 break; |
3943 | 3791 |
3944 case 173: | 3792 case 173: |
3945 | 3793 /* Line 1792 of yacc.c */ |
3946 /* Line 1806 of yacc.c */ | 3794 #line 1150 "go.y" |
3947 #line 1147 "go.y" | |
3948 { | 3795 { |
3949 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); | 3796 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); |
3950 } | 3797 } |
3951 break; | 3798 break; |
3952 | 3799 |
3953 case 178: | 3800 case 178: |
3954 | 3801 /* Line 1792 of yacc.c */ |
3955 /* Line 1806 of yacc.c */ | 3802 #line 1160 "go.y" |
3956 #line 1157 "go.y" | |
3957 { | 3803 { |
3958 (yyval.node) = nod(OTPAREN, (yyvsp[(2) - (3)].node), N); | 3804 (yyval.node) = nod(OTPAREN, (yyvsp[(2) - (3)].node), N); |
3959 } | 3805 } |
3960 break; | 3806 break; |
3961 | 3807 |
3962 case 188: | 3808 case 188: |
3963 | 3809 /* Line 1792 of yacc.c */ |
3964 /* Line 1806 of yacc.c */ | 3810 #line 1181 "go.y" |
3965 #line 1178 "go.y" | |
3966 { | 3811 { |
3967 if((yyvsp[(1) - (3)].node)->op == OPACK) { | 3812 if((yyvsp[(1) - (3)].node)->op == OPACK) { |
3968 Sym *s; | 3813 Sym *s; |
3969 s = restrictlookup((yyvsp[(3) - (3)].sym)->name, (yyvsp[
(1) - (3)].node)->pkg); | 3814 s = restrictlookup((yyvsp[(3) - (3)].sym)->name, (yyvsp[
(1) - (3)].node)->pkg); |
3970 (yyvsp[(1) - (3)].node)->used = 1; | 3815 (yyvsp[(1) - (3)].node)->used = 1; |
3971 (yyval.node) = oldname(s); | 3816 (yyval.node) = oldname(s); |
3972 break; | 3817 break; |
3973 } | 3818 } |
3974 (yyval.node) = nod(OXDOT, (yyvsp[(1) - (3)].node), newname((yyvs
p[(3) - (3)].sym))); | 3819 (yyval.node) = nod(OXDOT, (yyvsp[(1) - (3)].node), newname((yyvs
p[(3) - (3)].sym))); |
3975 } | 3820 } |
3976 break; | 3821 break; |
3977 | 3822 |
3978 case 189: | 3823 case 189: |
3979 | 3824 /* Line 1792 of yacc.c */ |
3980 /* Line 1806 of yacc.c */ | 3825 #line 1194 "go.y" |
3981 #line 1191 "go.y" | |
3982 { | 3826 { |
3983 (yyval.node) = nod(OTARRAY, (yyvsp[(2) - (4)].node), (yyvsp[(4)
- (4)].node)); | 3827 (yyval.node) = nod(OTARRAY, (yyvsp[(2) - (4)].node), (yyvsp[(4)
- (4)].node)); |
3984 } | 3828 } |
3985 break; | 3829 break; |
3986 | 3830 |
3987 case 190: | 3831 case 190: |
3988 | 3832 /* Line 1792 of yacc.c */ |
3989 /* Line 1806 of yacc.c */ | 3833 #line 1198 "go.y" |
3990 #line 1195 "go.y" | |
3991 { | 3834 { |
3992 // array literal of nelem | 3835 // array literal of nelem |
3993 (yyval.node) = nod(OTARRAY, nod(ODDD, N, N), (yyvsp[(4) - (4)].n
ode)); | 3836 (yyval.node) = nod(OTARRAY, nod(ODDD, N, N), (yyvsp[(4) - (4)].n
ode)); |
3994 } | 3837 } |
3995 break; | 3838 break; |
3996 | 3839 |
3997 case 191: | 3840 case 191: |
3998 | 3841 /* Line 1792 of yacc.c */ |
3999 /* Line 1806 of yacc.c */ | 3842 #line 1203 "go.y" |
4000 #line 1200 "go.y" | |
4001 { | 3843 { |
4002 (yyval.node) = nod(OTCHAN, (yyvsp[(2) - (2)].node), N); | 3844 (yyval.node) = nod(OTCHAN, (yyvsp[(2) - (2)].node), N); |
4003 (yyval.node)->etype = Cboth; | 3845 (yyval.node)->etype = Cboth; |
4004 } | 3846 } |
4005 break; | 3847 break; |
4006 | 3848 |
4007 case 192: | 3849 case 192: |
4008 | 3850 /* Line 1792 of yacc.c */ |
4009 /* Line 1806 of yacc.c */ | 3851 #line 1208 "go.y" |
4010 #line 1205 "go.y" | |
4011 { | 3852 { |
4012 (yyval.node) = nod(OTCHAN, (yyvsp[(3) - (3)].node), N); | 3853 (yyval.node) = nod(OTCHAN, (yyvsp[(3) - (3)].node), N); |
4013 (yyval.node)->etype = Csend; | 3854 (yyval.node)->etype = Csend; |
4014 } | 3855 } |
4015 break; | 3856 break; |
4016 | 3857 |
4017 case 193: | 3858 case 193: |
4018 | 3859 /* Line 1792 of yacc.c */ |
4019 /* Line 1806 of yacc.c */ | 3860 #line 1213 "go.y" |
4020 #line 1210 "go.y" | |
4021 { | 3861 { |
4022 (yyval.node) = nod(OTMAP, (yyvsp[(3) - (5)].node), (yyvsp[(5) -
(5)].node)); | 3862 (yyval.node) = nod(OTMAP, (yyvsp[(3) - (5)].node), (yyvsp[(5) -
(5)].node)); |
4023 } | 3863 } |
4024 break; | 3864 break; |
4025 | 3865 |
4026 case 196: | 3866 case 196: |
4027 | 3867 /* Line 1792 of yacc.c */ |
4028 /* Line 1806 of yacc.c */ | 3868 #line 1221 "go.y" |
4029 #line 1218 "go.y" | |
4030 { | 3869 { |
4031 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); | 3870 (yyval.node) = nod(OIND, (yyvsp[(2) - (2)].node), N); |
4032 } | 3871 } |
4033 break; | 3872 break; |
4034 | 3873 |
4035 case 197: | 3874 case 197: |
4036 | 3875 /* Line 1792 of yacc.c */ |
4037 /* Line 1806 of yacc.c */ | 3876 #line 1227 "go.y" |
4038 #line 1224 "go.y" | |
4039 { | 3877 { |
4040 (yyval.node) = nod(OTCHAN, (yyvsp[(3) - (3)].node), N); | 3878 (yyval.node) = nod(OTCHAN, (yyvsp[(3) - (3)].node), N); |
4041 (yyval.node)->etype = Crecv; | 3879 (yyval.node)->etype = Crecv; |
4042 } | 3880 } |
4043 break; | 3881 break; |
4044 | 3882 |
4045 case 198: | 3883 case 198: |
4046 | 3884 /* Line 1792 of yacc.c */ |
4047 /* Line 1806 of yacc.c */ | 3885 #line 1234 "go.y" |
4048 #line 1231 "go.y" | |
4049 { | 3886 { |
4050 (yyval.node) = nod(OTSTRUCT, N, N); | 3887 (yyval.node) = nod(OTSTRUCT, N, N); |
4051 (yyval.node)->list = (yyvsp[(3) - (5)].list); | 3888 (yyval.node)->list = (yyvsp[(3) - (5)].list); |
4052 fixlbrace((yyvsp[(2) - (5)].i)); | 3889 fixlbrace((yyvsp[(2) - (5)].i)); |
4053 } | 3890 } |
4054 break; | 3891 break; |
4055 | 3892 |
4056 case 199: | 3893 case 199: |
4057 | 3894 /* Line 1792 of yacc.c */ |
4058 /* Line 1806 of yacc.c */ | 3895 #line 1240 "go.y" |
4059 #line 1237 "go.y" | |
4060 { | 3896 { |
4061 (yyval.node) = nod(OTSTRUCT, N, N); | 3897 (yyval.node) = nod(OTSTRUCT, N, N); |
4062 fixlbrace((yyvsp[(2) - (3)].i)); | 3898 fixlbrace((yyvsp[(2) - (3)].i)); |
4063 } | 3899 } |
4064 break; | 3900 break; |
4065 | 3901 |
4066 case 200: | 3902 case 200: |
4067 | 3903 /* Line 1792 of yacc.c */ |
4068 /* Line 1806 of yacc.c */ | 3904 #line 1247 "go.y" |
4069 #line 1244 "go.y" | |
4070 { | 3905 { |
4071 (yyval.node) = nod(OTINTER, N, N); | 3906 (yyval.node) = nod(OTINTER, N, N); |
4072 (yyval.node)->list = (yyvsp[(3) - (5)].list); | 3907 (yyval.node)->list = (yyvsp[(3) - (5)].list); |
4073 fixlbrace((yyvsp[(2) - (5)].i)); | 3908 fixlbrace((yyvsp[(2) - (5)].i)); |
4074 } | 3909 } |
4075 break; | 3910 break; |
4076 | 3911 |
4077 case 201: | 3912 case 201: |
4078 | 3913 /* Line 1792 of yacc.c */ |
4079 /* Line 1806 of yacc.c */ | 3914 #line 1253 "go.y" |
4080 #line 1250 "go.y" | |
4081 { | 3915 { |
4082 (yyval.node) = nod(OTINTER, N, N); | 3916 (yyval.node) = nod(OTINTER, N, N); |
4083 fixlbrace((yyvsp[(2) - (3)].i)); | 3917 fixlbrace((yyvsp[(2) - (3)].i)); |
4084 } | 3918 } |
4085 break; | 3919 break; |
4086 | 3920 |
4087 case 202: | 3921 case 202: |
4088 | 3922 /* Line 1792 of yacc.c */ |
4089 /* Line 1806 of yacc.c */ | 3923 #line 1264 "go.y" |
4090 #line 1261 "go.y" | |
4091 { | 3924 { |
4092 (yyval.node) = (yyvsp[(2) - (3)].node); | 3925 (yyval.node) = (yyvsp[(2) - (3)].node); |
4093 if((yyval.node) == N) | 3926 if((yyval.node) == N) |
4094 break; | 3927 break; |
4095 (yyval.node)->nbody = (yyvsp[(3) - (3)].list); | 3928 (yyval.node)->nbody = (yyvsp[(3) - (3)].list); |
4096 (yyval.node)->endlineno = lineno; | 3929 (yyval.node)->endlineno = lineno; |
4097 funcbody((yyval.node)); | 3930 funcbody((yyval.node)); |
4098 } | 3931 } |
4099 break; | 3932 break; |
4100 | 3933 |
4101 case 203: | 3934 case 203: |
4102 | 3935 /* Line 1792 of yacc.c */ |
4103 /* Line 1806 of yacc.c */ | 3936 #line 1275 "go.y" |
4104 #line 1272 "go.y" | |
4105 { | 3937 { |
4106 Node *t; | 3938 Node *t; |
4107 | 3939 |
4108 (yyval.node) = N; | 3940 (yyval.node) = N; |
4109 (yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list),
1); | 3941 (yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list),
1); |
4110 | 3942 |
4111 if(strcmp((yyvsp[(1) - (5)].sym)->name, "init") == 0) { | 3943 if(strcmp((yyvsp[(1) - (5)].sym)->name, "init") == 0) { |
4112 (yyvsp[(1) - (5)].sym) = renameinit(); | 3944 (yyvsp[(1) - (5)].sym) = renameinit(); |
4113 if((yyvsp[(3) - (5)].list) != nil || (yyvsp[(5) - (5)].l
ist) != nil) | 3945 if((yyvsp[(3) - (5)].list) != nil || (yyvsp[(5) - (5)].l
ist) != nil) |
4114 yyerror("func init must have no arguments and no
return values"); | 3946 yyerror("func init must have no arguments and no
return values"); |
(...skipping 11 matching lines...) Expand all Loading... |
4126 (yyval.node)->nname = newname((yyvsp[(1) - (5)].sym)); | 3958 (yyval.node)->nname = newname((yyvsp[(1) - (5)].sym)); |
4127 (yyval.node)->nname->defn = (yyval.node); | 3959 (yyval.node)->nname->defn = (yyval.node); |
4128 (yyval.node)->nname->ntype = t; // TODO: check if nname
already has an ntype | 3960 (yyval.node)->nname->ntype = t; // TODO: check if nname
already has an ntype |
4129 declare((yyval.node)->nname, PFUNC); | 3961 declare((yyval.node)->nname, PFUNC); |
4130 | 3962 |
4131 funchdr((yyval.node)); | 3963 funchdr((yyval.node)); |
4132 } | 3964 } |
4133 break; | 3965 break; |
4134 | 3966 |
4135 case 204: | 3967 case 204: |
4136 | 3968 /* Line 1792 of yacc.c */ |
4137 /* Line 1806 of yacc.c */ | 3969 #line 1304 "go.y" |
4138 #line 1301 "go.y" | |
4139 { | 3970 { |
4140 Node *rcvr, *t; | 3971 Node *rcvr, *t; |
4141 | 3972 |
4142 (yyval.node) = N; | 3973 (yyval.node) = N; |
4143 (yyvsp[(2) - (8)].list) = checkarglist((yyvsp[(2) - (8)].list),
0); | 3974 (yyvsp[(2) - (8)].list) = checkarglist((yyvsp[(2) - (8)].list),
0); |
4144 (yyvsp[(6) - (8)].list) = checkarglist((yyvsp[(6) - (8)].list),
1); | 3975 (yyvsp[(6) - (8)].list) = checkarglist((yyvsp[(6) - (8)].list),
1); |
4145 | 3976 |
4146 if((yyvsp[(2) - (8)].list) == nil) { | 3977 if((yyvsp[(2) - (8)].list) == nil) { |
4147 yyerror("method has no receiver"); | 3978 yyerror("method has no receiver"); |
4148 break; | 3979 break; |
(...skipping 20 matching lines...) Expand all Loading... |
4169 (yyval.node)->nname->defn = (yyval.node); | 4000 (yyval.node)->nname->defn = (yyval.node); |
4170 (yyval.node)->nname->ntype = t; | 4001 (yyval.node)->nname->ntype = t; |
4171 (yyval.node)->nname->nointerface = nointerface; | 4002 (yyval.node)->nname->nointerface = nointerface; |
4172 declare((yyval.node)->nname, PFUNC); | 4003 declare((yyval.node)->nname, PFUNC); |
4173 | 4004 |
4174 funchdr((yyval.node)); | 4005 funchdr((yyval.node)); |
4175 } | 4006 } |
4176 break; | 4007 break; |
4177 | 4008 |
4178 case 205: | 4009 case 205: |
4179 | 4010 /* Line 1792 of yacc.c */ |
4180 /* Line 1806 of yacc.c */ | 4011 #line 1344 "go.y" |
4181 #line 1341 "go.y" | |
4182 { | 4012 { |
4183 Sym *s; | 4013 Sym *s; |
4184 Type *t; | 4014 Type *t; |
4185 | 4015 |
4186 (yyval.node) = N; | 4016 (yyval.node) = N; |
4187 | 4017 |
4188 s = (yyvsp[(1) - (5)].sym); | 4018 s = (yyvsp[(1) - (5)].sym); |
4189 t = functype(N, (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list)
); | |
4190 | |
4191 importsym(s, ONAME); | 4019 importsym(s, ONAME); |
4192 if(s->def != N && s->def->op == ONAME) { | 4020 if(s->def != N && s->def->op == ONAME) { |
4193 » » » if(eqtype(t, s->def->type)) { | 4021 » » » if(eqfunctype(s->def->type, nil, (yyvsp[(3) - (5)].flist
), (yyvsp[(5) - (5)].flist))) { |
4194 dclcontext = PDISCARD; // since we skip funchdr
below | 4022 dclcontext = PDISCARD; // since we skip funchdr
below |
4195 break; | 4023 break; |
4196 } | 4024 } |
| 4025 t = functype(F, (yyvsp[(3) - (5)].flist), (yyvsp[(5) - (
5)].flist)); |
4197 yyerror("inconsistent definition for func %S during impo
rt\n\t%T\n\t%T", s, s->def->type, t); | 4026 yyerror("inconsistent definition for func %S during impo
rt\n\t%T\n\t%T", s, s->def->type, t); |
4198 } | 4027 } |
4199 | 4028 |
| 4029 t = functype(F, (yyvsp[(3) - (5)].flist), (yyvsp[(5) - (5)].flis
t)); |
4200 (yyval.node) = newname(s); | 4030 (yyval.node) = newname(s); |
4201 (yyval.node)->type = t; | 4031 (yyval.node)->type = t; |
4202 declare((yyval.node), PFUNC); | 4032 declare((yyval.node), PFUNC); |
4203 | 4033 |
4204 funchdr((yyval.node)); | 4034 funchdr((yyval.node)); |
4205 } | 4035 } |
4206 break; | 4036 break; |
4207 | 4037 |
4208 case 206: | 4038 case 206: |
4209 | 4039 /* Line 1792 of yacc.c */ |
4210 /* Line 1806 of yacc.c */ | 4040 #line 1369 "go.y" |
4211 #line 1366 "go.y" | |
4212 { | 4041 { |
4213 » » (yyval.node) = methodname1(newname((yyvsp[(4) - (8)].sym)), (yyv
sp[(2) - (8)].list)->n->right);· | 4042 » » (yyval.node) = N; |
4214 » » (yyval.node)->type = functype((yyvsp[(2) - (8)].list)->n, (yyvsp
[(6) - (8)].list), (yyvsp[(8) - (8)].list)); | 4043 » » if(!mustaddmethod((yyvsp[(4) - (8)].sym), (yyvsp[(2) - (8)].flis
t), (yyvsp[(6) - (8)].flist), (yyvsp[(8) - (8)].flist))) { |
| 4044 » » » dclcontext = PDISCARD; |
| 4045 » » » break; |
| 4046 » » } |
| 4047 » » (yyval.node) = methodname1(newname((yyvsp[(4) - (8)].sym)), type
nod((yyvsp[(2) - (8)].flist)->f->type));· |
| 4048 » » (yyval.node)->type = functype((yyvsp[(2) - (8)].flist)->f, (yyvs
p[(6) - (8)].flist), (yyvsp[(8) - (8)].flist)); |
4215 | 4049 |
4216 checkwidth((yyval.node)->type); | 4050 checkwidth((yyval.node)->type); |
4217 addmethod((yyvsp[(4) - (8)].sym), (yyval.node)->type, 0, nointer
face); | 4051 addmethod((yyvsp[(4) - (8)].sym), (yyval.node)->type, 0, nointer
face); |
4218 nointerface = 0; | 4052 nointerface = 0; |
4219 funchdr((yyval.node)); | 4053 funchdr((yyval.node)); |
4220 ················ | 4054 ················ |
4221 // inl.c's inlnode in on a dotmeth node expects to find the inli
neable body as | 4055 // inl.c's inlnode in on a dotmeth node expects to find the inli
neable body as |
4222 // (dotmeth's type)->nname->inl, and dotmeth's type has been pul
led | 4056 // (dotmeth's type)->nname->inl, and dotmeth's type has been pul
led |
4223 // out by typecheck's lookdot as this $$->ttype. So by providin
g | 4057 // out by typecheck's lookdot as this $$->ttype. So by providin
g |
4224 // this back link here we avoid special casing there. | 4058 // this back link here we avoid special casing there. |
4225 (yyval.node)->type->nname = (yyval.node); | 4059 (yyval.node)->type->nname = (yyval.node); |
4226 } | 4060 } |
4227 break; | 4061 break; |
4228 | 4062 |
4229 case 207: | 4063 case 207: |
4230 | 4064 /* Line 1792 of yacc.c */ |
4231 /* Line 1806 of yacc.c */ | 4065 #line 1392 "go.y" |
4232 #line 1384 "go.y" | |
4233 { | 4066 { |
4234 (yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list),
1); | 4067 (yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list),
1); |
4235 (yyval.node) = nod(OTFUNC, N, N); | 4068 (yyval.node) = nod(OTFUNC, N, N); |
4236 (yyval.node)->list = (yyvsp[(3) - (5)].list); | 4069 (yyval.node)->list = (yyvsp[(3) - (5)].list); |
4237 (yyval.node)->rlist = (yyvsp[(5) - (5)].list); | 4070 (yyval.node)->rlist = (yyvsp[(5) - (5)].list); |
4238 } | 4071 } |
4239 break; | 4072 break; |
4240 | 4073 |
4241 case 208: | 4074 case 208: |
4242 | 4075 /* Line 1792 of yacc.c */ |
4243 /* Line 1806 of yacc.c */ | 4076 #line 1400 "go.y" |
4244 #line 1392 "go.y" | |
4245 { | 4077 { |
4246 (yyval.list) = nil; | 4078 (yyval.list) = nil; |
4247 } | 4079 } |
4248 break; | 4080 break; |
4249 | 4081 |
4250 case 209: | 4082 case 209: |
4251 | 4083 /* Line 1792 of yacc.c */ |
4252 /* Line 1806 of yacc.c */ | 4084 #line 1404 "go.y" |
4253 #line 1396 "go.y" | |
4254 { | 4085 { |
4255 (yyval.list) = (yyvsp[(2) - (3)].list); | 4086 (yyval.list) = (yyvsp[(2) - (3)].list); |
4256 if((yyval.list) == nil) | 4087 if((yyval.list) == nil) |
4257 (yyval.list) = list1(nod(OEMPTY, N, N)); | 4088 (yyval.list) = list1(nod(OEMPTY, N, N)); |
4258 } | 4089 } |
4259 break; | 4090 break; |
4260 | 4091 |
4261 case 210: | 4092 case 210: |
4262 | 4093 /* Line 1792 of yacc.c */ |
4263 /* Line 1806 of yacc.c */ | 4094 #line 1412 "go.y" |
4264 #line 1404 "go.y" | |
4265 { | 4095 { |
4266 (yyval.list) = nil; | 4096 (yyval.list) = nil; |
4267 } | 4097 } |
4268 break; | 4098 break; |
4269 | 4099 |
4270 case 211: | 4100 case 211: |
4271 | 4101 /* Line 1792 of yacc.c */ |
4272 /* Line 1806 of yacc.c */ | 4102 #line 1416 "go.y" |
4273 #line 1408 "go.y" | |
4274 { | 4103 { |
4275 (yyval.list) = list1(nod(ODCLFIELD, N, (yyvsp[(1) - (1)].node)))
; | 4104 (yyval.list) = list1(nod(ODCLFIELD, N, (yyvsp[(1) - (1)].node)))
; |
4276 } | 4105 } |
4277 break; | 4106 break; |
4278 | 4107 |
4279 case 212: | 4108 case 212: |
4280 | 4109 /* Line 1792 of yacc.c */ |
4281 /* Line 1806 of yacc.c */ | 4110 #line 1420 "go.y" |
4282 #line 1412 "go.y" | |
4283 { | 4111 { |
4284 (yyvsp[(2) - (3)].list) = checkarglist((yyvsp[(2) - (3)].list),
0); | 4112 (yyvsp[(2) - (3)].list) = checkarglist((yyvsp[(2) - (3)].list),
0); |
4285 (yyval.list) = (yyvsp[(2) - (3)].list); | 4113 (yyval.list) = (yyvsp[(2) - (3)].list); |
4286 } | 4114 } |
4287 break; | 4115 break; |
4288 | 4116 |
4289 case 213: | 4117 case 213: |
4290 | 4118 /* Line 1792 of yacc.c */ |
4291 /* Line 1806 of yacc.c */ | 4119 #line 1427 "go.y" |
4292 #line 1419 "go.y" | |
4293 { | 4120 { |
4294 closurehdr((yyvsp[(1) - (1)].node)); | 4121 closurehdr((yyvsp[(1) - (1)].node)); |
4295 } | 4122 } |
4296 break; | 4123 break; |
4297 | 4124 |
4298 case 214: | 4125 case 214: |
4299 | 4126 /* Line 1792 of yacc.c */ |
4300 /* Line 1806 of yacc.c */ | 4127 #line 1433 "go.y" |
4301 #line 1425 "go.y" | |
4302 { | 4128 { |
4303 (yyval.node) = closurebody((yyvsp[(3) - (4)].list)); | 4129 (yyval.node) = closurebody((yyvsp[(3) - (4)].list)); |
4304 fixlbrace((yyvsp[(2) - (4)].i)); | 4130 fixlbrace((yyvsp[(2) - (4)].i)); |
4305 } | 4131 } |
4306 break; | 4132 break; |
4307 | 4133 |
4308 case 215: | 4134 case 215: |
4309 | 4135 /* Line 1792 of yacc.c */ |
4310 /* Line 1806 of yacc.c */ | 4136 #line 1438 "go.y" |
4311 #line 1430 "go.y" | |
4312 { | 4137 { |
4313 (yyval.node) = closurebody(nil); | 4138 (yyval.node) = closurebody(nil); |
4314 } | 4139 } |
4315 break; | 4140 break; |
4316 | 4141 |
4317 case 216: | 4142 case 216: |
4318 | 4143 /* Line 1792 of yacc.c */ |
4319 /* Line 1806 of yacc.c */ | 4144 #line 1449 "go.y" |
4320 #line 1441 "go.y" | |
4321 { | 4145 { |
4322 (yyval.list) = nil; | 4146 (yyval.list) = nil; |
4323 } | 4147 } |
4324 break; | 4148 break; |
4325 | 4149 |
4326 case 217: | 4150 case 217: |
4327 | 4151 /* Line 1792 of yacc.c */ |
4328 /* Line 1806 of yacc.c */ | 4152 #line 1453 "go.y" |
4329 #line 1445 "go.y" | |
4330 { | 4153 { |
4331 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)]
.list)); | 4154 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)]
.list)); |
4332 if(nsyntaxerrors == 0) | 4155 if(nsyntaxerrors == 0) |
4333 testdclstack(); | 4156 testdclstack(); |
4334 nointerface = 0; | 4157 nointerface = 0; |
4335 } | 4158 } |
4336 break; | 4159 break; |
4337 | 4160 |
4338 case 219: | 4161 case 219: |
4339 | 4162 /* Line 1792 of yacc.c */ |
4340 /* Line 1806 of yacc.c */ | 4163 #line 1463 "go.y" |
4341 #line 1455 "go.y" | |
4342 { | 4164 { |
4343 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); | 4165 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); |
4344 } | 4166 } |
4345 break; | 4167 break; |
4346 | 4168 |
4347 case 221: | 4169 case 221: |
4348 | 4170 /* Line 1792 of yacc.c */ |
4349 /* Line 1806 of yacc.c */ | 4171 #line 1470 "go.y" |
4350 #line 1462 "go.y" | |
4351 { | 4172 { |
4352 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); | 4173 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); |
4353 } | 4174 } |
4354 break; | 4175 break; |
4355 | 4176 |
4356 case 222: | 4177 case 222: |
4357 | 4178 /* Line 1792 of yacc.c */ |
4358 /* Line 1806 of yacc.c */ | 4179 #line 1476 "go.y" |
4359 #line 1468 "go.y" | |
4360 { | 4180 { |
4361 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4181 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4362 } | 4182 } |
4363 break; | 4183 break; |
4364 | 4184 |
4365 case 223: | 4185 case 223: |
4366 | 4186 /* Line 1792 of yacc.c */ |
4367 /* Line 1806 of yacc.c */ | 4187 #line 1480 "go.y" |
4368 #line 1472 "go.y" | |
4369 { | 4188 { |
4370 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4189 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4371 } | 4190 } |
4372 break; | 4191 break; |
4373 | 4192 |
4374 case 225: | 4193 case 225: |
4375 | 4194 /* Line 1792 of yacc.c */ |
4376 /* Line 1806 of yacc.c */ | 4195 #line 1487 "go.y" |
4377 #line 1479 "go.y" | |
4378 { | 4196 { |
4379 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); | 4197 (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)]
.list)); |
4380 } | 4198 } |
4381 break; | 4199 break; |
4382 | 4200 |
4383 case 226: | 4201 case 226: |
4384 | 4202 /* Line 1792 of yacc.c */ |
4385 /* Line 1806 of yacc.c */ | 4203 #line 1493 "go.y" |
4386 #line 1485 "go.y" | |
4387 { | 4204 { |
4388 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4205 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4389 } | 4206 } |
4390 break; | 4207 break; |
4391 | 4208 |
4392 case 227: | 4209 case 227: |
4393 | 4210 /* Line 1792 of yacc.c */ |
4394 /* Line 1806 of yacc.c */ | 4211 #line 1497 "go.y" |
4395 #line 1489 "go.y" | |
4396 { | 4212 { |
4397 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4213 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4398 } | 4214 } |
4399 break; | 4215 break; |
4400 | 4216 |
4401 case 228: | 4217 case 228: |
4402 | 4218 /* Line 1792 of yacc.c */ |
4403 /* Line 1806 of yacc.c */ | 4219 #line 1503 "go.y" |
4404 #line 1495 "go.y" | |
4405 { | 4220 { |
4406 NodeList *l; | 4221 NodeList *l; |
4407 | 4222 |
4408 Node *n; | 4223 Node *n; |
4409 l = (yyvsp[(1) - (3)].list); | 4224 l = (yyvsp[(1) - (3)].list); |
4410 if(l != nil && l->next == nil && l->n == nil) { | 4225 if(l != nil && l->next == nil && l->n == nil) { |
4411 // ? symbol, during import | 4226 // ? symbol, during import |
4412 n = (yyvsp[(2) - (3)].node); | 4227 n = (yyvsp[(2) - (3)].node); |
4413 if(n->op == OIND) | 4228 if(n->op == OIND) |
4414 n = n->left; | 4229 n = n->left; |
4415 n = embedded(n->sym); | 4230 n = embedded(n->sym); |
4416 n->right = (yyvsp[(2) - (3)].node); | 4231 n->right = (yyvsp[(2) - (3)].node); |
4417 n->val = (yyvsp[(3) - (3)].val); | 4232 n->val = (yyvsp[(3) - (3)].val); |
4418 (yyval.list) = list1(n); | 4233 (yyval.list) = list1(n); |
4419 break; | 4234 break; |
4420 } | 4235 } |
4421 | 4236 |
4422 for(l=(yyvsp[(1) - (3)].list); l; l=l->next) { | 4237 for(l=(yyvsp[(1) - (3)].list); l; l=l->next) { |
4423 l->n = nod(ODCLFIELD, l->n, (yyvsp[(2) - (3)].node)); | 4238 l->n = nod(ODCLFIELD, l->n, (yyvsp[(2) - (3)].node)); |
4424 l->n->val = (yyvsp[(3) - (3)].val); | 4239 l->n->val = (yyvsp[(3) - (3)].val); |
4425 } | 4240 } |
4426 } | 4241 } |
4427 break; | 4242 break; |
4428 | 4243 |
4429 case 229: | 4244 case 229: |
4430 | 4245 /* Line 1792 of yacc.c */ |
4431 /* Line 1806 of yacc.c */ | 4246 #line 1526 "go.y" |
4432 #line 1518 "go.y" | |
4433 { | 4247 { |
4434 (yyvsp[(1) - (2)].node)->val = (yyvsp[(2) - (2)].val); | 4248 (yyvsp[(1) - (2)].node)->val = (yyvsp[(2) - (2)].val); |
4435 (yyval.list) = list1((yyvsp[(1) - (2)].node)); | 4249 (yyval.list) = list1((yyvsp[(1) - (2)].node)); |
4436 } | 4250 } |
4437 break; | 4251 break; |
4438 | 4252 |
4439 case 230: | 4253 case 230: |
4440 | 4254 /* Line 1792 of yacc.c */ |
4441 /* Line 1806 of yacc.c */ | 4255 #line 1531 "go.y" |
4442 #line 1523 "go.y" | |
4443 { | 4256 { |
4444 (yyvsp[(2) - (4)].node)->val = (yyvsp[(4) - (4)].val); | 4257 (yyvsp[(2) - (4)].node)->val = (yyvsp[(4) - (4)].val); |
4445 (yyval.list) = list1((yyvsp[(2) - (4)].node)); | 4258 (yyval.list) = list1((yyvsp[(2) - (4)].node)); |
4446 yyerror("cannot parenthesize embedded type"); | 4259 yyerror("cannot parenthesize embedded type"); |
4447 } | 4260 } |
4448 break; | 4261 break; |
4449 | 4262 |
4450 case 231: | 4263 case 231: |
4451 | 4264 /* Line 1792 of yacc.c */ |
4452 /* Line 1806 of yacc.c */ | 4265 #line 1537 "go.y" |
4453 #line 1529 "go.y" | |
4454 { | 4266 { |
4455 (yyvsp[(2) - (3)].node)->right = nod(OIND, (yyvsp[(2) - (3)].nod
e)->right, N); | 4267 (yyvsp[(2) - (3)].node)->right = nod(OIND, (yyvsp[(2) - (3)].nod
e)->right, N); |
4456 (yyvsp[(2) - (3)].node)->val = (yyvsp[(3) - (3)].val); | 4268 (yyvsp[(2) - (3)].node)->val = (yyvsp[(3) - (3)].val); |
4457 (yyval.list) = list1((yyvsp[(2) - (3)].node)); | 4269 (yyval.list) = list1((yyvsp[(2) - (3)].node)); |
4458 } | 4270 } |
4459 break; | 4271 break; |
4460 | 4272 |
4461 case 232: | 4273 case 232: |
4462 | 4274 /* Line 1792 of yacc.c */ |
4463 /* Line 1806 of yacc.c */ | 4275 #line 1543 "go.y" |
4464 #line 1535 "go.y" | |
4465 { | 4276 { |
4466 (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].nod
e)->right, N); | 4277 (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].nod
e)->right, N); |
4467 (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); | 4278 (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); |
4468 (yyval.list) = list1((yyvsp[(3) - (5)].node)); | 4279 (yyval.list) = list1((yyvsp[(3) - (5)].node)); |
4469 yyerror("cannot parenthesize embedded type"); | 4280 yyerror("cannot parenthesize embedded type"); |
4470 } | 4281 } |
4471 break; | 4282 break; |
4472 | 4283 |
4473 case 233: | 4284 case 233: |
4474 | 4285 /* Line 1792 of yacc.c */ |
4475 /* Line 1806 of yacc.c */ | 4286 #line 1550 "go.y" |
4476 #line 1542 "go.y" | |
4477 { | 4287 { |
4478 (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].nod
e)->right, N); | 4288 (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].nod
e)->right, N); |
4479 (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); | 4289 (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); |
4480 (yyval.list) = list1((yyvsp[(3) - (5)].node)); | 4290 (yyval.list) = list1((yyvsp[(3) - (5)].node)); |
4481 yyerror("cannot parenthesize embedded type"); | 4291 yyerror("cannot parenthesize embedded type"); |
4482 } | 4292 } |
4483 break; | 4293 break; |
4484 | 4294 |
4485 case 234: | 4295 case 234: |
4486 | 4296 /* Line 1792 of yacc.c */ |
4487 /* Line 1806 of yacc.c */ | 4297 #line 1559 "go.y" |
4488 #line 1551 "go.y" | |
4489 { | 4298 { |
4490 Node *n; | 4299 Node *n; |
4491 | 4300 |
4492 (yyval.sym) = (yyvsp[(1) - (1)].sym); | 4301 (yyval.sym) = (yyvsp[(1) - (1)].sym); |
4493 n = oldname((yyvsp[(1) - (1)].sym)); | 4302 n = oldname((yyvsp[(1) - (1)].sym)); |
4494 if(n->pack != N) | 4303 if(n->pack != N) |
4495 n->pack->used = 1; | 4304 n->pack->used = 1; |
4496 } | 4305 } |
4497 break; | 4306 break; |
4498 | 4307 |
4499 case 235: | 4308 case 235: |
4500 | 4309 /* Line 1792 of yacc.c */ |
4501 /* Line 1806 of yacc.c */ | 4310 #line 1568 "go.y" |
4502 #line 1560 "go.y" | |
4503 { | 4311 { |
4504 Pkg *pkg; | 4312 Pkg *pkg; |
4505 | 4313 |
4506 if((yyvsp[(1) - (3)].sym)->def == N || (yyvsp[(1) - (3)].sym)->d
ef->op != OPACK) { | 4314 if((yyvsp[(1) - (3)].sym)->def == N || (yyvsp[(1) - (3)].sym)->d
ef->op != OPACK) { |
4507 yyerror("%S is not a package", (yyvsp[(1) - (3)].sym)); | 4315 yyerror("%S is not a package", (yyvsp[(1) - (3)].sym)); |
4508 pkg = localpkg; | 4316 pkg = localpkg; |
4509 } else { | 4317 } else { |
4510 (yyvsp[(1) - (3)].sym)->def->used = 1; | 4318 (yyvsp[(1) - (3)].sym)->def->used = 1; |
4511 pkg = (yyvsp[(1) - (3)].sym)->def->pkg; | 4319 pkg = (yyvsp[(1) - (3)].sym)->def->pkg; |
4512 } | 4320 } |
4513 (yyval.sym) = restrictlookup((yyvsp[(3) - (3)].sym)->name, pkg); | 4321 (yyval.sym) = restrictlookup((yyvsp[(3) - (3)].sym)->name, pkg); |
4514 } | 4322 } |
4515 break; | 4323 break; |
4516 | 4324 |
4517 case 236: | 4325 case 236: |
4518 | 4326 /* Line 1792 of yacc.c */ |
4519 /* Line 1806 of yacc.c */ | 4327 #line 1583 "go.y" |
4520 #line 1575 "go.y" | |
4521 { | 4328 { |
4522 (yyval.node) = embedded((yyvsp[(1) - (1)].sym)); | 4329 (yyval.node) = embedded((yyvsp[(1) - (1)].sym)); |
4523 } | 4330 } |
4524 break; | 4331 break; |
4525 | 4332 |
4526 case 237: | 4333 case 237: |
4527 | 4334 /* Line 1792 of yacc.c */ |
4528 /* Line 1806 of yacc.c */ | 4335 #line 1589 "go.y" |
4529 #line 1581 "go.y" | |
4530 { | 4336 { |
4531 (yyval.node) = nod(ODCLFIELD, (yyvsp[(1) - (2)].node), (yyvsp[(2
) - (2)].node)); | 4337 (yyval.node) = nod(ODCLFIELD, (yyvsp[(1) - (2)].node), (yyvsp[(2
) - (2)].node)); |
4532 ifacedcl((yyval.node)); | 4338 ifacedcl((yyval.node)); |
4533 } | 4339 } |
4534 break; | 4340 break; |
4535 | 4341 |
4536 case 238: | 4342 case 238: |
4537 | 4343 /* Line 1792 of yacc.c */ |
4538 /* Line 1806 of yacc.c */ | 4344 #line 1594 "go.y" |
4539 #line 1586 "go.y" | |
4540 { | 4345 { |
4541 (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(1) - (1)].sym))
); | 4346 (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(1) - (1)].sym))
); |
4542 } | 4347 } |
4543 break; | 4348 break; |
4544 | 4349 |
4545 case 239: | 4350 case 239: |
4546 | 4351 /* Line 1792 of yacc.c */ |
4547 /* Line 1806 of yacc.c */ | 4352 #line 1598 "go.y" |
4548 #line 1590 "go.y" | |
4549 { | 4353 { |
4550 (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(2) - (3)].sym))
); | 4354 (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(2) - (3)].sym))
); |
4551 yyerror("cannot parenthesize embedded type"); | 4355 yyerror("cannot parenthesize embedded type"); |
4552 } | 4356 } |
4553 break; | 4357 break; |
4554 | 4358 |
4555 case 240: | 4359 case 240: |
4556 | 4360 /* Line 1792 of yacc.c */ |
4557 /* Line 1806 of yacc.c */ | 4361 #line 1605 "go.y" |
4558 #line 1597 "go.y" | |
4559 { | 4362 { |
4560 // without func keyword | 4363 // without func keyword |
4561 (yyvsp[(2) - (4)].list) = checkarglist((yyvsp[(2) - (4)].list),
1); | 4364 (yyvsp[(2) - (4)].list) = checkarglist((yyvsp[(2) - (4)].list),
1); |
4562 (yyval.node) = nod(OTFUNC, fakethis(), N); | 4365 (yyval.node) = nod(OTFUNC, fakethis(), N); |
4563 (yyval.node)->list = (yyvsp[(2) - (4)].list); | 4366 (yyval.node)->list = (yyvsp[(2) - (4)].list); |
4564 (yyval.node)->rlist = (yyvsp[(4) - (4)].list); | 4367 (yyval.node)->rlist = (yyvsp[(4) - (4)].list); |
4565 } | 4368 } |
4566 break; | 4369 break; |
4567 | 4370 |
4568 case 242: | 4371 case 242: |
4569 | 4372 /* Line 1792 of yacc.c */ |
4570 /* Line 1806 of yacc.c */ | 4373 #line 1619 "go.y" |
4571 #line 1611 "go.y" | |
4572 { | 4374 { |
4573 (yyval.node) = nod(ONONAME, N, N); | 4375 (yyval.node) = nod(ONONAME, N, N); |
4574 (yyval.node)->sym = (yyvsp[(1) - (2)].sym); | 4376 (yyval.node)->sym = (yyvsp[(1) - (2)].sym); |
4575 (yyval.node) = nod(OKEY, (yyval.node), (yyvsp[(2) - (2)].node)); | 4377 (yyval.node) = nod(OKEY, (yyval.node), (yyvsp[(2) - (2)].node)); |
4576 } | 4378 } |
4577 break; | 4379 break; |
4578 | 4380 |
4579 case 243: | 4381 case 243: |
4580 | 4382 /* Line 1792 of yacc.c */ |
4581 /* Line 1806 of yacc.c */ | 4383 #line 1625 "go.y" |
4582 #line 1617 "go.y" | |
4583 { | 4384 { |
4584 (yyval.node) = nod(ONONAME, N, N); | 4385 (yyval.node) = nod(ONONAME, N, N); |
4585 (yyval.node)->sym = (yyvsp[(1) - (2)].sym); | 4386 (yyval.node)->sym = (yyvsp[(1) - (2)].sym); |
4586 (yyval.node) = nod(OKEY, (yyval.node), (yyvsp[(2) - (2)].node)); | 4387 (yyval.node) = nod(OKEY, (yyval.node), (yyvsp[(2) - (2)].node)); |
4587 } | 4388 } |
4588 break; | 4389 break; |
4589 | 4390 |
4590 case 245: | 4391 case 245: |
4591 | 4392 /* Line 1792 of yacc.c */ |
4592 /* Line 1806 of yacc.c */ | 4393 #line 1634 "go.y" |
4593 #line 1626 "go.y" | |
4594 { | 4394 { |
4595 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4395 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4596 } | 4396 } |
4597 break; | 4397 break; |
4598 | 4398 |
4599 case 246: | 4399 case 246: |
4600 | 4400 /* Line 1792 of yacc.c */ |
4601 /* Line 1806 of yacc.c */ | 4401 #line 1638 "go.y" |
4602 #line 1630 "go.y" | |
4603 { | 4402 { |
4604 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4403 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4605 } | 4404 } |
4606 break; | 4405 break; |
4607 | 4406 |
4608 case 247: | 4407 case 247: |
4609 | 4408 /* Line 1792 of yacc.c */ |
4610 /* Line 1806 of yacc.c */ | 4409 #line 1643 "go.y" |
4611 #line 1635 "go.y" | |
4612 { | 4410 { |
4613 (yyval.list) = nil; | 4411 (yyval.list) = nil; |
4614 } | 4412 } |
4615 break; | 4413 break; |
4616 | 4414 |
4617 case 248: | 4415 case 248: |
4618 | 4416 /* Line 1792 of yacc.c */ |
4619 /* Line 1806 of yacc.c */ | 4417 #line 1647 "go.y" |
4620 #line 1639 "go.y" | |
4621 { | 4418 { |
4622 (yyval.list) = (yyvsp[(1) - (2)].list); | 4419 (yyval.list) = (yyvsp[(1) - (2)].list); |
4623 } | 4420 } |
4624 break; | 4421 break; |
4625 | 4422 |
4626 case 249: | 4423 case 249: |
4627 | 4424 /* Line 1792 of yacc.c */ |
4628 /* Line 1806 of yacc.c */ | 4425 #line 1655 "go.y" |
4629 #line 1647 "go.y" | |
4630 { | 4426 { |
4631 (yyval.node) = N; | 4427 (yyval.node) = N; |
4632 } | 4428 } |
4633 break; | 4429 break; |
4634 | 4430 |
4635 case 251: | 4431 case 251: |
4636 | 4432 /* Line 1792 of yacc.c */ |
4637 /* Line 1806 of yacc.c */ | 4433 #line 1660 "go.y" |
4638 #line 1652 "go.y" | |
4639 { | 4434 { |
4640 (yyval.node) = liststmt((yyvsp[(1) - (1)].list)); | 4435 (yyval.node) = liststmt((yyvsp[(1) - (1)].list)); |
4641 } | 4436 } |
4642 break; | 4437 break; |
4643 | 4438 |
4644 case 253: | 4439 case 253: |
4645 | 4440 /* Line 1792 of yacc.c */ |
4646 /* Line 1806 of yacc.c */ | 4441 #line 1665 "go.y" |
4647 #line 1657 "go.y" | |
4648 { | 4442 { |
4649 (yyval.node) = N; | 4443 (yyval.node) = N; |
4650 } | 4444 } |
4651 break; | 4445 break; |
4652 | 4446 |
4653 case 259: | 4447 case 259: |
4654 | 4448 /* Line 1792 of yacc.c */ |
4655 /* Line 1806 of yacc.c */ | 4449 #line 1676 "go.y" |
4656 #line 1668 "go.y" | |
4657 { | 4450 { |
4658 (yyvsp[(1) - (2)].node) = nod(OLABEL, (yyvsp[(1) - (2)].node), N
); | 4451 (yyvsp[(1) - (2)].node) = nod(OLABEL, (yyvsp[(1) - (2)].node), N
); |
4659 (yyvsp[(1) - (2)].node)->sym = dclstack; // context, for goto r
estrictions | 4452 (yyvsp[(1) - (2)].node)->sym = dclstack; // context, for goto r
estrictions |
4660 } | 4453 } |
4661 break; | 4454 break; |
4662 | 4455 |
4663 case 260: | 4456 case 260: |
4664 | 4457 /* Line 1792 of yacc.c */ |
4665 /* Line 1806 of yacc.c */ | 4458 #line 1681 "go.y" |
4666 #line 1673 "go.y" | |
4667 { | 4459 { |
4668 NodeList *l; | 4460 NodeList *l; |
4669 | 4461 |
4670 (yyvsp[(1) - (4)].node)->defn = (yyvsp[(4) - (4)].node); | 4462 (yyvsp[(1) - (4)].node)->defn = (yyvsp[(4) - (4)].node); |
4671 l = list1((yyvsp[(1) - (4)].node)); | 4463 l = list1((yyvsp[(1) - (4)].node)); |
4672 if((yyvsp[(4) - (4)].node)) | 4464 if((yyvsp[(4) - (4)].node)) |
4673 l = list(l, (yyvsp[(4) - (4)].node)); | 4465 l = list(l, (yyvsp[(4) - (4)].node)); |
4674 (yyval.node) = liststmt(l); | 4466 (yyval.node) = liststmt(l); |
4675 } | 4467 } |
4676 break; | 4468 break; |
4677 | 4469 |
4678 case 261: | 4470 case 261: |
4679 | 4471 /* Line 1792 of yacc.c */ |
4680 /* Line 1806 of yacc.c */ | 4472 #line 1691 "go.y" |
4681 #line 1683 "go.y" | |
4682 { | 4473 { |
4683 // will be converted to OFALL | 4474 // will be converted to OFALL |
4684 (yyval.node) = nod(OXFALL, N, N); | 4475 (yyval.node) = nod(OXFALL, N, N); |
4685 } | 4476 } |
4686 break; | 4477 break; |
4687 | 4478 |
4688 case 262: | 4479 case 262: |
4689 | 4480 /* Line 1792 of yacc.c */ |
4690 /* Line 1806 of yacc.c */ | 4481 #line 1696 "go.y" |
4691 #line 1688 "go.y" | |
4692 { | 4482 { |
4693 (yyval.node) = nod(OBREAK, (yyvsp[(2) - (2)].node), N); | 4483 (yyval.node) = nod(OBREAK, (yyvsp[(2) - (2)].node), N); |
4694 } | 4484 } |
4695 break; | 4485 break; |
4696 | 4486 |
4697 case 263: | 4487 case 263: |
4698 | 4488 /* Line 1792 of yacc.c */ |
4699 /* Line 1806 of yacc.c */ | 4489 #line 1700 "go.y" |
4700 #line 1692 "go.y" | |
4701 { | 4490 { |
4702 (yyval.node) = nod(OCONTINUE, (yyvsp[(2) - (2)].node), N); | 4491 (yyval.node) = nod(OCONTINUE, (yyvsp[(2) - (2)].node), N); |
4703 } | 4492 } |
4704 break; | 4493 break; |
4705 | 4494 |
4706 case 264: | 4495 case 264: |
4707 | 4496 /* Line 1792 of yacc.c */ |
4708 /* Line 1806 of yacc.c */ | 4497 #line 1704 "go.y" |
4709 #line 1696 "go.y" | |
4710 { | 4498 { |
4711 (yyval.node) = nod(OPROC, (yyvsp[(2) - (2)].node), N); | 4499 (yyval.node) = nod(OPROC, (yyvsp[(2) - (2)].node), N); |
4712 } | 4500 } |
4713 break; | 4501 break; |
4714 | 4502 |
4715 case 265: | 4503 case 265: |
4716 | 4504 /* Line 1792 of yacc.c */ |
4717 /* Line 1806 of yacc.c */ | 4505 #line 1708 "go.y" |
4718 #line 1700 "go.y" | |
4719 { | 4506 { |
4720 (yyval.node) = nod(ODEFER, (yyvsp[(2) - (2)].node), N); | 4507 (yyval.node) = nod(ODEFER, (yyvsp[(2) - (2)].node), N); |
4721 } | 4508 } |
4722 break; | 4509 break; |
4723 | 4510 |
4724 case 266: | 4511 case 266: |
4725 | 4512 /* Line 1792 of yacc.c */ |
4726 /* Line 1806 of yacc.c */ | 4513 #line 1712 "go.y" |
4727 #line 1704 "go.y" | |
4728 { | 4514 { |
4729 (yyval.node) = nod(OGOTO, (yyvsp[(2) - (2)].node), N); | 4515 (yyval.node) = nod(OGOTO, (yyvsp[(2) - (2)].node), N); |
4730 (yyval.node)->sym = dclstack; // context, for goto restrictions | 4516 (yyval.node)->sym = dclstack; // context, for goto restrictions |
4731 } | 4517 } |
4732 break; | 4518 break; |
4733 | 4519 |
4734 case 267: | 4520 case 267: |
4735 | 4521 /* Line 1792 of yacc.c */ |
4736 /* Line 1806 of yacc.c */ | 4522 #line 1717 "go.y" |
4737 #line 1709 "go.y" | |
4738 { | 4523 { |
4739 (yyval.node) = nod(ORETURN, N, N); | 4524 (yyval.node) = nod(ORETURN, N, N); |
4740 (yyval.node)->list = (yyvsp[(2) - (2)].list); | 4525 (yyval.node)->list = (yyvsp[(2) - (2)].list); |
4741 if((yyval.node)->list == nil && curfn != N) { | 4526 if((yyval.node)->list == nil && curfn != N) { |
4742 NodeList *l; | 4527 NodeList *l; |
4743 | 4528 |
4744 for(l=curfn->dcl; l; l=l->next) { | 4529 for(l=curfn->dcl; l; l=l->next) { |
4745 if(l->n->class == PPARAM) | 4530 if(l->n->class == PPARAM) |
4746 continue; | 4531 continue; |
4747 if(l->n->class != PPARAMOUT) | 4532 if(l->n->class != PPARAMOUT) |
4748 break; | 4533 break; |
4749 if(l->n->sym->def != l->n) | 4534 if(l->n->sym->def != l->n) |
4750 yyerror("%s is shadowed during return",
l->n->sym->name); | 4535 yyerror("%s is shadowed during return",
l->n->sym->name); |
4751 } | 4536 } |
4752 } | 4537 } |
4753 } | 4538 } |
4754 break; | 4539 break; |
4755 | 4540 |
4756 case 268: | 4541 case 268: |
4757 | 4542 /* Line 1792 of yacc.c */ |
4758 /* Line 1806 of yacc.c */ | 4543 #line 1736 "go.y" |
4759 #line 1728 "go.y" | |
4760 { | 4544 { |
4761 (yyval.list) = nil; | 4545 (yyval.list) = nil; |
4762 if((yyvsp[(1) - (1)].node) != N) | 4546 if((yyvsp[(1) - (1)].node) != N) |
4763 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4547 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4764 } | 4548 } |
4765 break; | 4549 break; |
4766 | 4550 |
4767 case 269: | 4551 case 269: |
4768 | 4552 /* Line 1792 of yacc.c */ |
4769 /* Line 1806 of yacc.c */ | 4553 #line 1742 "go.y" |
4770 #line 1734 "go.y" | |
4771 { | 4554 { |
4772 (yyval.list) = (yyvsp[(1) - (3)].list); | 4555 (yyval.list) = (yyvsp[(1) - (3)].list); |
4773 if((yyvsp[(3) - (3)].node) != N) | 4556 if((yyvsp[(3) - (3)].node) != N) |
4774 (yyval.list) = list((yyval.list), (yyvsp[(3) - (3)].node
)); | 4557 (yyval.list) = list((yyval.list), (yyvsp[(3) - (3)].node
)); |
4775 } | 4558 } |
4776 break; | 4559 break; |
4777 | 4560 |
4778 case 270: | 4561 case 270: |
4779 | 4562 /* Line 1792 of yacc.c */ |
4780 /* Line 1806 of yacc.c */ | 4563 #line 1750 "go.y" |
4781 #line 1742 "go.y" | |
4782 { | 4564 { |
4783 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4565 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4784 } | 4566 } |
4785 break; | 4567 break; |
4786 | 4568 |
4787 case 271: | 4569 case 271: |
4788 | 4570 /* Line 1792 of yacc.c */ |
4789 /* Line 1806 of yacc.c */ | 4571 #line 1754 "go.y" |
4790 #line 1746 "go.y" | |
4791 { | 4572 { |
4792 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4573 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4793 } | 4574 } |
4794 break; | 4575 break; |
4795 | 4576 |
4796 case 272: | 4577 case 272: |
4797 | 4578 /* Line 1792 of yacc.c */ |
4798 /* Line 1806 of yacc.c */ | 4579 #line 1760 "go.y" |
4799 #line 1752 "go.y" | |
4800 { | 4580 { |
4801 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4581 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4802 } | 4582 } |
4803 break; | 4583 break; |
4804 | 4584 |
4805 case 273: | 4585 case 273: |
4806 | 4586 /* Line 1792 of yacc.c */ |
4807 /* Line 1806 of yacc.c */ | 4587 #line 1764 "go.y" |
4808 #line 1756 "go.y" | |
4809 { | 4588 { |
4810 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4589 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4811 } | 4590 } |
4812 break; | 4591 break; |
4813 | 4592 |
4814 case 274: | 4593 case 274: |
4815 | 4594 /* Line 1792 of yacc.c */ |
4816 /* Line 1806 of yacc.c */ | 4595 #line 1770 "go.y" |
4817 #line 1762 "go.y" | |
4818 { | 4596 { |
4819 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4597 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4820 } | 4598 } |
4821 break; | 4599 break; |
4822 | 4600 |
4823 case 275: | 4601 case 275: |
4824 | 4602 /* Line 1792 of yacc.c */ |
4825 /* Line 1806 of yacc.c */ | 4603 #line 1774 "go.y" |
4826 #line 1766 "go.y" | |
4827 { | 4604 { |
4828 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4605 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4829 } | 4606 } |
4830 break; | 4607 break; |
4831 | 4608 |
4832 case 276: | 4609 case 276: |
4833 | 4610 /* Line 1792 of yacc.c */ |
4834 /* Line 1806 of yacc.c */ | 4611 #line 1780 "go.y" |
4835 #line 1772 "go.y" | |
4836 { | 4612 { |
4837 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4613 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4838 } | 4614 } |
4839 break; | 4615 break; |
4840 | 4616 |
4841 case 277: | 4617 case 277: |
4842 | 4618 /* Line 1792 of yacc.c */ |
4843 /* Line 1806 of yacc.c */ | 4619 #line 1784 "go.y" |
4844 #line 1776 "go.y" | |
4845 { | 4620 { |
4846 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4621 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4847 } | 4622 } |
4848 break; | 4623 break; |
4849 | 4624 |
4850 case 278: | 4625 case 278: |
4851 | 4626 /* Line 1792 of yacc.c */ |
4852 /* Line 1806 of yacc.c */ | 4627 #line 1793 "go.y" |
4853 #line 1785 "go.y" | |
4854 { | 4628 { |
4855 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4629 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4856 } | 4630 } |
4857 break; | 4631 break; |
4858 | 4632 |
4859 case 279: | 4633 case 279: |
4860 | 4634 /* Line 1792 of yacc.c */ |
4861 /* Line 1806 of yacc.c */ | 4635 #line 1797 "go.y" |
4862 #line 1789 "go.y" | |
4863 { | 4636 { |
4864 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 4637 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
4865 } | 4638 } |
4866 break; | 4639 break; |
4867 | 4640 |
4868 case 280: | 4641 case 280: |
4869 | 4642 /* Line 1792 of yacc.c */ |
4870 /* Line 1806 of yacc.c */ | 4643 #line 1801 "go.y" |
4871 #line 1793 "go.y" | |
4872 { | 4644 { |
4873 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4645 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4874 } | 4646 } |
4875 break; | 4647 break; |
4876 | 4648 |
4877 case 281: | 4649 case 281: |
4878 | 4650 /* Line 1792 of yacc.c */ |
4879 /* Line 1806 of yacc.c */ | 4651 #line 1805 "go.y" |
4880 #line 1797 "go.y" | |
4881 { | 4652 { |
4882 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 4653 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
4883 } | 4654 } |
4884 break; | 4655 break; |
4885 | 4656 |
4886 case 282: | 4657 case 282: |
4887 | 4658 /* Line 1792 of yacc.c */ |
4888 /* Line 1806 of yacc.c */ | 4659 #line 1810 "go.y" |
4889 #line 1802 "go.y" | |
4890 { | 4660 { |
4891 (yyval.list) = nil; | 4661 (yyval.list) = nil; |
4892 } | 4662 } |
4893 break; | 4663 break; |
4894 | 4664 |
4895 case 283: | 4665 case 283: |
4896 | 4666 /* Line 1792 of yacc.c */ |
4897 /* Line 1806 of yacc.c */ | 4667 #line 1814 "go.y" |
4898 #line 1806 "go.y" | |
4899 { | 4668 { |
4900 (yyval.list) = (yyvsp[(1) - (2)].list); | 4669 (yyval.list) = (yyvsp[(1) - (2)].list); |
4901 } | 4670 } |
4902 break; | 4671 break; |
4903 | 4672 |
4904 case 288: | 4673 case 288: |
4905 | 4674 /* Line 1792 of yacc.c */ |
4906 /* Line 1806 of yacc.c */ | 4675 #line 1828 "go.y" |
4907 #line 1820 "go.y" | |
4908 { | 4676 { |
4909 (yyval.node) = N; | 4677 (yyval.node) = N; |
4910 } | 4678 } |
4911 break; | 4679 break; |
4912 | 4680 |
4913 case 290: | 4681 case 290: |
4914 | 4682 /* Line 1792 of yacc.c */ |
4915 /* Line 1806 of yacc.c */ | 4683 #line 1834 "go.y" |
4916 #line 1826 "go.y" | |
4917 { | 4684 { |
4918 (yyval.list) = nil; | 4685 (yyval.list) = nil; |
4919 } | 4686 } |
4920 break; | 4687 break; |
4921 | 4688 |
4922 case 292: | 4689 case 292: |
4923 | 4690 /* Line 1792 of yacc.c */ |
4924 /* Line 1806 of yacc.c */ | 4691 #line 1840 "go.y" |
4925 #line 1832 "go.y" | |
4926 { | 4692 { |
4927 (yyval.node) = N; | 4693 (yyval.node) = N; |
4928 } | 4694 } |
4929 break; | 4695 break; |
4930 | 4696 |
4931 case 294: | 4697 case 294: |
4932 | 4698 /* Line 1792 of yacc.c */ |
4933 /* Line 1806 of yacc.c */ | 4699 #line 1846 "go.y" |
4934 #line 1838 "go.y" | 4700 { |
4935 { | 4701 » » (yyval.flist) = nil; |
4936 » » (yyval.list) = nil; | |
4937 } | 4702 } |
4938 break; | 4703 break; |
4939 | 4704 |
4940 case 296: | 4705 case 296: |
4941 | 4706 /* Line 1792 of yacc.c */ |
4942 /* Line 1806 of yacc.c */ | 4707 #line 1852 "go.y" |
4943 #line 1844 "go.y" | |
4944 { | 4708 { |
4945 (yyval.list) = nil; | 4709 (yyval.list) = nil; |
4946 } | 4710 } |
4947 break; | 4711 break; |
4948 | 4712 |
4949 case 298: | 4713 case 298: |
4950 | 4714 /* Line 1792 of yacc.c */ |
4951 /* Line 1806 of yacc.c */ | 4715 #line 1858 "go.y" |
4952 #line 1850 "go.y" | |
4953 { | 4716 { |
4954 (yyval.list) = nil; | 4717 (yyval.list) = nil; |
4955 } | 4718 } |
4956 break; | 4719 break; |
4957 | 4720 |
4958 case 300: | 4721 case 300: |
4959 | 4722 /* Line 1792 of yacc.c */ |
4960 /* Line 1806 of yacc.c */ | 4723 #line 1864 "go.y" |
4961 #line 1856 "go.y" | |
4962 { | 4724 { |
4963 (yyval.val).ctype = CTxxx; | 4725 (yyval.val).ctype = CTxxx; |
4964 } | 4726 } |
4965 break; | 4727 break; |
4966 | 4728 |
4967 case 302: | 4729 case 302: |
4968 | 4730 /* Line 1792 of yacc.c */ |
4969 /* Line 1806 of yacc.c */ | 4731 #line 1874 "go.y" |
4970 #line 1866 "go.y" | |
4971 { | 4732 { |
4972 importimport((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].val).u.sv
al); | 4733 importimport((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].val).u.sv
al); |
4973 } | 4734 } |
4974 break; | 4735 break; |
4975 | 4736 |
4976 case 303: | 4737 case 303: |
4977 | 4738 /* Line 1792 of yacc.c */ |
4978 /* Line 1806 of yacc.c */ | 4739 #line 1878 "go.y" |
4979 #line 1870 "go.y" | |
4980 { | 4740 { |
4981 importvar((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].type)); | 4741 importvar((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].type)); |
4982 } | 4742 } |
4983 break; | 4743 break; |
4984 | 4744 |
4985 case 304: | 4745 case 304: |
4986 | 4746 /* Line 1792 of yacc.c */ |
4987 /* Line 1806 of yacc.c */ | 4747 #line 1882 "go.y" |
4988 #line 1874 "go.y" | |
4989 { | 4748 { |
4990 importconst((yyvsp[(2) - (5)].sym), types[TIDEAL], (yyvsp[(4) -
(5)].node)); | 4749 importconst((yyvsp[(2) - (5)].sym), types[TIDEAL], (yyvsp[(4) -
(5)].node)); |
4991 } | 4750 } |
4992 break; | 4751 break; |
4993 | 4752 |
4994 case 305: | 4753 case 305: |
4995 | 4754 /* Line 1792 of yacc.c */ |
4996 /* Line 1806 of yacc.c */ | 4755 #line 1886 "go.y" |
4997 #line 1878 "go.y" | |
4998 { | 4756 { |
4999 importconst((yyvsp[(2) - (6)].sym), (yyvsp[(3) - (6)].type), (yy
vsp[(5) - (6)].node)); | 4757 importconst((yyvsp[(2) - (6)].sym), (yyvsp[(3) - (6)].type), (yy
vsp[(5) - (6)].node)); |
5000 } | 4758 } |
5001 break; | 4759 break; |
5002 | 4760 |
5003 case 306: | 4761 case 306: |
5004 | 4762 /* Line 1792 of yacc.c */ |
5005 /* Line 1806 of yacc.c */ | 4763 #line 1890 "go.y" |
5006 #line 1882 "go.y" | |
5007 { | 4764 { |
5008 importtype((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].type)); | 4765 importtype((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].type)); |
5009 } | 4766 } |
5010 break; | 4767 break; |
5011 | 4768 |
5012 case 307: | 4769 case 307: |
5013 | 4770 /* Line 1792 of yacc.c */ |
5014 /* Line 1806 of yacc.c */ | 4771 #line 1894 "go.y" |
5015 #line 1886 "go.y" | |
5016 { | 4772 { |
5017 if((yyvsp[(2) - (4)].node) == N) { | 4773 if((yyvsp[(2) - (4)].node) == N) { |
5018 dclcontext = PEXTERN; // since we skip the funcbody bel
ow | 4774 dclcontext = PEXTERN; // since we skip the funcbody bel
ow |
5019 break; | 4775 break; |
5020 } | 4776 } |
5021 | 4777 |
5022 (yyvsp[(2) - (4)].node)->inl = (yyvsp[(3) - (4)].list); | 4778 (yyvsp[(2) - (4)].node)->inl = (yyvsp[(3) - (4)].list); |
5023 | 4779 |
5024 funcbody((yyvsp[(2) - (4)].node)); | 4780 funcbody((yyvsp[(2) - (4)].node)); |
5025 importlist = list(importlist, (yyvsp[(2) - (4)].node)); | 4781 importlist = list(importlist, (yyvsp[(2) - (4)].node)); |
5026 | 4782 |
5027 if(debug['E']) { | 4783 if(debug['E']) { |
5028 print("import [%Z] func %lN \n", importpkg->path, (yyvsp
[(2) - (4)].node)); | 4784 print("import [%Z] func %lN \n", importpkg->path, (yyvsp
[(2) - (4)].node)); |
5029 if(debug['m'] > 2 && (yyvsp[(2) - (4)].node)->inl) | 4785 if(debug['m'] > 2 && (yyvsp[(2) - (4)].node)->inl) |
5030 print("inl body:%+H\n", (yyvsp[(2) - (4)].node)-
>inl); | 4786 print("inl body:%+H\n", (yyvsp[(2) - (4)].node)-
>inl); |
5031 } | 4787 } |
5032 } | 4788 } |
5033 break; | 4789 break; |
5034 | 4790 |
5035 case 308: | 4791 case 308: |
5036 | 4792 /* Line 1792 of yacc.c */ |
5037 /* Line 1806 of yacc.c */ | 4793 #line 1914 "go.y" |
5038 #line 1906 "go.y" | |
5039 { | 4794 { |
5040 (yyval.sym) = (yyvsp[(1) - (1)].sym); | 4795 (yyval.sym) = (yyvsp[(1) - (1)].sym); |
5041 structpkg = (yyval.sym)->pkg; | 4796 structpkg = (yyval.sym)->pkg; |
5042 } | 4797 } |
5043 break; | 4798 break; |
5044 | 4799 |
5045 case 309: | 4800 case 309: |
5046 | 4801 /* Line 1792 of yacc.c */ |
5047 /* Line 1806 of yacc.c */ | 4802 #line 1921 "go.y" |
5048 #line 1913 "go.y" | |
5049 { | 4803 { |
5050 (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); | 4804 (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); |
5051 importsym((yyvsp[(1) - (1)].sym), OTYPE); | 4805 importsym((yyvsp[(1) - (1)].sym), OTYPE); |
5052 } | 4806 } |
5053 break; | 4807 break; |
5054 | 4808 |
5055 case 315: | 4809 case 315: |
5056 | 4810 /* Line 1792 of yacc.c */ |
5057 /* Line 1806 of yacc.c */ | 4811 #line 1941 "go.y" |
5058 #line 1933 "go.y" | |
5059 { | 4812 { |
5060 (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); | 4813 (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); |
5061 } | 4814 } |
5062 break; | 4815 break; |
5063 | 4816 |
5064 case 316: | 4817 case 316: |
5065 | 4818 /* Line 1792 of yacc.c */ |
5066 /* Line 1806 of yacc.c */ | 4819 #line 1945 "go.y" |
5067 #line 1937 "go.y" | |
5068 { | 4820 { |
5069 // predefined name like uint8 | 4821 // predefined name like uint8 |
5070 (yyvsp[(1) - (1)].sym) = pkglookup((yyvsp[(1) - (1)].sym)->name,
builtinpkg); | 4822 (yyvsp[(1) - (1)].sym) = pkglookup((yyvsp[(1) - (1)].sym)->name,
builtinpkg); |
5071 if((yyvsp[(1) - (1)].sym)->def == N || (yyvsp[(1) - (1)].sym)->d
ef->op != OTYPE) { | 4823 if((yyvsp[(1) - (1)].sym)->def == N || (yyvsp[(1) - (1)].sym)->d
ef->op != OTYPE) { |
5072 yyerror("%s is not a type", (yyvsp[(1) - (1)].sym)->name
); | 4824 yyerror("%s is not a type", (yyvsp[(1) - (1)].sym)->name
); |
5073 (yyval.type) = T; | 4825 (yyval.type) = T; |
5074 } else | 4826 } else |
5075 (yyval.type) = (yyvsp[(1) - (1)].sym)->def->type; | 4827 (yyval.type) = (yyvsp[(1) - (1)].sym)->def->type; |
5076 } | 4828 } |
5077 break; | 4829 break; |
5078 | 4830 |
5079 case 317: | 4831 case 317: |
5080 | 4832 /* Line 1792 of yacc.c */ |
5081 /* Line 1806 of yacc.c */ | 4833 #line 1955 "go.y" |
5082 #line 1947 "go.y" | |
5083 { | 4834 { |
5084 (yyval.type) = aindex(N, (yyvsp[(3) - (3)].type)); | 4835 (yyval.type) = aindex(N, (yyvsp[(3) - (3)].type)); |
5085 } | 4836 } |
5086 break; | 4837 break; |
5087 | 4838 |
5088 case 318: | 4839 case 318: |
5089 | 4840 /* Line 1792 of yacc.c */ |
5090 /* Line 1806 of yacc.c */ | 4841 #line 1959 "go.y" |
5091 #line 1951 "go.y" | |
5092 { | 4842 { |
5093 (yyval.type) = aindex(nodlit((yyvsp[(2) - (4)].val)), (yyvsp[(4)
- (4)].type)); | 4843 (yyval.type) = aindex(nodlit((yyvsp[(2) - (4)].val)), (yyvsp[(4)
- (4)].type)); |
5094 } | 4844 } |
5095 break; | 4845 break; |
5096 | 4846 |
5097 case 319: | 4847 case 319: |
5098 | 4848 /* Line 1792 of yacc.c */ |
5099 /* Line 1806 of yacc.c */ | 4849 #line 1963 "go.y" |
5100 #line 1955 "go.y" | |
5101 { | 4850 { |
5102 (yyval.type) = maptype((yyvsp[(3) - (5)].type), (yyvsp[(5) - (5)
].type)); | 4851 (yyval.type) = maptype((yyvsp[(3) - (5)].type), (yyvsp[(5) - (5)
].type)); |
5103 } | 4852 } |
5104 break; | 4853 break; |
5105 | 4854 |
5106 case 320: | 4855 case 320: |
5107 | 4856 /* Line 1792 of yacc.c */ |
5108 /* Line 1806 of yacc.c */ | 4857 #line 1967 "go.y" |
5109 #line 1959 "go.y" | |
5110 { | 4858 { |
5111 (yyval.type) = tostruct((yyvsp[(3) - (4)].list)); | 4859 (yyval.type) = tostruct((yyvsp[(3) - (4)].list)); |
5112 } | 4860 } |
5113 break; | 4861 break; |
5114 | 4862 |
5115 case 321: | 4863 case 321: |
5116 | 4864 /* Line 1792 of yacc.c */ |
5117 /* Line 1806 of yacc.c */ | 4865 #line 1971 "go.y" |
5118 #line 1963 "go.y" | |
5119 { | 4866 { |
5120 (yyval.type) = tointerface((yyvsp[(3) - (4)].list)); | 4867 (yyval.type) = tointerface((yyvsp[(3) - (4)].list)); |
5121 } | 4868 } |
5122 break; | 4869 break; |
5123 | 4870 |
5124 case 322: | 4871 case 322: |
5125 | 4872 /* Line 1792 of yacc.c */ |
5126 /* Line 1806 of yacc.c */ | 4873 #line 1975 "go.y" |
5127 #line 1967 "go.y" | |
5128 { | 4874 { |
5129 (yyval.type) = ptrto((yyvsp[(2) - (2)].type)); | 4875 (yyval.type) = ptrto((yyvsp[(2) - (2)].type)); |
5130 } | 4876 } |
5131 break; | 4877 break; |
5132 | 4878 |
5133 case 323: | 4879 case 323: |
5134 | 4880 /* Line 1792 of yacc.c */ |
5135 /* Line 1806 of yacc.c */ | 4881 #line 1979 "go.y" |
5136 #line 1971 "go.y" | |
5137 { | 4882 { |
5138 (yyval.type) = typ(TCHAN); | 4883 (yyval.type) = typ(TCHAN); |
5139 (yyval.type)->type = (yyvsp[(2) - (2)].type); | 4884 (yyval.type)->type = (yyvsp[(2) - (2)].type); |
5140 (yyval.type)->chan = Cboth; | 4885 (yyval.type)->chan = Cboth; |
5141 } | 4886 } |
5142 break; | 4887 break; |
5143 | 4888 |
5144 case 324: | 4889 case 324: |
5145 | 4890 /* Line 1792 of yacc.c */ |
5146 /* Line 1806 of yacc.c */ | 4891 #line 1985 "go.y" |
5147 #line 1977 "go.y" | |
5148 { | 4892 { |
5149 (yyval.type) = typ(TCHAN); | 4893 (yyval.type) = typ(TCHAN); |
5150 (yyval.type)->type = (yyvsp[(3) - (4)].type); | 4894 (yyval.type)->type = (yyvsp[(3) - (4)].type); |
5151 (yyval.type)->chan = Cboth; | 4895 (yyval.type)->chan = Cboth; |
5152 } | 4896 } |
5153 break; | 4897 break; |
5154 | 4898 |
5155 case 325: | 4899 case 325: |
5156 | 4900 /* Line 1792 of yacc.c */ |
5157 /* Line 1806 of yacc.c */ | 4901 #line 1991 "go.y" |
5158 #line 1983 "go.y" | |
5159 { | 4902 { |
5160 (yyval.type) = typ(TCHAN); | 4903 (yyval.type) = typ(TCHAN); |
5161 (yyval.type)->type = (yyvsp[(3) - (3)].type); | 4904 (yyval.type)->type = (yyvsp[(3) - (3)].type); |
5162 (yyval.type)->chan = Csend; | 4905 (yyval.type)->chan = Csend; |
5163 } | 4906 } |
5164 break; | 4907 break; |
5165 | 4908 |
5166 case 326: | 4909 case 326: |
5167 | 4910 /* Line 1792 of yacc.c */ |
5168 /* Line 1806 of yacc.c */ | 4911 #line 1999 "go.y" |
5169 #line 1991 "go.y" | |
5170 { | 4912 { |
5171 (yyval.type) = typ(TCHAN); | 4913 (yyval.type) = typ(TCHAN); |
5172 (yyval.type)->type = (yyvsp[(3) - (3)].type); | 4914 (yyval.type)->type = (yyvsp[(3) - (3)].type); |
5173 (yyval.type)->chan = Crecv; | 4915 (yyval.type)->chan = Crecv; |
5174 } | 4916 } |
5175 break; | 4917 break; |
5176 | 4918 |
5177 case 327: | 4919 case 327: |
5178 | 4920 /* Line 1792 of yacc.c */ |
5179 /* Line 1806 of yacc.c */ | 4921 #line 2007 "go.y" |
5180 #line 1999 "go.y" | |
5181 { | 4922 { |
5182 » » (yyval.type) = functype(nil, (yyvsp[(3) - (5)].list), (yyvsp[(5)
- (5)].list)); | 4923 » » (yyval.type) = functype(nil, (yyvsp[(3) - (5)].flist), (yyvsp[(5
) - (5)].flist)); |
5183 } | 4924 } |
5184 break; | 4925 break; |
5185 | 4926 |
5186 case 328: | 4927 case 328: |
5187 | 4928 /* Line 1792 of yacc.c */ |
5188 /* Line 1806 of yacc.c */ | 4929 #line 2013 "go.y" |
5189 #line 2005 "go.y" | |
5190 { | 4930 { |
5191 » » (yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(2) - (3)].type)
)); | 4931 » » (yyval.field) = fld((yyvsp[(1) - (3)].sym), (yyvsp[(2) - (3)].ty
pe)); |
5192 » » if((yyvsp[(1) - (3)].sym)) | 4932 » » (yyval.field)->tag = (yyvsp[(3) - (3)].val); |
5193 » » » (yyval.node)->left = newname((yyvsp[(1) - (3)].sym)); | |
5194 » » (yyval.node)->val = (yyvsp[(3) - (3)].val); | |
5195 } | 4933 } |
5196 break; | 4934 break; |
5197 | 4935 |
5198 case 329: | 4936 case 329: |
5199 | 4937 /* Line 1792 of yacc.c */ |
5200 /* Line 1806 of yacc.c */ | 4938 #line 2018 "go.y" |
5201 #line 2012 "go.y" | |
5202 { | 4939 { |
5203 Type *t; | 4940 Type *t; |
5204 ········ | 4941 ········ |
5205 t = typ(TARRAY); | 4942 t = typ(TARRAY); |
5206 t->bound = -1; | 4943 t->bound = -1; |
5207 t->type = (yyvsp[(3) - (4)].type); | 4944 t->type = (yyvsp[(3) - (4)].type); |
5208 | 4945 |
5209 » » (yyval.node) = nod(ODCLFIELD, N, typenod(t)); | 4946 » » (yyval.field) = fld((yyvsp[(1) - (4)].sym), t); |
5210 » » if((yyvsp[(1) - (4)].sym)) | 4947 » » (yyval.field)->isddd = 1; |
5211 » » » (yyval.node)->left = newname((yyvsp[(1) - (4)].sym)); | 4948 » » (yyval.field)->tag = (yyvsp[(4) - (4)].val); |
5212 » » (yyval.node)->isddd = 1; | |
5213 » » (yyval.node)->val = (yyvsp[(4) - (4)].val); | |
5214 } | 4949 } |
5215 break; | 4950 break; |
5216 | 4951 |
5217 case 330: | 4952 case 330: |
5218 | 4953 /* Line 1792 of yacc.c */ |
5219 /* Line 1806 of yacc.c */ | 4954 #line 2032 "go.y" |
5220 #line 2028 "go.y" | |
5221 { | 4955 { |
5222 Sym *s; | 4956 Sym *s; |
5223 | 4957 |
5224 if((yyvsp[(1) - (3)].sym) != S) { | 4958 if((yyvsp[(1) - (3)].sym) != S) { |
5225 (yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (3)].
sym)), typenod((yyvsp[(2) - (3)].type))); | 4959 (yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (3)].
sym)), typenod((yyvsp[(2) - (3)].type))); |
5226 (yyval.node)->val = (yyvsp[(3) - (3)].val); | 4960 (yyval.node)->val = (yyvsp[(3) - (3)].val); |
5227 } else { | 4961 } else { |
5228 s = (yyvsp[(2) - (3)].type)->sym; | 4962 s = (yyvsp[(2) - (3)].type)->sym; |
5229 if(s == S && isptr[(yyvsp[(2) - (3)].type)->etype]) | 4963 if(s == S && isptr[(yyvsp[(2) - (3)].type)->etype]) |
5230 s = (yyvsp[(2) - (3)].type)->type->sym; | 4964 s = (yyvsp[(2) - (3)].type)->type->sym; |
5231 (yyval.node) = embedded(s); | 4965 (yyval.node) = embedded(s); |
5232 (yyval.node)->right = typenod((yyvsp[(2) - (3)].type)); | 4966 (yyval.node)->right = typenod((yyvsp[(2) - (3)].type)); |
5233 (yyval.node)->val = (yyvsp[(3) - (3)].val); | 4967 (yyval.node)->val = (yyvsp[(3) - (3)].val); |
5234 } | 4968 } |
5235 } | 4969 } |
5236 break; | 4970 break; |
5237 | 4971 |
5238 case 331: | 4972 case 331: |
5239 | 4973 /* Line 1792 of yacc.c */ |
5240 /* Line 1806 of yacc.c */ | 4974 #line 2050 "go.y" |
5241 #line 2046 "go.y" | |
5242 { | 4975 { |
5243 » » (yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (5)].sym)), t
ypenod(functype(fakethis(), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list)))); | 4976 » » (yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (5)].sym)), t
ypenod(functype(fakefldthis(), (yyvsp[(3) - (5)].flist), (yyvsp[(5) - (5)].flist
)))); |
5244 } | 4977 } |
5245 break; | 4978 break; |
5246 | 4979 |
5247 case 332: | 4980 case 332: |
5248 | 4981 /* Line 1792 of yacc.c */ |
5249 /* Line 1806 of yacc.c */ | 4982 #line 2054 "go.y" |
5250 #line 2050 "go.y" | |
5251 { | 4983 { |
5252 (yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type)
)); | 4984 (yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type)
)); |
5253 } | 4985 } |
5254 break; | 4986 break; |
5255 | 4987 |
5256 case 333: | 4988 case 333: |
5257 | 4989 /* Line 1792 of yacc.c */ |
5258 /* Line 1806 of yacc.c */ | 4990 #line 2059 "go.y" |
5259 #line 2055 "go.y" | |
5260 { | 4991 { |
5261 » » (yyval.list) = nil; | 4992 » » (yyval.flist) = nil; |
5262 } | 4993 } |
5263 break; | 4994 break; |
5264 | 4995 |
5265 case 335: | 4996 case 335: |
5266 | 4997 /* Line 1792 of yacc.c */ |
5267 /* Line 1806 of yacc.c */ | 4998 #line 2066 "go.y" |
5268 #line 2062 "go.y" | |
5269 { | 4999 { |
5270 » » (yyval.list) = (yyvsp[(2) - (3)].list); | 5000 » » (yyval.flist) = (yyvsp[(2) - (3)].flist); |
5271 } | 5001 } |
5272 break; | 5002 break; |
5273 | 5003 |
5274 case 336: | 5004 case 336: |
5275 | 5005 /* Line 1792 of yacc.c */ |
5276 /* Line 1806 of yacc.c */ | 5006 #line 2070 "go.y" |
5277 #line 2066 "go.y" | |
5278 { | 5007 { |
5279 » » (yyval.list) = list1(nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)]
.type)))); | 5008 » » (yyval.flist) = fldlist(nil, fld(S, (yyvsp[(1) - (1)].type))); |
5280 } | 5009 } |
5281 break; | 5010 break; |
5282 | 5011 |
5283 case 337: | 5012 case 337: |
5284 | 5013 /* Line 1792 of yacc.c */ |
5285 /* Line 1806 of yacc.c */ | 5014 #line 2080 "go.y" |
5286 #line 2076 "go.y" | |
5287 { | 5015 { |
5288 (yyval.node) = nodlit((yyvsp[(1) - (1)].val)); | 5016 (yyval.node) = nodlit((yyvsp[(1) - (1)].val)); |
5289 } | 5017 } |
5290 break; | 5018 break; |
5291 | 5019 |
5292 case 338: | 5020 case 338: |
5293 | 5021 /* Line 1792 of yacc.c */ |
5294 /* Line 1806 of yacc.c */ | 5022 #line 2084 "go.y" |
5295 #line 2080 "go.y" | |
5296 { | 5023 { |
5297 (yyval.node) = nodlit((yyvsp[(2) - (2)].val)); | 5024 (yyval.node) = nodlit((yyvsp[(2) - (2)].val)); |
5298 switch((yyval.node)->val.ctype){ | 5025 switch((yyval.node)->val.ctype){ |
5299 case CTINT: | 5026 case CTINT: |
5300 case CTRUNE: | 5027 case CTRUNE: |
5301 mpnegfix((yyval.node)->val.u.xval); | 5028 mpnegfix((yyval.node)->val.u.xval); |
5302 break; | 5029 break; |
5303 case CTFLT: | 5030 case CTFLT: |
5304 mpnegflt((yyval.node)->val.u.fval); | 5031 mpnegflt((yyval.node)->val.u.fval); |
5305 break; | 5032 break; |
5306 default: | 5033 default: |
5307 yyerror("bad negated constant"); | 5034 yyerror("bad negated constant"); |
5308 } | 5035 } |
5309 } | 5036 } |
5310 break; | 5037 break; |
5311 | 5038 |
5312 case 339: | 5039 case 339: |
5313 | 5040 /* Line 1792 of yacc.c */ |
5314 /* Line 1806 of yacc.c */ | 5041 #line 2099 "go.y" |
5315 #line 2095 "go.y" | |
5316 { | 5042 { |
5317 (yyval.node) = oldname(pkglookup((yyvsp[(1) - (1)].sym)->name, b
uiltinpkg)); | 5043 (yyval.node) = oldname(pkglookup((yyvsp[(1) - (1)].sym)->name, b
uiltinpkg)); |
5318 if((yyval.node)->op != OLITERAL) | 5044 if((yyval.node)->op != OLITERAL) |
5319 yyerror("bad constant %S", (yyval.node)->sym); | 5045 yyerror("bad constant %S", (yyval.node)->sym); |
5320 } | 5046 } |
5321 break; | 5047 break; |
5322 | 5048 |
5323 case 341: | 5049 case 341: |
5324 | 5050 /* Line 1792 of yacc.c */ |
5325 /* Line 1806 of yacc.c */ | 5051 #line 2108 "go.y" |
5326 #line 2104 "go.y" | |
5327 { | 5052 { |
5328 if((yyvsp[(2) - (5)].node)->val.ctype == CTRUNE && (yyvsp[(4) -
(5)].node)->val.ctype == CTINT) { | 5053 if((yyvsp[(2) - (5)].node)->val.ctype == CTRUNE && (yyvsp[(4) -
(5)].node)->val.ctype == CTINT) { |
5329 (yyval.node) = (yyvsp[(2) - (5)].node); | 5054 (yyval.node) = (yyvsp[(2) - (5)].node); |
5330 mpaddfixfix((yyvsp[(2) - (5)].node)->val.u.xval, (yyvsp[
(4) - (5)].node)->val.u.xval, 0); | 5055 mpaddfixfix((yyvsp[(2) - (5)].node)->val.u.xval, (yyvsp[
(4) - (5)].node)->val.u.xval, 0); |
5331 break; | 5056 break; |
5332 } | 5057 } |
5333 (yyvsp[(4) - (5)].node)->val.u.cval->real = (yyvsp[(4) - (5)].no
de)->val.u.cval->imag; | 5058 (yyvsp[(4) - (5)].node)->val.u.cval->real = (yyvsp[(4) - (5)].no
de)->val.u.cval->imag; |
5334 mpmovecflt(&(yyvsp[(4) - (5)].node)->val.u.cval->imag, 0.0); | 5059 mpmovecflt(&(yyvsp[(4) - (5)].node)->val.u.cval->imag, 0.0); |
5335 (yyval.node) = nodcplxlit((yyvsp[(2) - (5)].node)->val, (yyvsp[(
4) - (5)].node)->val); | 5060 (yyval.node) = nodcplxlit((yyvsp[(2) - (5)].node)->val, (yyvsp[(
4) - (5)].node)->val); |
5336 } | 5061 } |
5337 break; | 5062 break; |
5338 | 5063 |
5339 case 344: | 5064 case 344: |
5340 | 5065 /* Line 1792 of yacc.c */ |
5341 /* Line 1806 of yacc.c */ | 5066 #line 2124 "go.y" |
5342 #line 2120 "go.y" | |
5343 { | 5067 { |
5344 » » (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 5068 » » (yyval.flist) = fldlist(nil, (yyvsp[(1) - (1)].field)); |
5345 } | 5069 } |
5346 break; | 5070 break; |
5347 | 5071 |
5348 case 345: | 5072 case 345: |
5349 | 5073 /* Line 1792 of yacc.c */ |
5350 /* Line 1806 of yacc.c */ | 5074 #line 2128 "go.y" |
5351 #line 2124 "go.y" | |
5352 { | 5075 { |
5353 » » (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 5076 » » (yyval.flist) = fldlist((yyvsp[(1) - (3)].flist), (yyvsp[(3) - (
3)].field)); |
5354 } | 5077 } |
5355 break; | 5078 break; |
5356 | 5079 |
5357 case 346: | 5080 case 346: |
5358 | 5081 /* Line 1792 of yacc.c */ |
5359 /* Line 1806 of yacc.c */ | 5082 #line 2134 "go.y" |
5360 #line 2130 "go.y" | |
5361 { | 5083 { |
5362 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 5084 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
5363 } | 5085 } |
5364 break; | 5086 break; |
5365 | 5087 |
5366 case 347: | 5088 case 347: |
5367 | 5089 /* Line 1792 of yacc.c */ |
5368 /* Line 1806 of yacc.c */ | 5090 #line 2138 "go.y" |
5369 #line 2134 "go.y" | |
5370 { | 5091 { |
5371 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 5092 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
5372 } | 5093 } |
5373 break; | 5094 break; |
5374 | 5095 |
5375 case 348: | 5096 case 348: |
5376 | 5097 /* Line 1792 of yacc.c */ |
5377 /* Line 1806 of yacc.c */ | 5098 #line 2144 "go.y" |
5378 #line 2140 "go.y" | |
5379 { | 5099 { |
5380 (yyval.list) = list1((yyvsp[(1) - (1)].node)); | 5100 (yyval.list) = list1((yyvsp[(1) - (1)].node)); |
5381 } | 5101 } |
5382 break; | 5102 break; |
5383 | 5103 |
5384 case 349: | 5104 case 349: |
5385 | 5105 /* Line 1792 of yacc.c */ |
5386 /* Line 1806 of yacc.c */ | 5106 #line 2148 "go.y" |
5387 #line 2144 "go.y" | |
5388 { | 5107 { |
5389 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); | 5108 (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].n
ode)); |
5390 } | 5109 } |
5391 break; | 5110 break; |
5392 | 5111 |
5393 | 5112 |
5394 | 5113 /* Line 1792 of yacc.c */ |
5395 /* Line 1806 of yacc.c */ | 5114 #line 5116 "y.tab.c" |
5396 #line 5398 "y.tab.c" | |
5397 default: break; | 5115 default: break; |
5398 } | 5116 } |
5399 /* User semantic actions sometimes alter yychar, and that requires | 5117 /* User semantic actions sometimes alter yychar, and that requires |
5400 that yytoken be updated with the new translation. We take the | 5118 that yytoken be updated with the new translation. We take the |
5401 approach of translating immediately before every use of yytoken. | 5119 approach of translating immediately before every use of yytoken. |
5402 One alternative is translating here after every semantic action, | 5120 One alternative is translating here after every semantic action, |
5403 but that translation would be missed if the semantic action invokes | 5121 but that translation would be missed if the semantic action invokes |
5404 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or | 5122 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
5405 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an | 5123 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
5406 incorrect destructor might then be invoked immediately. In the | 5124 incorrect destructor might then be invoked immediately. In the |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5549 YYABORT; | 5267 YYABORT; |
5550 | 5268 |
5551 | 5269 |
5552 yydestruct ("Error: popping", | 5270 yydestruct ("Error: popping", |
5553 yystos[yystate], yyvsp); | 5271 yystos[yystate], yyvsp); |
5554 YYPOPSTACK (1); | 5272 YYPOPSTACK (1); |
5555 yystate = *yyssp; | 5273 yystate = *yyssp; |
5556 YY_STACK_PRINT (yyss, yyssp); | 5274 YY_STACK_PRINT (yyss, yyssp); |
5557 } | 5275 } |
5558 | 5276 |
| 5277 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
5559 *++yyvsp = yylval; | 5278 *++yyvsp = yylval; |
| 5279 YY_IGNORE_MAYBE_UNINITIALIZED_END |
5560 | 5280 |
5561 | 5281 |
5562 /* Shift the error token. */ | 5282 /* Shift the error token. */ |
5563 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | 5283 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
5564 | 5284 |
5565 yystate = yyn; | 5285 yystate = yyn; |
5566 goto yynewstate; | 5286 goto yynewstate; |
5567 | 5287 |
5568 | 5288 |
5569 /*-------------------------------------. | 5289 /*-------------------------------------. |
5570 | yyacceptlab -- YYACCEPT comes here. | | 5290 | yyacceptlab -- YYACCEPT comes here. | |
5571 `-------------------------------------*/ | 5291 `-------------------------------------*/ |
5572 yyacceptlab: | 5292 yyacceptlab: |
5573 yyresult = 0; | 5293 yyresult = 0; |
5574 goto yyreturn; | 5294 goto yyreturn; |
5575 | 5295 |
5576 /*-----------------------------------. | 5296 /*-----------------------------------. |
5577 | yyabortlab -- YYABORT comes here. | | 5297 | yyabortlab -- YYABORT comes here. | |
5578 `-----------------------------------*/ | 5298 `-----------------------------------*/ |
5579 yyabortlab: | 5299 yyabortlab: |
5580 yyresult = 1; | 5300 yyresult = 1; |
5581 goto yyreturn; | 5301 goto yyreturn; |
5582 | 5302 |
5583 #if !defined(yyoverflow) || YYERROR_VERBOSE | 5303 #if !defined yyoverflow || YYERROR_VERBOSE |
5584 /*-------------------------------------------------. | 5304 /*-------------------------------------------------. |
5585 | yyexhaustedlab -- memory exhaustion comes here. | | 5305 | yyexhaustedlab -- memory exhaustion comes here. | |
5586 `-------------------------------------------------*/ | 5306 `-------------------------------------------------*/ |
5587 yyexhaustedlab: | 5307 yyexhaustedlab: |
5588 yyerror (YY_("memory exhausted")); | 5308 yyerror (YY_("memory exhausted")); |
5589 yyresult = 2; | 5309 yyresult = 2; |
5590 /* Fall through. */ | 5310 /* Fall through. */ |
5591 #endif | 5311 #endif |
5592 | 5312 |
5593 yyreturn: | 5313 yyreturn: |
(...skipping 21 matching lines...) Expand all Loading... |
5615 #endif | 5335 #endif |
5616 #if YYERROR_VERBOSE | 5336 #if YYERROR_VERBOSE |
5617 if (yymsg != yymsgbuf) | 5337 if (yymsg != yymsgbuf) |
5618 YYSTACK_FREE (yymsg); | 5338 YYSTACK_FREE (yymsg); |
5619 #endif | 5339 #endif |
5620 /* Make sure YYID is used. */ | 5340 /* Make sure YYID is used. */ |
5621 return YYID (yyresult); | 5341 return YYID (yyresult); |
5622 } | 5342 } |
5623 | 5343 |
5624 | 5344 |
5625 | 5345 /* Line 2055 of yacc.c */ |
5626 /* Line 2067 of yacc.c */ | 5346 #line 2152 "go.y" |
5627 #line 2148 "go.y" | |
5628 | 5347 |
5629 | 5348 |
5630 static void | 5349 static void |
5631 fixlbrace(int lbr) | 5350 fixlbrace(int lbr) |
5632 { | 5351 { |
5633 // If the opening brace was an LBODY, | 5352 // If the opening brace was an LBODY, |
5634 // set up for another one now that we're done. | 5353 // set up for another one now that we're done. |
5635 // See comment in lex.c about loophack. | 5354 // See comment in lex.c about loophack. |
5636 if(lbr == LBODY) | 5355 if(lbr == LBODY) |
5637 loophack = 1; | 5356 loophack = 1; |
5638 } | 5357 } |
5639 | 5358 |
5640 | |
OLD | NEW |