From 4f73dc31d42627f022d5efc9b241571c0ea1d4cb Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 4 Jul 2015 16:45:49 +0200 Subject: [PATCH] Issue 4483: parser.yy: reimplement MAKE_SYNTAX using with_location --- lily/parser.yy | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index ef0962c05e..25b7cd86c3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -187,39 +187,30 @@ Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const str parser->lexer_->override_input (spot)) /* ES TODO: -- Don't use lily module, create a new module instead. - delay application of the function */ -static SCM -syntax_call (void *arg) -{ - SCM sarg = reinterpret_cast (arg); - return scm_apply_0 (scm_car (sarg), scm_cdr (sarg)); -} - -#define LOWLEVEL_MAKE_SYNTAX(location, args) \ - scm_c_with_fluid \ - (Lily::f_location, \ - parser->lexer_->override_input (location).smobbed_copy (), \ - syntax_call, \ - reinterpret_cast (args)) +#define LOWLEVEL_MAKE_SYNTAX(location, proc, ...) \ + with_location \ + (parser->lexer_->override_input (location).smobbed_copy (), \ + proc, \ + ##__VA_ARGS__) /* Syntactic Sugar. */ #define MAKE_SYNTAX(name, location, ...) \ - LOWLEVEL_MAKE_SYNTAX (location, \ - scm_list_n (Syntax::name, \ - ##__VA_ARGS__, SCM_UNDEFINED)) + LOWLEVEL_MAKE_SYNTAX (location, Syntax::name, ##__VA_ARGS__) #define START_MAKE_SYNTAX(name, ...) \ - scm_list_n (Syntax::name, \ - ##__VA_ARGS__, SCM_UNDEFINED) + scm_list_n (Syntax::name, ##__VA_ARGS__, SCM_UNDEFINED) #define FINISH_MAKE_SYNTAX(start, location, ...) \ - LOWLEVEL_MAKE_SYNTAX (location, \ - scm_append_x \ - (scm_list_2 (start, scm_list_n \ - (__VA_ARGS__, SCM_UNDEFINED)))) + LOWLEVEL_MAKE_SYNTAX \ + (location, \ + Guile_user::apply, \ + scm_car (start), \ + scm_append_x \ + (scm_list_2 (scm_cdr (start), \ + scm_list_n (__VA_ARGS__, SCM_UNDEFINED)))) SCM get_next_unique_context_id (); SCM get_next_unique_lyrics_context_id (); -- 2.39.2