From d5520dfd94c82e43a76adca47a8aefc71d7f6b4a Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Tue, 4 Jan 2011 15:14:10 +0100 Subject: [PATCH] Allow \markuplines to be stored in a variable and inserted later on in the parser --- input/regression/markup-lines-identifier.ly | 19 +++++++++++++++++++ lily/parser.yy | 17 +++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 input/regression/markup-lines-identifier.ly diff --git a/input/regression/markup-lines-identifier.ly b/input/regression/markup-lines-identifier.ly new file mode 100644 index 0000000000..65a40f387e --- /dev/null +++ b/input/regression/markup-lines-identifier.ly @@ -0,0 +1,19 @@ +\version "2.13.47" + +\header { + texidoc = "Text that can spread over pages is entered with the +@code{\\markuplines} command. It can be assigned to a variable and inserted +at top-level with or without preceding it by @code{\\markuplines}." +} + +#(set-default-paper-size "a6") + +mytext = \markuplines { + \justified-lines { + Lorem ipsum dolor sit amet, consectetur adipisici elit, sed + eiusmod tempor incidunt ut labore et dolore magna aliqua. ... + } +} + +\markuplines \mytext +\mytext diff --git a/lily/parser.yy b/lily/parser.yy index 031e117e90..240a4c1e3b 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -290,6 +290,7 @@ If we give names, Bison complains. %token MARKUP_FUNCTION %token MARKUP_LIST_FUNCTION %token MARKUP_IDENTIFIER +%token MARKUPLINES_IDENTIFIER %token MUSIC_FUNCTION %token MUSIC_IDENTIFIER %token NOTENAME_PITCH @@ -615,6 +616,9 @@ identifier_init: | full_markup { $$ = $1; } + | full_markup_list { + $$ = $1; + } | DIGIT { $$ = scm_from_int ($1); } @@ -2401,7 +2405,10 @@ lyric_markup: ; full_markup_list: - MARKUPLINES + MARKUPLINES_IDENTIFIER { + $$ = $1; + } + | MARKUPLINES { PARSER->lexer_->push_markup_state (); } markup_list { $$ = $3; @@ -2434,7 +2441,10 @@ markup_top: ; markup_list: - markup_composed_list { + MARKUPLINES_IDENTIFIER { + $$ = $1; + } + | markup_composed_list { $$ = $1; } | markup_braced_list { @@ -2627,6 +2637,9 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid) if (is_lyric_state ()) return LYRIC_MARKUP_IDENTIFIER; return MARKUP_IDENTIFIER; + } else if (Text_interface::is_markup_list (sid)) { + *destination = sid; + return MARKUPLINES_IDENTIFIER; } return -1; -- 2.39.2