Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pygments/lexers/tlb.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

11 statements  

1""" 

2 pygments.lexers.tlb 

3 ~~~~~~~~~~~~~~~~~~~ 

4 

5 Lexers for TL-b. 

6 

7 :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. 

8 :license: BSD, see LICENSE for details. 

9""" 

10 

11from pygments.lexer import RegexLexer, include, words 

12from pygments.token import Operator, Name, \ 

13 Number, Whitespace, Punctuation, Comment 

14 

15__all__ = ['TlbLexer'] 

16 

17 

18class TlbLexer(RegexLexer): 

19 """ 

20 For TL-b source code. 

21 """ 

22 

23 name = 'Tl-b' 

24 aliases = ['tlb'] 

25 filenames = ['*.tlb'] 

26 url = 'https://docs.ton.org/#/overviews/TL-B' 

27 version_added = '' 

28 

29 tokens = { 

30 'root': [ 

31 (r'\s+', Whitespace), 

32 

33 include('comments'), 

34 

35 (r'[0-9]+', Number), 

36 (words(( 

37 '+', '-', '*', '=', '?', '~', '.', 

38 '^', '==', '<', '>', '<=', '>=', '!=' 

39 )), Operator), 

40 (words(('##', '#<', '#<=')), Name.Tag), 

41 (r'#[0-9a-f]*_?', Name.Tag), 

42 (r'\$[01]*_?', Name.Tag), 

43 

44 (r'[a-zA-Z_][0-9a-zA-Z_]*', Name), 

45 

46 (r'[;():\[\]{}]', Punctuation) 

47 ], 

48 

49 'comments': [ 

50 (r'//.*', Comment.Singleline), 

51 (r'/\*', Comment.Multiline, 'comment'), 

52 ], 

53 'comment': [ 

54 (r'[^/*]+', Comment.Multiline), 

55 (r'/\*', Comment.Multiline, '#push'), 

56 (r'\*/', Comment.Multiline, '#pop'), 

57 (r'[*/]', Comment.Multiline), 

58 ], 

59 }