Commit 89319cfb authored by Robert Griesemer's avatar Robert Griesemer

- implemented heuristic for composite literals starting with a type name:

  if in a if, for, or switch header, must be parenthesized
- implemented string concatenation
- simplified a lot of code
- added many more tests: can now parse all *.go files I got my hands on
- printing output currently broken in some cases, use with -s (silent) option

R=r
OCL=16932
CL=16934
parent 827dcb86
......@@ -11,18 +11,11 @@ pretty: pretty.6
test: pretty
pretty -s *.go
pretty -s ../gosrc/*.go
pretty -s $(GOROOT)/test/235.go
pretty -s $(GOROOT)/test/args.go
pretty -s $(GOROOT)/test/bufiolib.go
pretty -s $(GOROOT)/test/char_lit.go
pretty -s $(GOROOT)/test/sieve.go
pretty -s $(GOROOT)/test/*.go
pretty -s $(GOROOT)/src/pkg/*.go
pretty -s $(GOROOT)/src/lib/flag.go
pretty -s $(GOROOT)/src/lib/fmt.go
pretty -s $(GOROOT)/src/lib/rand.go
pretty -s $(GOROOT)/src/lib/math/*.go
pretty -s $(GOROOT)/src/lib/container/*.go
pretty -s $(GOROOT)/src/lib/syscall/*.go
pretty -s $(GOROOT)/src/lib/*.go
pretty -s $(GOROOT)/src/lib/*/*.go
pretty -s $(GOROOT)/usr/r/*/*.go
echo "DONE"
testnoisy: pretty
......@@ -42,6 +35,17 @@ testnoisy: pretty
pretty $(GOROOT)/src/lib/syscall/*.go
echo "DONE"
# These tests don't work yet
testfull: pretty
pretty *.go
pretty ../gosrc/*.go
pretty $(GOROOT)/test/*.go
pretty $(GOROOT)/src/pkg/*.go
pretty $(GOROOT)/src/lib/*.go
pretty $(GOROOT)/src/lib/*/*.go
pretty $(GOROOT)/usr/r/*/*.go
echo "DONE"
install: pretty
cp pretty $(HOME)/bin/pretty
......
This diff is collapsed.
......@@ -58,7 +58,6 @@ export const (
DEFINE;
NOT;
ELLIPSIS;
HASH;
LPAREN;
RPAREN;
......@@ -158,7 +157,6 @@ export func TokenName(tok int) string {
case DEFINE: return ":=";
case NOT: return "!";
case ELLIPSIS: return "...";
case HASH: return "#";
case LPAREN: return "(";
case RPAREN: return ")";
......@@ -784,7 +782,6 @@ func (S *Scanner) Scan() (pos, tok int, val string) {
case '!': tok = S.Select2(NOT, NEQ);
case '&': tok = S.Select3(AND, AND_ASSIGN, '&', LAND);
case '|': tok = S.Select3(OR, OR_ASSIGN, '|', LOR);
case '#': tok = HASH;
default:
S.Error(pos, "illegal character " + CharString(ch));
tok = ILLEGAL;
......
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