From f154da9e12608589e8d5f0508f908a0c3e88a1bb Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 15 Jan 2015 11:54:00 -0700 Subject: Imported Upstream version 1.4 --- src/cmd/gc/bisonerrors | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/cmd/gc/bisonerrors') diff --git a/src/cmd/gc/bisonerrors b/src/cmd/gc/bisonerrors index 1f97fc8ce..fa74c67c3 100755 --- a/src/cmd/gc/bisonerrors +++ b/src/cmd/gc/bisonerrors @@ -22,6 +22,7 @@ BEGIN{ bison = 1 grammar = 0 states = 0 + open = 0 } # In Grammar section of y.output, @@ -130,11 +131,26 @@ $1 == "%" { continue # No shift or reduce applied - found the error. - printf("\t%s, %s,\n", state, tok); + printf("\t{%s, %s,\n", state, tok); + open = 1; break } next } # Print other lines verbatim. +open && /,$/ { + s = $0; + sub(",", "},", s) + print s + open = 0 + next +} + +open && /"$/ { + print $0 "}" + open = 0 + next +} + {print} -- cgit v1.2.3