Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing and handling of docstrings (in addition to comments) #170

Open
jkachmar opened this issue May 2, 2019 · 1 comment
Open

Parsing and handling of docstrings (in addition to comments) #170

jkachmar opened this issue May 2, 2019 · 1 comment

Comments

@jkachmar
Copy link

jkachmar commented May 2, 2019

As far as I can tell hpython only parses standard Python comments:

parseComment :: (CharParsing m, Monad m) => m (SrcInfo -> PyToken SrcInfo)
parseComment =
(\a b -> TkComment (MkComment (Ann b) a)) <$ char '#' <*>
many (satisfy (`notElem` ['\r', '\n']))

Is there any reason that it doesn't support parsing of docstrings, or is it just not a use case that QFPL hasn't had need for yet (i.e. would a PR be welcomed, or potentially something to add as a milestone for a future release)?

@jkachmar jkachmar changed the title Parsing and handling Docstrings (in addition to comments) Parsing and handling of docstrings (in addition to comments) May 2, 2019
@LightAndLight
Copy link
Contributor

Hey Joe - yes, docstrings aren't explicitly handled by the parser. This is because they're not a syntactic feature, they're a string literal on the first line of a function/class body. hpython doesn't ignore docstrings, they're just not considered comments.

That being said, I think we could do with functions that make it easier to create and modify docstrings. I'll think about the shape of those functions over the next few hours and check in later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants