Issue #828 resolved

Implementing a new language variant means repeating a lot of code

Alastair Houghton
created an issue

Currently if you want to add, for instance, a new C family language, you need to write a complete new RegexLexer subclass, because RegexLexer has no support for inheriting token definitions. Yes, it’s possible to fudge this with constructs like

class MyLexer(CLexer):
    ...
    tokens = { CLexer.tokens['whitespace'], ... }

but that’s ugly.

This is fixed in pull request #141, which adds an inherit object that can be used to selectively inherit tokendefs from the superclass hierarchy.

Comments (1)

  1. Log in to comment