[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue 5712: Split context_specification syntax constructor (issue 565560
From: |
nine . fierce . ballads |
Subject: |
Issue 5712: Split context_specification syntax constructor (issue 565560043 by address@hidden) |
Date: |
Wed, 29 Jan 2020 15:59:05 -0800 |
Reviewers: ,
Description:
https://sourceforge.net/p/testlilyissues/issues/5712/
... into context_create and context_find_or_create. This trades the
obscurity of a boolean constant for the clarity of specific names.
Please review this at https://codereview.appspot.com/565560043/
Affected files (+13, -9 lines):
M lily/include/lily-imports.hh
M lily/lily-imports.cc
M lily/parser.yy
M scm/ly-syntax-constructors.scm
Index: lily/include/lily-imports.hh
diff --git a/lily/include/lily-imports.hh b/lily/include/lily-imports.hh
index
1dbafaab8cf813b3944ce9ca240bbbc76d2dd8fe..42573978d2feb1467a2684654084d9c608bd34e7
100644
--- a/lily/include/lily-imports.hh
+++ b/lily/include/lily-imports.hh
@@ -126,7 +126,8 @@ namespace Syntax {
extern Variable argument_error;
extern Variable composed_markup_list;
extern Variable context_change;
- extern Variable context_specification;
+ extern Variable context_create;
+ extern Variable context_find_or_create;
extern Variable create_script;
extern Variable create_script_function;
extern Variable event_chord;
Index: lily/lily-imports.cc
diff --git a/lily/lily-imports.cc b/lily/lily-imports.cc
index
9cee91b5d1d5ff26d2331db5d062e96109c0d92b..42bae16501c45feb09f8c4033a88557320bdfb52
100644
--- a/lily/lily-imports.cc
+++ b/lily/lily-imports.cc
@@ -118,7 +118,8 @@ namespace Syntax {
Variable argument_error ("argument-error");
Variable composed_markup_list ("composed-markup-list");
Variable context_change ("context-change");
- Variable context_specification ("context-specification");
+ Variable context_create ("context-create");
+ Variable context_find_or_create ("context-find-or-create");
Variable create_script ("create-script");
Variable create_script_function ("create-script-function");
Variable event_chord ("event-chord");
Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index
dd58232ed12343508bc4ba55ab412c26879c32cf..89511c5d9d67a8091cbf9e043d9b99def124be58
100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -1605,10 +1605,10 @@ context_mod_list:
context_prefix:
CONTEXT symbol optional_id optional_context_mods {
- $$ = START_MAKE_SYNTAX (context_specification, $2, $3, $4,
SCM_BOOL_F);
+ $$ = START_MAKE_SYNTAX (context_find_or_create, $2, $3, $4);
}
| NEWCONTEXT symbol optional_id optional_context_mods {
- $$ = START_MAKE_SYNTAX (context_specification, $2, $3, $4,
SCM_BOOL_T);
+ $$ = START_MAKE_SYNTAX (context_create, $2, $3, $4);
}
;
@@ -2626,7 +2626,7 @@ mode_changed_music:
parser->lexer_->pop_state ();
}
| mode_changing_head_with_context optional_context_mods
grouped_music_list {
- $$ = MAKE_SYNTAX (context_specification, @$, $1, SCM_EOL, $2,
SCM_BOOL_T, $3);
+ $$ = MAKE_SYNTAX (context_create, @$, $1, SCM_EOL, $2, $3);
if (scm_is_eq ($1, ly_symbol2scm ("ChordNames")))
{
$$ = MAKE_SYNTAX (unrelativable_music, @$, $$);
Index: scm/ly-syntax-constructors.scm
diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm
index
c1950c4d3e4ad64ddf80960d0a731e7f4e3812b5..4303ff4fd2135c7599cf43f761b70d86b3d2c498
100644
--- a/scm/ly-syntax-constructors.scm
+++ b/scm/ly-syntax-constructors.scm
@@ -209,12 +209,14 @@ into a @code{MultiMeasureTextEvent}."
'duration duration
'elements articulations)))
-(define-public (context-specification type id ops create-new mus)
- (let ((csm (context-spec-music mus type id)))
- (set! (ly:music-property csm 'property-operations) ops)
- (if create-new (set! (ly:music-property csm 'create-new) #t))
+(define-public (context-create type id ops mus)
+ (let ((csm (context-spec-music mus type id ops)))
+ (set! (ly:music-property csm 'create-new) #t)
(ly:set-origin! csm)))
+(define-public (context-find-or-create type id ops mus)
+ (ly:set-origin! (context-spec-music mus type id ops)))
+
(define-public (composed-markup-list commands markups)
;; `markups' being a list of markups, eg (markup1 markup2 markup3),
;; and `commands' a list of commands with their scheme arguments, in reverse
order,
- Issue 5712: Split context_specification syntax constructor (issue 565560043 by address@hidden),
nine . fierce . ballads <=