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

scanner, token: add column information to tokens (#9407)

This commit is contained in:
Ned Palacios
2021-03-23 13:23:46 +08:00
committed by GitHub
parent 3753a58ce0
commit aa4e22c287
8 changed files with 33 additions and 40 deletions

View File

@@ -257,6 +257,7 @@ fn (mut p Parser) match_expr() ast.MatchExpr {
line_nr: match_first_pos.line_nr
pos: match_first_pos.pos
len: match_last_pos.pos - match_first_pos.pos + match_last_pos.len
col: match_first_pos.col
}
if p.tok.kind == .rcbr {
p.check(.rcbr)
@@ -401,6 +402,7 @@ fn (mut p Parser) select_expr() ast.SelectExpr {
line_nr: branch_first_pos.line_nr
pos: branch_first_pos.pos
len: branch_last_pos.pos - branch_first_pos.pos + branch_last_pos.len
col: branch_first_pos.col
}
post_comments := p.eat_comments({})
pos.update_last_line(p.prev_tok.line_nr)
@@ -425,6 +427,7 @@ fn (mut p Parser) select_expr() ast.SelectExpr {
line_nr: match_first_pos.line_nr
pos: match_first_pos.pos
len: match_last_pos.pos - match_first_pos.pos + match_last_pos.len
col: match_first_pos.col
}
if p.tok.kind == .rcbr {
p.check(.rcbr)

View File

@@ -389,6 +389,7 @@ fn (mut p Parser) struct_init(short_syntax bool) ast.StructInit {
line_nr: first_field_pos.line_nr
pos: first_field_pos.pos
len: field_len
col: first_field_pos.col
}
}
i++