Pull requests

#342 Merged
Repository
Deleted repository
Branch
default (3d1f646ed925)
Repository
birkenfeld/pygments-main pygments-main
Branch
default

Add ability to specify default state transition

Author
  1. Gaurav Jain
Reviewers
Description

The C lexer (and possibly others) creates an empty (Token.Text, u'') token in order to move from the 'root' state to the 'statement' state. Instead of this workaround, we can allow states to specify a default state transition to do.

  • Learn about pull requests

Comments (5)

    1. Tim Hatch

      Sure, me too. I need a little time to test it... in the meantime could you add a test that confirms multiple states, like default('a', 'b') works?

  1. Gaurav Jain author
    • Added a unit test to test multiple states
    • Added support for default state transition in ExtendedRegexLexer
    • Applied default state transition to various lexers
    • Verified with make test

    I didn't throw the exception due to the check in _process_token