ALPHAWORD {A}+
-DIGIT {N}
UNSIGNED {N}+
E_UNSIGNED \\{N}+
FRACTION {N}+\/{N}+
<INITIAL,chords,lyrics,figures,notes>{BOM_UTF8}/.* {
if (this->lexloc_->line_number () != 1 || this->lexloc_->column_number () != 0)
{
- LexerError (_ ("stray UTF-8 BOM encountered").c_str ());
- exit (1);
+ LexerWarning (_ ("stray UTF-8 BOM encountered").c_str ());
+ // exit (1);
}
debug_output (_ ("Skipping UTF-8 BOM"));
}
yylval.scm = scan_fraction (YYText ());
return FRACTION;
}
- {DIGIT} {
- yylval.i = String_convert::dec2int (string (YYText ()));
- return DIGIT;
- }
- {UNSIGNED}/\/[^0-9] { // backup rule
- yylval.i = String_convert::dec2int (string (YYText ()));
- return UNSIGNED;
- }
{UNSIGNED}/\/ | // backup rule
{UNSIGNED} {
yylval.i = String_convert::dec2int (string (YYText ()));
[{}] {
return YYText ()[0];
}
- [^#{}"\\ \t\n\r\f]+ {
+ [^#{}\"\\ \t\n\r\f]+ {
string s (YYText ());
char c = s[s.length () - 1];
extra_token_types_.push_back (token_type);
}
-void
-Lily_lexer::push_embedded_token ()
-{
- push_extra_token (EMBEDDED_LILY);
-}
-
void
Lily_lexer::push_chord_state (SCM tab)
{
SCM sid = lookup_identifier (str);
if (is_music_function (sid))
{
+ int funtype = SCM_FUNCTION;
+
yylval.scm = get_music_function_transform (sid);
SCM s = scm_object_property (yylval.scm, ly_symbol2scm ("music-function-signature"));
+ SCM cs = scm_car (s);
+
+ if (scm_is_eq (cs, ly_lily_module_constant ("ly:music?")))
+ funtype = MUSIC_FUNCTION;
+ else if (ly_is_procedure (cs))
+ funtype = SCM_FUNCTION;
+ else programming_error ("Bad syntax function predicate");
+
push_extra_token (EXPECT_NO_MORE_ARGS);
- for (; scm_is_pair (s); s = scm_cdr (s))
+ for (s = scm_cdr (s); scm_is_pair (s); s = scm_cdr (s))
{
- SCM cs = scm_car (s);
+ cs = scm_car (s);
if (cs == ly_music_p_proc)
push_extra_token (EXPECT_MUSIC);
push_extra_token (EXPECT_SCM);
else programming_error ("Function parameter without type-checking predicate");
}
- return MUSIC_FUNCTION;
+ return funtype;
}
if (sid != SCM_UNDEFINED)