From 881fede3d7f33766c404d90303f7a929b58c7316 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 2 Feb 2006 01:05:31 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 6 ++++++ lily/lexer.ll | 12 +++++++++++- lily/parser.yy | 17 +++++++++++++---- scm/output-ps.scm | 1 - 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d76b12286..37c119fe69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ 2006-02-02 Han-Wen Nienhuys + * lily/parser.yy (output_def_head_with_mode_switch): new + production. Result: dashes and underscores may be used in the + \paper block. + + * lily/lexer.ll: add DASHED_WORD. Accept in INITIAL mode. + * python/convertrules.py (conv): oops. One slash too much. 2006-02-02 Jan Nieuwenhuizen diff --git a/lily/lexer.ll b/lily/lexer.ll index 6b418db07c..abd0c101de 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -124,6 +124,8 @@ ACCENT \\[`'"^] NATIONAL [\001-\006\021-\027\031\036\200-\377] TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} WORD {A}{AN}* +DASHED_WORD {A}({AN}|-)* +DASHED_KEY_WORD \\{DASHED_WORD} ALPHAWORD {A}+ DIGIT {N} UNSIGNED {N}+ @@ -212,7 +214,7 @@ BOM_UTF8 \357\273\277 LexerError (_ ("quoted string expected after \\version").c_str ()); yy_pop_state (); } ->. { +. { LexerError (_ ("quoted string expected after \\sourcefilename").c_str ()); yy_pop_state (); } @@ -559,6 +561,14 @@ BOM_UTF8 \357\273\277 yyterminate (); } +{ + {DASHED_WORD} { + return scan_bare_word (YYText ()); + } + {DASHED_KEY_WORD} { + return scan_escaped_word (YYText () + 1); + } +} {WORD} { return scan_bare_word (YYText ()); diff --git a/lily/parser.yy b/lily/parser.yy index 0f6e2c120f..4c5413acdd 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -342,6 +342,7 @@ If we give names, Bison complains. %type output_def_body %type output_def_head +%type output_def_head_with_mode_switch %type output_def %type paper_block @@ -531,9 +532,13 @@ assignment: assignment_id '=' identifier_init { if (! is_regular_identifier ($1)) { +#if 0 + /* no longer valid with dashes in \paper{} block. */ @1.warning (_ ("identifier should have alphabetic characters only")); +#endif } + THIS->lexer_->set_identifier ($1, $3); /* @@ -758,21 +763,25 @@ output_def_head: } ; +output_def_head_with_mode_switch: + output_def_head { + THIS->lexer_->push_initial_state (); + $$ = $1; + } + ; output_def_body: - output_def_head '{' { + output_def_head_with_mode_switch '{' { $$ = $1; $$->input_origin_.set_spot (@$); - THIS->lexer_->push_initial_state (); } - | output_def_head '{' OUTPUT_DEF_IDENTIFIER { + | output_def_head_with_mode_switch '{' OUTPUT_DEF_IDENTIFIER { $1->unprotect (); Output_def *o = unsmob_output_def ($3); o->input_origin_.set_spot (@$); $$ = o; THIS->lexer_->remove_scope (); THIS->lexer_->add_scope (o->scope_); - THIS->lexer_->push_initial_state (); } | output_def_body assignment { diff --git a/scm/output-ps.scm b/scm/output-ps.scm index f7d0ee5b44..e9e57d2750 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -130,7 +130,6 @@ (ly:number->string y2) " lineto stroke")) (define (embedded-ps string) - (display (list "len " (string-length string) "\n")) string) (define (glyph-string -- 2.39.2