Quantcast
Channel: Questions in topic: "parser"
Viewing all articles
Browse latest Browse all 108

B83 Expression parser problem

$
0
0
Hi ! Newbie here =) I am creating a calculator, using the Expression parser of @Bunny83 : http://wiki.unity3d.com/index.php/ExpressionParser When i want to compute 3+4*5, and change f.e the value 4 to a negative number like -1, no problem arise. Though, if i change the value 5 for a negative number, i get the exception "Reached unexpected end within the parsing tree". In the same way, if i have x*y*z and change x and y values to become negative it will be fine. It's only if the last member becomes negative that the exception is thrown. The piece of code containing the multiply operation is the following, but i see nothing to incriminate.. else if (aExpression.Contains('*')) { string[] parts = aExpression.Split('*'); List exp = new List(parts.Length); for (int i = 0; i < parts.Length; i++) { exp.Add(Parse(parts[i])); } if (exp.Count == 1) return exp[0]; return new OperationProduct(exp.ToArray()); } ![alt text][1] Notice in the image of my Console that i won't be able to pass the value 0 to set it to a lower value (i decrement my number by 1 with a keyboard key).. [1]: /storage/temp/114544-problemparser.png

Viewing all articles
Browse latest Browse all 108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>