Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pygments/lexers/rita.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

12 statements  

1""" 

2 pygments.lexers.rita 

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

4 

5 Lexers for RITA language 

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 

12from pygments.token import Comment, Operator, Keyword, Name, Literal, \ 

13 Punctuation, Whitespace 

14 

15__all__ = ['RitaLexer'] 

16 

17 

18class RitaLexer(RegexLexer): 

19 """ 

20 Lexer for RITA. 

21 """ 

22 name = 'Rita' 

23 url = 'https://github.com/zaibacu/rita-dsl' 

24 filenames = ['*.rita'] 

25 aliases = ['rita'] 

26 mimetypes = ['text/rita'] 

27 version_added = '2.11' 

28 

29 tokens = { 

30 'root': [ 

31 (r'\n', Whitespace), 

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

33 (r'#(.*?)\n', Comment.Single), 

34 (r'@(.*?)\n', Operator), # Yes, whole line as an operator 

35 (r'"(\w|\d|\s|(\\")|[\'_\-./,\?\!])+?"', Literal), 

36 (r'\'(\w|\d|\s|(\\\')|["_\-./,\?\!])+?\'', Literal), 

37 (r'([A-Z_]+)', Keyword), 

38 (r'([a-z0-9_]+)', Name), 

39 (r'((->)|[!?+*|=])', Operator), 

40 (r'[\(\),\{\}]', Punctuation) 

41 ] 

42 }