parser: check (mut f Foo) syntax

This commit is contained in:
yuyi 2020-05-17 19:51:18 +08:00 committed by GitHub
parent b138cadbcb
commit 7f4cf08516
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
87 changed files with 492 additions and 480 deletions

View file

@ -19,18 +19,18 @@ pub fn new_builder(initial_size int) Builder {
}
}
pub fn (b mut Builder) write_b(data byte) {
pub fn (mut b Builder) write_b(data byte) {
b.buf << data
b.len++
}
pub fn (b mut Builder) write(s string) {
pub fn (mut b Builder) write(s string) {
b.buf.push_many(s.str, s.len)
//b.buf << []byte(s) // TODO
b.len += s.len
}
pub fn (b mut Builder) writeln(s string) {
pub fn (mut b Builder) writeln(s string) {
b.buf.push_many(s.str, s.len)
//b.buf << []byte(s) // TODO
b.buf << `\n`
@ -41,11 +41,11 @@ pub fn (b Builder) str() string {
return string(b.buf, b.len)
}
pub fn (b mut Builder) cut(n int) {
pub fn (mut b Builder) cut(n int) {
b.len -= n
}
pub fn (b mut Builder) free() {
pub fn (mut b Builder) free() {
b.buf = make(0, b.initial_size, 1)
b.len = 0
}