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

matlabsession lexer crashes with ellipsis #2166

Closed
alexmv opened this issue Jun 23, 2022 · 2 comments
Closed

matlabsession lexer crashes with ellipsis #2166

alexmv opened this issue Jun 23, 2022 · 2 comments

Comments

@alexmv
Copy link

alexmv commented Jun 23, 2022

This currently crashes pygments with the matlabsession lexer:

>> foo()
bar
...
baz

...with the traceback:

Traceback (most recent call last):
  File "/usr/local/bin/pygmentize", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/pygments/cmdline.py", line 638, in main
    return main_inner(parser, argns)
  File "/usr/local/lib/python3.9/site-packages/pygments/cmdline.py", line 490, in main_inner
    highlight(code, lexer, fmter, outfile)
  File "/usr/local/lib/python3.9/site-packages/pygments/__init__.py", line 82, in highlight
    return format(lex(code, lexer), formatter, outfile)
  File "/usr/local/lib/python3.9/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, outfile)
  File "/usr/local/lib/python3.9/site-packages/pygments/formatters/terminal256.py", line 250, in format
    return Formatter.format(self, tokensource, outfile)
  File "/usr/local/lib/python3.9/site-packages/pygments/formatter.py", line 94, in format
    return self.format_unencoded(tokensource, outfile)
  File "/usr/local/lib/python3.9/site-packages/pygments/formatters/terminal256.py", line 256, in format_unencoded
    for ttype, value in tokensource:
  File "/usr/local/lib/python3.9/site-packages/pygments/lexer.py", line 190, in streamer
    for _, t, v in self.get_tokens_unprocessed(text):
  File "/usr/local/lib/python3.9/site-packages/pygments/lexers/matlab.py", line 2781, in get_tokens_unprocessed
    line_start = len(insertions[-1][-1][-1])
IndexError: list index out of range
@birkenfeld
Copy link
Member

Thanks for the report!

@alexmv
Copy link
Author

alexmv commented Jun 23, 2022

Thanks for the quick fix!

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