mte/unikernel/duniverse/dune_/doc/exts/opam_lexer.py
2025-11-11 02:07:51 +01:00

26 lines
481 B
Python

from pygments.lexer import RegexLexer
from pygments.token import (
Keyword,
Number,
Punctuation,
String,
Text,
Whitespace,
)
ident = r"[-\w]+"
class OpamLexer(RegexLexer):
name = "opam"
tokens = {
"root": [
(r"\d\.\d", Number),
(r"^" + ident + ":", Keyword),
(ident, Text),
(r"[\[\]{}>=]", Punctuation),
(r"\s+", Whitespace),
(r'"[^\"]*"', String),
]
}