X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=165d105e386399ec7fdc0f0cdc48306c7ec32e95;hb=56803f159f4a7bcf205835b781531c7db9c10958;hp=33a75d50c89654c2728ae87f3cafb1746b9fa6cb;hpb=4b318c7b80d4b4c4084c49f62fa5ab8035adb136;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index 33a75d50c8..165d105e38 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -8,8 +8,9 @@ (c) 1997--2001 Han-Wen Nienhuys Jan Nieuwenhuizen */ - +#include #include + #include "translator-def.hh" #include "lily-guile.hh" #include "change-iterator.hh" @@ -45,6 +46,24 @@ #include "un-relativable-music.hh" #include "chord.hh" + + +bool +regular_identifier_b (SCM id) +{ + String str = ly_scm2string (id); + char const *s = str.ch_C() ; + + bool v = true; + while (*s && v) + { + v = v && isalpha (*s); + s++; + } + return v; +} + + bool is_duration_b (int t) { @@ -384,6 +403,9 @@ assignment: THIS->remember_spot (); } /* cont */ '=' identifier_init { + if (! regular_identifier_b ($1)) + THIS->parser_error (_ ("Identifier should have alphabetic characters only")); + THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4); /* @@ -1222,7 +1244,7 @@ request_that_take_dir: gen_text_def | verbose_request | script_abbreviation { - SCM s = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1)); + SCM s = THIS->lexer_p_->lookup_identifier ("dash" + ly_scm2string ($1)); Articulation_req *a = new Articulation_req; if (gh_string_p (s)) a->set_mus_property ("articulation-type", s); @@ -1476,22 +1498,22 @@ gen_text_def: script_abbreviation: '^' { - $$ = gh_str02scm ("hat"); + $$ = gh_str02scm ("Hat"); } | '+' { - $$ = gh_str02scm ("plus"); + $$ = gh_str02scm ("Plus"); } | '-' { - $$ = gh_str02scm ("dash"); + $$ = gh_str02scm ("Dash"); } | '|' { - $$ = gh_str02scm ("bar"); + $$ = gh_str02scm ("Bar"); } | '>' { - $$ = gh_str02scm ("larger"); + $$ = gh_str02scm ("Larger"); } | '.' { - $$ = gh_str02scm ("dot"); + $$ = gh_str02scm ("Dot"); } ;