3 pygments.lexers.zig |
3 pygments.lexers.zig |
4 ~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for Zig. |
6 Lexers for Zig. |
7 |
7 |
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 from pygments.lexer import RegexLexer, words |
12 from pygments.lexer import RegexLexer, words |
13 from pygments.token import Comment, Operator, Keyword, Name, String, \ |
13 from pygments.token import Comment, Operator, Keyword, Name, String, \ |
100 (r'@[a-zA-Z_]\w*', Name.Builtin), |
100 (r'@[a-zA-Z_]\w*', Name.Builtin), |
101 (r'[a-zA-Z_]\w*', Name), |
101 (r'[a-zA-Z_]\w*', Name), |
102 |
102 |
103 # Characters |
103 # Characters |
104 (r'\'\\\'\'', String.Escape), |
104 (r'\'\\\'\'', String.Escape), |
105 (r'\'\\(|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\'"])\'', |
105 (r'\'\\(x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\'"])\'', |
106 String.Escape), |
106 String.Escape), |
107 (r'\'[^\\\']\'', String), |
107 (r'\'[^\\\']\'', String), |
108 |
108 |
109 # Strings |
109 # Strings |
110 (r'\\\\[^\n]*', String.Heredoc), |
110 (r'\\\\[^\n]*', String.Heredoc), |
120 String.Escape), |
120 String.Escape), |
121 (r'[^\\"\n]+', String), |
121 (r'[^\\"\n]+', String), |
122 (r'"', String, '#pop') |
122 (r'"', String, '#pop') |
123 ] |
123 ] |
124 } |
124 } |
125 |
|
126 def get_tokens_unprocessed(self, text): |
|
127 for index, token, value in \ |
|
128 RegexLexer.get_tokens_unprocessed(self, text): |
|
129 yield index, token, value |
|