Parses a subset of LilyPond input syntax:
abjad> from abjad.tools.lilypondparsertools import LilyPondParser
abjad> parser = LilyPondParser( )
abjad> input = r"\new Staff { c'4 ( d'8 e' fs'2) \fermata }"
abjad> result = parser(input)
abjad> f(result)
\new Staff {
c'4 (
d'8
e'8
fs'2 -\fermata )
}
LilyPondParser defaults to English note names, but any of the other languages supported by LilyPond may be used:
abjad> parser = LilyPondParser('nederlands')
abjad> input = '{ c des e fis }'
abjad> result = parser(input)
abjad> f(result)
{
c4
df4
e4
fs4
}
Briefly, LilyPondParser understands theses aspects of LilyPond syntax:
Notes, chords, rests, skips and multi-measure rests
Durations, dots, and multipliers
All pitchnames, and octave ticks
Simple markup (i.e. c'4 ^ "hello!")
Most articulations
Most spanners, including beams, slurs, phrasing slurs, ties, and glissandi
Most context types via \new and \context, as well as context ids (i.e. \new Staff = "foo" { })
Variable assignment (i.e. global = { \time 3/4 } \new Staff { \global })
LilyPondParser currently DOES NOT understand many other aspects of LilyPond syntax:
Returns LilyPondParser instance.
Tuple of pitch-name languages supported by LilyPondParser:
abjad> from abjad.tools.lilypondparsertools import LilyPondParser
abjad> parser = LilyPondParser( )
abjad> parser.available_languages
('catalan', 'deutsch', 'english', 'espanol', 'italiano', 'nederlands', 'norsk', 'portugues', 'suomi', 'svenska', 'vlaams')
Return tuple.
Read/write attribute to set parser’s default pitch-name language:
abjad> from abjad.tools.lilypondparsertools import LilyPondParser
abjad> parser = LilyPondParser( )
abjad> parser.default_language
'english'
abjad> parser('{ c df e fs }')
{c4, df4, e4, fs4}
abjad> parser.default_language = 'nederlands'
abjad> parser.default_language
'nederlands'
abjad> parser('{ c des e fis }')
{c4, df4, e4, fs4}
x.__delattr__(‘name’) <==> del x.name
Note
Inherited from __builtin__.object
True when id(self) equals id(arg).
Return boolean.
Note
Inherited from abctools.AbjadObject
Abjad objects by default do not implement this method.
Raise exception.
Note
Inherited from abctools.AbjadObject
Abjad objects by default do not implement this method.
Raise exception
Note
Inherited from abctools.AbjadObject
Note
Inherited from __builtin__.object
Abjad objects by default do not implement this method.
Raise exception.
Note
Inherited from abctools.AbjadObject
Abjad objects by default do not implement this method.
Raise exception.
Note
Inherited from abctools.AbjadObject
True when id(self) does not equal id(arg).
Return boolean.
Note
Inherited from abctools.AbjadObject
Interpreter representation of Abjad object defaulting to class name, mandatory arguments, keyword arguments.
Return string.
Note
Inherited from abctools.AbjadObject
x.__setattr__(‘name’, value) <==> x.name = value
Note
Inherited from __builtin__.object
Note
Inherited from __builtin__.object