Issue #777 resolved

raise from Python syntax not supported

Robert Lehmann avatarRobert Lehmann created an issue

I'm copying this bug here, as it seems to be related to Pygments:

sandrotosi wrote:

Hello, it seems sphinx doesn't like the PEP 409, as you can see at:

http://docs.python.org/dev/whatsnew/3.3.html#pep-409-suppressing-exception-context

"from None" gets the '...' attached and the next command line receives an extra new line right after the prompt.

See https://bitbucket.org/birkenfeld/sphinx/issue/938/support-pep-409 for original report.

It think I have isolated the error to PythonLexer but I might be entirely mistaken:

>>> list(pygments.lexers.PythonLexer().get_tokens_unprocessed('raise E from e\nprint 1'))
[
  (0, Token.Keyword, 'raise'),
  (5, Token.Text, ' '),
  (6, Token.Name, 'E'),
  (7, Token.Text, ' '),
  (8, Token.Keyword.Namespace, 'from'),
  (12, Token.Text, ' '),
  (13, Token.Name.Namespace, 'e'),
  (15, Token.Text, u'\n'),  #<<< should be 14?
  (15, Token.Keyword, 'print'),
  (20, Token.Text, ' '),
  (21, Token.Literal.Number.Integer, '1')
]

Comments (2)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.