----- Original Message -----
> From: Oscar Benjamin <oscar.j.benja...@gmail.com>
> To: Tutor@python.org
> Cc:
> Sent: Tuesday, June 18, 2013 12:42 PM
> Subject: Re: [Tutor] regex grouping/capturing
>
> On 18 June 2013 09:27, Albert-Jan Roskam <fo...@yahoo.com> wrote:
>> from pygments.lexer import RegexLexer, bygroups from pygments.token import
> * class IniLexer(RegexLexer): name = 'INI' aliases = ['ini',
> 'cfg'] filenames = ['*.ini', '*.cfg'] tokens = {
> 'root': [ (r'\s+', Text), (r';.*?$', Comment),
> (r'\[.*?\]$', Keyword),
> (r'(.*?)(\s*)(=)(\s*)(.*?)$', bygroups(Name.Attribute, Text,
> Operator, Text, String)) ] }
>
> I'm not sure how you sent this email but I'm assuming it wasn't
> supposed to look like it does above. Did you compose/send this as
> plain-text or html?
yikes! Sorry about that. It seems that even in plain-text mode copy-pasted text
gets mangled by yahoo. That happens *after* sending the mail. Here is the
correctly indented code (website-->notepad-->yahoo):
from pygments.lexer import RegexLexer, bygroups
from pygments.token import *
class IniLexer(RegexLexer):
name = 'INI'
aliases = ['ini', 'cfg']
filenames = ['*.ini', '*.cfg']
tokens = {
'root': [
(r'\s+', Text),
(r';.*?$', Comment),
(r'\[.*?\]$', Keyword),
(r'(.*?)(\s*)(=)(\s*)(.*?)$',
bygroups(Name.Attribute, Text, Operator, Text, String))
]
}
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor