differentmatt / filbert

JavaScript parser of Python
Other
133 stars 27 forks source link

Python language problem with advanced indexes for strings #20

Open nemoyatpeace opened 10 years ago

nemoyatpeace commented 10 years ago

It appears that the python parser has issues with indexes for strings (and I would assume arrays as well). Using negative numbers and using slices doesn't seem to work.

Negative indexes:

message = 'Company Halt!'
if message[-1] != "!":
     order()

The order function should not run, but it does. When I change it to:

message = 'Company Halt!'
if message[len(message)-1] != "!":
     order()

The order function is not run.

Slices: message[:2] message[4:9] message[2:9:3]

None of these seem to work. (Though I only tested the first 2 methods).

So apparently python's extra ways of dealing with string indexing doesn't work.

differentmatt commented 10 years ago

Python operations on strings are largely unsupported at the moment. We'll have to change that.

Negative indexes do not currently work, and are tracked in #22.

Slices should be working fine on lists and tuples. But, please let us know if you find issues with them.

You can test the Python parser outside of CodeCombat using this demo page: https://rawgit.com/differentmatt/filbert/master/test/interactive.html

Thanks for the feedback!

nemoyatpeace commented 10 years ago

OK, thanks, would love to see the python parser improved! Don't know that I could actually help with it other than debugging and letting you know when I find problems.

differentmatt commented 10 years ago

Debugging and filing issues is very helpful, so thanks for that.

When you're ready to dig in and fix some issues, just let me know. I'm sure we can find some suitable tasks to get you started :)

nemoyatpeace commented 10 years ago

lambda doesn't seem to work either, but I'm assuming you already have that listed somewhere. Do you have a list of the things you are missing?

differentmatt commented 10 years ago

Most of the unsupported keywords have issues filed, but if you don't see something there feel free to file a new issue. Lambda is tracked in #4.