Python pygments.token.Name.Label() Examples
The following are 3
code examples of pygments.token.Name.Label().
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.Name
, or try the search function
.
Example #1
Source File: test_java.py From pygments with BSD 2-Clause "Simplified" License | 6 votes |
def test_enhanced_for(lexer): fragment = u'label:\nfor(String var2: var1) {}\n' tokens = [ (Name.Label, u'label:'), (Text, u'\n'), (Keyword, u'for'), (Punctuation, u'('), (Name, u'String'), (Text, u' '), (Name, u'var2'), (Punctuation, u':'), (Text, u' '), (Name, u'var1'), (Punctuation, u')'), (Text, u' '), (Punctuation, u'{'), (Punctuation, u'}'), (Text, u'\n'), ] assert list(lexer.get_tokens(fragment)) == tokens
Example #2
Source File: mime.py From pygments with BSD 2-Clause "Simplified" License | 5 votes |
def store_content_type(self, match): self.content_type = match.group(1) prefix_len = match.start(1) - match.start(0) yield match.start(0), Text.Whitespace, match.group(0)[:prefix_len] yield match.start(1), Name.Label, match.group(2) yield match.end(2), String.Delimiter, u"/" yield match.start(3), Name.Label, match.group(3)
Example #3
Source File: mime.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def store_content_type(self, match): self.content_type = match.group(1) prefix_len = match.start(1) - match.start(0) yield match.start(0), Text.Whitespace, match.group(0)[:prefix_len] yield match.start(1), Name.Label, match.group(2) yield match.end(2), String.Delimiter, u"/" yield match.start(3), Name.Label, match.group(3)