Hi all,
I'm trying to write a lexer for the LilyPond language, because I'd
like
to have it in Sphinx.
Unfortunately, I'm moving my very first steps in Python so the
documentation is not so clear to me. I hope this could be the chance
to
start diving into python ;-)
Here's what I've done so far:
1) I added the new lexer in
/usr/local/lib/python2.6/dist-packages/Pygments-1.3.1-py2.6.egg/
pygments/lexers/text.py.
I chose text.py because there's the TeX language, which has something
in
common with the LilyPond language.
I just added the following lines (at the bottom of the file) in order
to
make a first test:
class LilyLexer(RegexLexer):
"""
Lexer for the LilyPond music typesetting language.
"""
name = 'Lily'
aliases = ['lily', 'lilypond']
filenames = ['*.ly']
mimetypes = ['text/x-lilypond']
tokens = {
'general': [
(r'%.*?\n', Comment),
]
}
2) Then I opened a python console and typed::
>>> from pygments import highlight
>>> from pygments.lexers import LilyLexer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name LilyLexer
>>>
Why the LilyLexer is not recognized?
Should I reload python packages somehow?
Or I wrote something wrong in text.py?
Thanks in advance for your help,
Federico
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.