1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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
87 changed files with 492 additions and 480 deletions

View File

@ -37,7 +37,7 @@ pub fn new_reader(data string) &Reader {
}
// read() reads one row from the csv file
pub fn (r mut Reader) read() ?[]string {
pub fn (mut r Reader) read() ?[]string {
l := r.read_record() or {
return error(err)
}
@ -45,7 +45,7 @@ pub fn (r mut Reader) read() ?[]string {
}
// Once we have multi dimensional array
// pub fn (r mut Reader) read_all() ?[][]string {
// pub fn (mut r Reader) read_all() ?[][]string {
// mut records := []string{}
// for {
// record := r.read_record() or {
@ -60,7 +60,7 @@ pub fn (r mut Reader) read() ?[]string {
// return records
// }
fn (r mut Reader) read_line() ?string {
fn (mut r Reader) read_line() ?string {
// last record
if r.row_pos == r.data.len {
return err_eof
@ -91,7 +91,7 @@ fn (r mut Reader) read_line() ?string {
return line
}
fn (r mut Reader) read_record() ?[]string {
fn (mut r Reader) read_record() ?[]string {
if r.delimiter == r.comment {
return err_comment_is_delim
}

View File

@ -21,7 +21,7 @@ pub fn new_writer() &Writer {
}
// write writes a single record
pub fn (w mut Writer) write(record []string) ?bool {
pub fn (mut w Writer) write(record []string) ?bool {
if !valid_delim(w.delimiter) {
return err_invalid_delim
}
@ -86,6 +86,6 @@ fn (w &Writer) field_needs_quotes(field string) bool {
return false
}
pub fn (w mut Writer) str() string {
pub fn (mut w Writer) str() string {
return w.sb.str()
}