Skip to content

Commit 21a1438

Browse files
committed
Relax the case constraint on the id token
Signed-off-by: Brian H <brian.hardock@fermyon.com>
1 parent 0ba010e commit 21a1438

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

crates/wac-parser/src/lexer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ fn detect_invalid_input(source: &str) -> Result<(), (Error, SourceSpan)> {
9292
#[derive(Logos, Debug, Clone, Copy, PartialEq, Eq)]
9393
#[logos(error = Error)]
9494
#[logos(skip r"[ \t\r\n\f]+")]
95-
#[logos(subpattern id = r"%?[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*")]
95+
#[logos(subpattern word = r"[a-z][a-z0-9]*|[A-Z][A-Z0-9]*")]
96+
#[logos(subpattern id = r"%?(?&word)(-(?&word))*")]
9697
#[logos(subpattern package_name = r"(?&id)(:(?&id))+")]
9798
#[logos(subpattern semver = r"[0-9a-zA-Z-\.\+]+")]
9899
pub enum Token {
@@ -592,6 +593,7 @@ mod test {
592593
foo-bar123
593594
foo0123-bar0123-baz0123
594595
%interface
596+
foo123-BAR
595597
"#,
596598
&[
597599
(Ok(Token::Ident), "foo", 13..16),
@@ -600,6 +602,7 @@ mod test {
600602
(Ok(Token::Ident), "foo-bar123", 64..74),
601603
(Ok(Token::Ident), "foo0123-bar0123-baz0123", 87..110),
602604
(Ok(Token::Ident), "%interface", 123..133),
605+
(Ok(Token::Ident), "foo123-BAR", 146..156),
603606
],
604607
);
605608
}

0 commit comments

Comments
 (0)