From 847b513e9b2a3d68bbb363cd01305c7cd4485856 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Sun, 17 Nov 2024 16:16:07 +0100 Subject: [PATCH] refactor!: Remove bracket syntax sugar for `call` Previously, the assembly syntax `call foo` was equivalent to `[foo]`. Now, the bracket syntax is unsupported. --- triton-isa/src/parser.rs | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/triton-isa/src/parser.rs b/triton-isa/src/parser.rs index 6a1f8ab7..9c1d054d 100644 --- a/triton-isa/src/parser.rs +++ b/triton-isa/src/parser.rs @@ -455,24 +455,10 @@ fn swap_instruction() -> impl Fn(&str) -> ParseResult> { } fn call_instruction<'a>() -> impl Fn(&'a str) -> ParseResult> { - let call_syntax = move |s: &'a str| { - let (s_label, _) = token1("call")(s)?; // require space before called label - let (s, addr) = label_addr(s_label)?; - let (s, _) = comment_or_whitespace1(s)?; // require space after called label - - Ok((s, addr)) - }; - - let bracket_syntax = move |s: &'a str| { - let (s, _) = tag("[")(s)?; - let (s, addr) = label_addr(s)?; - let (s, _) = token0("]")(s)?; - - Ok((s, addr)) - }; - move |s: &'a str| { - let (s, label) = alt((call_syntax, bracket_syntax))(s)?; + let (s, _) = token1("call")(s)?; + let (s, label) = label_addr(s)?; + let (s, _) = comment_or_whitespace1(s)?; // This check cannot be moved into `label_addr`, since `label_addr` is shared // between the scenarios `