#include <iostream>
using namespace std;
-
+#include "music-function.hh"
#include "source-file.hh"
#include "parse-scm.hh"
#include "lily-guile.hh"
void strip_trailing_white (String&);
void strip_leading_white (String&);
String lyric_fudge (String s);
-
+int music_function_type (SCM);
SCM lookup_markup_command (String s);
bool is_valid_version (String s);
}
}
-<INITIAL>\\encoding{WHITE}* {
+<INITIAL,notes>\\encoding{WHITE}* {
yy_push_state (encoding);
}
<INITIAL,chords,lyrics,notes,figures>\\version{WHITE}* {
return l;
}
SCM sid = lookup_identifier (str);
+ if (is_music_function (sid))
+ {
+ yylval.scm = get_music_function_transform (sid);
+
+ return music_function_type (yylval.scm);
+ }
+
if (sid != SCM_UNDEFINED)
{
yylval.scm = sid;
SCM proc = ly_scheme_function ("lookup-markup-command");
return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ()));
}
+
+
+int
+music_function_type (SCM func)
+{
+ SCM type= scm_object_property (func, ly_symbol2scm ("music-function-signature-keyword"));
+ if (type == ly_symbol2scm ("scm"))
+ {
+ return MUSIC_FUNCTION_SCM;
+ }
+ else if (type == ly_symbol2scm ("music"))
+ {
+ return MUSIC_FUNCTION_MUSIC;
+ }
+ else if (type == ly_symbol2scm ("scm-music"))
+ {
+ return MUSIC_FUNCTION_SCM_MUSIC;
+ }
+ else if (type == ly_symbol2scm ("music-music"))
+ {
+ return MUSIC_FUNCTION_MUSIC_MUSIC;
+ }
+ else if (type == ly_symbol2scm ("scm-music-music"))
+ {
+ return MUSIC_FUNCTION_SCM_MUSIC_MUSIC;
+ }
+ else if (type == ly_symbol2scm ("scm-scm-music"))
+ {
+ return MUSIC_FUNCTION_SCM_SCM_MUSIC;
+ }
+ else if (type == ly_symbol2scm ("noarg"))
+ {
+ return MUSIC_FUNCTION;
+ }
+ else
+ {
+ /* TODO: print location */
+ error ("Can not find sigature for music function.");
+ }
+
+ return MUSIC_FUNCTION_SCM;
+}