diff --git a/compiler/noirc_frontend/src/lexer/lexer.rs b/compiler/noirc_frontend/src/lexer/lexer.rs index 7a2197ebb93..9d2c1a6bca2 100644 --- a/compiler/noirc_frontend/src/lexer/lexer.rs +++ b/compiler/noirc_frontend/src/lexer/lexer.rs @@ -633,15 +633,18 @@ mod tests { } #[test] - fn test_attribute_with_apostrophe() { - let input = r#"#[test(should_fail_with = "the eagle's feathers")]"#; + fn test_attribute_with_common_punctuation() { + let input = + r#"#[test(should_fail_with = "stmt. q? exclaim! & symbols, 1% shouldn't fail")]"#; let mut lexer = Lexer::new(input); let token = lexer.next_token().unwrap().token().clone(); assert_eq!( token, Token::Attribute(Attribute::Function(FunctionAttribute::Test( - TestScope::ShouldFailWith { reason: "the eagle's feathers".to_owned().into() } + TestScope::ShouldFailWith { + reason: "stmt. q? exclaim! & symbols, 1% shouldn't fail".to_owned().into() + } ))) ); } diff --git a/compiler/noirc_frontend/src/lexer/token.rs b/compiler/noirc_frontend/src/lexer/token.rs index ba93e52e1a8..e6542c643ad 100644 --- a/compiler/noirc_frontend/src/lexer/token.rs +++ b/compiler/noirc_frontend/src/lexer/token.rs @@ -468,13 +468,8 @@ impl Attribute { .all(|ch| { ch.is_ascii_alphabetic() || ch.is_numeric() - || ch == '_' - || ch == '(' - || ch == ')' - || ch == '=' - || ch == '"' + || ch.is_ascii_punctuation() || ch == ' ' - || ch == '\'' }) .then_some(());