]> git.donarmstrong.com Git - lilypond.git/blob - lily/lily-lexer-scheme.cc
Allow --safe testing as a snippet.
[lilypond.git] / lily / lily-lexer-scheme.cc
1 /* 
2   lily-lexer-scheme.cc -- implement Lily_lexer bindings. 
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2006 Han-Wen Nienhuys <hanwen@lilypond.org>
7   
8 */
9
10 #include "lily-lexer.hh"
11
12 LY_DEFINE(ly_lexer_keywords, "ly:lexer-keywords",
13           1, 0, 0, (SCM lexer),
14           "Return a list of (KEY . CODE) pairs, signifying the lilypond reserved words list.")
15 {
16   Lily_lexer * lex = Lily_lexer::unsmob (lexer);
17   SCM_ASSERT_TYPE(lex, lexer, SCM_ARG1, __FUNCTION__, "lily lexer");
18   return lex->keyword_list ();
19 }
20           
21
22 LY_DEFINE(ly_lexer_set_safe, "ly:lexer-set-safe!",
23           1, 0, 0, (SCM lexer),
24           "Switch on safe mode for the rest of the file.")
25 {
26   Lily_lexer * lex = Lily_lexer::unsmob (lexer);
27   SCM_ASSERT_TYPE(lex, lexer, SCM_ARG1, __FUNCTION__, "lily lexer");
28
29   lex->be_safe_ = true;
30   lex->allow_includes_ = false;
31   
32   return SCM_UNSPECIFIED;
33 }