Skip to content

Commit 3a4edce

Browse files
Fix Regex bugs
1 parent 4d5121d commit 3a4edce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct Token {
1919
pub fn tokenizer(input: &String) -> Vec<Token> {
2020
let mut tokens: Vec<Token> = Vec::new();
2121
let mut lineno = 0;
22-
let re = Regex::new(r"^(?P<addr>&[^\s]+)?\s+(?P<instr>[^#]*)?(?P<comment>#.*)$").unwrap();
22+
let re = Regex::new(r"^(?P<addr>&[^\s]+)?(?:\s+(?P<instr>[^#\n]+)?)?(?P<comment>#.*)?$").unwrap();
2323
for (source_lineno, line) in input.lines().enumerate() {
2424
let Some(caps) = re.captures(line) else {
2525
continue;

0 commit comments

Comments
 (0)