rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.33k stars 734 forks source link

Extend the python lexer for python3 #3

Closed jneen closed 5 years ago

thomasboyt commented 8 years ago

From what I've seen so far, the lexer seems to work for most Python 3 syntax, with the exception of the new yield from statement in Python 3.3: https://docs.python.org/3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator

looks like this is because the from keyword immediately kicks the lexer state into "importing" mode, so the fix should be relatively simple: https://github.com/jneen/rouge/blob/master/lib/rouge/lexers/python.rb#L98-L101

I'll take a look at a PR for this soon, but wanted to leave a comment in case I didn't get the chance to come back to this issue :)

thomasboyt commented 8 years ago

ack, nevermind, someone did this already! what I get for searching issues instead of PRs :p https://github.com/jneen/rouge/pull/324

rumpelsepp commented 8 years ago

raise ... from also causes problems.

raise RuntimeError('Object cannot be packed') from e
mnakama commented 8 years ago

@rumpelsepp are you using the latest git code? I thought I fixed yield and raise in #324 .

robin850 commented 7 years ago

(Hi there! I guess this issue can certainly be closed thanks to #324 and https://github.com/jneen/rouge/commit/81c08594e8ef08fcc16d5b3968de037321ca49af 😊 )

miparnisari commented 5 years ago

This can be closed too @pyrmont

image

image

pyrmont commented 5 years ago

Thanks @robin850 and @miparnisari :)