4170:8bc578136279 | 4172:4f20dba37ab6 |
---|---|
3 pygments.token | 3 pygments.token |
4 ~~~~~~~~~~~~~~ | 4 ~~~~~~~~~~~~~~ |
5 | 5 |
6 Basic token types and the standard tokens. | 6 Basic token types and the standard tokens. |
7 | 7 |
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | 8 :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. | 9 :license: BSD, see LICENSE for details. |
10 """ | 10 """ |
11 | |
12 from __future__ import unicode_literals | |
13 | 11 |
14 class _TokenType(tuple): | 12 class _TokenType(tuple): |
15 parent = None | 13 parent = None |
16 | 14 |
17 def split(self): | 15 def split(self): |
49 Token = _TokenType() | 47 Token = _TokenType() |
50 | 48 |
51 # Special token types | 49 # Special token types |
52 Text = Token.Text | 50 Text = Token.Text |
53 Whitespace = Text.Whitespace | 51 Whitespace = Text.Whitespace |
52 Escape = Token.Escape | |
54 Error = Token.Error | 53 Error = Token.Error |
55 # Text that doesn't belong to this lexer (e.g. HTML in PHP) | 54 # Text that doesn't belong to this lexer (e.g. HTML in PHP) |
56 Other = Token.Other | 55 Other = Token.Other |
57 | 56 |
58 # Common token types for source code | 57 # Common token types for source code |
116 STANDARD_TYPES = { | 115 STANDARD_TYPES = { |
117 Token: '', | 116 Token: '', |
118 | 117 |
119 Text: '', | 118 Text: '', |
120 Whitespace: 'w', | 119 Whitespace: 'w', |
120 Escape: 'esc', | |
121 Error: 'err', | 121 Error: 'err', |
122 Other: 'x', | 122 Other: 'x', |
123 | 123 |
124 Keyword: 'k', | 124 Keyword: 'k', |
125 Keyword.Constant: 'kc', | 125 Keyword.Constant: 'kc', |
164 String.Regex: 'sr', | 164 String.Regex: 'sr', |
165 String.Single: 's1', | 165 String.Single: 's1', |
166 String.Symbol: 'ss', | 166 String.Symbol: 'ss', |
167 | 167 |
168 Number: 'm', | 168 Number: 'm', |
169 Number.Bin: 'mb', | |
169 Number.Float: 'mf', | 170 Number.Float: 'mf', |
170 Number.Hex: 'mh', | 171 Number.Hex: 'mh', |
171 Number.Integer: 'mi', | 172 Number.Integer: 'mi', |
172 Number.Integer.Long: 'il', | 173 Number.Integer.Long: 'il', |
173 Number.Oct: 'mo', | 174 Number.Oct: 'mo', |