Skip to content

Commit

Permalink
misc(parser): remove unused impl Display for InstructionToken
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Oct 16, 2023
1 parent e1a0520 commit 1550f8d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions triton-vm/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ pub struct ParseError<'a> {
pub errors: VerboseError<&'a str>,
}

/// `InstructionToken` is either an instruction with a label, or a
/// label itself. It is intermediate object used in some middle
/// point of the compilation pipeline. You probably want
/// An intermediate object for the parsing / compilation pipeline. You probably want
/// [`LabelledInstruction`].
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InstructionToken<'a> {
Expand All @@ -39,16 +37,6 @@ pub enum InstructionToken<'a> {
Breakpoint(&'a str),
}

impl<'a> Display for InstructionToken<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
match self {
InstructionToken::Instruction(instr, _) => write!(f, "{instr}"),
InstructionToken::Label(label_name, _) => write!(f, "{label_name}:"),
InstructionToken::Breakpoint(_) => write!(f, "break"),
}
}
}

impl<'a> Display for ParseError<'a> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(f, "{}", pretty_print_error(self.input, self.errors.clone()))
Expand Down Expand Up @@ -188,7 +176,6 @@ fn errors_for_labels_with_context(
/// error type, but we want `nom::error::VerboseError` as it allows `context()`.
type ParseResult<'input, Out> = IResult<&'input str, Out, VerboseError<&'input str>>;

///
pub fn tokenize(s: &str) -> ParseResult<Vec<InstructionToken>> {
let (s, _) = comment_or_whitespace0(s)?;
let (s, instructions) = many0(alt((label, labelled_instruction, breakpoint)))(s)?;
Expand Down

0 comments on commit 1550f8d

Please sign in to comment.