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

16 statements  

1""" 

2 pygments.lexers.x10 

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

4 

5 Lexers for the X10 programming 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 Text, Comment, Keyword, String 

13 

14__all__ = ['X10Lexer'] 

15 

16 

17class X10Lexer(RegexLexer): 

18 """ 

19 For the X10 language. 

20 """ 

21 

22 name = 'X10' 

23 url = 'http://x10-lang.org/' 

24 aliases = ['x10', 'xten'] 

25 filenames = ['*.x10'] 

26 mimetypes = ['text/x-x10'] 

27 version_added = '2.2' 

28 

29 keywords = ( 

30 'as', 'assert', 'async', 'at', 'athome', 'ateach', 'atomic', 

31 'break', 'case', 'catch', 'class', 'clocked', 'continue', 

32 'def', 'default', 'do', 'else', 'final', 'finally', 'finish', 

33 'for', 'goto', 'haszero', 'here', 'if', 'import', 'in', 

34 'instanceof', 'interface', 'isref', 'new', 'offer', 

35 'operator', 'package', 'return', 'struct', 'switch', 'throw', 

36 'try', 'type', 'val', 'var', 'when', 'while' 

37 ) 

38 

39 types = ( 

40 'void' 

41 ) 

42 

43 values = ( 

44 'false', 'null', 'self', 'super', 'this', 'true' 

45 ) 

46 

47 modifiers = ( 

48 'abstract', 'extends', 'implements', 'native', 'offers', 

49 'private', 'property', 'protected', 'public', 'static', 

50 'throws', 'transient' 

51 ) 

52 

53 tokens = { 

54 'root': [ 

55 (r'[^\S\n]+', Text), 

56 (r'//.*?\n', Comment.Single), 

57 (r'/\*(.|\n)*?\*/', Comment.Multiline), 

58 (r'\b({})\b'.format('|'.join(keywords)), Keyword), 

59 (r'\b({})\b'.format('|'.join(types)), Keyword.Type), 

60 (r'\b({})\b'.format('|'.join(values)), Keyword.Constant), 

61 (r'\b({})\b'.format('|'.join(modifiers)), Keyword.Declaration), 

62 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), 

63 (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), 

64 (r'.', Text) 

65 ], 

66 }