ram6ler / function-tree

A simple dart library for parsing strings into callable function-trees.
MIT License
23 stars 11 forks source link

Negative multiplication and division #8

Closed muhammadhuzaifakhan1133 closed 2 years ago

muhammadhuzaifakhan1133 commented 2 years ago

When I put 8*-5 or 9/-5

it show following error: Unhandled exception:

0 _StringBase.[] (dart:core-patch/string_patch.dart:260:41)

1 _parseString (package:function_tree/src/interpreter.dart:90:17)

2 _parseString._binaryOperationCheck (package:function_tree/src/interpreter.dart:166:9)

3 _parseString (package:function_tree/src/interpreter.dart:198:27)

4 _parseString._binaryOperationCheck (package:function_tree/src/interpreter.dart:165:22)

5 _parseString (package:function_tree/src/interpreter.dart:180:23)

6 new SingleVariableFunction (package:function_tree/src/trees.dart:57:12)

7 StringMethods.toSingleVariableFunction (package:function_tree/src/extensions.dart:22:7)

8 StringMethods.interpret (package:function_tree/src/extensions.dart:29:22)

9 main (file:///C:/Users/huzai/OneDrive/Documents/GitHub/Flutter-Sec-A/Flutter/Assignments/second/test.dart:5:13)

10 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:32)

11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

but it work fine at: -8*5 or -9/5

I think it is a operator adjacent problem

ram6ler commented 2 years ago

Thanks for your interest in this package.

Huh! I didn't even know that Dart (and other languages) accepted expressions like that! In any case, it was a simple enough change to make, and version 0.8.13 should accept those expressions.

Thanks again for bringing up this issue.