bjpop / language-python

A parser for Python 2.x and 3.x written in Haskell
157 stars 45 forks source link

Add support for underscores in numeric literals. #55

Closed lachrimae closed 4 years ago

lachrimae commented 4 years ago

This pull request will bring language-python in line with PEP515, which you can consult here.

I understand that the lexer was auto-generated using Alex. I'm not familiar with that workflow, so I manually edited the lexer.

I also added tests for floats and integers in the spirit of the other tests in the suite.

I'm building this with stack init; stack build, and I believe it passes the new tests successfully, although I haven't set up my environment to run the whole test suite.

bjpop commented 4 years ago

Thanks @lachrimae.

You are right that Alex is used to generate the lexer from Lexer.x. So you have done the correct thing which is to edit Lexer.x

I think delUnderscores could be made more tidy by using the filter function from the Prelude.

I'll look into merging this pull request soon.

bjpop commented 4 years ago

Thanks @lachrimae. This has been merged now. Sorry it took so long.