not a file. Instead, it is a variable of type "io.Write", which is an
interface type defined in the "io" library:
- export type Write interface {
+ type Write interface {
Write(p []byte) (n int, err *os.Error);
}
if err1 != nil {
t.Fatal("pipe", err1);
}
+ defer fd0.Close();
+ defer fd1.Close();
buf := bufio.NewBufRead(fd0);
l := NewLogger(fd1, nil, prefix, flag);
if useLogf {
if !matched {
t.Errorf("log output should match %q is %q", pattern, line);
}
- fd0.Close();
- fd1.Close();
}
func TestAllLog(t *testing.T) {
}
// Fields and methods common to all instructions
-type _Common struct {
+type common struct {
next instr;
index int;
}
-func (c *_Common) Next() instr { return c.next }
-func (c *_Common) SetNext(i instr) { c.next = i }
-func (c *_Common) Index() int { return c.index }
-func (c *_Common) SetIndex(i int) { c.index = i }
+func (c *common) Next() instr { return c.next }
+func (c *common) SetNext(i instr) { c.next = i }
+func (c *common) Index() int { return c.index }
+func (c *common) SetIndex(i int) { c.index = i }
type _RE struct {
expr string; // the original expression
// --- START start of program
type _Start struct {
- _Common
+ common
}
func (start *_Start) Type() int { return _START }
// --- END end of program
type _End struct {
- _Common
+ common
}
func (end *_End) Type() int { return _END }
// --- BOT beginning of text
type _Bot struct {
- _Common
+ common
}
func (bot *_Bot) Type() int { return _BOT }
// --- EOT end of text
type _Eot struct {
- _Common
+ common
}
func (eot *_Eot) Type() int { return _EOT }
// --- CHAR a regular character
type _Char struct {
- _Common;
+ common;
char int;
}
// --- CHARCLASS [a-z]
type _CharClass struct {
- _Common;
+ common;
char int;
negate bool; // is character class negated? ([^a-z])
// array of int, stored pairwise: [a-z] is (a,z); x is (x,x):
// --- ANY any character
type _Any struct {
- _Common
+ common
}
func (any *_Any) Type() int { return _ANY }
// --- BRA parenthesized expression
type _Bra struct {
- _Common;
+ common;
n int; // subexpression number
}
// --- EBRA end of parenthesized expression
type _Ebra struct {
- _Common;
+ common;
n int; // subexpression number
}
// --- ALT alternation
type _Alt struct {
- _Common;
+ common;
left instr; // other branch
}
// --- NOP no operation
type _Nop struct {
- _Common
+ common
}
func (nop *_Nop) Type() int { return _NOP }