This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ezio.melotti, mrabarnett, serhiy.storchaka
Date 2017-05-07.15:27:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494170858.78.0.223872265764.issue30299@psf.upfronthosting.co.za>
In-reply-to
Content
Proposed patch makes compiling a regular expression in debug mode (with the re.DEBUG flag) displaying the bytecode in human readable form (in addition to the syntax tree). For example:

>>> re.compile('test_[a-z_]+', re.DEBUG)
LITERAL 116
LITERAL 101
LITERAL 115
LITERAL 116
LITERAL 95
MAX_REPEAT 1 MAXREPEAT
  IN
    RANGE (97, 122)
    LITERAL 95

 0. INFO 16 0b1 6 MAXREPEAT (to 17)
      prefix_skip 5
      prefix [0x74, 0x65, 0x73, 0x74, 0x5f] ('test_')
      overlap [0, 0, 0, 1, 0]
17: LITERAL 0x74 ('t')
19. LITERAL 0x65 ('e')
21. LITERAL 0x73 ('s')
23. LITERAL 0x74 ('t')
25. LITERAL 0x5f ('_')
27. REPEAT_ONE 12 1 MAXREPEAT (to 40)
31.   IN 7 (to 39)
33.     RANGE 0x61 0x7a ('a'-'z')
36.     LITERAL 0x5f ('_')
38.     FAILURE
39:   SUCCESS
40: SUCCESS
re.compile('test_[a-z_]+', re.DEBUG)

This feature is needed mainly for our own needs. It can help optimizing regular expression compilation.
History
Date User Action Args
2017-05-07 15:27:38serhiy.storchakasetrecipients: + serhiy.storchaka, ezio.melotti, mrabarnett
2017-05-07 15:27:38serhiy.storchakasetmessageid: <1494170858.78.0.223872265764.issue30299@psf.upfronthosting.co.za>
2017-05-07 15:27:38serhiy.storchakalinkissue30299 messages
2017-05-07 15:27:38serhiy.storchakacreate