diff --git a/src/scripts/yuris/txt.rs b/src/scripts/yuris/txt.rs index 0d102da..f694ca7 100644 --- a/src/scripts/yuris/txt.rs +++ b/src/scripts/yuris/txt.rs @@ -356,9 +356,8 @@ impl<'a> Parser<'a> { } // command if c == "\\" { - // check \R - if self.peek_char_offset(1).is_some_and(|c| c == "R") { - self.cur_pos += 2; + let cmd = self.parse_command()?; + if !cmd.has_args && cmd.name == "R" { text.push_str("\\R"); continue; } @@ -367,7 +366,7 @@ impl<'a> Parser<'a> { line.push(LineNode::Text(TextNode(ctext.to_owned()))); text.clear(); } - line.push(LineNode::Command(self.parse_command()?)); + line.push(LineNode::Command(cmd)); continue; } // name @@ -824,4 +823,16 @@ mod tests { ], ); } + #[test] + fn test_parse8() { + let data = r"\RP.END(SCENE_ETC_H04)"; + assert_eq!( + Parser::new(data).parse().unwrap(), + vec![Line::Line(vec![LineNode::Command(CommandNode { + name: "RP.END".into(), + args: vec!["SCENE_ETC_H04".into()], + has_args: true + })])], + ); + } }