void start_main_input ();
+ SCM keyword_list () const;
SCM lookup_identifier (string s);
SCM lookup_identifier_symbol (SCM s);
void push_extra_token (int token_type);
--- /dev/null
+/*
+ lily-lexer-scheme.cc -- implement Lily_lexer bindings.
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2006 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+*/
+
+#include "lily-lexer.hh"
+
+LY_DEFINE(ly_lexer_keywords, "ly:lexer-keywords",
+ 1,0,0, (SCM lexer),
+ "Return a list of (KEY . CODE) pairs, signifying the lilypond reserved words list.")
+{
+ Lily_lexer * lex = Lily_lexer::unsmob (lexer);
+ SCM_ASSERT_TYPE(lex, lexer, SCM_ARG1, __FUNCTION__, "lily lexer");
+ return lex->keyword_list ();
+}
+
return keytable_->lookup (s.c_str ());
}
+SCM
+Lily_lexer::keyword_list () const
+{
+ if (!keytable_)
+ return SCM_EOL;
+
+ SCM l = SCM_EOL;
+ SCM *tail = &l;
+ for (vsize i = 0; i < keytable_->table_.size (); i++)
+ {
+ *tail = scm_acons (scm_makfrom0str (keytable_->table_[i].name_),
+ scm_from_int (keytable_->table_[i].tokcode_),
+ SCM_EOL);
+
+ tail = SCM_CDRLOC(*tail);
+ }
+
+ return l;
+}
+
SCM
Lily_lexer::lookup_identifier_symbol (SCM sym)
{