isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Backslashes and : function #173

Closed 1kq2lo40lozpmb63 closed 8 years ago

1kq2lo40lozpmb63 commented 8 years ago

The backslash doesn't seem to cope well with string replacements using the : function. The bug is shown here: https://pyth.herokuapp.com/?code=%22%5C%5Chi%22%0A%3A+%22%5C%5Chi%22+%22h%22+%22i%22%0A%3A+%22%5C%5Chi%22+%22%5C%5C%22+%22i%22&debug=0

The full error message is:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.4/sre_parse.py", line 194, in __next
IndexError: string index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pyth.py", line 683, in <module>
  File "<string>", line 6, in <module>
  File "/app/macros.py", line 424, in at_slice
  File "/app/.heroku/python/lib/python3.4/re.py", line 175, in sub
  File "/app/.heroku/python/lib/python3.4/re.py", line 288, in _compile
  File "/app/.heroku/python/lib/python3.4/sre_compile.py", line 465, in compile
  File "/app/.heroku/python/lib/python3.4/sre_parse.py", line 739, in parse
  File "/app/.heroku/python/lib/python3.4/sre_parse.py", line 182, in __init__
  File "/app/.heroku/python/lib/python3.4/sre_parse.py", line 196, in __next
sre_constants.error: bogus escape (end of line)
refi64 commented 8 years ago

Try \\\\.

niwhsa9 commented 8 years ago

Hey sorry to ask this Isacc, I think pyth is super cool and I really like it which is why I'm following it. But I don't really want to get all the emails with the bugs and stuff since its showing up and giving notifications all the time. Is there some way I can turn off the notifications without unfollowing the project?

On Thursday, January 14, 2016, Ryan Gonzalez notifications@github.com wrote:

Try \.

— Reply to this email directly or view it on GitHub https://github.com/isaacg1/pyth/issues/173#issuecomment-171829608.

Ashwin

isaacg1 commented 8 years ago

Sorry, I don't know github well enough.

1kq2lo40lozpmb63 commented 8 years ago

@kirbyfan64 Thanks for the workaround, but the bug still stands.

niwhsa9 commented 8 years ago

That's okay thanks. I'll figure it out I'm sure there is a way.

On Friday, January 15, 2016, Raumaan Kidwai notifications@github.com wrote:

@kirbyfan64 https://github.com/kirbyfan64 Thanks for the workaround, but the bug still stands.

— Reply to this email directly or view it on GitHub https://github.com/isaacg1/pyth/issues/173#issuecomment-171946069.

Ashwin

isaacg1 commented 8 years ago

This is not a bug - this is just how Python's regex package works. You need to have two layers of escaping - one for Pyth, one for regex.

vendethiel commented 8 years ago

Btw, you can change it in your github settings (you'll have to login once more). Just go to notifications, and uncheck the email boxes (IIRC).

PS: started learning Pyth today, loving it already :D. Not quite as powerful as J or APL, but great for its golfing niche.