#33002: Make DebugLexer.tokenize() more similar to Lexer.tokenize()
-------------------------------------+-------------------------------------
               Reporter:  Chris      |          Owner:  Chris Jerdonek
  Jerdonek                           |
                   Type:             |         Status:  assigned
  Cleanup/optimization               |
              Component:  Template   |        Version:  dev
  system                             |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Currently,
 
[https://github.com/django/django/blob/8208381ba6a3d1613bb746617062ccf1a6a28591/django/template/base.py#L396-L418
 DebugLexer.tokenize()] looks somewhat dissimilar to
 
[https://github.com/django/django/blob/8208381ba6a3d1613bb746617062ccf1a6a28591/django/template/base.py#L352-L364
 Lexer.tokenize()], even though they do more or less the same thing. For
 example, the `Lexer` class's implementation contains just one call to
 `self.create_token()`, whereas `DebugLexer` contains three calls to it.

 This ticket is to make `DebugLexer.tokenize()` look visibly much more the
 same as `Lexer.tokenize()`, and in particular simpler. One advantage is
 that it will be more obvious on inspection that `DebugLexer` acts the same
 as `Lexer`. Another advantage is that it will be easier to keep the two
 implementations in step when applying optimizations to `Lexer`. It will be
 more maintainable and less likely to introduce bugs if the implementations
 for the two lexers don't diverge too much.

 The idea will become more clear once the PR is posted.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33002>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.4595a1eccc7da42844babc1d603327c8%40djangoproject.com.

Reply via email to