| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| //line grammar.y:18 |
| |
| // This grammar.y.go file was auto-generated by yacc from grammar.y. |
| |
| package parse |
| |
| import __yyfmt__ "fmt" |
| |
| //line grammar.y:20 |
| import ( |
| "math/big" |
| "strings" |
| ) |
| |
| type intPos struct { |
| int *big.Int |
| pos Pos |
| } |
| |
| type ratPos struct { |
| rat *big.Rat |
| pos Pos |
| } |
| |
| // typeListToStrList converts a slice of Type to a slice of StringPos. Each |
| // type must be a TypeNamed with an empty PackageName, otherwise errors are |
| // reported, and ok=false is returned. |
| func typeListToStrList(yylex yyLexer, typeList []Type) (strList []StringPos, ok bool) { |
| ok = true |
| for _, t := range typeList { |
| var tn *TypeNamed |
| if tn, ok = t.(*TypeNamed); !ok { |
| lexPosErrorf(yylex, t.Pos(), "%s invalid (expected one or more variable names)", t.String()) |
| return |
| } |
| if strings.ContainsRune(tn.Name, '.') { |
| ok = false |
| lexPosErrorf(yylex, t.Pos(), "%s invalid (expected one or more variable names).", tn.Name) |
| return |
| } |
| strList = append(strList, StringPos{tn.Name, tn.P}) |
| } |
| return |
| } |
| |
| //line grammar.y:62 |
| type yySymType struct { |
| yys int |
| pos Pos |
| strpos StringPos |
| intpos intPos |
| ratpos ratPos |
| namepos NamePos |
| nameposes []NamePos |
| typeexpr Type |
| typeexprs []Type |
| fields []*Field |
| iface *Interface |
| constexpr ConstExpr |
| constexprs []ConstExpr |
| complit *ConstCompositeLit |
| kvlit KVLit |
| kvlits []KVLit |
| errordef ErrorDef |
| } |
| |
| const startFileImports = 57346 |
| const startFile = 57347 |
| const startConfigImports = 57348 |
| const startConfig = 57349 |
| const startExprs = 57350 |
| const tOROR = 57351 |
| const tANDAND = 57352 |
| const tLE = 57353 |
| const tGE = 57354 |
| const tNE = 57355 |
| const tEQEQ = 57356 |
| const tLSH = 57357 |
| const tRSH = 57358 |
| const tCONST = 57359 |
| const tENUM = 57360 |
| const tERROR = 57361 |
| const tIMPORT = 57362 |
| const tINTERFACE = 57363 |
| const tMAP = 57364 |
| const tPACKAGE = 57365 |
| const tSET = 57366 |
| const tSTREAM = 57367 |
| const tSTRUCT = 57368 |
| const tTYPE = 57369 |
| const tTYPEOBJECT = 57370 |
| const tUNION = 57371 |
| const tIDENT = 57372 |
| const tSTRLIT = 57373 |
| const tINTLIT = 57374 |
| const tRATLIT = 57375 |
| const notPackage = 57376 |
| const notConfig = 57377 |
| |
| var yyToknames = [...]string{ |
| "$end", |
| "error", |
| "$unk", |
| "startFileImports", |
| "startFile", |
| "startConfigImports", |
| "startConfig", |
| "startExprs", |
| "';'", |
| "':'", |
| "','", |
| "'.'", |
| "'('", |
| "')'", |
| "'['", |
| "']'", |
| "'{'", |
| "'}'", |
| "'<'", |
| "'>'", |
| "'='", |
| "'!'", |
| "'+'", |
| "'-'", |
| "'*'", |
| "'/'", |
| "'%'", |
| "'|'", |
| "'&'", |
| "'^'", |
| "'?'", |
| "tOROR", |
| "tANDAND", |
| "tLE", |
| "tGE", |
| "tNE", |
| "tEQEQ", |
| "tLSH", |
| "tRSH", |
| "tCONST", |
| "tENUM", |
| "tERROR", |
| "tIMPORT", |
| "tINTERFACE", |
| "tMAP", |
| "tPACKAGE", |
| "tSET", |
| "tSTREAM", |
| "tSTRUCT", |
| "tTYPE", |
| "tTYPEOBJECT", |
| "tUNION", |
| "tIDENT", |
| "tSTRLIT", |
| "tINTLIT", |
| "tRATLIT", |
| "notPackage", |
| "notConfig", |
| } |
| var yyStatenames = [...]string{} |
| |
| const yyEofCode = 1 |
| const yyErrCode = 2 |
| const yyInitialStackSize = 16 |
| |
| //line yacctab:1 |
| var yyExca = [...]int{ |
| -1, 1, |
| 1, -1, |
| -2, 0, |
| -1, 26, |
| 13, 40, |
| 17, 40, |
| -2, 117, |
| -1, 175, |
| 18, 148, |
| -2, 143, |
| -1, 290, |
| 18, 148, |
| -2, 143, |
| } |
| |
| const yyNprod = 149 |
| const yyPrivate = 57344 |
| |
| var yyTokenNames []string |
| var yyStates []string |
| |
| const yyLast = 813 |
| |
| var yyAct = [...]int{ |
| |
| 14, 26, 13, 139, 174, 241, 250, 165, 219, 185, |
| 136, 146, 234, 132, 192, 37, 272, 138, 180, 189, |
| 251, 252, 193, 150, 242, 89, 152, 151, 190, 77, |
| 209, 21, 216, 133, 248, 143, 126, 79, 88, 39, |
| 42, 11, 191, 239, 269, 8, 101, 99, 188, 103, |
| 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
| 114, 115, 116, 117, 118, 119, 120, 121, 86, 251, |
| 252, 193, 122, 40, 88, 125, 78, 127, 242, 89, |
| 177, 88, 193, 88, 88, 88, 88, 255, 190, 124, |
| 97, 30, 147, 149, 102, 141, 212, 206, 184, 95, |
| 92, 96, 97, 275, 86, 296, 295, 36, 215, 94, |
| 85, 86, 292, 86, 86, 86, 86, 31, 29, 152, |
| 151, 33, 291, 32, 45, 34, 297, 87, 35, 39, |
| 89, 88, 274, 152, 151, 190, 209, 157, 187, 158, |
| 276, 88, 294, 278, 169, 100, 123, 156, 15, 173, |
| 59, 60, 61, 130, 63, 134, 135, 140, 140, 270, |
| 266, 86, 201, 65, 66, 200, 67, 68, 69, 70, |
| 88, 86, 88, 179, 88, 288, 147, 203, 197, 194, |
| 195, 299, 232, 225, 287, 91, 204, 202, 198, 88, |
| 84, 83, 80, 168, 208, 167, 129, 82, 75, 81, |
| 86, 76, 86, 164, 86, 74, 218, 41, 214, 298, |
| 265, 88, 263, 171, 246, 223, 228, 43, 44, 86, |
| 46, 226, 88, 244, 235, 229, 237, 243, 221, 222, |
| 161, 220, 72, 71, 238, 90, 73, 88, 236, 253, |
| 256, 86, 196, 290, 140, 247, 199, 245, 257, 254, |
| 261, 259, 86, 47, 260, 48, 88, 88, 175, 262, |
| 243, 210, 258, 230, 267, 227, 224, 86, 271, 205, |
| 183, 182, 264, 181, 170, 166, 148, 88, 88, 280, |
| 98, 284, 88, 210, 285, 286, 86, 86, 279, 289, |
| 88, 103, 217, 236, 140, 57, 58, 59, 60, 61, |
| 62, 63, 64, 213, 186, 207, 155, 86, 86, 171, |
| 65, 66, 86, 2, 3, 4, 5, 6, 10, 7, |
| 86, 154, 153, 9, 12, 178, 93, 1, 140, 199, |
| 249, 231, 145, 27, 277, 28, 16, 30, 240, 273, |
| 283, 268, 38, 131, 17, 18, 19, 0, 0, 140, |
| 282, 0, 20, 36, 171, 0, 0, 0, 0, 0, |
| 0, 0, 293, 31, 29, 0, 0, 33, 0, 32, |
| 0, 34, 0, 22, 35, 39, 23, 24, 25, 28, |
| 0, 30, 0, 0, 144, 0, 0, 0, 17, 18, |
| 19, 0, 0, 0, 0, 0, 20, 36, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 31, 29, 0, |
| 0, 33, 0, 32, 28, 34, 30, 22, 35, 39, |
| 23, 24, 25, 17, 18, 19, 0, 0, 0, 0, |
| 0, 20, 36, 30, 0, 0, 0, 0, 281, 0, |
| 0, 0, 31, 29, 0, 0, 33, 0, 32, 36, |
| 34, 0, 22, 35, 39, 23, 24, 25, 0, 31, |
| 29, 233, 30, 33, 0, 32, 0, 34, 0, 87, |
| 35, 39, 89, 0, 0, 0, 0, 30, 36, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, |
| 0, 0, 33, 36, 32, 0, 34, 0, 87, 35, |
| 39, 89, 0, 31, 29, 0, 211, 33, 172, 32, |
| 0, 34, 30, 87, 35, 39, 89, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, 0, 30, 36, 0, |
| 142, 0, 0, 0, 0, 0, 0, 0, 31, 29, |
| 0, 0, 33, 36, 32, 0, 34, 0, 87, 35, |
| 39, 89, 30, 31, 29, 137, 0, 33, 0, 32, |
| 0, 34, 0, 87, 35, 39, 89, 30, 36, 0, |
| 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, |
| 0, 0, 33, 36, 32, 0, 34, 0, 87, 35, |
| 39, 89, 0, 31, 29, 0, 0, 33, 176, 32, |
| 0, 34, 0, 87, 35, 39, 89, 51, 52, 0, |
| 0, 57, 58, 59, 60, 61, 62, 63, 64, 0, |
| 49, 50, 53, 54, 55, 56, 65, 66, 163, 0, |
| 0, 51, 52, 0, 0, 57, 58, 59, 60, 61, |
| 62, 63, 64, 0, 49, 50, 53, 54, 55, 56, |
| 65, 66, 162, 0, 0, 51, 52, 0, 0, 57, |
| 58, 59, 60, 61, 62, 63, 64, 0, 49, 50, |
| 53, 54, 55, 56, 65, 66, 160, 0, 0, 0, |
| 0, 51, 52, 0, 0, 57, 58, 59, 60, 61, |
| 62, 63, 64, 159, 49, 50, 53, 54, 55, 56, |
| 65, 66, 0, 51, 52, 0, 0, 57, 58, 59, |
| 60, 61, 62, 63, 64, 0, 49, 50, 53, 54, |
| 55, 56, 65, 66, 128, 0, 0, 0, 0, 51, |
| 52, 0, 0, 57, 58, 59, 60, 61, 62, 63, |
| 64, 0, 49, 50, 53, 54, 55, 56, 65, 66, |
| 51, 52, 0, 0, 57, 58, 59, 60, 61, 62, |
| 63, 64, 0, 49, 50, 53, 54, 55, 56, 65, |
| 66, 51, 52, 0, 0, 57, 58, 59, 60, 61, |
| 62, 63, 64, 0, 0, 50, 53, 54, 55, 56, |
| 65, 66, 51, 52, 0, 0, 57, 58, 59, 60, |
| 61, 62, 63, 64, 0, 0, 0, 53, 54, 55, |
| 56, 65, 66, |
| } |
| var yyPact = [...]int{ |
| |
| 309, -1000, -1, -1, -12, -12, 401, -1000, -13, -1000, |
| -1000, 103, -1000, 244, 731, -1000, -1000, 401, 401, 401, |
| 401, 220, 219, 224, -1000, -1000, 190, 186, 401, -1000, |
| 21, 175, 184, 182, 174, 173, 552, 223, 168, -1000, |
| -1000, 59, 271, 47, 59, 401, 47, -1000, 401, 401, |
| 401, 401, 401, 401, 401, 401, 401, 401, 401, 401, |
| 401, 401, 401, 401, 401, 401, 401, -1000, -1000, -1000, |
| -1000, 401, 552, -14, 401, -17, 401, 710, 180, 552, |
| -20, 552, 552, 537, 512, -1000, -1000, -1000, -1000, 224, |
| -18, 366, -1000, 267, -1000, -1000, -1000, 80, -1000, 97, |
| -1000, 684, 97, 731, 752, 773, 272, 272, 272, 272, |
| 272, 272, 125, 125, -1000, -1000, -1000, 125, -1000, 125, |
| -1000, -1000, 662, 216, 223, 636, -1000, 612, -1000, 552, |
| -1000, 266, -1000, -1000, 179, 177, 265, -1000, -1000, 497, |
| -1000, 265, -1000, -1000, -1000, 247, -1000, 588, -1000, 66, |
| -1000, -1000, -36, 264, 262, 261, 85, 35, 29, -1000, |
| -1000, -1000, -1000, -1000, -1000, 161, -20, -1000, 552, 160, |
| 552, -1000, 552, 147, 144, 401, 401, -1000, 260, -1000, |
| -1000, -1000, -1000, -1000, 83, -1000, -1000, 462, 82, -1000, |
| 87, 18, -1000, 218, -1000, -1000, -1000, -1000, -1000, -1000, |
| -1000, -1000, -1000, 731, 214, -27, -1000, 257, -1000, 552, |
| -1000, 166, -1000, 256, -1000, 401, -1000, 254, -1000, 165, |
| 447, -1000, -1000, 212, -23, 25, 209, -25, 731, 200, |
| -31, -1000, 16, -1000, 238, 76, -1000, -1000, -1000, -1000, |
| 253, -1000, 218, -1000, -1000, -1000, -1000, -1000, -1000, 239, |
| -1000, -1000, 249, 198, 552, 552, 196, 142, -29, -4, |
| 141, -33, -38, -1000, -1000, -1000, -1000, -1000, 90, 121, |
| -1000, -1000, -1000, 126, -1000, 552, 418, -1000, 322, 238, |
| 76, -1000, 164, -1000, 232, 94, 84, -1000, 552, 124, |
| 401, 64, 63, 106, -1000, 195, 167, -1000, -1000, -1000, |
| } |
| var yyPgo = [...]int{ |
| |
| 0, 1, 15, 13, 343, 73, 31, 342, 3, 341, |
| 10, 17, 12, 8, 339, 338, 5, 0, 148, 336, |
| 334, 2, 333, 11, 332, 331, 330, 6, 327, 319, |
| 207, 100, 47, 318, 326, 325, 7, 23, 322, 321, |
| 306, 305, 9, 304, 303, 19, 292, 14, 4, |
| } |
| var yyR1 = [...]int{ |
| |
| 0, 28, 28, 28, 28, 28, 31, 31, 31, 31, |
| 29, 29, 33, 33, 30, 30, 34, 34, 34, 35, |
| 35, 37, 37, 32, 32, 32, 32, 38, 38, 38, |
| 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, |
| 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, |
| 6, 6, 5, 5, 4, 4, 3, 10, 10, 11, |
| 8, 8, 43, 43, 15, 15, 16, 16, 13, 13, |
| 13, 12, 12, 14, 14, 14, 9, 9, 9, 9, |
| 20, 20, 20, 21, 21, 44, 44, 45, 17, 17, |
| 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, |
| 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, |
| 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, |
| 19, 19, 19, 22, 22, 24, 24, 23, 23, 46, |
| 46, 47, 25, 25, 25, 26, 26, 27, 27, 1, |
| 1, 2, 2, 7, 7, 36, 36, 48, 48, |
| } |
| var yyR2 = [...]int{ |
| |
| 0, 4, 4, 4, 4, 3, 0, 1, 1, 1, |
| 0, 3, 0, 4, 0, 3, 3, 5, 2, 1, |
| 3, 1, 2, 0, 3, 3, 3, 3, 5, 2, |
| 2, 3, 5, 2, 3, 5, 2, 1, 3, 2, |
| 1, 1, 4, 3, 5, 4, 5, 5, 3, 5, |
| 3, 2, 1, 1, 1, 3, 1, 1, 3, 2, |
| 1, 3, 4, 6, 1, 3, 5, 1, 2, 4, |
| 4, 1, 3, 1, 6, 6, 0, 3, 4, 6, |
| 0, 2, 4, 1, 3, 1, 3, 3, 1, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, |
| 2, 2, 4, 4, 1, 1, 1, 1, 1, 3, |
| 4, 4, 3, 3, 5, 1, 3, 1, 3, 1, |
| 3, 3, 0, 2, 4, 1, 3, 1, 3, 1, |
| 3, 1, 3, 0, 1, 0, 1, 0, 1, |
| } |
| var yyChk = [...]int{ |
| |
| -1000, -28, 4, 5, 6, 7, 8, -29, 46, -29, |
| -33, 53, -33, -21, -17, -18, -19, 22, 23, 24, |
| 30, -6, 51, 54, 55, 56, -1, -22, 13, 42, |
| 15, 41, 47, 45, 49, 52, 31, -2, -7, 53, |
| -5, -30, 53, -30, -30, 21, -30, 9, 11, 32, |
| 33, 19, 20, 34, 35, 36, 37, 23, 24, 25, |
| 26, 27, 28, 29, 30, 38, 39, -18, -18, -18, |
| -18, 13, 13, 12, 15, 12, 15, -17, 55, 16, |
| 17, 15, 15, 17, 17, -5, -6, 51, -1, 54, |
| 12, 17, -31, -34, 50, 40, 42, 43, 9, -32, |
| -31, -17, -32, -17, -17, -17, -17, -17, -17, -17, |
| -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, |
| -17, -17, -17, -5, -2, -17, 53, -17, 14, 16, |
| -5, -4, -3, 53, -5, -5, -10, 18, -11, -8, |
| -5, -10, 18, 53, 18, -24, -23, -17, 9, 13, |
| -37, 54, 53, -38, -39, -40, 50, 40, 42, 9, |
| 14, 14, 16, 16, -5, -36, 9, 16, 16, -36, |
| 9, -5, 11, -36, -48, 11, 10, 14, -35, -37, |
| 54, 9, 9, 9, 13, -42, -43, 53, 13, -45, |
| 53, 13, -47, 53, 18, -3, -5, 18, -11, -5, |
| 18, 18, -23, -17, -36, 9, 14, -41, -42, 53, |
| -5, 44, 14, -44, -45, 21, 14, -46, -47, -13, |
| 13, 14, -37, -36, 9, 17, -36, 9, -17, -36, |
| 9, -25, 17, 14, -12, -8, -11, 14, -42, 18, |
| -15, -16, 53, -1, 14, -45, 14, -47, 18, -26, |
| -27, 53, 54, -48, 11, 11, -48, -36, 9, -13, |
| -48, 11, 10, 14, -11, 14, 18, -16, -9, 48, |
| 18, -27, 54, -14, 42, 13, 19, -20, 17, -12, |
| -8, 20, -5, 18, -21, -48, -48, 20, 11, -48, |
| 11, 28, 28, -5, 18, 42, 42, 20, 14, 14, |
| } |
| var yyDef = [...]int{ |
| |
| 0, -2, 10, 10, 12, 12, 143, 14, 0, 14, |
| 14, 0, 14, 0, 83, 88, 107, 143, 143, 143, |
| 143, 52, 53, 114, 115, 116, -2, 118, 143, 41, |
| 0, 0, 0, 0, 0, 0, 0, 139, 0, 141, |
| 144, 6, 0, 23, 6, 143, 23, 5, 143, 143, |
| 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 143, 143, 143, 143, 143, 143, 143, 108, 109, 110, |
| 111, 143, 0, 0, 143, 0, 143, 0, 0, 0, |
| 0, 0, 0, 0, 0, 51, 52, 53, 40, 0, |
| 0, 143, 1, 0, 7, 8, 9, 0, 11, 2, |
| 3, 0, 4, 84, 89, 90, 91, 92, 93, 94, |
| 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 105, 106, 0, 0, 140, 0, 119, 0, 122, 0, |
| 43, 145, 54, 56, 0, 0, 145, 48, 57, 0, |
| 60, 145, 50, 142, 123, 147, 125, 127, 15, 0, |
| 18, 21, 0, 0, 0, 0, 0, 0, 0, 13, |
| 112, 113, 121, 120, 42, 0, 146, 45, 0, 0, |
| 146, 59, 0, 0, 0, -2, 143, 16, 145, 19, |
| 22, 24, 25, 26, 0, 29, 30, 0, 0, 33, |
| 0, 0, 36, 0, 44, 55, 46, 47, 58, 61, |
| 49, 124, 126, 128, 0, 146, 27, 145, 37, 0, |
| 39, 0, 31, 145, 85, 143, 34, 145, 129, 132, |
| 0, 17, 20, 0, 146, 0, 0, 146, 87, 0, |
| 146, 131, 0, 68, 147, 147, 71, 28, 38, 62, |
| 145, 64, 141, 67, 32, 86, 35, 130, 133, 147, |
| 135, 137, 0, 0, 148, 148, 0, 0, 146, 76, |
| 0, 148, 0, 69, 72, 70, 63, 65, 0, 0, |
| 134, 136, 138, 80, 73, 0, 0, 66, 143, 147, |
| 147, 77, 0, 81, 147, 0, 0, 78, 0, 0, |
| -2, 0, 0, 0, 82, 0, 0, 79, 74, 75, |
| } |
| var yyTok1 = [...]int{ |
| |
| 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 22, 3, 3, 3, 27, 29, 3, |
| 13, 14, 25, 23, 11, 24, 12, 26, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 10, 9, |
| 19, 21, 20, 31, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 15, 3, 16, 30, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 3, 3, 3, 17, 28, 18, |
| } |
| var yyTok2 = [...]int{ |
| |
| 2, 3, 4, 5, 6, 7, 8, 32, 33, 34, |
| 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 55, 56, 57, 58, |
| } |
| var yyTok3 = [...]int{ |
| 0, |
| } |
| |
| var yyErrorMessages = [...]struct { |
| state int |
| token int |
| msg string |
| }{} |
| |
| //line yaccpar:1 |
| |
| /* parser for yacc output */ |
| |
| var ( |
| yyDebug = 0 |
| yyErrorVerbose = false |
| ) |
| |
| type yyLexer interface { |
| Lex(lval *yySymType) int |
| Error(s string) |
| } |
| |
| type yyParser interface { |
| Parse(yyLexer) int |
| Lookahead() int |
| } |
| |
| type yyParserImpl struct { |
| lval yySymType |
| stack [yyInitialStackSize]yySymType |
| char int |
| } |
| |
| func (p *yyParserImpl) Lookahead() int { |
| return p.char |
| } |
| |
| func yyNewParser() yyParser { |
| return &yyParserImpl{} |
| } |
| |
| const yyFlag = -1000 |
| |
| func yyTokname(c int) string { |
| if c >= 1 && c-1 < len(yyToknames) { |
| if yyToknames[c-1] != "" { |
| return yyToknames[c-1] |
| } |
| } |
| return __yyfmt__.Sprintf("tok-%v", c) |
| } |
| |
| func yyStatname(s int) string { |
| if s >= 0 && s < len(yyStatenames) { |
| if yyStatenames[s] != "" { |
| return yyStatenames[s] |
| } |
| } |
| return __yyfmt__.Sprintf("state-%v", s) |
| } |
| |
| func yyErrorMessage(state, lookAhead int) string { |
| const TOKSTART = 4 |
| |
| if !yyErrorVerbose { |
| return "syntax error" |
| } |
| |
| for _, e := range yyErrorMessages { |
| if e.state == state && e.token == lookAhead { |
| return "syntax error: " + e.msg |
| } |
| } |
| |
| res := "syntax error: unexpected " + yyTokname(lookAhead) |
| |
| // To match Bison, suggest at most four expected tokens. |
| expected := make([]int, 0, 4) |
| |
| // Look for shiftable tokens. |
| base := yyPact[state] |
| for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { |
| if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { |
| if len(expected) == cap(expected) { |
| return res |
| } |
| expected = append(expected, tok) |
| } |
| } |
| |
| if yyDef[state] == -2 { |
| i := 0 |
| for yyExca[i] != -1 || yyExca[i+1] != state { |
| i += 2 |
| } |
| |
| // Look for tokens that we accept or reduce. |
| for i += 2; yyExca[i] >= 0; i += 2 { |
| tok := yyExca[i] |
| if tok < TOKSTART || yyExca[i+1] == 0 { |
| continue |
| } |
| if len(expected) == cap(expected) { |
| return res |
| } |
| expected = append(expected, tok) |
| } |
| |
| // If the default action is to accept or reduce, give up. |
| if yyExca[i+1] != 0 { |
| return res |
| } |
| } |
| |
| for i, tok := range expected { |
| if i == 0 { |
| res += ", expecting " |
| } else { |
| res += " or " |
| } |
| res += yyTokname(tok) |
| } |
| return res |
| } |
| |
| func yylex1(lex yyLexer, lval *yySymType) (char, token int) { |
| token = 0 |
| char = lex.Lex(lval) |
| if char <= 0 { |
| token = yyTok1[0] |
| goto out |
| } |
| if char < len(yyTok1) { |
| token = yyTok1[char] |
| goto out |
| } |
| if char >= yyPrivate { |
| if char < yyPrivate+len(yyTok2) { |
| token = yyTok2[char-yyPrivate] |
| goto out |
| } |
| } |
| for i := 0; i < len(yyTok3); i += 2 { |
| token = yyTok3[i+0] |
| if token == char { |
| token = yyTok3[i+1] |
| goto out |
| } |
| } |
| |
| out: |
| if token == 0 { |
| token = yyTok2[1] /* unknown char */ |
| } |
| if yyDebug >= 3 { |
| __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) |
| } |
| return char, token |
| } |
| |
| func yyParse(yylex yyLexer) int { |
| return yyNewParser().Parse(yylex) |
| } |
| |
| func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { |
| var yyn int |
| var yyVAL yySymType |
| var yyDollar []yySymType |
| _ = yyDollar // silence set and not used |
| yyS := yyrcvr.stack[:] |
| |
| Nerrs := 0 /* number of errors */ |
| Errflag := 0 /* error recovery flag */ |
| yystate := 0 |
| yyrcvr.char = -1 |
| yytoken := -1 // yyrcvr.char translated into internal numbering |
| defer func() { |
| // Make sure we report no lookahead when not parsing. |
| yystate = -1 |
| yyrcvr.char = -1 |
| yytoken = -1 |
| }() |
| yyp := -1 |
| goto yystack |
| |
| ret0: |
| return 0 |
| |
| ret1: |
| return 1 |
| |
| yystack: |
| /* put a state and value onto the stack */ |
| if yyDebug >= 4 { |
| __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) |
| } |
| |
| yyp++ |
| if yyp >= len(yyS) { |
| nyys := make([]yySymType, len(yyS)*2) |
| copy(nyys, yyS) |
| yyS = nyys |
| } |
| yyS[yyp] = yyVAL |
| yyS[yyp].yys = yystate |
| |
| yynewstate: |
| yyn = yyPact[yystate] |
| if yyn <= yyFlag { |
| goto yydefault /* simple state */ |
| } |
| if yyrcvr.char < 0 { |
| yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) |
| } |
| yyn += yytoken |
| if yyn < 0 || yyn >= yyLast { |
| goto yydefault |
| } |
| yyn = yyAct[yyn] |
| if yyChk[yyn] == yytoken { /* valid shift */ |
| yyrcvr.char = -1 |
| yytoken = -1 |
| yyVAL = yyrcvr.lval |
| yystate = yyn |
| if Errflag > 0 { |
| Errflag-- |
| } |
| goto yystack |
| } |
| |
| yydefault: |
| /* default state action */ |
| yyn = yyDef[yystate] |
| if yyn == -2 { |
| if yyrcvr.char < 0 { |
| yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) |
| } |
| |
| /* look through exception table */ |
| xi := 0 |
| for { |
| if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { |
| break |
| } |
| xi += 2 |
| } |
| for xi += 2; ; xi += 2 { |
| yyn = yyExca[xi+0] |
| if yyn < 0 || yyn == yytoken { |
| break |
| } |
| } |
| yyn = yyExca[xi+1] |
| if yyn < 0 { |
| goto ret0 |
| } |
| } |
| if yyn == 0 { |
| /* error ... attempt to resume parsing */ |
| switch Errflag { |
| case 0: /* brand new error */ |
| yylex.Error(yyErrorMessage(yystate, yytoken)) |
| Nerrs++ |
| if yyDebug >= 1 { |
| __yyfmt__.Printf("%s", yyStatname(yystate)) |
| __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) |
| } |
| fallthrough |
| |
| case 1, 2: /* incompletely recovered error ... try again */ |
| Errflag = 3 |
| |
| /* find a state where "error" is a legal shift action */ |
| for yyp >= 0 { |
| yyn = yyPact[yyS[yyp].yys] + yyErrCode |
| if yyn >= 0 && yyn < yyLast { |
| yystate = yyAct[yyn] /* simulate a shift of "error" */ |
| if yyChk[yystate] == yyErrCode { |
| goto yystack |
| } |
| } |
| |
| /* the current p has no shift on "error", pop stack */ |
| if yyDebug >= 2 { |
| __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) |
| } |
| yyp-- |
| } |
| /* there is no state on the stack with an error shift ... abort */ |
| goto ret1 |
| |
| case 3: /* no shift yet; clobber input char */ |
| if yyDebug >= 2 { |
| __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) |
| } |
| if yytoken == yyEofCode { |
| goto ret1 |
| } |
| yyrcvr.char = -1 |
| yytoken = -1 |
| goto yynewstate /* try again in the same state */ |
| } |
| } |
| |
| /* reduction by production yyn */ |
| if yyDebug >= 2 { |
| __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) |
| } |
| |
| yynt := yyn |
| yypt := yyp |
| _ = yypt // guard against "declared and not used" |
| |
| yyp -= yyR2[yyn] |
| // yyp is now the index of $0. Perform the default action. Iff the |
| // reduced production is ε, $1 is possibly out of range. |
| if yyp+1 >= len(yyS) { |
| nyys := make([]yySymType, len(yyS)*2) |
| copy(nyys, yyS) |
| yyS = nyys |
| } |
| yyVAL = yyS[yyp+1] |
| |
| /* consult goto table to find next state */ |
| yyn = yyR1[yyn] |
| yyg := yyPgo[yyn] |
| yyj := yyg + yyS[yyp].yys + 1 |
| |
| if yyj >= yyLast { |
| yystate = yyAct[yyg] |
| } else { |
| yystate = yyAct[yyj] |
| if yyChk[yystate] != -yyn { |
| yystate = yyAct[yyg] |
| } |
| } |
| // dummy call; replaced with literal code |
| switch yynt { |
| |
| case 5: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:136 |
| { |
| lexStoreExprs(yylex, yyDollar[2].constexprs) |
| } |
| case 6: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:145 |
| { |
| lexGenEOF(yylex) |
| } |
| case 7: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:147 |
| { |
| lexGenEOF(yylex) |
| } |
| case 8: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:149 |
| { |
| lexGenEOF(yylex) |
| } |
| case 9: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:151 |
| { |
| lexGenEOF(yylex) |
| } |
| case 10: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:156 |
| { |
| lexPosErrorf(yylex, Pos{}, "vdl file must start with package clause") |
| } |
| case 11: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:158 |
| { |
| lexVDLFile(yylex).PackageDef = NamePos{Name: yyDollar[2].strpos.String, Pos: yyDollar[2].strpos.Pos} |
| } |
| case 12: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:163 |
| { |
| lexPosErrorf(yylex, Pos{}, "config file must start with config clause") |
| } |
| case 13: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:165 |
| { |
| // We allow "config" as an identifier; it is not a keyword. So we check |
| // manually to make sure the syntax is correct. |
| if yyDollar[1].strpos.String != "config" { |
| lexPosErrorf(yylex, yyDollar[1].strpos.Pos, "config file must start with config clause") |
| return 1 // Any non-zero code indicates an error |
| } |
| file := lexVDLFile(yylex) |
| file.PackageDef = NamePos{Name: "config", Pos: yyDollar[1].strpos.Pos} |
| file.ConstDefs = []*ConstDef{{Expr: yyDollar[3].constexpr}} |
| } |
| case 21: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:193 |
| { |
| imps := &lexVDLFile(yylex).Imports |
| *imps = append(*imps, &Import{Path: yyDollar[1].strpos.String, NamePos: NamePos{Pos: yyDollar[1].strpos.Pos}}) |
| } |
| case 22: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:198 |
| { |
| imps := &lexVDLFile(yylex).Imports |
| *imps = append(*imps, &Import{Path: yyDollar[2].strpos.String, NamePos: NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}) |
| } |
| case 39: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:233 |
| { |
| tds := &lexVDLFile(yylex).TypeDefs |
| *tds = append(*tds, &TypeDef{Type: yyDollar[2].typeexpr, NamePos: NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}) |
| } |
| case 40: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:255 |
| { |
| yyVAL.typeexpr = &TypeNamed{Name: yyDollar[1].strpos.String, P: yyDollar[1].strpos.Pos} |
| } |
| case 41: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:257 |
| { |
| yyVAL.typeexpr = &TypeNamed{Name: "error", P: yyDollar[1].pos} |
| } |
| case 42: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:259 |
| { |
| yyVAL.typeexpr = &TypeArray{Len: int(yyDollar[2].intpos.int.Int64()), Elem: yyDollar[4].typeexpr, P: yyDollar[1].pos} |
| } |
| case 43: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:261 |
| { |
| yyVAL.typeexpr = &TypeList{Elem: yyDollar[3].typeexpr, P: yyDollar[1].pos} |
| } |
| case 44: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:263 |
| { |
| yyVAL.typeexpr = &TypeEnum{Labels: yyDollar[3].nameposes, P: yyDollar[1].pos} |
| } |
| case 45: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:265 |
| { |
| yyVAL.typeexpr = &TypeSet{Key: yyDollar[3].typeexpr, P: yyDollar[1].pos} |
| } |
| case 46: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:267 |
| { |
| yyVAL.typeexpr = &TypeMap{Key: yyDollar[3].typeexpr, Elem: yyDollar[5].typeexpr, P: yyDollar[1].pos} |
| } |
| case 47: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:269 |
| { |
| yyVAL.typeexpr = &TypeStruct{Fields: yyDollar[3].fields, P: yyDollar[1].pos} |
| } |
| case 48: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:271 |
| { |
| yyVAL.typeexpr = &TypeStruct{P: yyDollar[1].pos} |
| } |
| case 49: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:273 |
| { |
| yyVAL.typeexpr = &TypeUnion{Fields: yyDollar[3].fields, P: yyDollar[1].pos} |
| } |
| case 50: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:275 |
| { |
| yyVAL.typeexpr = &TypeUnion{P: yyDollar[1].pos} |
| } |
| case 51: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:277 |
| { |
| yyVAL.typeexpr = &TypeOptional{Base: yyDollar[2].typeexpr, P: yyDollar[1].pos} |
| } |
| case 52: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:282 |
| { |
| yyVAL.typeexpr = yyDollar[1].typeexpr |
| } |
| case 53: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:284 |
| { |
| yyVAL.typeexpr = &TypeNamed{Name: "typeobject", P: yyDollar[1].pos} |
| } |
| case 54: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:288 |
| { |
| yyVAL.nameposes = []NamePos{yyDollar[1].namepos} |
| } |
| case 55: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:290 |
| { |
| yyVAL.nameposes = append(yyDollar[1].nameposes, yyDollar[3].namepos) |
| } |
| case 56: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:294 |
| { |
| yyVAL.namepos = NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos} |
| } |
| case 57: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:298 |
| { |
| yyVAL.fields = yyDollar[1].fields |
| } |
| case 58: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:300 |
| { |
| yyVAL.fields = append(yyDollar[1].fields, yyDollar[3].fields...) |
| } |
| case 59: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:338 |
| { |
| if names, ok := typeListToStrList(yylex, yyDollar[1].typeexprs); ok { |
| for _, n := range names { |
| yyVAL.fields = append(yyVAL.fields, &Field{Type: yyDollar[2].typeexpr, NamePos: NamePos{Name: n.String, Pos: n.Pos}}) |
| } |
| } else { |
| lexPosErrorf(yylex, yyDollar[2].typeexpr.Pos(), "perhaps you forgot a comma before %q?.", yyDollar[2].typeexpr.String()) |
| } |
| } |
| case 60: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:350 |
| { |
| yyVAL.typeexprs = []Type{yyDollar[1].typeexpr} |
| } |
| case 61: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:352 |
| { |
| yyVAL.typeexprs = append(yyDollar[1].typeexprs, yyDollar[3].typeexpr) |
| } |
| case 62: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:357 |
| { |
| ifs := &lexVDLFile(yylex).Interfaces |
| *ifs = append(*ifs, &Interface{NamePos: NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}) |
| } |
| case 63: |
| yyDollar = yyS[yypt-6 : yypt+1] |
| //line grammar.y:362 |
| { |
| yyDollar[4].iface.Name, yyDollar[4].iface.Pos = yyDollar[1].strpos.String, yyDollar[1].strpos.Pos |
| ifs := &lexVDLFile(yylex).Interfaces |
| *ifs = append(*ifs, yyDollar[4].iface) |
| } |
| case 64: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:370 |
| { |
| yyVAL.iface = yyDollar[1].iface |
| } |
| case 65: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:372 |
| { |
| yyDollar[1].iface.Embeds = append(yyDollar[1].iface.Embeds, yyDollar[3].iface.Embeds...) |
| yyDollar[1].iface.Methods = append(yyDollar[1].iface.Methods, yyDollar[3].iface.Methods...) |
| yyVAL.iface = yyDollar[1].iface |
| } |
| case 66: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:380 |
| { |
| yyVAL.iface = &Interface{Methods: []*Method{{InArgs: yyDollar[2].fields, InStream: yyDollar[3].typeexprs[0], OutStream: yyDollar[3].typeexprs[1], OutArgs: yyDollar[4].fields, Tags: yyDollar[5].constexprs, NamePos: NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}}} |
| } |
| case 67: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:382 |
| { |
| yyVAL.iface = &Interface{Embeds: []*NamePos{{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}} |
| } |
| case 68: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:386 |
| { |
| yyVAL.fields = nil |
| } |
| case 69: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:388 |
| { |
| yyVAL.fields = yyDollar[2].fields |
| } |
| case 70: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:392 |
| { |
| for _, t := range yyDollar[2].typeexprs { |
| yyVAL.fields = append(yyVAL.fields, &Field{Type: t, NamePos: NamePos{Pos: t.Pos()}}) |
| } |
| } |
| case 71: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:402 |
| { |
| yyVAL.fields = yyDollar[1].fields |
| } |
| case 72: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:404 |
| { |
| yyVAL.fields = append(yyDollar[1].fields, yyDollar[3].fields...) |
| } |
| case 73: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:415 |
| { |
| yyVAL.fields = nil |
| } |
| case 74: |
| yyDollar = yyS[yypt-6 : yypt+1] |
| //line grammar.y:417 |
| { |
| yyVAL.fields = yyDollar[2].fields |
| } |
| case 75: |
| yyDollar = yyS[yypt-6 : yypt+1] |
| //line grammar.y:421 |
| { |
| for _, t := range yyDollar[2].typeexprs { |
| yyVAL.fields = append(yyVAL.fields, &Field{Type: t, NamePos: NamePos{Pos: t.Pos()}}) |
| } |
| } |
| case 76: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:429 |
| { |
| yyVAL.typeexprs = []Type{nil, nil} |
| } |
| case 77: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:431 |
| { |
| yyVAL.typeexprs = []Type{nil, nil} |
| } |
| case 78: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:433 |
| { |
| yyVAL.typeexprs = []Type{yyDollar[3].typeexpr, nil} |
| } |
| case 79: |
| yyDollar = yyS[yypt-6 : yypt+1] |
| //line grammar.y:435 |
| { |
| yyVAL.typeexprs = []Type{yyDollar[3].typeexpr, yyDollar[5].typeexpr} |
| } |
| case 80: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:439 |
| { |
| yyVAL.constexprs = nil |
| } |
| case 81: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:441 |
| { |
| yyVAL.constexprs = nil |
| } |
| case 82: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:443 |
| { |
| yyVAL.constexprs = yyDollar[2].constexprs |
| } |
| case 83: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:447 |
| { |
| yyVAL.constexprs = []ConstExpr{yyDollar[1].constexpr} |
| } |
| case 84: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:449 |
| { |
| yyVAL.constexprs = append(yyDollar[1].constexprs, yyDollar[3].constexpr) |
| } |
| case 87: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:458 |
| { |
| cds := &lexVDLFile(yylex).ConstDefs |
| *cds = append(*cds, &ConstDef{Expr: yyDollar[3].constexpr, NamePos: NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos}}) |
| } |
| case 88: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:465 |
| { |
| yyVAL.constexpr = yyDollar[1].constexpr |
| } |
| case 89: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:467 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"||", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 90: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:469 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"&&", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 91: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:471 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"<", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 92: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:473 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{">", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 93: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:475 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"<=", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 94: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:477 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{">=", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 95: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:479 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"!=", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 96: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:481 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"==", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 97: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:483 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"+", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 98: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:485 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"-", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 99: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:487 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"*", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 100: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:489 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"/", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 101: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:491 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"%", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 102: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:493 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"|", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 103: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:495 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"&", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 104: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:497 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"^", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 105: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:499 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{"<<", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 106: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:501 |
| { |
| yyVAL.constexpr = &ConstBinaryOp{">>", yyDollar[1].constexpr, yyDollar[3].constexpr, yyDollar[2].pos} |
| } |
| case 107: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:505 |
| { |
| yyVAL.constexpr = yyDollar[1].constexpr |
| } |
| case 108: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:507 |
| { |
| yyVAL.constexpr = &ConstUnaryOp{"!", yyDollar[2].constexpr, yyDollar[1].pos} |
| } |
| case 109: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:509 |
| { |
| yyVAL.constexpr = &ConstUnaryOp{"+", yyDollar[2].constexpr, yyDollar[1].pos} |
| } |
| case 110: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:511 |
| { |
| yyVAL.constexpr = &ConstUnaryOp{"-", yyDollar[2].constexpr, yyDollar[1].pos} |
| } |
| case 111: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:513 |
| { |
| yyVAL.constexpr = &ConstUnaryOp{"^", yyDollar[2].constexpr, yyDollar[1].pos} |
| } |
| case 112: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:515 |
| { |
| yyVAL.constexpr = &ConstTypeConv{yyDollar[1].typeexpr, yyDollar[3].constexpr, yyDollar[1].typeexpr.Pos()} |
| } |
| case 113: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:517 |
| { |
| yyVAL.constexpr = &ConstTypeObject{yyDollar[3].typeexpr, yyDollar[1].pos} |
| } |
| case 114: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:521 |
| { |
| yyVAL.constexpr = &ConstLit{yyDollar[1].strpos.String, yyDollar[1].strpos.Pos} |
| } |
| case 115: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:523 |
| { |
| yyVAL.constexpr = &ConstLit{yyDollar[1].intpos.int, yyDollar[1].intpos.pos} |
| } |
| case 116: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:525 |
| { |
| yyVAL.constexpr = &ConstLit{yyDollar[1].ratpos.rat, yyDollar[1].ratpos.pos} |
| } |
| case 117: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:527 |
| { |
| yyVAL.constexpr = &ConstNamed{yyDollar[1].strpos.String, yyDollar[1].strpos.Pos} |
| } |
| case 118: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:529 |
| { |
| yyVAL.constexpr = yyDollar[1].complit |
| } |
| case 119: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:531 |
| { |
| lexPosErrorf(yylex, yyDollar[2].pos, "cannot apply selector operator to unnamed constant") |
| } |
| case 120: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:533 |
| { |
| lexPosErrorf(yylex, yyDollar[2].pos, "cannot apply index operator to unnamed constant") |
| } |
| case 121: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:535 |
| { |
| yyVAL.constexpr = &ConstIndexed{&ConstNamed{yyDollar[1].strpos.String, yyDollar[1].strpos.Pos}, yyDollar[3].constexpr, yyDollar[1].strpos.Pos} |
| } |
| case 122: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:537 |
| { |
| yyVAL.constexpr = yyDollar[2].constexpr |
| } |
| case 123: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:541 |
| { |
| yyVAL.complit = &ConstCompositeLit{yyDollar[1].typeexpr, nil, yyDollar[2].pos} |
| } |
| case 124: |
| yyDollar = yyS[yypt-5 : yypt+1] |
| //line grammar.y:543 |
| { |
| yyVAL.complit = &ConstCompositeLit{yyDollar[1].typeexpr, yyDollar[3].kvlits, yyDollar[2].pos} |
| } |
| case 125: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:547 |
| { |
| yyVAL.kvlits = []KVLit{yyDollar[1].kvlit} |
| } |
| case 126: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:549 |
| { |
| yyVAL.kvlits = append(yyDollar[1].kvlits, yyDollar[3].kvlit) |
| } |
| case 127: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:553 |
| { |
| yyVAL.kvlit = KVLit{Value: yyDollar[1].constexpr} |
| } |
| case 128: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:555 |
| { |
| yyVAL.kvlit = KVLit{Key: yyDollar[1].constexpr, Value: yyDollar[3].constexpr} |
| } |
| case 131: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:564 |
| { |
| // Create *ErrorDef starting with a copy of error_details, filling in the |
| // name and params |
| ed := yyDollar[3].errordef |
| ed.NamePos = NamePos{Name: yyDollar[1].strpos.String, Pos: yyDollar[1].strpos.Pos} |
| ed.Params = yyDollar[2].fields |
| eds := &lexVDLFile(yylex).ErrorDefs |
| *eds = append(*eds, &ed) |
| } |
| case 132: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:576 |
| { |
| yyVAL.errordef = ErrorDef{} |
| } |
| case 133: |
| yyDollar = yyS[yypt-2 : yypt+1] |
| //line grammar.y:578 |
| { |
| yyVAL.errordef = ErrorDef{} |
| } |
| case 134: |
| yyDollar = yyS[yypt-4 : yypt+1] |
| //line grammar.y:580 |
| { |
| yyVAL.errordef = yyDollar[2].errordef |
| } |
| case 135: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:584 |
| { |
| yyVAL.errordef = yyDollar[1].errordef |
| } |
| case 136: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:586 |
| { |
| // Merge each ErrorDef in-order to build the final ErrorDef. |
| yyVAL.errordef = yyDollar[1].errordef |
| switch { |
| case len(yyDollar[3].errordef.Actions) > 0: |
| yyVAL.errordef.Actions = append(yyVAL.errordef.Actions, yyDollar[3].errordef.Actions...) |
| case len(yyDollar[3].errordef.Formats) > 0: |
| yyVAL.errordef.Formats = append(yyVAL.errordef.Formats, yyDollar[3].errordef.Formats...) |
| } |
| } |
| case 137: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:599 |
| { |
| yyVAL.errordef = ErrorDef{Actions: []StringPos{yyDollar[1].strpos}} |
| } |
| case 138: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:601 |
| { |
| yyVAL.errordef = ErrorDef{Formats: []LangFmt{{Lang: yyDollar[1].strpos, Fmt: yyDollar[3].strpos}}} |
| } |
| case 139: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:613 |
| { |
| yyVAL.strpos = yyDollar[1].strpos |
| } |
| case 140: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:615 |
| { |
| yyVAL.strpos = StringPos{"\"" + yyDollar[1].strpos.String + "\"." + yyDollar[3].strpos.String, yyDollar[1].strpos.Pos} |
| } |
| case 141: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:620 |
| { |
| yyVAL.strpos = yyDollar[1].strpos |
| } |
| case 142: |
| yyDollar = yyS[yypt-3 : yypt+1] |
| //line grammar.y:622 |
| { |
| yyVAL.strpos = StringPos{yyDollar[1].strpos.String + "." + yyDollar[3].strpos.String, yyDollar[1].strpos.Pos} |
| } |
| case 143: |
| yyDollar = yyS[yypt-0 : yypt+1] |
| //line grammar.y:626 |
| { |
| yyVAL.typeexpr = nil |
| } |
| case 144: |
| yyDollar = yyS[yypt-1 : yypt+1] |
| //line grammar.y:628 |
| { |
| yyVAL.typeexpr = yyDollar[1].typeexpr |
| } |
| } |
| goto yystack /* stack new state and value */ |
| } |