github.com/coyove/nj@v0.0.0-20221110084952-c7f8db1065c3/parser/parser.go (about) 1 // Code generated by goyacc -o parser.go parser.go.y. DO NOT EDIT. 2 3 //line parser.go.y:2 4 package parser 5 6 import __yyfmt__ "fmt" 7 8 //line parser.go.y:2 9 10 import "github.com/coyove/nj/typ" 11 12 func ss(yylex yyLexer) *Lexer { return yylex.(*Lexer) } 13 14 //line parser.go.y:27 15 type yySymType struct { 16 yys int 17 token Token 18 expr Node 19 } 20 21 const TDo = 57346 22 const TLocal = 57347 23 const TElseIf = 57348 24 const TThen = 57349 25 const TEnd = 57350 26 const TBreak = 57351 27 const TContinue = 57352 28 const TElse = 57353 29 const TFor = 57354 30 const TWhile = 57355 31 const TFunc = 57356 32 const TIf = 57357 33 const TReturn = 57358 34 const TReturnVoid = 57359 35 const TRepeat = 57360 36 const TUntil = 57361 37 const TNot = 57362 38 const TLabel = 57363 39 const TGoto = 57364 40 const TIn = 57365 41 const TLsh = 57366 42 const TRsh = 57367 43 const TURsh = 57368 44 const TDotDotDot = 57369 45 const TLParen = 57370 46 const TLBracket = 57371 47 const TIs = 57372 48 const TOr = 57373 49 const TAnd = 57374 50 const TEqeq = 57375 51 const TNeq = 57376 52 const TLte = 57377 53 const TGte = 57378 54 const TIdent = 57379 55 const TNumber = 57380 56 const TString = 57381 57 const TIDiv = 57382 58 const TInv = 57383 59 const TAddEq = 57384 60 const TSubEq = 57385 61 const TMulEq = 57386 62 const TDivEq = 57387 63 const TIDivEq = 57388 64 const TModEq = 57389 65 const TBitAndEq = 57390 66 const TBitOrEq = 57391 67 const TBitXorEq = 57392 68 const TBitLshEq = 57393 69 const TBitRshEq = 57394 70 const TBitURshEq = 57395 71 const ASSIGN = 57396 72 const FUNC = 57397 73 const UNARY = 57398 74 75 var yyToknames = [...]string{ 76 "$end", 77 "error", 78 "$unk", 79 "TDo", 80 "TLocal", 81 "TElseIf", 82 "TThen", 83 "TEnd", 84 "TBreak", 85 "TContinue", 86 "TElse", 87 "TFor", 88 "TWhile", 89 "TFunc", 90 "TIf", 91 "TReturn", 92 "TReturnVoid", 93 "TRepeat", 94 "TUntil", 95 "TNot", 96 "TLabel", 97 "TGoto", 98 "TIn", 99 "TLsh", 100 "TRsh", 101 "TURsh", 102 "TDotDotDot", 103 "TLParen", 104 "TLBracket", 105 "TIs", 106 "TOr", 107 "TAnd", 108 "TEqeq", 109 "TNeq", 110 "TLte", 111 "TGte", 112 "TIdent", 113 "TNumber", 114 "TString", 115 "TIDiv", 116 "TInv", 117 "TAddEq", 118 "TSubEq", 119 "TMulEq", 120 "TDivEq", 121 "TIDivEq", 122 "TModEq", 123 "TBitAndEq", 124 "TBitOrEq", 125 "TBitXorEq", 126 "TBitLshEq", 127 "TBitRshEq", 128 "TBitURshEq", 129 "'{'", 130 "'['", 131 "'('", 132 "'='", 133 "'>'", 134 "'<'", 135 "'+'", 136 "'-'", 137 "'*'", 138 "'/'", 139 "'%'", 140 "'^'", 141 "'#'", 142 "'.'", 143 "'&'", 144 "'|'", 145 "'~'", 146 "':'", 147 "')'", 148 "','", 149 "'T'", 150 "ASSIGN", 151 "FUNC", 152 "UNARY", 153 "';'", 154 "']'", 155 "'}'", 156 } 157 158 var yyStatenames = [...]string{} 159 160 const yyEofCode = 1 161 const yyErrCode = 2 162 const yyInitialStackSize = 16 163 164 //line parser.go.y:224 165 166 //line yacctab:1 167 var yyExca = [...]int{ 168 -1, 1, 169 1, -1, 170 -2, 0, 171 -1, 20, 172 57, 105, 173 73, 105, 174 -2, 90, 175 -1, 147, 176 57, 106, 177 73, 106, 178 -2, 90, 179 } 180 181 const yyPrivate = 57344 182 183 const yyLast = 2004 184 185 var yyAct = [...]int{ 186 17, 229, 175, 210, 72, 38, 44, 245, 209, 244, 187 145, 243, 145, 48, 222, 145, 20, 45, 219, 145, 188 239, 119, 88, 144, 74, 91, 25, 208, 97, 98, 189 99, 100, 178, 176, 101, 45, 107, 43, 240, 145, 190 75, 73, 255, 109, 113, 116, 237, 188, 179, 224, 191 20, 199, 122, 123, 124, 125, 126, 127, 128, 129, 192 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 193 140, 141, 103, 176, 73, 45, 220, 149, 150, 151, 194 152, 153, 154, 155, 156, 157, 158, 159, 160, 147, 195 185, 2, 187, 145, 168, 169, 36, 45, 142, 68, 196 69, 70, 148, 20, 39, 71, 117, 195, 177, 217, 197 73, 114, 146, 37, 89, 63, 73, 50, 49, 186, 198 45, 73, 189, 30, 192, 20, 190, 39, 165, 182, 199 111, 171, 40, 167, 173, 184, 145, 61, 62, 64, 200 31, 26, 32, 65, 29, 45, 96, 94, 121, 120, 201 90, 115, 191, 42, 41, 40, 112, 35, 34, 33, 202 71, 39, 163, 197, 198, 93, 200, 227, 202, 28, 203 193, 206, 118, 27, 170, 249, 207, 45, 164, 212, 204 45, 45, 194, 190, 232, 95, 213, 214, 216, 40, 205 218, 3, 223, 221, 5, 20, 50, 49, 8, 7, 206 110, 181, 143, 6, 233, 105, 234, 19, 1, 0, 207 20, 238, 0, 0, 0, 20, 0, 0, 0, 31, 208 0, 32, 0, 0, 0, 0, 0, 246, 247, 0, 209 0, 0, 251, 0, 50, 49, 35, 34, 33, 0, 210 0, 45, 45, 0, 0, 50, 49, 256, 257, 0, 211 0, 30, 0, 196, 265, 0, 20, 31, 201, 32, 212 0, 267, 20, 0, 20, 0, 20, 0, 106, 26, 213 32, 274, 29, 0, 35, 34, 33, 0, 0, 0, 214 20, 0, 20, 20, 0, 35, 34, 33, 0, 20, 215 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 216 0, 27, 0, 0, 0, 0, 0, 0, 242, 0, 217 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 218 248, 0, 250, 0, 252, 4, 18, 231, 0, 0, 219 11, 12, 230, 23, 21, 10, 24, 16, 15, 22, 220 0, 30, 14, 13, 0, 0, 0, 0, 0, 0, 221 0, 266, 0, 268, 0, 269, 0, 0, 31, 26, 222 32, 0, 29, 0, 275, 0, 0, 68, 69, 70, 223 0, 0, 0, 71, 0, 35, 34, 33, 0, 0, 224 0, 0, 0, 63, 4, 18, 0, 28, 276, 11, 225 12, 27, 23, 21, 10, 24, 16, 15, 22, 9, 226 30, 14, 13, 59, 60, 61, 62, 64, 67, 0, 227 0, 65, 66, 0, 0, 0, 0, 31, 26, 32, 228 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 229 0, 0, 0, 0, 35, 34, 33, 0, 0, 0, 230 0, 0, 0, 4, 18, 0, 28, 273, 11, 12, 231 27, 23, 21, 10, 24, 16, 15, 22, 9, 30, 232 14, 13, 76, 77, 78, 79, 80, 81, 82, 83, 233 84, 85, 86, 87, 0, 0, 31, 26, 32, 0, 234 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 235 0, 0, 0, 35, 34, 33, 0, 0, 0, 0, 236 0, 0, 4, 18, 0, 28, 271, 11, 12, 27, 237 23, 21, 10, 24, 16, 15, 22, 9, 30, 14, 238 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239 0, 0, 0, 0, 0, 31, 26, 32, 0, 29, 240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241 0, 0, 35, 34, 33, 0, 0, 0, 0, 0, 242 0, 4, 18, 0, 28, 264, 11, 12, 27, 23, 243 21, 10, 24, 16, 15, 22, 9, 30, 14, 13, 244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 245 0, 0, 0, 0, 31, 26, 32, 0, 29, 0, 246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247 0, 35, 34, 33, 0, 0, 0, 0, 0, 0, 248 4, 18, 0, 28, 262, 11, 12, 27, 23, 21, 249 10, 24, 16, 15, 22, 9, 30, 14, 13, 0, 250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251 0, 0, 0, 31, 26, 32, 0, 29, 0, 0, 252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253 35, 34, 33, 0, 0, 0, 0, 0, 0, 4, 254 18, 0, 28, 258, 11, 12, 27, 23, 21, 10, 255 24, 16, 15, 22, 9, 30, 14, 13, 0, 0, 256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257 0, 0, 31, 26, 32, 0, 29, 0, 0, 0, 258 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 259 34, 33, 0, 0, 0, 0, 0, 0, 4, 18, 260 0, 28, 225, 11, 12, 27, 23, 21, 10, 24, 261 16, 15, 22, 9, 30, 14, 13, 0, 0, 0, 262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 263 0, 31, 26, 32, 0, 29, 0, 0, 0, 0, 264 0, 0, 0, 0, 0, 0, 0, 0, 35, 34, 265 33, 0, 0, 0, 0, 0, 0, 4, 18, 0, 266 28, 215, 11, 12, 27, 23, 21, 10, 24, 16, 267 15, 22, 9, 30, 14, 13, 0, 0, 0, 0, 268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 269 31, 26, 32, 0, 29, 0, 0, 0, 0, 0, 270 0, 0, 0, 0, 0, 0, 0, 35, 34, 33, 271 0, 0, 0, 0, 0, 0, 4, 18, 0, 28, 272 183, 11, 12, 27, 23, 21, 10, 24, 16, 15, 273 22, 9, 30, 14, 13, 0, 0, 0, 0, 0, 274 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 275 26, 32, 0, 29, 0, 0, 0, 0, 0, 0, 276 0, 0, 0, 0, 0, 0, 35, 34, 33, 0, 277 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 278 0, 0, 27, 4, 18, 0, 0, 0, 11, 12, 279 9, 23, 21, 10, 24, 16, 15, 22, 162, 30, 280 14, 13, 0, 0, 0, 0, 0, 0, 0, 0, 281 0, 0, 0, 0, 0, 0, 31, 26, 32, 0, 282 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 283 0, 0, 0, 35, 34, 33, 0, 0, 0, 0, 284 0, 0, 4, 18, 0, 28, 108, 11, 12, 27, 285 23, 21, 10, 24, 16, 15, 22, 9, 30, 14, 286 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 287 0, 0, 0, 0, 0, 31, 26, 32, 0, 29, 288 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289 0, 0, 35, 34, 33, 0, 0, 0, 0, 0, 290 0, 4, 18, 0, 28, 0, 11, 12, 27, 23, 291 21, 10, 24, 16, 15, 22, 9, 30, 14, 13, 292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 293 0, 0, 0, 0, 31, 26, 32, 0, 29, 0, 294 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, 295 70, 35, 34, 33, 71, 51, 52, 57, 58, 56, 296 55, 0, 0, 28, 63, 0, 0, 27, 0, 0, 297 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 298 0, 0, 53, 54, 59, 60, 61, 62, 64, 67, 299 0, 0, 65, 66, 0, 205, 0, 0, 68, 69, 300 70, 0, 0, 204, 71, 51, 52, 57, 58, 56, 301 55, 68, 69, 70, 63, 0, 0, 71, 51, 52, 302 57, 58, 56, 55, 0, 0, 0, 63, 0, 0, 303 0, 0, 53, 54, 59, 60, 61, 62, 64, 67, 304 0, 259, 65, 66, 0, 53, 54, 59, 60, 61, 305 62, 64, 67, 254, 0, 65, 66, 0, 0, 0, 306 0, 68, 69, 70, 0, 0, 236, 71, 51, 52, 307 57, 58, 56, 55, 0, 0, 0, 63, 68, 69, 308 70, 0, 0, 0, 71, 51, 52, 57, 58, 56, 309 55, 0, 0, 0, 63, 53, 54, 59, 60, 61, 310 62, 64, 67, 0, 0, 65, 66, 0, 0, 0, 311 260, 0, 53, 54, 59, 60, 61, 62, 64, 67, 312 0, 0, 65, 66, 68, 69, 70, 253, 0, 0, 313 71, 51, 52, 57, 58, 56, 55, 0, 0, 0, 314 63, 68, 69, 70, 0, 0, 0, 71, 51, 52, 315 57, 58, 56, 55, 0, 0, 0, 63, 53, 54, 316 59, 60, 61, 62, 64, 67, 0, 0, 65, 66, 317 0, 0, 0, 226, 0, 53, 54, 59, 60, 61, 318 62, 64, 67, 0, 0, 65, 66, 68, 69, 70, 319 203, 0, 0, 71, 51, 52, 57, 58, 56, 55, 320 0, 0, 0, 63, 68, 69, 70, 0, 0, 0, 321 71, 51, 52, 57, 58, 56, 55, 0, 0, 0, 322 63, 53, 54, 59, 60, 61, 62, 64, 67, 0, 323 0, 65, 66, 0, 0, 270, 0, 0, 53, 54, 324 59, 60, 61, 62, 64, 67, 47, 0, 65, 66, 325 0, 0, 174, 0, 0, 50, 49, 0, 0, 0, 326 0, 30, 0, 46, 0, 0, 0, 0, 0, 0, 327 0, 0, 0, 0, 0, 0, 0, 0, 31, 26, 328 32, 0, 29, 0, 0, 0, 0, 0, 0, 0, 329 0, 0, 68, 69, 70, 35, 34, 33, 71, 51, 330 52, 57, 58, 56, 55, 0, 0, 28, 63, 0, 331 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 332 102, 0, 0, 0, 0, 0, 53, 54, 59, 60, 333 61, 62, 64, 67, 0, 0, 65, 66, 0, 241, 334 68, 69, 70, 0, 0, 0, 71, 51, 52, 57, 335 58, 56, 55, 0, 0, 0, 63, 0, 0, 0, 336 0, 0, 0, 0, 0, 50, 49, 0, 0, 0, 337 0, 30, 0, 0, 53, 54, 59, 60, 61, 62, 338 64, 67, 272, 0, 65, 66, 0, 180, 31, 26, 339 32, 0, 29, 0, 0, 0, 0, 0, 0, 0, 340 0, 0, 68, 69, 70, 35, 34, 33, 71, 51, 341 52, 57, 58, 56, 55, 0, 0, 28, 63, 0, 342 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 343 235, 263, 0, 0, 0, 0, 53, 54, 59, 60, 344 61, 62, 64, 67, 0, 261, 65, 66, 68, 69, 345 70, 0, 0, 0, 71, 51, 52, 57, 58, 56, 346 55, 0, 0, 0, 63, 68, 69, 70, 0, 0, 347 0, 71, 51, 52, 57, 58, 56, 55, 0, 0, 348 0, 63, 53, 54, 59, 60, 61, 62, 64, 67, 349 0, 228, 65, 66, 0, 0, 0, 0, 0, 53, 350 54, 59, 60, 61, 62, 64, 67, 166, 0, 65, 351 66, 68, 69, 70, 0, 0, 0, 71, 51, 52, 352 57, 58, 56, 55, 68, 69, 70, 63, 0, 0, 353 71, 51, 52, 57, 58, 56, 55, 0, 0, 0, 354 63, 0, 0, 0, 0, 53, 54, 59, 60, 61, 355 62, 64, 67, 161, 0, 65, 66, 0, 53, 54, 356 59, 60, 61, 62, 64, 67, 0, 0, 65, 66, 357 0, 0, 0, 68, 69, 70, 0, 0, 0, 71, 358 51, 52, 57, 58, 56, 55, 68, 69, 70, 63, 359 0, 0, 71, 51, 52, 57, 58, 56, 55, 0, 360 0, 0, 63, 0, 0, 0, 0, 53, 54, 59, 361 60, 61, 62, 64, 67, 0, 0, 65, 66, 0, 362 53, 54, 59, 60, 61, 62, 64, 67, 0, 0, 363 65, 66, 68, 69, 70, 0, 0, 0, 71, 0, 364 52, 57, 58, 56, 55, 68, 69, 70, 63, 0, 365 0, 71, 0, 0, 57, 58, 56, 55, 0, 0, 366 0, 63, 0, 0, 0, 0, 53, 54, 59, 60, 367 61, 62, 64, 67, 0, 0, 65, 66, 47, 53, 368 54, 59, 60, 61, 62, 64, 67, 50, 49, 65, 369 66, 0, 0, 30, 0, 46, 0, 0, 47, 0, 370 0, 0, 0, 0, 0, 0, 0, 50, 49, 0, 371 31, 26, 32, 30, 29, 46, 0, 0, 0, 0, 372 0, 0, 0, 0, 0, 0, 0, 35, 34, 33, 373 31, 26, 32, 0, 29, 0, 0, 0, 0, 28, 374 0, 0, 0, 27, 0, 172, 0, 35, 34, 33, 375 50, 49, 0, 0, 0, 0, 30, 92, 0, 28, 376 0, 0, 0, 27, 93, 0, 0, 0, 0, 0, 377 50, 49, 0, 31, 26, 32, 30, 29, 0, 0, 378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 379 35, 34, 33, 31, 26, 32, 0, 29, 0, 0, 380 0, 0, 28, 0, 0, 0, 27, 50, 49, 0, 381 35, 34, 33, 30, 0, 0, 0, 0, 0, 0, 382 0, 0, 28, 0, 0, 0, 27, 0, 0, 0, 383 211, 26, 32, 0, 29, 0, 0, 0, 0, 0, 384 0, 0, 0, 0, 0, 0, 0, 35, 34, 33, 385 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 386 0, 0, 0, 27, 387 } 388 389 var yyPact = [...]int{ 390 -1000, -1000, 1037, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 391 76, -1000, -1000, 117, 116, -1000, 1833, 1702, 73, -33, 392 420, 1896, -1000, 113, 1876, 118, -1000, 1896, 1896, 1896, 393 1896, -1000, -1000, 1896, 1381, 231, 978, 133, -1000, 84, 394 79, -1000, 151, -52, -1000, 1702, 112, 111, -1000, 137, 395 99, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 396 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 397 1896, 182, -34, -1000, 1833, 220, 1896, 1896, 1896, 1896, 398 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1689, 919, 399 105, 1640, 96, 1896, 103, 94, 1813, -1000, -1000, -1000, 400 -1000, 1320, -1000, -40, -1000, -41, -9, 1456, -1000, -1000, 401 92, 852, -1000, 63, 73, -1000, 20, 73, -1000, 1833, 402 -1000, 95, 1748, 1761, 343, 343, 343, 343, 343, 343, 403 75, 75, 130, 130, 130, 130, 130, 75, 75, 130, 404 130, 130, 118, 220, 1833, 70, -52, -1000, 118, 1702, 405 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 406 1702, -1000, 1896, 1896, 14, 1896, -1000, 147, 1257, 1064, 407 1896, -1000, -1000, 0, -1000, -71, 1833, -77, 1933, 1833, 408 1833, 793, 99, -1000, -1000, 37, -54, -1000, 4, -58, 409 -1000, 1896, 11, 118, -52, -1000, 734, 1702, 1240, 144, 410 1627, 321, 177, 1896, -1000, 1491, 1127, -26, -53, -1000, 411 -1000, -19, 1408, -1000, -1000, -1000, -1000, -1000, -61, -1000, 412 -1000, -63, -1000, 1702, -72, -1000, 1896, 1896, -1000, 167, 413 -1000, 1896, -1000, 1194, 1114, -1000, -1000, -1000, -30, -1000, 414 1833, 1833, 675, -1000, -1000, -1000, 1177, 1581, 616, -1000, 415 1037, 1564, 557, 1896, -1000, -1000, -1000, -1000, -1000, -1000, 416 1896, -1000, -1000, -1000, -1000, 1303, 498, 1518, 439, 321, 417 -1000, -1000, -1000, -1000, -1000, 380, -1000, 418 } 419 420 var yyPgo = [...]int{ 421 0, 208, 91, 13, 207, 4, 0, 6, 37, 205, 422 26, 203, 199, 198, 1, 194, 191, 5, 2, 423 } 424 425 var yyR1 = [...]int{ 426 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 427 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 428 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 429 12, 12, 13, 13, 14, 14, 14, 16, 16, 17, 430 17, 17, 17, 17, 17, 17, 17, 17, 17, 15, 431 15, 15, 15, 15, 15, 3, 3, 3, 7, 7, 432 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 433 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 434 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 435 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 436 10, 10, 10, 10, 10, 4, 4, 5, 5, 8, 437 8, 9, 9, 9, 9, 18, 18, 438 } 439 440 var yyR2 = [...]int{ 441 0, 1, 0, 2, 4, 2, 2, 2, 2, 2, 442 1, 2, 4, 3, 3, 3, 3, 3, 3, 3, 443 3, 3, 3, 3, 3, 3, 5, 4, 9, 11, 444 9, 7, 6, 7, 0, 2, 5, 5, 7, 2, 445 3, 4, 4, 5, 2, 3, 4, 4, 5, 1, 446 1, 2, 3, 1, 2, 1, 4, 3, 1, 2, 447 4, 5, 1, 1, 3, 3, 3, 3, 3, 3, 448 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 449 3, 3, 3, 3, 3, 4, 2, 2, 2, 2, 450 1, 8, 4, 1, 3, 2, 2, 4, 4, 6, 451 5, 5, 3, 5, 6, 1, 3, 1, 3, 1, 452 3, 3, 3, 5, 5, 0, 1, 453 } 454 455 var yyChk = [...]int{ 456 -1000, -1, -2, -16, 4, -15, -11, -12, -13, 78, 457 14, 9, 10, 22, 21, 17, 16, -6, 5, -4, 458 -3, 13, 18, 12, 15, -10, 38, 70, 66, 41, 459 20, 37, 39, 56, 55, 54, -2, 37, -17, 28, 460 56, 37, 37, -8, -7, -6, 22, 5, -3, 15, 461 14, 31, 32, 58, 59, 36, 35, 33, 34, 60, 462 61, 62, 63, 40, 64, 68, 69, 65, 24, 25, 463 26, 30, -5, 37, 57, 73, 42, 43, 44, 45, 464 46, 47, 48, 49, 50, 51, 52, 53, -6, -2, 465 37, -6, 21, 28, 29, 67, 28, -6, -6, -6, 466 -6, -6, 79, -8, 80, -9, 37, -6, 8, -17, 467 67, -2, 72, -5, 27, 72, -5, 27, 21, 73, 468 37, 37, -6, -6, -6, -6, -6, -6, -6, -6, 469 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, 470 -6, -6, -10, 20, 57, 73, -8, -3, -10, -6, 471 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, 472 -6, 4, 19, 57, 73, 23, 7, 37, -6, -6, 473 71, 37, 72, -8, 72, -18, 73, -18, 73, 57, 474 71, -2, 37, 8, 72, 27, -5, 72, 27, -5, 475 -7, 57, 29, -10, -8, 37, -2, -6, -6, 37, 476 -6, -2, 21, 73, 79, 71, -6, -18, 27, 79, 477 80, 37, -6, -7, -7, 8, -17, 72, -5, 72, 478 72, -5, 72, -6, 38, 8, 73, 23, 4, -14, 479 11, 6, 7, -6, -6, 79, 79, 72, -18, 73, 480 57, 71, -2, 72, 72, 79, -6, -6, -2, 8, 481 -2, -6, -2, 73, 79, 72, -7, -7, 8, 4, 482 73, 4, 8, 7, 8, -6, -2, -6, -2, -2, 483 72, 8, 4, 8, -14, -2, 8, 484 } 485 486 var yyDef = [...]int{ 487 2, -2, 1, 3, 2, 5, 6, 7, 8, 9, 488 0, 49, 50, 0, 0, 53, 0, 10, 0, 0, 489 -2, 0, 2, 0, 0, 62, 63, 0, 0, 0, 490 0, 55, 93, 0, 0, 0, 0, 0, 2, 0, 491 0, 51, 0, 54, 109, 58, 0, 0, 90, 0, 492 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 493 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 494 0, 0, 11, 107, 0, 0, 0, 0, 0, 0, 495 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 496 0, 0, 0, 0, 0, 0, 0, 86, 87, 88, 497 89, 0, 95, 115, 96, 115, 55, 0, 4, 2, 498 0, 0, 39, 0, 0, 44, 0, 0, 52, 0, 499 59, 0, 64, 65, 66, 67, 68, 69, 70, 71, 500 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 501 82, 83, 84, 0, 0, 0, 13, -2, 0, 14, 502 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 503 25, 2, 0, 0, 0, 0, 2, 0, 0, 0, 504 0, 57, 102, 115, 94, 0, 116, 0, 116, 0, 505 0, 0, 0, 92, 40, 0, 0, 45, 0, 0, 506 110, 0, 0, 85, 12, 108, 0, 27, 0, 0, 507 0, 34, 0, 0, 56, 0, 0, 0, 115, 97, 508 98, 55, 0, 111, 112, 37, 2, 41, 0, 42, 509 46, 0, 47, 60, 0, 26, 0, 0, 2, 0, 510 2, 0, 2, 0, 0, 101, 100, 103, 0, 116, 511 0, 0, 0, 43, 48, 61, 0, 0, 0, 32, 512 35, 0, 0, 0, 99, 104, 113, 114, 38, 2, 513 0, 2, 31, 2, 33, 0, 0, 0, 0, 34, 514 91, 28, 2, 30, 36, 0, 29, 515 } 516 517 var yyTok1 = [...]int{ 518 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 519 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 520 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 521 3, 3, 3, 3, 3, 66, 3, 64, 68, 3, 522 56, 72, 62, 60, 73, 61, 67, 63, 3, 3, 523 3, 3, 3, 3, 3, 3, 3, 3, 71, 78, 524 59, 57, 58, 3, 3, 3, 3, 3, 3, 3, 525 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 526 3, 3, 3, 3, 74, 3, 3, 3, 3, 3, 527 3, 55, 3, 79, 65, 3, 3, 3, 3, 3, 528 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 529 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 530 3, 3, 3, 54, 69, 80, 70, 531 } 532 533 var yyTok2 = [...]int{ 534 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 535 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 536 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 537 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 538 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 539 52, 53, 75, 76, 77, 540 } 541 542 var yyTok3 = [...]int{ 543 0, 544 } 545 546 var yyErrorMessages = [...]struct { 547 state int 548 token int 549 msg string 550 }{} 551 552 //line yaccpar:1 553 554 /* parser for yacc output */ 555 556 var ( 557 yyDebug = 0 558 yyErrorVerbose = false 559 ) 560 561 type yyLexer interface { 562 Lex(lval *yySymType) int 563 Error(s string) 564 } 565 566 type yyParser interface { 567 Parse(yyLexer) int 568 Lookahead() int 569 } 570 571 type yyParserImpl struct { 572 lval yySymType 573 stack [yyInitialStackSize]yySymType 574 char int 575 } 576 577 func (p *yyParserImpl) Lookahead() int { 578 return p.char 579 } 580 581 func yyNewParser() yyParser { 582 return &yyParserImpl{} 583 } 584 585 const yyFlag = -1000 586 587 func yyTokname(c int) string { 588 if c >= 1 && c-1 < len(yyToknames) { 589 if yyToknames[c-1] != "" { 590 return yyToknames[c-1] 591 } 592 } 593 return __yyfmt__.Sprintf("tok-%v", c) 594 } 595 596 func yyStatname(s int) string { 597 if s >= 0 && s < len(yyStatenames) { 598 if yyStatenames[s] != "" { 599 return yyStatenames[s] 600 } 601 } 602 return __yyfmt__.Sprintf("state-%v", s) 603 } 604 605 func yyErrorMessage(state, lookAhead int) string { 606 const TOKSTART = 4 607 608 if !yyErrorVerbose { 609 return "syntax error" 610 } 611 612 for _, e := range yyErrorMessages { 613 if e.state == state && e.token == lookAhead { 614 return "syntax error: " + e.msg 615 } 616 } 617 618 res := "syntax error: unexpected " + yyTokname(lookAhead) 619 620 // To match Bison, suggest at most four expected tokens. 621 expected := make([]int, 0, 4) 622 623 // Look for shiftable tokens. 624 base := yyPact[state] 625 for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { 626 if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { 627 if len(expected) == cap(expected) { 628 return res 629 } 630 expected = append(expected, tok) 631 } 632 } 633 634 if yyDef[state] == -2 { 635 i := 0 636 for yyExca[i] != -1 || yyExca[i+1] != state { 637 i += 2 638 } 639 640 // Look for tokens that we accept or reduce. 641 for i += 2; yyExca[i] >= 0; i += 2 { 642 tok := yyExca[i] 643 if tok < TOKSTART || yyExca[i+1] == 0 { 644 continue 645 } 646 if len(expected) == cap(expected) { 647 return res 648 } 649 expected = append(expected, tok) 650 } 651 652 // If the default action is to accept or reduce, give up. 653 if yyExca[i+1] != 0 { 654 return res 655 } 656 } 657 658 for i, tok := range expected { 659 if i == 0 { 660 res += ", expecting " 661 } else { 662 res += " or " 663 } 664 res += yyTokname(tok) 665 } 666 return res 667 } 668 669 func yylex1(lex yyLexer, lval *yySymType) (char, token int) { 670 token = 0 671 char = lex.Lex(lval) 672 if char <= 0 { 673 token = yyTok1[0] 674 goto out 675 } 676 if char < len(yyTok1) { 677 token = yyTok1[char] 678 goto out 679 } 680 if char >= yyPrivate { 681 if char < yyPrivate+len(yyTok2) { 682 token = yyTok2[char-yyPrivate] 683 goto out 684 } 685 } 686 for i := 0; i < len(yyTok3); i += 2 { 687 token = yyTok3[i+0] 688 if token == char { 689 token = yyTok3[i+1] 690 goto out 691 } 692 } 693 694 out: 695 if token == 0 { 696 token = yyTok2[1] /* unknown char */ 697 } 698 if yyDebug >= 3 { 699 __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) 700 } 701 return char, token 702 } 703 704 func yyParse(yylex yyLexer) int { 705 return yyNewParser().Parse(yylex) 706 } 707 708 func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { 709 var yyn int 710 var yyVAL yySymType 711 var yyDollar []yySymType 712 _ = yyDollar // silence set and not used 713 yyS := yyrcvr.stack[:] 714 715 Nerrs := 0 /* number of errors */ 716 Errflag := 0 /* error recovery flag */ 717 yystate := 0 718 yyrcvr.char = -1 719 yytoken := -1 // yyrcvr.char translated into internal numbering 720 defer func() { 721 // Make sure we report no lookahead when not parsing. 722 yystate = -1 723 yyrcvr.char = -1 724 yytoken = -1 725 }() 726 yyp := -1 727 goto yystack 728 729 ret0: 730 return 0 731 732 ret1: 733 return 1 734 735 yystack: 736 /* put a state and value onto the stack */ 737 if yyDebug >= 4 { 738 __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) 739 } 740 741 yyp++ 742 if yyp >= len(yyS) { 743 nyys := make([]yySymType, len(yyS)*2) 744 copy(nyys, yyS) 745 yyS = nyys 746 } 747 yyS[yyp] = yyVAL 748 yyS[yyp].yys = yystate 749 750 yynewstate: 751 yyn = yyPact[yystate] 752 if yyn <= yyFlag { 753 goto yydefault /* simple state */ 754 } 755 if yyrcvr.char < 0 { 756 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) 757 } 758 yyn += yytoken 759 if yyn < 0 || yyn >= yyLast { 760 goto yydefault 761 } 762 yyn = yyAct[yyn] 763 if yyChk[yyn] == yytoken { /* valid shift */ 764 yyrcvr.char = -1 765 yytoken = -1 766 yyVAL = yyrcvr.lval 767 yystate = yyn 768 if Errflag > 0 { 769 Errflag-- 770 } 771 goto yystack 772 } 773 774 yydefault: 775 /* default state action */ 776 yyn = yyDef[yystate] 777 if yyn == -2 { 778 if yyrcvr.char < 0 { 779 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) 780 } 781 782 /* look through exception table */ 783 xi := 0 784 for { 785 if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { 786 break 787 } 788 xi += 2 789 } 790 for xi += 2; ; xi += 2 { 791 yyn = yyExca[xi+0] 792 if yyn < 0 || yyn == yytoken { 793 break 794 } 795 } 796 yyn = yyExca[xi+1] 797 if yyn < 0 { 798 goto ret0 799 } 800 } 801 if yyn == 0 { 802 /* error ... attempt to resume parsing */ 803 switch Errflag { 804 case 0: /* brand new error */ 805 yylex.Error(yyErrorMessage(yystate, yytoken)) 806 Nerrs++ 807 if yyDebug >= 1 { 808 __yyfmt__.Printf("%s", yyStatname(yystate)) 809 __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) 810 } 811 fallthrough 812 813 case 1, 2: /* incompletely recovered error ... try again */ 814 Errflag = 3 815 816 /* find a state where "error" is a legal shift action */ 817 for yyp >= 0 { 818 yyn = yyPact[yyS[yyp].yys] + yyErrCode 819 if yyn >= 0 && yyn < yyLast { 820 yystate = yyAct[yyn] /* simulate a shift of "error" */ 821 if yyChk[yystate] == yyErrCode { 822 goto yystack 823 } 824 } 825 826 /* the current p has no shift on "error", pop stack */ 827 if yyDebug >= 2 { 828 __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) 829 } 830 yyp-- 831 } 832 /* there is no state on the stack with an error shift ... abort */ 833 goto ret1 834 835 case 3: /* no shift yet; clobber input char */ 836 if yyDebug >= 2 { 837 __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) 838 } 839 if yytoken == yyEofCode { 840 goto ret1 841 } 842 yyrcvr.char = -1 843 yytoken = -1 844 goto yynewstate /* try again in the same state */ 845 } 846 } 847 848 /* reduction by production yyn */ 849 if yyDebug >= 2 { 850 __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) 851 } 852 853 yynt := yyn 854 yypt := yyp 855 _ = yypt // guard against "declared and not used" 856 857 yyp -= yyR2[yyn] 858 // yyp is now the index of $0. Perform the default action. Iff the 859 // reduced production is ε, $1 is possibly out of range. 860 if yyp+1 >= len(yyS) { 861 nyys := make([]yySymType, len(yyS)*2) 862 copy(nyys, yyS) 863 yyS = nyys 864 } 865 yyVAL = yyS[yyp+1] 866 867 /* consult goto table to find next state */ 868 yyn = yyR1[yyn] 869 yyg := yyPgo[yyn] 870 yyj := yyg + yyS[yyp].yys + 1 871 872 if yyj >= yyLast { 873 yystate = yyAct[yyg] 874 } else { 875 yystate = yyAct[yyj] 876 if yyChk[yystate] != -yyn { 877 yystate = yyAct[yyg] 878 } 879 } 880 // dummy call; replaced with literal code 881 switch yynt { 882 883 case 1: 884 yyDollar = yyS[yypt-1 : yypt+1] 885 //line parser.go.y:55 886 { 887 ss(yylex).Stmts = yyDollar[1].expr 888 } 889 case 2: 890 yyDollar = yyS[yypt-0 : yypt+1] 891 //line parser.go.y:58 892 { 893 yyVAL.expr = &Prog{} 894 } 895 case 3: 896 yyDollar = yyS[yypt-2 : yypt+1] 897 //line parser.go.y:59 898 { 899 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[2].expr) 900 } 901 case 4: 902 yyDollar = yyS[yypt-4 : yypt+1] 903 //line parser.go.y:60 904 { 905 yyDollar[3].expr.(*Prog).DoBlock = true 906 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[3].expr) 907 } 908 case 5: 909 yyDollar = yyS[yypt-2 : yypt+1] 910 //line parser.go.y:61 911 { 912 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[2].expr) 913 } 914 case 6: 915 yyDollar = yyS[yypt-2 : yypt+1] 916 //line parser.go.y:62 917 { 918 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[2].expr) 919 } 920 case 7: 921 yyDollar = yyS[yypt-2 : yypt+1] 922 //line parser.go.y:63 923 { 924 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[2].expr) 925 } 926 case 8: 927 yyDollar = yyS[yypt-2 : yypt+1] 928 //line parser.go.y:64 929 { 930 yyVAL.expr = yyDollar[1].expr.(*Prog).Append(yyDollar[2].expr) 931 } 932 case 9: 933 yyDollar = yyS[yypt-2 : yypt+1] 934 //line parser.go.y:65 935 { 936 yyVAL.expr = yyDollar[1].expr 937 } 938 case 10: 939 yyDollar = yyS[yypt-1 : yypt+1] 940 //line parser.go.y:68 941 { 942 yyVAL.expr = yyDollar[1].expr 943 } 944 case 11: 945 yyDollar = yyS[yypt-2 : yypt+1] 946 //line parser.go.y:69 947 { 948 yyVAL.expr = ss(yylex).pDeclareAssign([]Node(yyDollar[2].expr.(IdentList)), nil, false, yyDollar[1].token) 949 } 950 case 12: 951 yyDollar = yyS[yypt-4 : yypt+1] 952 //line parser.go.y:70 953 { 954 yyVAL.expr = ss(yylex).pDeclareAssign([]Node(yyDollar[2].expr.(IdentList)), yyDollar[4].expr.(ExprList), false, yyDollar[1].token) 955 } 956 case 13: 957 yyDollar = yyS[yypt-3 : yypt+1] 958 //line parser.go.y:71 959 { 960 yyVAL.expr = ss(yylex).pDeclareAssign([]Node(yyDollar[1].expr.(DeclList)), yyDollar[3].expr.(ExprList), true, yyDollar[2].token) 961 } 962 case 14: 963 yyDollar = yyS[yypt-3 : yypt+1] 964 //line parser.go.y:72 965 { 966 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpAdd, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 967 } 968 case 15: 969 yyDollar = yyS[yypt-3 : yypt+1] 970 //line parser.go.y:73 971 { 972 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpSub, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 973 } 974 case 16: 975 yyDollar = yyS[yypt-3 : yypt+1] 976 //line parser.go.y:74 977 { 978 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpMul, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 979 } 980 case 17: 981 yyDollar = yyS[yypt-3 : yypt+1] 982 //line parser.go.y:75 983 { 984 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpDiv, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 985 } 986 case 18: 987 yyDollar = yyS[yypt-3 : yypt+1] 988 //line parser.go.y:76 989 { 990 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpIDiv, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 991 } 992 case 19: 993 yyDollar = yyS[yypt-3 : yypt+1] 994 //line parser.go.y:77 995 { 996 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBinary(typ.OpMod, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 997 } 998 case 20: 999 yyDollar = yyS[yypt-3 : yypt+1] 1000 //line parser.go.y:78 1001 { 1002 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitAnd, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1003 } 1004 case 21: 1005 yyDollar = yyS[yypt-3 : yypt+1] 1006 //line parser.go.y:79 1007 { 1008 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitOr, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1009 } 1010 case 22: 1011 yyDollar = yyS[yypt-3 : yypt+1] 1012 //line parser.go.y:80 1013 { 1014 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitXor, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1015 } 1016 case 23: 1017 yyDollar = yyS[yypt-3 : yypt+1] 1018 //line parser.go.y:81 1019 { 1020 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitLsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1021 } 1022 case 24: 1023 yyDollar = yyS[yypt-3 : yypt+1] 1024 //line parser.go.y:82 1025 { 1026 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitRsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1027 } 1028 case 25: 1029 yyDollar = yyS[yypt-3 : yypt+1] 1030 //line parser.go.y:83 1031 { 1032 yyVAL.expr = assignLoadStore(yyDollar[1].expr, ss(yylex).pBitwise(typ.OpExtBitURsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token), yyDollar[2].token) 1033 } 1034 case 26: 1035 yyDollar = yyS[yypt-5 : yypt+1] 1036 //line parser.go.y:86 1037 { 1038 yyVAL.expr = ss(yylex).pLoop(&If{yyDollar[2].expr, yyDollar[4].expr, emptyBreak}) 1039 } 1040 case 27: 1041 yyDollar = yyS[yypt-4 : yypt+1] 1042 //line parser.go.y:87 1043 { 1044 yyVAL.expr = ss(yylex).pLoop(yyDollar[2].expr, &If{yyDollar[4].expr, emptyBreak, emptyProg}) 1045 } 1046 case 28: 1047 yyDollar = yyS[yypt-9 : yypt+1] 1048 //line parser.go.y:88 1049 { 1050 yyVAL.expr = ss(yylex).pForRange(yyDollar[2].token, yyDollar[4].expr, yyDollar[6].expr, one, yyDollar[8].expr, yyDollar[1].token) 1051 } 1052 case 29: 1053 yyDollar = yyS[yypt-11 : yypt+1] 1054 //line parser.go.y:89 1055 { 1056 yyVAL.expr = ss(yylex).pForRange(yyDollar[2].token, yyDollar[4].expr, yyDollar[6].expr, yyDollar[8].expr, yyDollar[10].expr, yyDollar[1].token) 1057 } 1058 case 30: 1059 yyDollar = yyS[yypt-9 : yypt+1] 1060 //line parser.go.y:90 1061 { 1062 yyVAL.expr = ss(yylex).pForIn(yyDollar[2].token, yyDollar[4].token, yyDollar[6].expr, yyDollar[8].expr, yyDollar[1].token) 1063 } 1064 case 31: 1065 yyDollar = yyS[yypt-7 : yypt+1] 1066 //line parser.go.y:91 1067 { 1068 yyVAL.expr = ss(yylex).pForIn(yyDollar[2].token, yyDollar[1].token, yyDollar[4].expr, yyDollar[6].expr, yyDollar[1].token) 1069 } 1070 case 32: 1071 yyDollar = yyS[yypt-6 : yypt+1] 1072 //line parser.go.y:94 1073 { 1074 yyVAL.expr = &If{yyDollar[2].expr, yyDollar[4].expr, yyDollar[5].expr} 1075 } 1076 case 33: 1077 yyDollar = yyS[yypt-7 : yypt+1] 1078 //line parser.go.y:95 1079 { 1080 yyVAL.expr = &If{ss(yylex).Int(0), ss(yylex).pProg(false, &GotoLabel{yyDollar[3].token.Str, false, yyDollar[1].token.Line()}, yyDollar[6].expr), emptyProg} 1081 } 1082 case 34: 1083 yyDollar = yyS[yypt-0 : yypt+1] 1084 //line parser.go.y:100 1085 { 1086 yyVAL.expr = nil 1087 } 1088 case 35: 1089 yyDollar = yyS[yypt-2 : yypt+1] 1090 //line parser.go.y:101 1091 { 1092 yyVAL.expr = yyDollar[2].expr 1093 } 1094 case 36: 1095 yyDollar = yyS[yypt-5 : yypt+1] 1096 //line parser.go.y:102 1097 { 1098 yyVAL.expr = &If{yyDollar[2].expr, yyDollar[4].expr, yyDollar[5].expr} 1099 } 1100 case 37: 1101 yyDollar = yyS[yypt-5 : yypt+1] 1102 //line parser.go.y:105 1103 { 1104 yyVAL.expr = ss(yylex).pFunc(false, yyDollar[2].token, yyDollar[3].expr, yyDollar[4].expr, yyDollar[1].token) 1105 } 1106 case 38: 1107 yyDollar = yyS[yypt-7 : yypt+1] 1108 //line parser.go.y:108 1109 { 1110 m := ss(yylex).pFunc(true, __markupFuncName(yyDollar[2].token, yyDollar[4].token), yyDollar[5].expr, yyDollar[6].expr, yyDollar[1].token) 1111 yyVAL.expr = &Tenary{typ.OpStore, Sym(yyDollar[2].token), ss(yylex).Str(yyDollar[4].token.Str), m, yyDollar[1].token.Line()} 1112 } 1113 case 39: 1114 yyDollar = yyS[yypt-2 : yypt+1] 1115 //line parser.go.y:114 1116 { 1117 yyVAL.expr = (IdentList)(nil) 1118 } 1119 case 40: 1120 yyDollar = yyS[yypt-3 : yypt+1] 1121 //line parser.go.y:115 1122 { 1123 yyVAL.expr = yyDollar[2].expr 1124 } 1125 case 41: 1126 yyDollar = yyS[yypt-4 : yypt+1] 1127 //line parser.go.y:116 1128 { 1129 yyVAL.expr = IdentVarargList{yyDollar[2].expr.(IdentList)} 1130 } 1131 case 42: 1132 yyDollar = yyS[yypt-4 : yypt+1] 1133 //line parser.go.y:117 1134 { 1135 yyVAL.expr = IdentVarargExpandList{nil, yyDollar[3].expr.(IdentList)} 1136 } 1137 case 43: 1138 yyDollar = yyS[yypt-5 : yypt+1] 1139 //line parser.go.y:118 1140 { 1141 yyVAL.expr = IdentVarargExpandList{yyDollar[2].expr.(IdentList), yyDollar[4].expr.(IdentList)} 1142 } 1143 case 44: 1144 yyDollar = yyS[yypt-2 : yypt+1] 1145 //line parser.go.y:119 1146 { 1147 yyVAL.expr = (IdentList)(nil) 1148 } 1149 case 45: 1150 yyDollar = yyS[yypt-3 : yypt+1] 1151 //line parser.go.y:120 1152 { 1153 yyVAL.expr = yyDollar[2].expr 1154 } 1155 case 46: 1156 yyDollar = yyS[yypt-4 : yypt+1] 1157 //line parser.go.y:121 1158 { 1159 yyVAL.expr = IdentVarargList{yyDollar[2].expr.(IdentList)} 1160 } 1161 case 47: 1162 yyDollar = yyS[yypt-4 : yypt+1] 1163 //line parser.go.y:122 1164 { 1165 yyVAL.expr = IdentVarargExpandList{nil, yyDollar[3].expr.(IdentList)} 1166 } 1167 case 48: 1168 yyDollar = yyS[yypt-5 : yypt+1] 1169 //line parser.go.y:123 1170 { 1171 yyVAL.expr = IdentVarargExpandList{yyDollar[2].expr.(IdentList), yyDollar[4].expr.(IdentList)} 1172 } 1173 case 49: 1174 yyDollar = yyS[yypt-1 : yypt+1] 1175 //line parser.go.y:126 1176 { 1177 yyVAL.expr = &BreakContinue{true, yyDollar[1].token.Line()} 1178 } 1179 case 50: 1180 yyDollar = yyS[yypt-1 : yypt+1] 1181 //line parser.go.y:127 1182 { 1183 yyVAL.expr = &BreakContinue{false, yyDollar[1].token.Line()} 1184 } 1185 case 51: 1186 yyDollar = yyS[yypt-2 : yypt+1] 1187 //line parser.go.y:128 1188 { 1189 yyVAL.expr = &GotoLabel{yyDollar[2].token.Str, true, yyDollar[1].token.Line()} 1190 } 1191 case 52: 1192 yyDollar = yyS[yypt-3 : yypt+1] 1193 //line parser.go.y:129 1194 { 1195 yyVAL.expr = &GotoLabel{yyDollar[2].token.Str, false, yyDollar[1].token.Line()} 1196 } 1197 case 53: 1198 yyDollar = yyS[yypt-1 : yypt+1] 1199 //line parser.go.y:130 1200 { 1201 yyVAL.expr = &Unary{typ.OpRet, SNil, yyDollar[1].token.Line()} 1202 } 1203 case 54: 1204 yyDollar = yyS[yypt-2 : yypt+1] 1205 //line parser.go.y:131 1206 { 1207 if el := yyDollar[2].expr.(ExprList); len(el) == 1 { 1208 ss(yylex).pFindTailCall(el[0]) 1209 yyVAL.expr = &Unary{typ.OpRet, el[0], yyDollar[1].token.Line()} 1210 } else { 1211 yyVAL.expr = &Unary{typ.OpRet, yyDollar[2].expr, yyDollar[1].token.Line()} 1212 } 1213 } 1214 case 55: 1215 yyDollar = yyS[yypt-1 : yypt+1] 1216 //line parser.go.y:141 1217 { 1218 yyVAL.expr = Sym(yyDollar[1].token) 1219 } 1220 case 56: 1221 yyDollar = yyS[yypt-4 : yypt+1] 1222 //line parser.go.y:144 1223 { 1224 yyVAL.expr = &Tenary{typ.OpLoad, yyDollar[1].expr, yyDollar[3].expr, Address(typ.RegA), yyDollar[2].token.Line()} 1225 } 1226 case 57: 1227 yyDollar = yyS[yypt-3 : yypt+1] 1228 //line parser.go.y:147 1229 { 1230 yyVAL.expr = &Tenary{typ.OpLoad, yyDollar[1].expr, ss(yylex).Str(yyDollar[3].token.Str), Address(typ.RegA), yyDollar[2].token.Line()} 1231 } 1232 case 58: 1233 yyDollar = yyS[yypt-1 : yypt+1] 1234 //line parser.go.y:152 1235 { 1236 yyVAL.expr = yyDollar[1].expr 1237 } 1238 case 59: 1239 yyDollar = yyS[yypt-2 : yypt+1] 1240 //line parser.go.y:153 1241 { 1242 yyVAL.expr = ss(yylex).Str(yyDollar[2].token.Str) 1243 } 1244 case 60: 1245 yyDollar = yyS[yypt-4 : yypt+1] 1246 //line parser.go.y:154 1247 { 1248 yyVAL.expr = ss(yylex).pDeclareAssign([]Node{Sym(yyDollar[2].token)}, ExprList{yyDollar[4].expr}, false, yyDollar[1].token) 1249 } 1250 case 61: 1251 yyDollar = yyS[yypt-5 : yypt+1] 1252 //line parser.go.y:155 1253 { 1254 yyVAL.expr = &Declare{Sym(yyDollar[2].token), ss(yylex).pArrayN(yyDollar[4].token.Str), yyDollar[1].token.Line()} 1255 } 1256 case 62: 1257 yyDollar = yyS[yypt-1 : yypt+1] 1258 //line parser.go.y:158 1259 { 1260 yyVAL.expr = yyDollar[1].expr 1261 } 1262 case 63: 1263 yyDollar = yyS[yypt-1 : yypt+1] 1264 //line parser.go.y:159 1265 { 1266 yyVAL.expr = ss(yylex).Num(yyDollar[1].token.Str) 1267 } 1268 case 64: 1269 yyDollar = yyS[yypt-3 : yypt+1] 1270 //line parser.go.y:160 1271 { 1272 yyVAL.expr = &Or{yyDollar[1].expr, yyDollar[3].expr} 1273 } 1274 case 65: 1275 yyDollar = yyS[yypt-3 : yypt+1] 1276 //line parser.go.y:161 1277 { 1278 yyVAL.expr = &And{yyDollar[1].expr, yyDollar[3].expr} 1279 } 1280 case 66: 1281 yyDollar = yyS[yypt-3 : yypt+1] 1282 //line parser.go.y:162 1283 { 1284 yyVAL.expr = ss(yylex).pBinary(typ.OpLess, yyDollar[3].expr, yyDollar[1].expr, yyDollar[2].token) 1285 } 1286 case 67: 1287 yyDollar = yyS[yypt-3 : yypt+1] 1288 //line parser.go.y:163 1289 { 1290 yyVAL.expr = ss(yylex).pBinary(typ.OpLess, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1291 } 1292 case 68: 1293 yyDollar = yyS[yypt-3 : yypt+1] 1294 //line parser.go.y:164 1295 { 1296 yyVAL.expr = ss(yylex).pBinary(typ.OpLessEq, yyDollar[3].expr, yyDollar[1].expr, yyDollar[2].token) 1297 } 1298 case 69: 1299 yyDollar = yyS[yypt-3 : yypt+1] 1300 //line parser.go.y:165 1301 { 1302 yyVAL.expr = ss(yylex).pBinary(typ.OpLessEq, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1303 } 1304 case 70: 1305 yyDollar = yyS[yypt-3 : yypt+1] 1306 //line parser.go.y:166 1307 { 1308 yyVAL.expr = ss(yylex).pBinary(typ.OpEq, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1309 } 1310 case 71: 1311 yyDollar = yyS[yypt-3 : yypt+1] 1312 //line parser.go.y:167 1313 { 1314 yyVAL.expr = ss(yylex).pBinary(typ.OpNeq, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1315 } 1316 case 72: 1317 yyDollar = yyS[yypt-3 : yypt+1] 1318 //line parser.go.y:168 1319 { 1320 yyVAL.expr = ss(yylex).pBinary(typ.OpAdd, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1321 } 1322 case 73: 1323 yyDollar = yyS[yypt-3 : yypt+1] 1324 //line parser.go.y:169 1325 { 1326 yyVAL.expr = ss(yylex).pBinary(typ.OpSub, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1327 } 1328 case 74: 1329 yyDollar = yyS[yypt-3 : yypt+1] 1330 //line parser.go.y:170 1331 { 1332 yyVAL.expr = ss(yylex).pBinary(typ.OpMul, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1333 } 1334 case 75: 1335 yyDollar = yyS[yypt-3 : yypt+1] 1336 //line parser.go.y:171 1337 { 1338 yyVAL.expr = ss(yylex).pBinary(typ.OpDiv, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1339 } 1340 case 76: 1341 yyDollar = yyS[yypt-3 : yypt+1] 1342 //line parser.go.y:172 1343 { 1344 yyVAL.expr = ss(yylex).pBinary(typ.OpIDiv, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1345 } 1346 case 77: 1347 yyDollar = yyS[yypt-3 : yypt+1] 1348 //line parser.go.y:173 1349 { 1350 yyVAL.expr = ss(yylex).pBinary(typ.OpMod, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1351 } 1352 case 78: 1353 yyDollar = yyS[yypt-3 : yypt+1] 1354 //line parser.go.y:174 1355 { 1356 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitAnd, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1357 } 1358 case 79: 1359 yyDollar = yyS[yypt-3 : yypt+1] 1360 //line parser.go.y:175 1361 { 1362 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitOr, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1363 } 1364 case 80: 1365 yyDollar = yyS[yypt-3 : yypt+1] 1366 //line parser.go.y:176 1367 { 1368 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitXor, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1369 } 1370 case 81: 1371 yyDollar = yyS[yypt-3 : yypt+1] 1372 //line parser.go.y:177 1373 { 1374 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitLsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1375 } 1376 case 82: 1377 yyDollar = yyS[yypt-3 : yypt+1] 1378 //line parser.go.y:178 1379 { 1380 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitRsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1381 } 1382 case 83: 1383 yyDollar = yyS[yypt-3 : yypt+1] 1384 //line parser.go.y:179 1385 { 1386 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitURsh, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1387 } 1388 case 84: 1389 yyDollar = yyS[yypt-3 : yypt+1] 1390 //line parser.go.y:180 1391 { 1392 yyVAL.expr = ss(yylex).pBinary(typ.OpIsProto, yyDollar[1].expr, yyDollar[3].expr, yyDollar[2].token) 1393 } 1394 case 85: 1395 yyDollar = yyS[yypt-4 : yypt+1] 1396 //line parser.go.y:181 1397 { 1398 yyVAL.expr = pUnary(typ.OpNot, ss(yylex).pBinary(typ.OpIsProto, yyDollar[1].expr, yyDollar[4].expr, yyDollar[2].token), yyDollar[2].token) 1399 } 1400 case 86: 1401 yyDollar = yyS[yypt-2 : yypt+1] 1402 //line parser.go.y:182 1403 { 1404 yyVAL.expr = ss(yylex).pBitwise(typ.OpExtBitXor, ss(yylex).Int(-1), yyDollar[2].expr, yyDollar[1].token) 1405 } 1406 case 87: 1407 yyDollar = yyS[yypt-2 : yypt+1] 1408 //line parser.go.y:183 1409 { 1410 yyVAL.expr = pUnary(typ.OpLen, yyDollar[2].expr, yyDollar[1].token) 1411 } 1412 case 88: 1413 yyDollar = yyS[yypt-2 : yypt+1] 1414 //line parser.go.y:184 1415 { 1416 yyVAL.expr = ss(yylex).pBinary(typ.OpSub, zero, yyDollar[2].expr, yyDollar[1].token) 1417 } 1418 case 89: 1419 yyDollar = yyS[yypt-2 : yypt+1] 1420 //line parser.go.y:185 1421 { 1422 yyVAL.expr = pUnary(typ.OpNot, yyDollar[2].expr, yyDollar[1].token) 1423 } 1424 case 90: 1425 yyDollar = yyS[yypt-1 : yypt+1] 1426 //line parser.go.y:188 1427 { 1428 yyVAL.expr = yyDollar[1].expr 1429 } 1430 case 91: 1431 yyDollar = yyS[yypt-8 : yypt+1] 1432 //line parser.go.y:189 1433 { 1434 yyVAL.expr = &If{yyDollar[3].expr, &Assign{Sa, yyDollar[5].expr, yyDollar[1].token.Line()}, &Assign{Sa, yyDollar[7].expr, yyDollar[1].token.Line()}} 1435 } 1436 case 92: 1437 yyDollar = yyS[yypt-4 : yypt+1] 1438 //line parser.go.y:190 1439 { 1440 yyVAL.expr = ss(yylex).pFunc(false, __markupLambdaName(yyDollar[1].token), yyDollar[2].expr, yyDollar[3].expr, yyDollar[1].token) 1441 } 1442 case 93: 1443 yyDollar = yyS[yypt-1 : yypt+1] 1444 //line parser.go.y:191 1445 { 1446 yyVAL.expr = ss(yylex).Str(yyDollar[1].token.Str) 1447 } 1448 case 94: 1449 yyDollar = yyS[yypt-3 : yypt+1] 1450 //line parser.go.y:192 1451 { 1452 yyVAL.expr = yyDollar[2].expr 1453 } 1454 case 95: 1455 yyDollar = yyS[yypt-2 : yypt+1] 1456 //line parser.go.y:193 1457 { 1458 yyVAL.expr = ss(yylex).pEmptyArray() 1459 } 1460 case 96: 1461 yyDollar = yyS[yypt-2 : yypt+1] 1462 //line parser.go.y:194 1463 { 1464 yyVAL.expr = ss(yylex).pEmptyObject() 1465 } 1466 case 97: 1467 yyDollar = yyS[yypt-4 : yypt+1] 1468 //line parser.go.y:195 1469 { 1470 yyVAL.expr = yyDollar[2].expr 1471 } 1472 case 98: 1473 yyDollar = yyS[yypt-4 : yypt+1] 1474 //line parser.go.y:196 1475 { 1476 yyVAL.expr = yyDollar[2].expr 1477 } 1478 case 99: 1479 yyDollar = yyS[yypt-6 : yypt+1] 1480 //line parser.go.y:197 1481 { 1482 yyVAL.expr = &Tenary{typ.OpSlice, yyDollar[1].expr, yyDollar[3].expr, yyDollar[5].expr, yyDollar[2].token.Line()} 1483 } 1484 case 100: 1485 yyDollar = yyS[yypt-5 : yypt+1] 1486 //line parser.go.y:198 1487 { 1488 yyVAL.expr = &Tenary{typ.OpSlice, yyDollar[1].expr, zero, yyDollar[4].expr, yyDollar[2].token.Line()} 1489 } 1490 case 101: 1491 yyDollar = yyS[yypt-5 : yypt+1] 1492 //line parser.go.y:199 1493 { 1494 yyVAL.expr = &Tenary{typ.OpSlice, yyDollar[1].expr, yyDollar[3].expr, ss(yylex).Int(-1), yyDollar[2].token.Line()} 1495 } 1496 case 102: 1497 yyDollar = yyS[yypt-3 : yypt+1] 1498 //line parser.go.y:200 1499 { 1500 yyVAL.expr = &Call{typ.OpCall, yyDollar[1].expr, ExprList(nil), false, yyDollar[2].token.Line()} 1501 } 1502 case 103: 1503 yyDollar = yyS[yypt-5 : yypt+1] 1504 //line parser.go.y:201 1505 { 1506 yyVAL.expr = &Call{typ.OpCall, yyDollar[1].expr, yyDollar[3].expr.(ExprList), false, yyDollar[2].token.Line()} 1507 } 1508 case 104: 1509 yyDollar = yyS[yypt-6 : yypt+1] 1510 //line parser.go.y:202 1511 { 1512 yyVAL.expr = &Call{typ.OpCall, yyDollar[1].expr, yyDollar[3].expr.(ExprList), true, yyDollar[2].token.Line()} 1513 } 1514 case 105: 1515 yyDollar = yyS[yypt-1 : yypt+1] 1516 //line parser.go.y:205 1517 { 1518 yyVAL.expr = DeclList{yyDollar[1].expr} 1519 } 1520 case 106: 1521 yyDollar = yyS[yypt-3 : yypt+1] 1522 //line parser.go.y:206 1523 { 1524 yyVAL.expr = append(yyDollar[1].expr.(DeclList), yyDollar[3].expr) 1525 } 1526 case 107: 1527 yyDollar = yyS[yypt-1 : yypt+1] 1528 //line parser.go.y:209 1529 { 1530 yyVAL.expr = IdentList{Sym(yyDollar[1].token)} 1531 } 1532 case 108: 1533 yyDollar = yyS[yypt-3 : yypt+1] 1534 //line parser.go.y:210 1535 { 1536 yyVAL.expr = append(yyDollar[1].expr.(IdentList), Sym(yyDollar[3].token)) 1537 } 1538 case 109: 1539 yyDollar = yyS[yypt-1 : yypt+1] 1540 //line parser.go.y:213 1541 { 1542 yyVAL.expr = ss(yylex).pArray(nil, yyDollar[1].expr) 1543 } 1544 case 110: 1545 yyDollar = yyS[yypt-3 : yypt+1] 1546 //line parser.go.y:214 1547 { 1548 yyVAL.expr = ss(yylex).pArray(yyDollar[1].expr, yyDollar[3].expr) 1549 } 1550 case 111: 1551 yyDollar = yyS[yypt-3 : yypt+1] 1552 //line parser.go.y:217 1553 { 1554 yyVAL.expr = ss(yylex).pObject(nil, ss(yylex).Str(yyDollar[1].token.Str), yyDollar[3].expr) 1555 } 1556 case 112: 1557 yyDollar = yyS[yypt-3 : yypt+1] 1558 //line parser.go.y:218 1559 { 1560 yyVAL.expr = ss(yylex).pObject(nil, yyDollar[1].expr, yyDollar[3].expr) 1561 } 1562 case 113: 1563 yyDollar = yyS[yypt-5 : yypt+1] 1564 //line parser.go.y:219 1565 { 1566 yyVAL.expr = ss(yylex).pObject(yyDollar[1].expr, ss(yylex).Str(yyDollar[3].token.Str), yyDollar[5].expr) 1567 } 1568 case 114: 1569 yyDollar = yyS[yypt-5 : yypt+1] 1570 //line parser.go.y:220 1571 { 1572 yyVAL.expr = ss(yylex).pObject(yyDollar[1].expr, yyDollar[3].expr, yyDollar[5].expr) 1573 } 1574 case 115: 1575 yyDollar = yyS[yypt-0 : yypt+1] 1576 //line parser.go.y:222 1577 { 1578 } 1579 case 116: 1580 yyDollar = yyS[yypt-1 : yypt+1] 1581 //line parser.go.y:222 1582 { 1583 } 1584 } 1585 goto yystack /* stack new state and value */ 1586 }