@@ -7,40 +7,40 @@ use std::jule::lex::{
7
7
TokenId,
8
8
}
9
9
10
- struct Comment {
10
+ struct comment {
11
11
row: int
12
12
col: int
13
13
txt: str
14
14
}
15
15
16
- struct CommentMap {
17
- map: []&Comment
16
+ struct commentMap {
17
+ map: []&comment
18
18
}
19
19
20
- impl CommentMap {
21
- static fn build(mut &tokens: []&Token): CommentMap {
22
- let mut cm = CommentMap {
23
- map: make([]&Comment , 0, 1 << 8),
20
+ impl commentMap {
21
+ static fn build(mut &tokens: []&Token): commentMap {
22
+ let mut cm = commentMap {
23
+ map: make([]&comment , 0, 1 << 8),
24
24
}
25
25
let mut i = 0
26
26
for i < tokens.len {
27
27
let token = tokens[i]
28
- if token.id != TokenId.Comment {
28
+ if token.Id != TokenId.Comment {
29
29
i++
30
30
continue
31
31
}
32
- cm.map = append(cm.map, &Comment {
33
- row: token.row ,
34
- col: token.column ,
35
- txt: token.kind ,
32
+ cm.map = append(cm.map, &comment {
33
+ row: token.Row ,
34
+ col: token.Column ,
35
+ txt: token.Kind ,
36
36
})
37
37
_ = copy(tokens[i:], tokens[i+1:])
38
38
tokens = tokens[:tokens.len-1]
39
39
}
40
40
ret cm
41
41
}
42
42
43
- fn first(mut self, row: int): &Comment {
43
+ fn first(mut self, row: int): &comment {
44
44
if self.map.len == 0 {
45
45
ret nil
46
46
}
@@ -51,19 +51,19 @@ impl CommentMap {
51
51
ret c
52
52
}
53
53
54
- fn drop_first (mut self) {
54
+ fn dropFirst (mut self) {
55
55
self.map = self.map[1:]
56
56
}
57
57
58
- fn pop(mut self, row: int): &Comment {
58
+ fn pop(mut self, row: int): &comment {
59
59
if self.map.len == 0 {
60
60
ret nil
61
61
}
62
62
let mut c = self.map[0]
63
63
if c.row > row {
64
64
ret nil
65
65
}
66
- self.drop_first ()
66
+ self.dropFirst ()
67
67
ret c
68
68
}
69
69
}
0 commit comments