#include "lily-proto.hh"
#include "scm-hash.hh"
#include "interval.hh"
-#include "input-file-results.hh"
#include "lily-guile.hh"
#include "parser.hh"
#include "keyword.hh"
{"appoggiatura", APPOGGIATURA},
{"autochange", AUTOCHANGE},
{"bar", BAR},
+ {"book", BOOK},
{"breathe", BREATHE},
{"change", CHANGE},
{"chords", CHORDS},
};
-My_lily_lexer::My_lily_lexer ()
+My_lily_lexer::My_lily_lexer (Sources *srcs)
{
keytable_ = new Keyword_table (the_key_tab);
-
+ encoding_ = SCM_EOL;
chordmodifier_tab_ = scm_make_vector (scm_int2num (1), SCM_EOL);
pitchname_tab_stack_ = SCM_EOL;
-
+ sources_ = srcs;
scopes_ = SCM_EOL;
add_scope (ly_make_anonymous_module ());
main_input_b_ = false;
}
+SCM
+My_lily_lexer::encoding () const
+{
+ return encoding_ ;
+}
+
void
My_lily_lexer::add_scope (SCM module)
{
ly_reexport_module (scm_current_module ());
scm_set_current_module (module);
- for (SCM s = scopes_; ly_pair_p (s); s = ly_cdr (s))
+ for (SCM s = scopes_; ly_c_pair_p (s); s = ly_cdr (s))
{
/* UGH. how to do this more neatly? */
SCM expr
My_lily_lexer::lookup_identifier (String s)
{
SCM sym = ly_symbol2scm (s.to_str0());
- for (SCM s = scopes_; ly_pair_p (s); s = ly_cdr (s))
+ for (SCM s = scopes_; ly_c_pair_p (s); s = ly_cdr (s))
{
SCM var = ly_module_lookup (ly_car (s), sym);
if (var != SCM_BOOL_F)
My_lily_lexer::start_main_input ()
{
// yy_flex_debug = 1;
-
- new_input (main_input_name_, &global_input_file->sources_);
+ new_input (main_input_name_, sources_);
/* Do not allow \include in --safe-mode */
allow_includes_b_ = allow_includes_b_ && ! safe_global_b;
void
My_lily_lexer::set_identifier (SCM name, SCM s)
{
- assert (gh_string_p (name));
+ assert (ly_c_string_p (name));
if (lookup_keyword (ly_scm2string (name)) >= 0)
{
}
SCM sym = scm_string_to_symbol (name);
- SCM mod = gh_car (scopes_);
+ SCM mod = ly_car (scopes_);
scm_module_define (mod, sym, s);
}
void
My_lily_lexer::set_encoding (String s)
{
- encoding_ = s;
+ if (s.length ())
+ encoding_ = ly_symbol2scm (s.to_str0 ());
+ else
+ encoding_ = SCM_EOL;
}