Python pygments.token.Literal() Examples
The following are 6
code examples of pygments.token.Literal().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygments.token
, or try the search function
.
Example #1
Source File: httpdomain.py From nltk-server with MIT License | 5 votes |
def header_callback(self, match): if match.group(1).lower() == 'content-type': content_type = match.group(5).strip() if ';' in content_type: content_type = content_type[:content_type.find(';')].strip() self.content_type = content_type yield match.start(1), Name.Attribute, match.group(1) yield match.start(2), Text, match.group(2) yield match.start(3), Operator, match.group(3) yield match.start(4), Text, match.group(4) yield match.start(5), Literal, match.group(5) yield match.start(6), Text, match.group(6)
Example #2
Source File: httpdomain.py From nltk-server with MIT License | 5 votes |
def continuous_header_callback(self, match): yield match.start(1), Text, match.group(1) yield match.start(2), Literal, match.group(2) yield match.start(3), Text, match.group(3)
Example #3
Source File: httpdomain.py From couchdb-documentation with Apache License 2.0 | 5 votes |
def header_callback(self, match): if match.group(1).lower() == "content-type": content_type = match.group(5).strip() if ";" in content_type: content_type = content_type[: content_type.find(";")].strip() self.content_type = content_type yield match.start(1), Name.Attribute, match.group(1) yield match.start(2), Text, match.group(2) yield match.start(3), Operator, match.group(3) yield match.start(4), Text, match.group(4) yield match.start(5), Literal, match.group(5) yield match.start(6), Text, match.group(6)
Example #4
Source File: httpdomain.py From couchdb-documentation with Apache License 2.0 | 5 votes |
def continuous_header_callback(self, match): yield match.start(1), Text, match.group(1) yield match.start(2), Literal, match.group(2) yield match.start(3), Text, match.group(3)
Example #5
Source File: test_token.py From pygments with BSD 2-Clause "Simplified" License | 5 votes |
def test_tokentype(): t = token.String assert t.split() == [token.Token, token.Literal, token.String] assert t.__class__ is token._TokenType
Example #6
Source File: test_token.py From pygments with BSD 2-Clause "Simplified" License | 5 votes |
def test_functions(): assert token.is_token_subtype(token.String, token.String) assert token.is_token_subtype(token.String, token.Literal) assert not token.is_token_subtype(token.Literal, token.String) assert token.string_to_tokentype(token.String) is token.String assert token.string_to_tokentype('') is token.Token assert token.string_to_tokentype('String') is token.String