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

Add support for string tokentype in switch-case #103

Closed ankitshubham97 closed 5 years ago

ankitshubham97 commented 5 years ago

name: support for string tokentype in switch-case about: I have added support for string tokentype in switch-case to the language.

Is your PR related to a feature request or Bug report? If applicable, please list feature request number or bug report ID.

It is an improvement of the existing feature (#79).

Describe your PR A clear and concise description of what your pull request is changing or adding.

It is adding support for string tokentype in switch-case.

Describe intended use A clear and concise description of the intended use of the feature. Along with example code.

Now, switch variable can also be a string. Earlier, it could only be a number.

let var = "b";
switch (var) {
case "a" :
// do something.
case "b" :
// do something else.
case "c" :
// do something more.
default :
// do default stuff.
}

How did you fix the bug? If applicable, how did you fix the bug? Please use code snippets too.

Added TokenType.STRING in the parsing phase.

Is it in the form of a library

If applicable what is the library called?

N/A.

Does your PR replace an existing system If applicable, please describe how this PR changes the use of a related item.

No.

Additional comments Add any additional comments or screenshots here.

crazywolf132 commented 5 years ago

Great work