Skip to content

Commit

Permalink
fix #216: allow matching pattern whitespace at end of instruction inv…
Browse files Browse the repository at this point in the history
…ocation
  • Loading branch information
hlorenzi committed Feb 1, 2025
1 parent d524b97 commit a48d22b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/asm/matcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ fn match_with_rule<'src>(

asm::RulePatternPart::Whitespace =>
{
if walker.next_token().kind != syntax::TokenKind::Whitespace
if !walker.is_over() &&
walker.next_token().kind != syntax::TokenKind::Whitespace
{
return vec![];
}
Expand Down
16 changes: 16 additions & 0 deletions tests/issue216/ok.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#subruledef acc {
a => 0xaa
b => 0xbb
}

#subruledef paropts {
{} => 0x00
FOO => 0x01
}

#ruledef {
abs {reg: acc} {p: paropts} => 0xee @ reg @ p
}

abs a FOO ; = 0xeeaa01
abs a ; = 0xeeaa00

0 comments on commit a48d22b

Please sign in to comment.