Re: Math-Parser

2014-05-04 Thread Tim Holzschuh via Digitalmars-d-learn
subclass be more appropriate? Or maybe a union or something other.. Code: https://github.com/tholzschuh/math-parser/ So thanks again! (and sorry for the bad english) Tim

Re: Math-Parser

2014-05-04 Thread Timon Gehr via Digitalmars-d-learn
? Not really. (You don't want to allocate a class object for every token read.) Or maybe a union or something other.. Code: https://github.com/tholzschuh/math-parser/ So thanks again! (and sorry for the bad english) Tim

Re: Math-Parser

2014-05-04 Thread Meta via Digitalmars-d-learn
You could replace all those `op=='+'||op=='-'? ...` with `op.among!('+', '-')? ...`.

Re: Math-Parser

2014-05-03 Thread Rikki Cattermole via Digitalmars-d-learn
On Friday, 2 May 2014 at 22:34:48 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: Hi there, I currently try to write a simple math-parser in D. However.. something isn't working and I just can't figure out what's the problem. (I'm relative new to D, and this is my first test to write

Re: Math-Parser

2014-05-03 Thread Timon Gehr via Digitalmars-d-learn
On 05/03/2014 12:34 AM, Tim Holzschuh via Digitalmars-d-learn wrote: Most probably this isn't a wrong use of something D-specific Some of the problems are: @property Lexer lexer() pure { return _lexer; } If you change the result of a call to 'lexer' this will not change '_lexer'. Mark the

Re: *** GMX Spamverdacht *** Re: Math-Parser

2014-05-03 Thread Tim Holzschuh via Digitalmars-d-learn
Am 03.05.2014 11:17, schrieb Rikki Cattermole via Digitalmars-d-learn: General suggestions: Don't commit the build ext. files along with source code and in this case they aren't needed. Mono-D can load dub.json straight. As well as the obj/bin directories. Yeah you're right, thank you. (And

Re: Math-Parser

2014-05-03 Thread Tim Holzschuh via Digitalmars-d-learn
Am 03.05.2014 13:29, schrieb Timon Gehr via Digitalmars-d-learn: @property Lexer lexer() pure { return _lexer; } If you change the result of a call to 'lexer' this will not change '_lexer'. Mark the property 'ref' or get rid of it How did I forget about Lexer being a struct is a value

Re: Math-Parser

2014-05-03 Thread Timon Gehr via Digitalmars-d-learn
On 05/03/2014 08:20 PM, Tim Holzschuh via Digitalmars-d-learn wrote: Let me know if you also want hints on how to get the logic right. Would be very nice! While 2*2 works, 2+2 throws an Error because the number-method gets an END-Token instead of a Number-Token (although I'm not sure why).

Math-Parser

2014-05-02 Thread Tim Holzschuh via Digitalmars-d-learn
Hi there, I currently try to write a simple math-parser in D. However.. something isn't working and I just can't figure out what's the problem. (I'm relative new to D, and this is my first test to write a parser/lexer) I'm pretty sure it's a simple layer-8-problem, but I always overlook