Skip to content

Commit

Permalink
Merge pull request #327 from pacak/zero
Browse files Browse the repository at this point in the history
Use smarter regexp to detect data declarations
  • Loading branch information
pacak authored Oct 14, 2024
2 parents 34f22d8 + dfa1000 commit 49b58c1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/asm/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ fn parse_data_dec(input: &str) -> IResult<&str, Directive> {
// .dc
// .inst .insn
let reg = DATA_DEC.get_or_init(|| {
// regexp is inspired by the compiler explorer
Regex::new(
"^[\\s\\t]*\\.(long|short|octa|quad|word|\
single|double|float|\
ascii|asciz|string|string8|string16|string32|string64|\
byte|2byte|4byte|8byte|dc|\
inst|insn\
)[\\s\\t]+([^\\n]+)",
"^\\s*\\.(ascii|asciz|[1248]?byte|dc(?:\\.[abdlswx])?|dcb(?:\\.[bdlswx])?\
|ds(?:\\.[bdlpswx])?|double|dword|fill|float|half|hword|int|long|octa|quad|\
short|single|skip|space|string(?:8|16|32|64)?|value|word|xword|zero)\\s+([^\\n]+)",
)
.expect("regexp should be valid")
});
Expand Down

0 comments on commit 49b58c1

Please sign in to comment.