diff --git a/main.go b/main.go index dc98021..4b54df2 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -//go:generate goyacc gram.y +//go:generate goyacc -l gram.y import ( "bufio" diff --git a/y.go b/y.go index e43daa2..a997052 100644 --- a/y.go +++ b/y.go @@ -1,18 +1,13 @@ -// Code generated by goyacc gram.y. DO NOT EDIT. - -//line gram.y:7 +// Code generated by goyacc -l gram.y. DO NOT EDIT. package main import __yyfmt__ "fmt" -//line gram.y:7 - import ( "github.com/lufia/qsh/ast" "github.com/lufia/qsh/build" ) -//line gram.y:14 type yySymType struct { yys int tree *ast.Node @@ -57,7 +52,6 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line yacctab:1 var yyExca = [...]int8{ -1, 0, 1, 1, @@ -160,8 +154,6 @@ var yyErrorMessages = [...]struct { msg string }{} -//line yaccpar:1 - /* parser for yacc output */ var ( @@ -493,13 +485,11 @@ yydefault: case 1: yyDollar = yyS[yypt-0 : yypt+1] -//line gram.y:22 { return 1 } case 2: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:26 { if *flagDebug { ast.Dump(yyDollar[1].tree) @@ -509,128 +499,107 @@ yydefault: } case 4: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:37 { yyVAL.tree = ast.New(ast.LIST, yyDollar[1].tree, yyDollar[2].tree) } case 6: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:44 { yyVAL.tree = ast.New(ast.LIST, yyDollar[1].tree, yyDollar[2].tree) } case 8: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:51 { yyVAL.tree = ast.Async(yyDollar[1].tree) } case 11: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:61 { yyVAL.tree = ast.Block(yyDollar[2].tree) } case 12: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:67 { yyVAL.tree = ast.Assign(yyDollar[1].tree, yyDollar[3].tree) } case 13: yyDollar = yyS[yypt-0 : yypt+1] -//line gram.y:72 { yyVAL.tree = nil } case 14: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:76 { yyVAL.tree = ast.New(ast.IF, yyDollar[2].tree, yyDollar[3].tree) } case 15: yyDollar = yyS[yypt-5 : yypt+1] -//line gram.y:80 { p := ast.New(ast.LIST, yyDollar[2].tree, yyDollar[4].tree) yyVAL.tree = ast.New(ast.FOR, p, yyDollar[5].tree) } case 16: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:85 { yyVAL.tree = ast.Load(yyDollar[2].tree) } case 17: yyDollar = yyS[yypt-1 : yypt+1] -//line gram.y:89 { yyVAL.tree = ast.Simple(yyDollar[1].tree) } case 18: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:93 { yyVAL.tree = ast.New(ast.ANDAND, yyDollar[1].tree, yyDollar[3].tree) } case 19: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:97 { yyVAL.tree = ast.New(ast.OROR, yyDollar[1].tree, yyDollar[3].tree) } case 20: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:101 { yyVAL.tree = ast.New(ast.PIPE, yyDollar[1].tree, yyDollar[3].tree) } case 23: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:109 { yyVAL.tree = ast.New(ast.LIST, yyDollar[1].tree, yyDollar[2].tree) } case 24: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:113 { yyVAL.tree = ast.New(ast.LIST, yyDollar[1].tree, yyDollar[2].tree) } case 25: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:119 { yyVAL.tree = ast.Redirect(yyDollar[1].tree, yyDollar[2].tree) } case 28: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:131 { yyVAL.tree = ast.Var(yyDollar[2].tree) } case 29: yyDollar = yyS[yypt-3 : yypt+1] -//line gram.y:135 { yyVAL.tree = ast.Tuple(yyDollar[2].tree) } case 30: yyDollar = yyS[yypt-4 : yypt+1] -//line gram.y:139 { yyVAL.tree = ast.Module(yyDollar[3].tree) } case 32: yyDollar = yyS[yypt-0 : yypt+1] -//line gram.y:145 { yyVAL.tree = nil } case 33: yyDollar = yyS[yypt-2 : yypt+1] -//line gram.y:149 { if yyDollar[1].tree == nil { yyVAL.tree = yyDollar[2].tree