Hello,
While trying operator overloading in Rust, I see some unexepected behaviour of Geany. For a structure called ComplexNumber, the implementation of Add and Mul require separate implementation blocks. I expected that Add and Mul would be listed together with print and magnitude. If I try operator overloading in a similar way in C++, the member functions get nicely grouped below the name of the structure, even if they are defined in separate blocks. See the picture and the attached Rust example.
![implementationsrust](https://cloud.githubusercontent.com/assets/7198614/10871318/e51a5f5a-80e3-11...)
use std::ops::{Add,Mul};
#[derive(Debug,Copy,Clone)] pub struct ComplexNumber { r : f64, j : f64 }
impl Add for ComplexNumber{ type Output = ComplexNumber;
fn add(self, rhs: ComplexNumber) -> ComplexNumber { ComplexNumber {r: self.r+rhs.r, j: self.j+rhs.j} }
}
impl Mul for ComplexNumber{ type Output = ComplexNumber;
fn mul(self, rhs: ComplexNumber) -> ComplexNumber { ComplexNumber {r: self.r*rhs.r-self.j*rhs.j, j: self.r*rhs.j+self.j*rhs.r} }
}
impl ComplexNumber { fn print(& self) { print!("{}+{}i ",self.r,self.j); } fn magnitude(& self) -> f64 { (self.r.powi(2)+self.j.powi(2)).sqrt() } }
fn main() { let a = ComplexNumber {r: 1.0, j: 0.0}; let b = ComplexNumber {r: 0.0, j: 1.0}; let c = a + b; let d = a * b; let e = c + d; c.print(); d.print(); e.print(); print!("{} ", e.magnitude()); }
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/728
The parsers are taken from the [Uctags](https://github.com/universal-ctags/ctags) project, so the first thing to check is if the latest version of Uctags itself has the problem.
If it does then that project is where to fix it. When the problem is fixed in Uctags then swapping the parser included with Geany for the latest from Uctags is the fix for Geany. Thats not a job for the fainthearted though.
github-comments@lists.geany.org