codekingpro/portable-devtools
114k
1"""2 pygments.lexers.tls3 ~~~~~~~~~~~~~~~~~~~4 5 Lexers for the TLS presentation language.6 7 :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.8 :license: BSD, see LICENSE for details.9"""10import re11 12from pygments.lexer import RegexLexer, words13from pygments.token import Comment, Operator, Keyword, Name, String, \14 Number, Punctuation, Whitespace15 16__all__ = ['TlsLexer']17 18 19class TlsLexer(RegexLexer):20 """21 The TLS presentation language, described in RFC 8446.22 """23 name = 'TLS Presentation Language'24 url = 'https://www.rfc-editor.org/rfc/rfc8446#section-3'25 filenames = []26 aliases = ['tls']27 mimetypes = []28 version_added = '2.16'29 30 flags = re.MULTILINE | re.DOTALL31 32 tokens = {33 'root': [34 (r'\s+', Whitespace),35 # comments36 (r'/[*].*?[*]/', Comment.Multiline),37 # Keywords38 (words(('struct', 'enum', 'select', 'case'), suffix=r'\b'),39 Keyword),40 (words(('uint8', 'uint16', 'uint24', 'uint32', 'uint64', 'opaque'),41 suffix=r'\b'), Keyword.Type),42 # numeric literals43 (r'0x[0-9a-fA-F]+', Number.Hex),44 (r'[0-9]+', Number.Integer),45 # string literal46 (r'"(\\.|[^"\\])*"', String),47 # tokens48 (r'[.]{2}', Operator),49 (r'[+\-*/&^]', Operator),50 (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),51 # identifiers52 (r'[^\W\d]\w*', Name.Other),53 ]54 }55 