feat: highlight ip6.arpa question with separation at upper-half hextet boundaries
This commit is contained in:
parent
18ecc98014
commit
e521fffed2
1 changed files with 12 additions and 1 deletions
13
dig-lexer.py
13
dig-lexer.py
|
@ -47,12 +47,23 @@ class CustomLexer(ExtendedRegexLexer):
|
||||||
yield re.start('nadd'), String.Doc, re.group('nadd')
|
yield re.start('nadd'), String.Doc, re.group('nadd')
|
||||||
ctx.pos = re.end()
|
ctx.pos = re.end()
|
||||||
|
|
||||||
|
def parse_rdns(lexer, re, ctx):
|
||||||
|
yield re.start('c1'), Comment.Hashbang, re.group('c1')
|
||||||
|
yield re.start('pl64'), Name.Class, re.group('pl64')
|
||||||
|
yield re.start('pl48'), Number.Integer, re.group('pl48')
|
||||||
|
yield re.start('pl32'), Name.Class, re.group('pl32')
|
||||||
|
yield re.start('pl16'), Name.Tag, re.group('pl16')
|
||||||
|
yield re.start('pl0'), String.Doc, re.group('pl0')
|
||||||
|
yield re.start('end'), Comment.Hashbang, re.group('end')
|
||||||
|
ctx.pos = re.end()
|
||||||
|
|
||||||
tokens = {
|
tokens = {
|
||||||
'root': [
|
'root': [
|
||||||
(r'(?P<c1>; <<>>)(?P<version>.*)(?P<c2><<>>)(?P<query>.*\n)', parse_dig_header),
|
(r'(?P<c1>; <<>>)(?P<version>.*)(?P<c2><<>>)(?P<query>.*\n)', parse_dig_header),
|
||||||
(r'(?P<c1>;; ->>HEADER<<- opcode: )(?P<opcode>[^\s]+)(?P<c2>, status: )(?P<rcode>[^\s]+)(?P<c3>, id: )(?P<nonce>[^\s]+\n)(?P<c4>;; flags: )(?P<flags>[^;]+)(?P<c5>; QUERY: )(?P<nquery>\d+)(?P<c6>, ANSWER: )(?P<nanswer>\d+)(?P<c7>, AUTHORITY: )(?P<nauth>\d+)(?P<c8>, ADDITIONAL: )(?P<nadd>\d+\n)', parse_response_header),
|
(r'(?P<c1>;; ->>HEADER<<- opcode: )(?P<opcode>[^\s]+)(?P<c2>, status: )(?P<rcode>[^\s]+)(?P<c3>, id: )(?P<nonce>[^\s]+\n)(?P<c4>;; flags: )(?P<flags>[^;]+)(?P<c5>; QUERY: )(?P<nquery>\d+)(?P<c6>, ANSWER: )(?P<nanswer>\d+)(?P<c7>, AUTHORITY: )(?P<nauth>\d+)(?P<c8>, ADDITIONAL: )(?P<nadd>\d+\n)', parse_response_header),
|
||||||
|
(r'(?P<c1>;)(?P<pl64>([0-9a-fA-F]\.){16})(?P<pl48>([0-9a-fA-F]\.){4})(?P<pl32>([0-9a-fA-F]\.){4})(?P<pl16>([0-9a-fA-F]\.){4})(?P<pl0>([0-9a-fA-F]\.){4})(?P<end>ip6\.arpa\..*$)', parse_rdns),
|
||||||
(r';;.*', Generic.Subheading), # comment section headers
|
(r';;.*', Generic.Subheading), # comment section headers
|
||||||
(r';.*', Comment.Single), # comment section headers
|
(r';.*', Comment.Single),
|
||||||
(r'\n', Generic),
|
(r'\n', Generic),
|
||||||
(r'^', Generic, 'rname')
|
(r'^', Generic, 'rname')
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue