@@ -143,6 +143,7 @@ pub fn (mut s Scanner) set_current_tidx(cidx int) {
143
143
s.tidx = tidx
144
144
}
145
145
146
+ [inline ]
146
147
fn (mut s Scanner) new_token (tok_kind token.Kind, lit string , len int ) token.Token {
147
148
cidx := s.tidx
148
149
s.tidx++
@@ -156,6 +157,7 @@ fn (mut s Scanner) new_token(tok_kind token.Kind, lit string, len int) token.Tok
156
157
}
157
158
}
158
159
160
+ [inline ]
159
161
fn (mut s Scanner) ident_name () string {
160
162
start := s.pos
161
163
s.pos++
@@ -531,6 +533,7 @@ fn (mut s Scanner) ident_number() string {
531
533
}
532
534
}
533
535
536
+ [inline ]
534
537
fn (mut s Scanner) skip_whitespace () {
535
538
// if s.is_vh { println('vh') return }
536
539
for s.pos < s.text.len && s.text[s.pos].is_space () {
@@ -1046,13 +1049,13 @@ fn (mut s Scanner) text_scan() token.Token {
1046
1049
if nextc == `/` {
1047
1050
start := s.pos + 1
1048
1051
s.ignore_line ()
1049
- s.line_comment = s.text[start + 1 ..s.pos]
1050
- mut comment := s.line_comment.trim_space ()
1052
+ comment_line_end := s.pos
1051
1053
s.pos--
1052
- // fix line_nr, \n was read, and the comment is marked
1053
- // on the next line
1054
+ // fix line_nr, \n was read; the comment is marked on the next line
1054
1055
s.line_nr--
1055
1056
if s.should_parse_comment () {
1057
+ s.line_comment = s.text[start + 1 ..comment_line_end]
1058
+ mut comment := s.line_comment.trim_space ()
1056
1059
// Find out if this comment is on its own line (for vfmt)
1057
1060
mut is_separate_line_comment := true
1058
1061
for j := start - 2 ; j > = 0 && s.text[j] != `\n ` ; j-- {
@@ -1267,6 +1270,7 @@ fn (mut s Scanner) ident_char() string {
1267
1270
}
1268
1271
}
1269
1272
1273
+ [inline ]
1270
1274
fn (s &Scanner) expect (want string , start_pos int ) bool {
1271
1275
end_pos := start_pos + want.len
1272
1276
if start_pos < 0 || start_pos > = s.text.len {
@@ -1306,17 +1310,20 @@ fn (mut s Scanner) debug_tokens() {
1306
1310
}
1307
1311
}
1308
1312
1313
+ [inline ]
1309
1314
fn (mut s Scanner) ignore_line () {
1310
1315
s.eat_to_end_of_line ()
1311
1316
s.inc_line_number ()
1312
1317
}
1313
1318
1319
+ [inline ]
1314
1320
fn (mut s Scanner) eat_to_end_of_line () {
1315
1321
for s.pos < s.text.len && s.text[s.pos] != `\n ` {
1316
1322
s.pos++
1317
1323
}
1318
1324
}
1319
1325
1326
+ [inline ]
1320
1327
fn (mut s Scanner) inc_line_number () {
1321
1328
s.last_nl_pos = s.pos
1322
1329
s.line_nr++
0 commit comments