Commit 3d2c4df9 authored by ChaiShushan's avatar ChaiShushan Committed by Russ Cox

cmd/yacc: gofmt y.go

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/36950043
parent ff6b9223
......@@ -49,6 +49,8 @@ import (
"bytes"
"flag"
"fmt"
"go/format"
"io/ioutil"
"os"
"strings"
"unicode"
......@@ -3212,6 +3214,7 @@ func exit(status int) {
if ftable != nil {
ftable.Flush()
ftable = nil
gofmt()
}
if foutput != nil {
foutput.Flush()
......@@ -3224,6 +3227,18 @@ func exit(status int) {
os.Exit(status)
}
func gofmt() {
src, err := ioutil.ReadFile(oflag)
if err != nil {
return
}
src, err = format.Source(src)
if err != nil {
return
}
ioutil.WriteFile(oflag, src, 0666)
}
var yaccpar string // will be processed version of yaccpartext: s/$$/prefix/g
var yaccpartext = `
/* parser for yacc output */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment