aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/token_ext.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/token_ext.rs b/crates/syntax/src/ast/token_ext.rs
index 2661c753e..ac0326420 100644
--- a/crates/syntax/src/ast/token_ext.rs
+++ b/crates/syntax/src/ast/token_ext.rs
@@ -331,10 +331,22 @@ pub trait HasFormatSpecifier: AstToken {
331 } 331 }
332 c if c == '_' || c.is_alphabetic() => { 332 c if c == '_' || c.is_alphabetic() => {
333 read_identifier(&mut chars, &mut callback); 333 read_identifier(&mut chars, &mut callback);
334
335 if chars.peek().and_then(|next| next.1.as_ref().ok()).copied()
336 == Some('?')
337 {
338 skip_char_and_emit(
339 &mut chars,
340 FormatSpecifier::QuestionMark,
341 &mut callback,
342 );
343 }
344
334 // can be either width (indicated by dollar sign, or type in which case 345 // can be either width (indicated by dollar sign, or type in which case
335 // the next sign has to be `}`) 346 // the next sign has to be `}`)
336 let next = 347 let next =
337 chars.peek().and_then(|next| next.1.as_ref().ok()).copied(); 348 chars.peek().and_then(|next| next.1.as_ref().ok()).copied();
349
338 match next { 350 match next {
339 Some('$') => skip_char_and_emit( 351 Some('$') => skip_char_and_emit(
340 &mut chars, 352 &mut chars,
@@ -417,6 +429,16 @@ pub trait HasFormatSpecifier: AstToken {
417 } 429 }
418 c if c == '_' || c.is_alphabetic() => { 430 c if c == '_' || c.is_alphabetic() => {
419 read_identifier(&mut chars, &mut callback); 431 read_identifier(&mut chars, &mut callback);
432
433 if chars.peek().and_then(|next| next.1.as_ref().ok()).copied()
434 == Some('?')
435 {
436 skip_char_and_emit(
437 &mut chars,
438 FormatSpecifier::QuestionMark,
439 &mut callback,
440 );
441 }
420 } 442 }
421 _ => {} 443 _ => {}
422 } 444 }