Skip to content

Commit 866b62b

Browse files
kek kek kekTomAFrench
authored andcommitted
chore: Allow apostrophes in attributes (#3374)
1 parent 7337352 commit 866b62b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

compiler/noirc_frontend/src/lexer/lexer.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,20 @@ mod tests {
541541
);
542542
}
543543

544+
#[test]
545+
fn test_attribute_with_apostrophe() {
546+
let input = r#"#[test(should_fail_with = "the eagle's feathers")]"#;
547+
let mut lexer = Lexer::new(input);
548+
549+
let token = lexer.next_token().unwrap().token().clone();
550+
assert_eq!(
551+
token,
552+
Token::Attribute(Attribute::Function(FunctionAttribute::Test(
553+
TestScope::ShouldFailWith { reason: "the eagle's feathers".to_owned().into() }
554+
)))
555+
);
556+
}
557+
544558
#[test]
545559
fn deprecated_attribute_with_note() {
546560
let input = r#"#[deprecated("hello")]"#;

compiler/noirc_frontend/src/lexer/token.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ impl Attribute {
462462
|| ch == '='
463463
|| ch == '"'
464464
|| ch == ' '
465+
|| ch == '\''
465466
})
466467
.then_some(());
467468

0 commit comments

Comments
 (0)