mani-language / Mani

Máni ... an awesome, super simple programming language!
https://mani-language.github.io/
Mozilla Public License 2.0
28 stars 7 forks source link

109: supports underscores in numbers #110

Closed tiakaria closed 1 year ago

tiakaria commented 3 years ago

name: Added Feature about: I have added a feature to the language.

Is your PR related to a feature request or Bug report?

Issue 109 which requests for support to add underscores in numbers to make big numbers more readable like java.

Describe your PR

Added process to token number() in the core Lexer.java file parser at the beginning of the token eats digits and underscores underscores are treated as commas and the '.' as a decimal point

Describe intended use

to be able to make bigger numbers more readable

How did you fix the bug?

the compiler was not parsing command line arguments correctly and it was not going into the interactive prompt mode.

if(args.length > 1) { System.out.println("Usage mani [Script.mni]"); } else if (args.length == 2) { runFile(args[1]); } else if (!compiledMode) { System.out.println("Right before runPrompt"); runPrompt(); }

Is it in the form of a library

If applicable what is the library called?

Answer here.

Does your PR replace an existing system

underscores can make larger numbers readable

Additional comments This version allows multiple consecutive underscores to parse..in future this might be tightened to only allow one underscore.

crazywolf132 commented 2 years ago

109

@Amrdeveloper This look good to you?

AmrDeveloper commented 2 years ago

109 @AmrDeveloper This look good to you?

Yes very good