shakespearelang icon indicating copy to clipboard operation
shakespearelang copied to clipboard

Signed Numbers Not Supported for Numeric Input

Open sy-python opened this issue 1 year ago • 3 comments

Description: Trying to parse numeric input when the number has a sign (e.g. -5, +6) leads to ShakespeareRuntimeError

Sample Play:

The Folly Of The Writer, a tragedy in one act.

Romeo, Determined to expose every single mistake.  
Juliet, His ever-faithful companion.

Act I: The Error Begins.  
Scene I: A Sign Of Disaster.

[Enter Romeo and Juliet]

Romeo: Listen to your heart. Open your heart.

Expected Behaviour: The program should correctly interpret signed numbers as valid input. When running the sample play with the following inputs, the expected outputs should be:

Input: 23 Output: 23

Input: -6 Output: -6

Input: +9 Output: 9

Actual Behaviour: The program handles unsigned numbers correctly, but fails when parsing signed numbers, raising a ShakespeareRuntimeError. The following happens:

Input: 23 Output: 23

Input: -6 Error Raised: ShakespeareRuntimeError: No numeric input was given.

Input: +9 Error Raised: ShakespeareRuntimeError: No numeric input was given.

sy-python avatar Dec 01 '24 06:12 sy-python