| 9 | from sphinx.highlighting import lexers |
| 10 | |
| 11 | class DFHackLexer(RegexLexer): |
| 12 | name = 'DFHack' |
| 13 | aliases = ['dfhack'] |
| 14 | flags = re.IGNORECASE | re.MULTILINE |
| 15 | |
| 16 | tokens = { |
| 17 | 'root': [ |
| 18 | (r'\#.+$', Comment.Single), |
| 19 | (r'^\[[a-z]+\]\# ', Generic.Prompt), |
| 20 | (r'.+?', Text), |
| 21 | ] |
| 22 | } |
| 23 | |
| 24 | def register_lexer(app): |
| 25 | lexers['dfhack'] = DFHackLexer() |