1
0

parser.go 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. //line parser.go.y:2
  2. package parse
  3. import __yyfmt__ "fmt"
  4. //line parser.go.y:2
  5. import (
  6. "github.com/yuin/gopher-lua/ast"
  7. )
  8. //line parser.go.y:34
  9. type yySymType struct {
  10. yys int
  11. token ast.Token
  12. stmts []ast.Stmt
  13. stmt ast.Stmt
  14. funcname *ast.FuncName
  15. funcexpr *ast.FunctionExpr
  16. exprlist []ast.Expr
  17. expr ast.Expr
  18. fieldlist []*ast.Field
  19. field *ast.Field
  20. fieldsep string
  21. namelist []string
  22. parlist *ast.ParList
  23. }
  24. const TAnd = 57346
  25. const TBreak = 57347
  26. const TDo = 57348
  27. const TElse = 57349
  28. const TElseIf = 57350
  29. const TEnd = 57351
  30. const TFalse = 57352
  31. const TFor = 57353
  32. const TFunction = 57354
  33. const TIf = 57355
  34. const TIn = 57356
  35. const TLocal = 57357
  36. const TNil = 57358
  37. const TNot = 57359
  38. const TOr = 57360
  39. const TReturn = 57361
  40. const TRepeat = 57362
  41. const TThen = 57363
  42. const TTrue = 57364
  43. const TUntil = 57365
  44. const TWhile = 57366
  45. const TEqeq = 57367
  46. const TNeq = 57368
  47. const TLte = 57369
  48. const TGte = 57370
  49. const T2Comma = 57371
  50. const T3Comma = 57372
  51. const TIdent = 57373
  52. const TNumber = 57374
  53. const TString = 57375
  54. const UNARY = 57376
  55. var yyToknames = []string{
  56. "TAnd",
  57. "TBreak",
  58. "TDo",
  59. "TElse",
  60. "TElseIf",
  61. "TEnd",
  62. "TFalse",
  63. "TFor",
  64. "TFunction",
  65. "TIf",
  66. "TIn",
  67. "TLocal",
  68. "TNil",
  69. "TNot",
  70. "TOr",
  71. "TReturn",
  72. "TRepeat",
  73. "TThen",
  74. "TTrue",
  75. "TUntil",
  76. "TWhile",
  77. "TEqeq",
  78. "TNeq",
  79. "TLte",
  80. "TGte",
  81. "T2Comma",
  82. "T3Comma",
  83. "TIdent",
  84. "TNumber",
  85. "TString",
  86. " {",
  87. " (",
  88. " >",
  89. " <",
  90. " +",
  91. " -",
  92. " *",
  93. " /",
  94. " %",
  95. "UNARY",
  96. " ^",
  97. }
  98. var yyStatenames = []string{}
  99. const yyEofCode = 1
  100. const yyErrCode = 2
  101. const yyMaxDepth = 200
  102. //line parser.go.y:514
  103. func TokenName(c int) string {
  104. if c >= TAnd && c-TAnd < len(yyToknames) {
  105. if yyToknames[c-TAnd] != "" {
  106. return yyToknames[c-TAnd]
  107. }
  108. }
  109. return string([]byte{byte(c)})
  110. }
  111. //line yacctab:1
  112. var yyExca = []int{
  113. -1, 1,
  114. 1, -1,
  115. -2, 0,
  116. -1, 17,
  117. 46, 31,
  118. 47, 31,
  119. -2, 68,
  120. -1, 93,
  121. 46, 32,
  122. 47, 32,
  123. -2, 68,
  124. }
  125. const yyNprod = 95
  126. const yyPrivate = 57344
  127. var yyTokenNames []string
  128. var yyStates []string
  129. const yyLast = 579
  130. var yyAct = []int{
  131. 24, 88, 50, 23, 45, 84, 56, 65, 137, 153,
  132. 136, 113, 52, 142, 54, 53, 33, 134, 65, 132,
  133. 62, 63, 32, 61, 108, 109, 48, 111, 106, 41,
  134. 42, 105, 49, 155, 166, 81, 82, 83, 138, 104,
  135. 22, 91, 131, 80, 95, 92, 162, 74, 48, 85,
  136. 150, 99, 165, 148, 49, 149, 75, 76, 77, 78,
  137. 79, 67, 80, 107, 106, 148, 114, 115, 116, 117,
  138. 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  139. 128, 129, 72, 73, 71, 70, 74, 65, 39, 40,
  140. 47, 139, 133, 68, 69, 75, 76, 77, 78, 79,
  141. 60, 80, 141, 144, 143, 146, 145, 31, 67, 147,
  142. 9, 48, 110, 97, 48, 152, 151, 49, 38, 62,
  143. 49, 17, 66, 77, 78, 79, 96, 80, 59, 72,
  144. 73, 71, 70, 74, 154, 102, 91, 156, 55, 157,
  145. 68, 69, 75, 76, 77, 78, 79, 21, 80, 187,
  146. 94, 20, 26, 184, 37, 179, 163, 112, 25, 35,
  147. 178, 93, 170, 172, 27, 171, 164, 173, 19, 159,
  148. 175, 174, 29, 89, 28, 39, 40, 20, 182, 181,
  149. 100, 34, 135, 183, 67, 39, 40, 47, 186, 64,
  150. 51, 1, 90, 87, 36, 130, 86, 30, 66, 18,
  151. 46, 44, 43, 8, 58, 72, 73, 71, 70, 74,
  152. 57, 67, 168, 169, 167, 3, 68, 69, 75, 76,
  153. 77, 78, 79, 160, 80, 66, 4, 2, 0, 0,
  154. 0, 158, 72, 73, 71, 70, 74, 0, 0, 0,
  155. 0, 0, 0, 68, 69, 75, 76, 77, 78, 79,
  156. 26, 80, 37, 0, 0, 0, 25, 35, 140, 0,
  157. 0, 0, 27, 0, 0, 0, 0, 0, 0, 0,
  158. 29, 21, 28, 39, 40, 20, 26, 0, 37, 34,
  159. 0, 0, 25, 35, 0, 0, 0, 0, 27, 0,
  160. 0, 0, 36, 98, 0, 0, 29, 89, 28, 39,
  161. 40, 20, 26, 0, 37, 34, 0, 0, 25, 35,
  162. 0, 0, 0, 0, 27, 67, 90, 176, 36, 0,
  163. 0, 0, 29, 21, 28, 39, 40, 20, 0, 66,
  164. 0, 34, 0, 0, 0, 0, 72, 73, 71, 70,
  165. 74, 0, 67, 0, 36, 0, 0, 68, 69, 75,
  166. 76, 77, 78, 79, 0, 80, 66, 0, 177, 0,
  167. 0, 0, 0, 72, 73, 71, 70, 74, 0, 67,
  168. 0, 185, 0, 0, 68, 69, 75, 76, 77, 78,
  169. 79, 0, 80, 66, 0, 161, 0, 0, 0, 0,
  170. 72, 73, 71, 70, 74, 0, 67, 0, 0, 0,
  171. 0, 68, 69, 75, 76, 77, 78, 79, 0, 80,
  172. 66, 0, 0, 180, 0, 0, 0, 72, 73, 71,
  173. 70, 74, 0, 67, 0, 0, 0, 0, 68, 69,
  174. 75, 76, 77, 78, 79, 0, 80, 66, 0, 0,
  175. 103, 0, 0, 0, 72, 73, 71, 70, 74, 0,
  176. 67, 0, 101, 0, 0, 68, 69, 75, 76, 77,
  177. 78, 79, 0, 80, 66, 0, 0, 0, 0, 0,
  178. 0, 72, 73, 71, 70, 74, 0, 67, 0, 0,
  179. 0, 0, 68, 69, 75, 76, 77, 78, 79, 0,
  180. 80, 66, 0, 0, 0, 0, 0, 0, 72, 73,
  181. 71, 70, 74, 0, 0, 0, 0, 0, 0, 68,
  182. 69, 75, 76, 77, 78, 79, 0, 80, 72, 73,
  183. 71, 70, 74, 0, 0, 0, 0, 0, 0, 68,
  184. 69, 75, 76, 77, 78, 79, 0, 80, 7, 10,
  185. 0, 0, 0, 0, 14, 15, 13, 0, 16, 0,
  186. 0, 0, 6, 12, 0, 0, 0, 11, 0, 0,
  187. 0, 0, 0, 0, 21, 0, 0, 0, 20, 0,
  188. 0, 0, 0, 0, 0, 0, 0, 0, 5,
  189. }
  190. var yyPact = []int{
  191. -1000, -1000, 533, -5, -1000, -1000, 292, -1000, -17, 152,
  192. -1000, 292, -1000, 292, 107, 97, 88, -1000, -1000, -1000,
  193. 292, -1000, -1000, -29, 473, -1000, -1000, -1000, -1000, -1000,
  194. -1000, 152, -1000, -1000, 292, 292, 292, 14, -1000, -1000,
  195. 142, 292, 116, 292, 95, -1000, 82, 240, -1000, -1000,
  196. 171, -1000, 446, 112, 419, -7, 17, 14, -24, -1000,
  197. 81, -19, -1000, 104, -42, 292, 292, 292, 292, 292,
  198. 292, 292, 292, 292, 292, 292, 292, 292, 292, 292,
  199. 292, -1, -1, -1, -1000, -11, -1000, -37, -1000, -8,
  200. 292, 473, -29, -1000, 152, 207, -1000, 55, -1000, -40,
  201. -1000, -1000, 292, -1000, 292, 292, 34, -1000, 24, 19,
  202. 14, 292, -1000, -1000, 473, 57, 493, 18, 18, 18,
  203. 18, 18, 18, 18, 83, 83, -1, -1, -1, -1,
  204. -44, -1000, -1000, -14, -1000, 266, -1000, -1000, 292, 180,
  205. -1000, -1000, -1000, 160, 473, -1000, 338, 40, -1000, -1000,
  206. -1000, -1000, -29, -1000, 157, 22, -1000, 473, -12, -1000,
  207. 205, 292, -1000, 154, -1000, -1000, 292, -1000, -1000, 292,
  208. 311, 151, -1000, 473, 146, 392, -1000, 292, -1000, -1000,
  209. -1000, 144, 365, -1000, -1000, -1000, 140, -1000,
  210. }
  211. var yyPgo = []int{
  212. 0, 190, 227, 2, 226, 223, 215, 210, 204, 203,
  213. 118, 6, 3, 0, 22, 107, 168, 199, 4, 197,
  214. 5, 195, 16, 193, 1, 182,
  215. }
  216. var yyR1 = []int{
  217. 0, 1, 1, 1, 2, 2, 2, 3, 4, 4,
  218. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  219. 4, 4, 5, 5, 6, 6, 6, 7, 7, 8,
  220. 8, 9, 9, 10, 10, 10, 11, 11, 12, 12,
  221. 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  222. 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  223. 13, 13, 13, 13, 13, 13, 13, 14, 15, 15,
  224. 15, 15, 17, 16, 16, 18, 18, 18, 18, 19,
  225. 20, 20, 21, 21, 21, 22, 22, 23, 23, 23,
  226. 24, 24, 24, 25, 25,
  227. }
  228. var yyR2 = []int{
  229. 0, 1, 2, 3, 0, 2, 2, 1, 3, 1,
  230. 3, 5, 4, 6, 8, 9, 11, 7, 3, 4,
  231. 4, 2, 0, 5, 1, 2, 1, 1, 3, 1,
  232. 3, 1, 3, 1, 4, 3, 1, 3, 1, 3,
  233. 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
  234. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  235. 3, 3, 3, 3, 2, 2, 2, 1, 1, 1,
  236. 1, 3, 3, 2, 4, 2, 3, 1, 1, 2,
  237. 5, 4, 1, 1, 3, 2, 3, 1, 3, 2,
  238. 3, 5, 1, 1, 1,
  239. }
  240. var yyChk = []int{
  241. -1000, -1, -2, -6, -4, 45, 19, 5, -9, -15,
  242. 6, 24, 20, 13, 11, 12, 15, -10, -17, -16,
  243. 35, 31, 45, -12, -13, 16, 10, 22, 32, 30,
  244. -19, -15, -14, -22, 39, 17, 52, 12, -10, 33,
  245. 34, 46, 47, 50, 49, -18, 48, 35, -22, -14,
  246. -3, -1, -13, -3, -13, 31, -11, -7, -8, 31,
  247. 12, -11, 31, -13, -16, 47, 18, 4, 36, 37,
  248. 28, 27, 25, 26, 29, 38, 39, 40, 41, 42,
  249. 44, -13, -13, -13, -20, 35, 54, -23, -24, 31,
  250. 50, -13, -12, -10, -15, -13, 31, 31, 53, -12,
  251. 9, 6, 23, 21, 46, 14, 47, -20, 48, 49,
  252. 31, 46, 53, 53, -13, -13, -13, -13, -13, -13,
  253. -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
  254. -21, 53, 30, -11, 54, -25, 47, 45, 46, -13,
  255. 51, -18, 53, -3, -13, -3, -13, -12, 31, 31,
  256. 31, -20, -12, 53, -3, 47, -24, -13, 51, 9,
  257. -5, 47, 6, -3, 9, 30, 46, 9, 7, 8,
  258. -13, -3, 9, -13, -3, -13, 6, 47, 9, 9,
  259. 21, -3, -13, -3, 9, 6, -3, 9,
  260. }
  261. var yyDef = []int{
  262. 4, -2, 1, 2, 5, 6, 24, 26, 0, 9,
  263. 4, 0, 4, 0, 0, 0, 0, -2, 69, 70,
  264. 0, 33, 3, 25, 38, 40, 41, 42, 43, 44,
  265. 45, 46, 47, 48, 0, 0, 0, 0, 68, 67,
  266. 0, 0, 0, 0, 0, 73, 0, 0, 77, 78,
  267. 0, 7, 0, 0, 0, 36, 0, 0, 27, 29,
  268. 0, 21, 36, 0, 70, 0, 0, 0, 0, 0,
  269. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  270. 0, 64, 65, 66, 79, 0, 85, 0, 87, 33,
  271. 0, 92, 8, -2, 0, 0, 35, 0, 75, 0,
  272. 10, 4, 0, 4, 0, 0, 0, 18, 0, 0,
  273. 0, 0, 71, 72, 39, 49, 50, 51, 52, 53,
  274. 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
  275. 0, 4, 82, 83, 86, 89, 93, 94, 0, 0,
  276. 34, 74, 76, 0, 12, 22, 0, 0, 37, 28,
  277. 30, 19, 20, 4, 0, 0, 88, 90, 0, 11,
  278. 0, 0, 4, 0, 81, 84, 0, 13, 4, 0,
  279. 0, 0, 80, 91, 0, 0, 4, 0, 17, 14,
  280. 4, 0, 0, 23, 15, 4, 0, 16,
  281. }
  282. var yyTok1 = []int{
  283. 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  284. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  285. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  286. 3, 3, 3, 3, 3, 52, 3, 42, 3, 3,
  287. 35, 53, 40, 38, 47, 39, 49, 41, 3, 3,
  288. 3, 3, 3, 3, 3, 3, 3, 3, 48, 45,
  289. 37, 46, 36, 3, 3, 3, 3, 3, 3, 3,
  290. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  291. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  292. 3, 50, 3, 51, 44, 3, 3, 3, 3, 3,
  293. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  294. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  295. 3, 3, 3, 34, 3, 54,
  296. }
  297. var yyTok2 = []int{
  298. 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
  299. 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
  300. 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  301. 32, 33, 43,
  302. }
  303. var yyTok3 = []int{
  304. 0,
  305. }
  306. //line yaccpar:1
  307. /* parser for yacc output */
  308. var yyDebug = 0
  309. type yyLexer interface {
  310. Lex(lval *yySymType) int
  311. Error(s string)
  312. }
  313. const yyFlag = -1000
  314. func yyTokname(c int) string {
  315. // 4 is TOKSTART above
  316. if c >= 4 && c-4 < len(yyToknames) {
  317. if yyToknames[c-4] != "" {
  318. return yyToknames[c-4]
  319. }
  320. }
  321. return __yyfmt__.Sprintf("tok-%v", c)
  322. }
  323. func yyStatname(s int) string {
  324. if s >= 0 && s < len(yyStatenames) {
  325. if yyStatenames[s] != "" {
  326. return yyStatenames[s]
  327. }
  328. }
  329. return __yyfmt__.Sprintf("state-%v", s)
  330. }
  331. func yylex1(lex yyLexer, lval *yySymType) int {
  332. c := 0
  333. char := lex.Lex(lval)
  334. if char <= 0 {
  335. c = yyTok1[0]
  336. goto out
  337. }
  338. if char < len(yyTok1) {
  339. c = yyTok1[char]
  340. goto out
  341. }
  342. if char >= yyPrivate {
  343. if char < yyPrivate+len(yyTok2) {
  344. c = yyTok2[char-yyPrivate]
  345. goto out
  346. }
  347. }
  348. for i := 0; i < len(yyTok3); i += 2 {
  349. c = yyTok3[i+0]
  350. if c == char {
  351. c = yyTok3[i+1]
  352. goto out
  353. }
  354. }
  355. out:
  356. if c == 0 {
  357. c = yyTok2[1] /* unknown char */
  358. }
  359. if yyDebug >= 3 {
  360. __yyfmt__.Printf("lex %s(%d)\n", yyTokname(c), uint(char))
  361. }
  362. return c
  363. }
  364. func yyParse(yylex yyLexer) int {
  365. var yyn int
  366. var yylval yySymType
  367. var yyVAL yySymType
  368. yyS := make([]yySymType, yyMaxDepth)
  369. Nerrs := 0 /* number of errors */
  370. Errflag := 0 /* error recovery flag */
  371. yystate := 0
  372. yychar := -1
  373. yyp := -1
  374. goto yystack
  375. ret0:
  376. return 0
  377. ret1:
  378. return 1
  379. yystack:
  380. /* put a state and value onto the stack */
  381. if yyDebug >= 4 {
  382. __yyfmt__.Printf("char %v in %v\n", yyTokname(yychar), yyStatname(yystate))
  383. }
  384. yyp++
  385. if yyp >= len(yyS) {
  386. nyys := make([]yySymType, len(yyS)*2)
  387. copy(nyys, yyS)
  388. yyS = nyys
  389. }
  390. yyS[yyp] = yyVAL
  391. yyS[yyp].yys = yystate
  392. yynewstate:
  393. yyn = yyPact[yystate]
  394. if yyn <= yyFlag {
  395. goto yydefault /* simple state */
  396. }
  397. if yychar < 0 {
  398. yychar = yylex1(yylex, &yylval)
  399. }
  400. yyn += yychar
  401. if yyn < 0 || yyn >= yyLast {
  402. goto yydefault
  403. }
  404. yyn = yyAct[yyn]
  405. if yyChk[yyn] == yychar { /* valid shift */
  406. yychar = -1
  407. yyVAL = yylval
  408. yystate = yyn
  409. if Errflag > 0 {
  410. Errflag--
  411. }
  412. goto yystack
  413. }
  414. yydefault:
  415. /* default state action */
  416. yyn = yyDef[yystate]
  417. if yyn == -2 {
  418. if yychar < 0 {
  419. yychar = yylex1(yylex, &yylval)
  420. }
  421. /* look through exception table */
  422. xi := 0
  423. for {
  424. if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {
  425. break
  426. }
  427. xi += 2
  428. }
  429. for xi += 2; ; xi += 2 {
  430. yyn = yyExca[xi+0]
  431. if yyn < 0 || yyn == yychar {
  432. break
  433. }
  434. }
  435. yyn = yyExca[xi+1]
  436. if yyn < 0 {
  437. goto ret0
  438. }
  439. }
  440. if yyn == 0 {
  441. /* error ... attempt to resume parsing */
  442. switch Errflag {
  443. case 0: /* brand new error */
  444. yylex.Error("syntax error")
  445. Nerrs++
  446. if yyDebug >= 1 {
  447. __yyfmt__.Printf("%s", yyStatname(yystate))
  448. __yyfmt__.Printf(" saw %s\n", yyTokname(yychar))
  449. }
  450. fallthrough
  451. case 1, 2: /* incompletely recovered error ... try again */
  452. Errflag = 3
  453. /* find a state where "error" is a legal shift action */
  454. for yyp >= 0 {
  455. yyn = yyPact[yyS[yyp].yys] + yyErrCode
  456. if yyn >= 0 && yyn < yyLast {
  457. yystate = yyAct[yyn] /* simulate a shift of "error" */
  458. if yyChk[yystate] == yyErrCode {
  459. goto yystack
  460. }
  461. }
  462. /* the current p has no shift on "error", pop stack */
  463. if yyDebug >= 2 {
  464. __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)
  465. }
  466. yyp--
  467. }
  468. /* there is no state on the stack with an error shift ... abort */
  469. goto ret1
  470. case 3: /* no shift yet; clobber input char */
  471. if yyDebug >= 2 {
  472. __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yychar))
  473. }
  474. if yychar == yyEofCode {
  475. goto ret1
  476. }
  477. yychar = -1
  478. goto yynewstate /* try again in the same state */
  479. }
  480. }
  481. /* reduction by production yyn */
  482. if yyDebug >= 2 {
  483. __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))
  484. }
  485. yynt := yyn
  486. yypt := yyp
  487. _ = yypt // guard against "declared and not used"
  488. yyp -= yyR2[yyn]
  489. yyVAL = yyS[yyp+1]
  490. /* consult goto table to find next state */
  491. yyn = yyR1[yyn]
  492. yyg := yyPgo[yyn]
  493. yyj := yyg + yyS[yyp].yys + 1
  494. if yyj >= yyLast {
  495. yystate = yyAct[yyg]
  496. } else {
  497. yystate = yyAct[yyj]
  498. if yyChk[yystate] != -yyn {
  499. yystate = yyAct[yyg]
  500. }
  501. }
  502. // dummy call; replaced with literal code
  503. switch yynt {
  504. case 1:
  505. //line parser.go.y:73
  506. {
  507. yyVAL.stmts = yyS[yypt-0].stmts
  508. if l, ok := yylex.(*Lexer); ok {
  509. l.Stmts = yyVAL.stmts
  510. }
  511. }
  512. case 2:
  513. //line parser.go.y:79
  514. {
  515. yyVAL.stmts = append(yyS[yypt-1].stmts, yyS[yypt-0].stmt)
  516. if l, ok := yylex.(*Lexer); ok {
  517. l.Stmts = yyVAL.stmts
  518. }
  519. }
  520. case 3:
  521. //line parser.go.y:85
  522. {
  523. yyVAL.stmts = append(yyS[yypt-2].stmts, yyS[yypt-1].stmt)
  524. if l, ok := yylex.(*Lexer); ok {
  525. l.Stmts = yyVAL.stmts
  526. }
  527. }
  528. case 4:
  529. //line parser.go.y:93
  530. {
  531. yyVAL.stmts = []ast.Stmt{}
  532. }
  533. case 5:
  534. //line parser.go.y:96
  535. {
  536. yyVAL.stmts = append(yyS[yypt-1].stmts, yyS[yypt-0].stmt)
  537. }
  538. case 6:
  539. //line parser.go.y:99
  540. {
  541. yyVAL.stmts = yyS[yypt-1].stmts
  542. }
  543. case 7:
  544. //line parser.go.y:104
  545. {
  546. yyVAL.stmts = yyS[yypt-0].stmts
  547. }
  548. case 8:
  549. //line parser.go.y:109
  550. {
  551. yyVAL.stmt = &ast.AssignStmt{Lhs: yyS[yypt-2].exprlist, Rhs: yyS[yypt-0].exprlist}
  552. yyVAL.stmt.SetLine(yyS[yypt-2].exprlist[0].Line())
  553. }
  554. case 9:
  555. //line parser.go.y:114
  556. {
  557. if _, ok := yyS[yypt-0].expr.(*ast.FuncCallExpr); !ok {
  558. yylex.(*Lexer).Error("parse error")
  559. } else {
  560. yyVAL.stmt = &ast.FuncCallStmt{Expr: yyS[yypt-0].expr}
  561. yyVAL.stmt.SetLine(yyS[yypt-0].expr.Line())
  562. }
  563. }
  564. case 10:
  565. //line parser.go.y:122
  566. {
  567. yyVAL.stmt = &ast.DoBlockStmt{Stmts: yyS[yypt-1].stmts}
  568. yyVAL.stmt.SetLine(yyS[yypt-2].token.Pos.Line)
  569. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  570. }
  571. case 11:
  572. //line parser.go.y:127
  573. {
  574. yyVAL.stmt = &ast.WhileStmt{Condition: yyS[yypt-3].expr, Stmts: yyS[yypt-1].stmts}
  575. yyVAL.stmt.SetLine(yyS[yypt-4].token.Pos.Line)
  576. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  577. }
  578. case 12:
  579. //line parser.go.y:132
  580. {
  581. yyVAL.stmt = &ast.RepeatStmt{Condition: yyS[yypt-0].expr, Stmts: yyS[yypt-2].stmts}
  582. yyVAL.stmt.SetLine(yyS[yypt-3].token.Pos.Line)
  583. yyVAL.stmt.SetLastLine(yyS[yypt-0].expr.Line())
  584. }
  585. case 13:
  586. //line parser.go.y:137
  587. {
  588. yyVAL.stmt = &ast.IfStmt{Condition: yyS[yypt-4].expr, Then: yyS[yypt-2].stmts}
  589. cur := yyVAL.stmt
  590. for _, elseif := range yyS[yypt-1].stmts {
  591. cur.(*ast.IfStmt).Else = []ast.Stmt{elseif}
  592. cur = elseif
  593. }
  594. yyVAL.stmt.SetLine(yyS[yypt-5].token.Pos.Line)
  595. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  596. }
  597. case 14:
  598. //line parser.go.y:147
  599. {
  600. yyVAL.stmt = &ast.IfStmt{Condition: yyS[yypt-6].expr, Then: yyS[yypt-4].stmts}
  601. cur := yyVAL.stmt
  602. for _, elseif := range yyS[yypt-3].stmts {
  603. cur.(*ast.IfStmt).Else = []ast.Stmt{elseif}
  604. cur = elseif
  605. }
  606. cur.(*ast.IfStmt).Else = yyS[yypt-1].stmts
  607. yyVAL.stmt.SetLine(yyS[yypt-7].token.Pos.Line)
  608. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  609. }
  610. case 15:
  611. //line parser.go.y:158
  612. {
  613. yyVAL.stmt = &ast.NumberForStmt{Name: yyS[yypt-7].token.Str, Init: yyS[yypt-5].expr, Limit: yyS[yypt-3].expr, Stmts: yyS[yypt-1].stmts}
  614. yyVAL.stmt.SetLine(yyS[yypt-8].token.Pos.Line)
  615. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  616. }
  617. case 16:
  618. //line parser.go.y:163
  619. {
  620. yyVAL.stmt = &ast.NumberForStmt{Name: yyS[yypt-9].token.Str, Init: yyS[yypt-7].expr, Limit: yyS[yypt-5].expr, Step: yyS[yypt-3].expr, Stmts: yyS[yypt-1].stmts}
  621. yyVAL.stmt.SetLine(yyS[yypt-10].token.Pos.Line)
  622. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  623. }
  624. case 17:
  625. //line parser.go.y:168
  626. {
  627. yyVAL.stmt = &ast.GenericForStmt{Names: yyS[yypt-5].namelist, Exprs: yyS[yypt-3].exprlist, Stmts: yyS[yypt-1].stmts}
  628. yyVAL.stmt.SetLine(yyS[yypt-6].token.Pos.Line)
  629. yyVAL.stmt.SetLastLine(yyS[yypt-0].token.Pos.Line)
  630. }
  631. case 18:
  632. //line parser.go.y:173
  633. {
  634. yyVAL.stmt = &ast.FuncDefStmt{Name: yyS[yypt-1].funcname, Func: yyS[yypt-0].funcexpr}
  635. yyVAL.stmt.SetLine(yyS[yypt-2].token.Pos.Line)
  636. yyVAL.stmt.SetLastLine(yyS[yypt-0].funcexpr.LastLine())
  637. }
  638. case 19:
  639. //line parser.go.y:178
  640. {
  641. yyVAL.stmt = &ast.LocalAssignStmt{Names: []string{yyS[yypt-1].token.Str}, Exprs: []ast.Expr{yyS[yypt-0].funcexpr}}
  642. yyVAL.stmt.SetLine(yyS[yypt-3].token.Pos.Line)
  643. yyVAL.stmt.SetLastLine(yyS[yypt-0].funcexpr.LastLine())
  644. }
  645. case 20:
  646. //line parser.go.y:183
  647. {
  648. yyVAL.stmt = &ast.LocalAssignStmt{Names: yyS[yypt-2].namelist, Exprs: yyS[yypt-0].exprlist}
  649. yyVAL.stmt.SetLine(yyS[yypt-3].token.Pos.Line)
  650. }
  651. case 21:
  652. //line parser.go.y:187
  653. {
  654. yyVAL.stmt = &ast.LocalAssignStmt{Names: yyS[yypt-0].namelist, Exprs: []ast.Expr{}}
  655. yyVAL.stmt.SetLine(yyS[yypt-1].token.Pos.Line)
  656. }
  657. case 22:
  658. //line parser.go.y:193
  659. {
  660. yyVAL.stmts = []ast.Stmt{}
  661. }
  662. case 23:
  663. //line parser.go.y:196
  664. {
  665. yyVAL.stmts = append(yyS[yypt-4].stmts, &ast.IfStmt{Condition: yyS[yypt-2].expr, Then: yyS[yypt-0].stmts})
  666. yyVAL.stmts[len(yyVAL.stmts)-1].SetLine(yyS[yypt-3].token.Pos.Line)
  667. }
  668. case 24:
  669. //line parser.go.y:202
  670. {
  671. yyVAL.stmt = &ast.ReturnStmt{Exprs: nil}
  672. yyVAL.stmt.SetLine(yyS[yypt-0].token.Pos.Line)
  673. }
  674. case 25:
  675. //line parser.go.y:206
  676. {
  677. yyVAL.stmt = &ast.ReturnStmt{Exprs: yyS[yypt-0].exprlist}
  678. yyVAL.stmt.SetLine(yyS[yypt-1].token.Pos.Line)
  679. }
  680. case 26:
  681. //line parser.go.y:210
  682. {
  683. yyVAL.stmt = &ast.BreakStmt{}
  684. yyVAL.stmt.SetLine(yyS[yypt-0].token.Pos.Line)
  685. }
  686. case 27:
  687. //line parser.go.y:216
  688. {
  689. yyVAL.funcname = yyS[yypt-0].funcname
  690. }
  691. case 28:
  692. //line parser.go.y:219
  693. {
  694. yyVAL.funcname = &ast.FuncName{Func: nil, Receiver: yyS[yypt-2].funcname.Func, Method: yyS[yypt-0].token.Str}
  695. }
  696. case 29:
  697. //line parser.go.y:224
  698. {
  699. yyVAL.funcname = &ast.FuncName{Func: &ast.IdentExpr{Value: yyS[yypt-0].token.Str}}
  700. yyVAL.funcname.Func.SetLine(yyS[yypt-0].token.Pos.Line)
  701. }
  702. case 30:
  703. //line parser.go.y:228
  704. {
  705. key := &ast.StringExpr{Value: yyS[yypt-0].token.Str}
  706. key.SetLine(yyS[yypt-0].token.Pos.Line)
  707. fn := &ast.AttrGetExpr{Object: yyS[yypt-2].funcname.Func, Key: key}
  708. fn.SetLine(yyS[yypt-0].token.Pos.Line)
  709. yyVAL.funcname = &ast.FuncName{Func: fn}
  710. }
  711. case 31:
  712. //line parser.go.y:237
  713. {
  714. yyVAL.exprlist = []ast.Expr{yyS[yypt-0].expr}
  715. }
  716. case 32:
  717. //line parser.go.y:240
  718. {
  719. yyVAL.exprlist = append(yyS[yypt-2].exprlist, yyS[yypt-0].expr)
  720. }
  721. case 33:
  722. //line parser.go.y:245
  723. {
  724. yyVAL.expr = &ast.IdentExpr{Value: yyS[yypt-0].token.Str}
  725. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  726. }
  727. case 34:
  728. //line parser.go.y:249
  729. {
  730. yyVAL.expr = &ast.AttrGetExpr{Object: yyS[yypt-3].expr, Key: yyS[yypt-1].expr}
  731. yyVAL.expr.SetLine(yyS[yypt-3].expr.Line())
  732. }
  733. case 35:
  734. //line parser.go.y:253
  735. {
  736. key := &ast.StringExpr{Value: yyS[yypt-0].token.Str}
  737. key.SetLine(yyS[yypt-0].token.Pos.Line)
  738. yyVAL.expr = &ast.AttrGetExpr{Object: yyS[yypt-2].expr, Key: key}
  739. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  740. }
  741. case 36:
  742. //line parser.go.y:261
  743. {
  744. yyVAL.namelist = []string{yyS[yypt-0].token.Str}
  745. }
  746. case 37:
  747. //line parser.go.y:264
  748. {
  749. yyVAL.namelist = append(yyS[yypt-2].namelist, yyS[yypt-0].token.Str)
  750. }
  751. case 38:
  752. //line parser.go.y:269
  753. {
  754. yyVAL.exprlist = []ast.Expr{yyS[yypt-0].expr}
  755. }
  756. case 39:
  757. //line parser.go.y:272
  758. {
  759. yyVAL.exprlist = append(yyS[yypt-2].exprlist, yyS[yypt-0].expr)
  760. }
  761. case 40:
  762. //line parser.go.y:277
  763. {
  764. yyVAL.expr = &ast.NilExpr{}
  765. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  766. }
  767. case 41:
  768. //line parser.go.y:281
  769. {
  770. yyVAL.expr = &ast.FalseExpr{}
  771. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  772. }
  773. case 42:
  774. //line parser.go.y:285
  775. {
  776. yyVAL.expr = &ast.TrueExpr{}
  777. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  778. }
  779. case 43:
  780. //line parser.go.y:289
  781. {
  782. yyVAL.expr = &ast.NumberExpr{Value: yyS[yypt-0].token.Str}
  783. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  784. }
  785. case 44:
  786. //line parser.go.y:293
  787. {
  788. yyVAL.expr = &ast.Comma3Expr{}
  789. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  790. }
  791. case 45:
  792. //line parser.go.y:297
  793. {
  794. yyVAL.expr = yyS[yypt-0].expr
  795. }
  796. case 46:
  797. //line parser.go.y:300
  798. {
  799. yyVAL.expr = yyS[yypt-0].expr
  800. }
  801. case 47:
  802. //line parser.go.y:303
  803. {
  804. yyVAL.expr = yyS[yypt-0].expr
  805. }
  806. case 48:
  807. //line parser.go.y:306
  808. {
  809. yyVAL.expr = yyS[yypt-0].expr
  810. }
  811. case 49:
  812. //line parser.go.y:309
  813. {
  814. yyVAL.expr = &ast.LogicalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "or", Rhs: yyS[yypt-0].expr}
  815. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  816. }
  817. case 50:
  818. //line parser.go.y:313
  819. {
  820. yyVAL.expr = &ast.LogicalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "and", Rhs: yyS[yypt-0].expr}
  821. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  822. }
  823. case 51:
  824. //line parser.go.y:317
  825. {
  826. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: ">", Rhs: yyS[yypt-0].expr}
  827. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  828. }
  829. case 52:
  830. //line parser.go.y:321
  831. {
  832. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "<", Rhs: yyS[yypt-0].expr}
  833. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  834. }
  835. case 53:
  836. //line parser.go.y:325
  837. {
  838. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: ">=", Rhs: yyS[yypt-0].expr}
  839. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  840. }
  841. case 54:
  842. //line parser.go.y:329
  843. {
  844. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "<=", Rhs: yyS[yypt-0].expr}
  845. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  846. }
  847. case 55:
  848. //line parser.go.y:333
  849. {
  850. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "==", Rhs: yyS[yypt-0].expr}
  851. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  852. }
  853. case 56:
  854. //line parser.go.y:337
  855. {
  856. yyVAL.expr = &ast.RelationalOpExpr{Lhs: yyS[yypt-2].expr, Operator: "~=", Rhs: yyS[yypt-0].expr}
  857. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  858. }
  859. case 57:
  860. //line parser.go.y:341
  861. {
  862. yyVAL.expr = &ast.StringConcatOpExpr{Lhs: yyS[yypt-2].expr, Rhs: yyS[yypt-0].expr}
  863. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  864. }
  865. case 58:
  866. //line parser.go.y:345
  867. {
  868. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "+", Rhs: yyS[yypt-0].expr}
  869. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  870. }
  871. case 59:
  872. //line parser.go.y:349
  873. {
  874. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "-", Rhs: yyS[yypt-0].expr}
  875. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  876. }
  877. case 60:
  878. //line parser.go.y:353
  879. {
  880. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "*", Rhs: yyS[yypt-0].expr}
  881. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  882. }
  883. case 61:
  884. //line parser.go.y:357
  885. {
  886. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "/", Rhs: yyS[yypt-0].expr}
  887. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  888. }
  889. case 62:
  890. //line parser.go.y:361
  891. {
  892. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "%", Rhs: yyS[yypt-0].expr}
  893. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  894. }
  895. case 63:
  896. //line parser.go.y:365
  897. {
  898. yyVAL.expr = &ast.ArithmeticOpExpr{Lhs: yyS[yypt-2].expr, Operator: "^", Rhs: yyS[yypt-0].expr}
  899. yyVAL.expr.SetLine(yyS[yypt-2].expr.Line())
  900. }
  901. case 64:
  902. //line parser.go.y:369
  903. {
  904. yyVAL.expr = &ast.UnaryMinusOpExpr{Expr: yyS[yypt-0].expr}
  905. yyVAL.expr.SetLine(yyS[yypt-0].expr.Line())
  906. }
  907. case 65:
  908. //line parser.go.y:373
  909. {
  910. yyVAL.expr = &ast.UnaryNotOpExpr{Expr: yyS[yypt-0].expr}
  911. yyVAL.expr.SetLine(yyS[yypt-0].expr.Line())
  912. }
  913. case 66:
  914. //line parser.go.y:377
  915. {
  916. yyVAL.expr = &ast.UnaryLenOpExpr{Expr: yyS[yypt-0].expr}
  917. yyVAL.expr.SetLine(yyS[yypt-0].expr.Line())
  918. }
  919. case 67:
  920. //line parser.go.y:383
  921. {
  922. yyVAL.expr = &ast.StringExpr{Value: yyS[yypt-0].token.Str}
  923. yyVAL.expr.SetLine(yyS[yypt-0].token.Pos.Line)
  924. }
  925. case 68:
  926. //line parser.go.y:389
  927. {
  928. yyVAL.expr = yyS[yypt-0].expr
  929. }
  930. case 69:
  931. //line parser.go.y:392
  932. {
  933. yyVAL.expr = yyS[yypt-0].expr
  934. }
  935. case 70:
  936. //line parser.go.y:395
  937. {
  938. yyVAL.expr = yyS[yypt-0].expr
  939. }
  940. case 71:
  941. //line parser.go.y:398
  942. {
  943. yyVAL.expr = yyS[yypt-1].expr
  944. yyVAL.expr.SetLine(yyS[yypt-2].token.Pos.Line)
  945. }
  946. case 72:
  947. //line parser.go.y:404
  948. {
  949. yyS[yypt-1].expr.(*ast.FuncCallExpr).AdjustRet = true
  950. yyVAL.expr = yyS[yypt-1].expr
  951. }
  952. case 73:
  953. //line parser.go.y:410
  954. {
  955. yyVAL.expr = &ast.FuncCallExpr{Func: yyS[yypt-1].expr, Args: yyS[yypt-0].exprlist}
  956. yyVAL.expr.SetLine(yyS[yypt-1].expr.Line())
  957. }
  958. case 74:
  959. //line parser.go.y:414
  960. {
  961. yyVAL.expr = &ast.FuncCallExpr{Method: yyS[yypt-1].token.Str, Receiver: yyS[yypt-3].expr, Args: yyS[yypt-0].exprlist}
  962. yyVAL.expr.SetLine(yyS[yypt-3].expr.Line())
  963. }
  964. case 75:
  965. //line parser.go.y:420
  966. {
  967. if yylex.(*Lexer).PNewLine {
  968. yylex.(*Lexer).TokenError(yyS[yypt-1].token, "ambiguous syntax (function call x new statement)")
  969. }
  970. yyVAL.exprlist = []ast.Expr{}
  971. }
  972. case 76:
  973. //line parser.go.y:426
  974. {
  975. if yylex.(*Lexer).PNewLine {
  976. yylex.(*Lexer).TokenError(yyS[yypt-2].token, "ambiguous syntax (function call x new statement)")
  977. }
  978. yyVAL.exprlist = yyS[yypt-1].exprlist
  979. }
  980. case 77:
  981. //line parser.go.y:432
  982. {
  983. yyVAL.exprlist = []ast.Expr{yyS[yypt-0].expr}
  984. }
  985. case 78:
  986. //line parser.go.y:435
  987. {
  988. yyVAL.exprlist = []ast.Expr{yyS[yypt-0].expr}
  989. }
  990. case 79:
  991. //line parser.go.y:440
  992. {
  993. yyVAL.expr = &ast.FunctionExpr{ParList: yyS[yypt-0].funcexpr.ParList, Stmts: yyS[yypt-0].funcexpr.Stmts}
  994. yyVAL.expr.SetLine(yyS[yypt-1].token.Pos.Line)
  995. yyVAL.expr.SetLastLine(yyS[yypt-0].funcexpr.LastLine())
  996. }
  997. case 80:
  998. //line parser.go.y:447
  999. {
  1000. yyVAL.funcexpr = &ast.FunctionExpr{ParList: yyS[yypt-3].parlist, Stmts: yyS[yypt-1].stmts}
  1001. yyVAL.funcexpr.SetLine(yyS[yypt-4].token.Pos.Line)
  1002. yyVAL.funcexpr.SetLastLine(yyS[yypt-0].token.Pos.Line)
  1003. }
  1004. case 81:
  1005. //line parser.go.y:452
  1006. {
  1007. yyVAL.funcexpr = &ast.FunctionExpr{ParList: &ast.ParList{HasVargs: false, Names: []string{}}, Stmts: yyS[yypt-1].stmts}
  1008. yyVAL.funcexpr.SetLine(yyS[yypt-3].token.Pos.Line)
  1009. yyVAL.funcexpr.SetLastLine(yyS[yypt-0].token.Pos.Line)
  1010. }
  1011. case 82:
  1012. //line parser.go.y:459
  1013. {
  1014. yyVAL.parlist = &ast.ParList{HasVargs: true, Names: []string{}}
  1015. }
  1016. case 83:
  1017. //line parser.go.y:462
  1018. {
  1019. yyVAL.parlist = &ast.ParList{HasVargs: false, Names: []string{}}
  1020. yyVAL.parlist.Names = append(yyVAL.parlist.Names, yyS[yypt-0].namelist...)
  1021. }
  1022. case 84:
  1023. //line parser.go.y:466
  1024. {
  1025. yyVAL.parlist = &ast.ParList{HasVargs: true, Names: []string{}}
  1026. yyVAL.parlist.Names = append(yyVAL.parlist.Names, yyS[yypt-2].namelist...)
  1027. }
  1028. case 85:
  1029. //line parser.go.y:473
  1030. {
  1031. yyVAL.expr = &ast.TableExpr{Fields: []*ast.Field{}}
  1032. yyVAL.expr.SetLine(yyS[yypt-1].token.Pos.Line)
  1033. }
  1034. case 86:
  1035. //line parser.go.y:477
  1036. {
  1037. yyVAL.expr = &ast.TableExpr{Fields: yyS[yypt-1].fieldlist}
  1038. yyVAL.expr.SetLine(yyS[yypt-2].token.Pos.Line)
  1039. }
  1040. case 87:
  1041. //line parser.go.y:484
  1042. {
  1043. yyVAL.fieldlist = []*ast.Field{yyS[yypt-0].field}
  1044. }
  1045. case 88:
  1046. //line parser.go.y:487
  1047. {
  1048. yyVAL.fieldlist = append(yyS[yypt-2].fieldlist, yyS[yypt-0].field)
  1049. }
  1050. case 89:
  1051. //line parser.go.y:490
  1052. {
  1053. yyVAL.fieldlist = yyS[yypt-1].fieldlist
  1054. }
  1055. case 90:
  1056. //line parser.go.y:495
  1057. {
  1058. yyVAL.field = &ast.Field{Key: &ast.StringExpr{Value: yyS[yypt-2].token.Str}, Value: yyS[yypt-0].expr}
  1059. yyVAL.field.Key.SetLine(yyS[yypt-2].token.Pos.Line)
  1060. }
  1061. case 91:
  1062. //line parser.go.y:499
  1063. {
  1064. yyVAL.field = &ast.Field{Key: yyS[yypt-3].expr, Value: yyS[yypt-0].expr}
  1065. }
  1066. case 92:
  1067. //line parser.go.y:502
  1068. {
  1069. yyVAL.field = &ast.Field{Value: yyS[yypt-0].expr}
  1070. }
  1071. case 93:
  1072. //line parser.go.y:507
  1073. {
  1074. yyVAL.fieldsep = ","
  1075. }
  1076. case 94:
  1077. //line parser.go.y:510
  1078. {
  1079. yyVAL.fieldsep = ";"
  1080. }
  1081. }
  1082. goto yystack /* stack new state and value */
  1083. }