nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] python syntax highlighting


From: John M. Gabriele
Subject: [Nano-devel] python syntax highlighting
Date: Wed, 15 Feb 2006 00:54:47 -0500
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

I've got a python file which isn't getting syntax-highlighted
(syntax-highlit? ;) correctly.

The patterns I'm using I've found in various places on the net:

syntax "python" "\.py$"
color brightblue "def [a-zA-Z_0-9]+"
color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
color brightgreen "([\"']).*?[^\\]\1"
color brightgreen start="\"\"\"" end="\"\"\""
color brightred "#.*$"

and it breaks on any file with a """triple-quoted string"""
as soon as it sees those first three double quote marks.

If they're '''triple-quoted like this''' everything is ok, but
I don't get the syntax highlighting over multiple lines.

If I remove that offending line from the .nanorc, then
both forms of multi-line strings (when used over multiple
lines) don't syntax highlight. (single-line triple-quoted
strings *do* syntax highlight correctly).

Anyone have any better Python regex patterns?

Thanks,
---John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]