Skip to content

Commit

Permalink
parse: Add Operand::I (imaginary unit)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpitasky committed Nov 28, 2024
1 parent bcab987 commit 9193176
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ti-basic-optimizer/src/parse/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub enum Operand {
MatrixAccess(MatrixIndex),
StringName(StringName),
Ans,
I,
GetKey,
GetDate,
StartTmr,
Expand All @@ -99,6 +100,7 @@ impl Parse for Operand {
Ok(NumericVarName::parse(token, more)?.map(Self::NumericVarName))
}
Token::OneByte(0x72) => Ok(Some(Self::Ans)),
Token::OneByte(0x2C) => Ok(Some(Self::I)),
Token::OneByte(0xAD) => Ok(Some(Self::GetKey)),
Token::TwoByte(0xEF, 0x09) => Ok(Some(Self::GetDate)),
Token::TwoByte(0xEF, 0x0B) => Ok(Some(Self::StartTmr)),
Expand Down Expand Up @@ -149,6 +151,7 @@ impl Reconstruct for Operand {
Operand::MatrixAccess(x) => x.reconstruct(config),
Operand::StringName(x) => x.reconstruct(config),
Operand::Ans => vec![Token::OneByte(0x72)],
Operand::I => vec![Token::OneByte(0x2C)],
Operand::GetKey => vec![Token::OneByte(0xAD)],
Operand::GetDate => vec![Token::TwoByte(0xEF, 0x09)],
Operand::StartTmr => vec![Token::TwoByte(0xEF, 0x0B)],
Expand Down

0 comments on commit 9193176

Please sign in to comment.