Code
Importing Lexer Components from pygments.lexer
When creating a custom regex-based lexer in Pygments, the base class and helper functions are imported from pygments.lexer:
from pygments.lexer import RegexLexer, include, words, bygroups, using, this
This import provides RegexLexer alongside lexer construction utilities such as include, words, bygroups, using, and this.
0
1
Updated 2026-10-08
Tags
Prep Sessions
Tokenizing Source Code: Classifying Keywords and Operators in Pygments @ University of Michigan - Ann Arbor
Ch.1 Lexical Analysis - Tokenizing Source Code: Classifying Keywords and Operators in Pygments @ University of Michigan - Ann Arbor
Lexers and tokens - Tokenizing Source Code: Classifying Keywords and Operators in Pygments @ University of Michigan - Ann Arbor