|
From: | Han-Wen Nienhuys |
Subject: | Re: Updated parser patch |
Date: | Mon, 29 May 2006 12:59:47 +0200 |
User-agent: | Thunderbird 1.5.0.2 (X11/20060501) |
Erik Sandberg schreef:
Hi, The attached patch is an updated version of the previous parser patch. News: - new syntax rule for property settings- The music function handler now signals errors through the parser. I have added a new function ly:parser-error, which music functions can use to signal errors.I think it can be good to add parameters parser and location to all syntax rules, just like for music functions, but I haven't implemented that change yet.
+LY_DEFINE (ly_parser_error, "ly:parser-error", + 2, 1, 0, (SCM parser, SCM msg, SCM input), + "Display an error message, and make the parser fail") +{ + Lily_parser *p = unsmob_lily_parser (parser); + SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); + SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string"); + string s = ly_scm2string (msg);+ + Input *i = unsmob_input (input);+ if (i) + p->parser_error (*i, s); + else + p->parser_error (s);+ return parser;+}
Can you make it accept arbitrary arguments in the spirit of (format ..)? you will have to change argument order, of course.
-- Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen LilyPond Software Design -- Code for Music Notation http://www.lilypond-design.com
[Prev in Thread] | Current Thread | [Next in Thread] |