source file of the LilyPond music typesetter
- (c) 1996--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "main.hh"
#include "musical-request.hh"
#include "identifier.hh"
-#include "mudela-version.hh"
#include "version.hh"
+#include "mudela-version.hh"
void strip_trailing_white (String&);
void strip_leading_white (String&);
return STRING;
}
. {
- return yylval.c = YYText ()[0];
+ return YYText ()[0];
}
}
<chords>{
- {
return CHORD_MINUS;
}
+ : {
+ return CHORD_COLON;
+ }
+ \/\+ {
+ return CHORD_BASS;
+ }
\^ {
return CHORD_CARET;
}
. {
- return yylval.c = YYText ()[0];
+ return YYText ()[0];
}
}
}
<INITIAL,notes>. {
- return yylval.c = YYText ()[0];
+ return YYText ()[0];
}
<INITIAL,lyrics,notes>\\. {
char c= YYText ()[1];
- yylval.c = c;
+
switch (c) {
case '>':
return E_BIGGER;
int
My_lily_lexer::scan_escaped_word (String str)
{
- DEBUG_OUT << "\\word: `" << str<<"'\n";
+ // use more SCM for this.
+
+ SCM sym = ly_symbol2scm (str.ch_C());
+
int l = lookup_keyword (str);
if (l != -1) {
- DEBUG_OUT << "(keyword)\n";
return l;
}
Identifier * id = lookup_identifier (str);
if (id) {
- DEBUG_OUT << "(identifier)\n";
yylval.id = id;
return id->token_code_i_;
}
if ((YYSTATE != notes) && (YYSTATE != chords)) {
- if (notename_b (str)) {
- yylval.pitch = new Musical_pitch (lookup_notename (str));
+ SCM pitch = scm_hashq_ref (pitchname_tab_, sym, SCM_BOOL_F);
+
+ if (pitch != SCM_BOOL_F)
+ {
+ yylval.pitch = new Musical_pitch (pitch);
yylval.pitch->set_spot (Input (source_file_l (),
here_ch_C ()));
return NOTENAME_PITCH;
}
}
- if (flower_dstream)
- print_declarations (true);
String msg (_f ("unknown escaped string: `\\%s'", str));
LexerError (msg.ch_C ());
- DEBUG_OUT << "(string)";
+
yylval.scm = ly_str02scm(str.ch_C());
return STRING;
int
My_lily_lexer::scan_bare_word (String str)
{
- DEBUG_OUT << "word: `" << str<< "'\n";
+ SCM sym = ly_symbol2scm (str.ch_C ());
if ((YYSTATE == notes) || (YYSTATE == chords)) {
- if (notename_b (str)) {
- DEBUG_OUT << "(notename)\n";
- yylval.pitch = new Musical_pitch (lookup_notename (str));
+ SCM pitch = scm_hashq_ref (pitchname_tab_, sym, SCM_BOOL_F);
+ if (pitch != SCM_BOOL_F) {
+ yylval.pitch = new Musical_pitch (pitch);
yylval.pitch->set_spot (Input (source_file_l (),
here_ch_C ()));
return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH;
- } else if (chordmodifier_b (str)) {
- DEBUG_OUT << "(chordmodifier)\n";
- yylval.pitch = new Musical_pitch (lookup_chordmodifier (str));
+ } else if ((pitch = scm_hashq_ref (chordmodifier_tab_, sym, SCM_BOOL_F))!= SCM_BOOL_F)
+ {
+ yylval.pitch = new Musical_pitch (pitch);
yylval.pitch->set_spot (Input (source_file_l (),
here_ch_C ()));
return CHORDMODIFIER_PITCH;