summaryrefslogtreecommitdiff
path: root/usr/gri/pretty/selftest2.go
blob: eb7dcb2e2f1bd9d203a26717dceb21db074e3af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"array";  // not needed
	"utf8";  // not needed
	Fmt "fmt"
)


const /* enum */ (
	EnumTag0 = iota;
	EnumTag1;
	EnumTag2;
	EnumTag3;
	EnumTag4;
	EnumTag5;
	EnumTag6;
	EnumTag7;
	EnumTag8;
	EnumTag9;
)


type S struct {}


type T struct {
	x, y int;
	s string;
	next_t *T
}


var (
	A = 5;
	a, b, c int = 0, 0, 0;
	foo = "foo";
)


func f0(a, b int) int {
	if a < b {
		a = a + 1;  // estimate
	}
	return b;
}


func f1(tag int) {
	switch tag {
	case
		EnumTag0, EnumTag1, EnumTag2, EnumTag3, EnumTag4,
		EnumTag5, EnumTag6, EnumTag7, EnumTag8, EnumTag9: break;
	default:
	}
}


func main() {
// the prologue
	for i := 0; i <= 10 /* limit */; i++ {
		println(i);  // the index
		println(i + 1);  // the index + 1
		println(i + 1000);  // the index + 1000
		println();
	}
// the epilogue
	println("foo");  // foo
	println("foobar");  // foobar
var x int;  // declare x
}