From: David Kastrup Date: Tue, 1 Nov 2011 11:27:56 +0000 (+0100) Subject: parser.yy et al: make UNSIGNED a Scheme value token X-Git-Tag: release/2.15.17-1~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4d3a8ac41c2a1e87e063301d386d2c69db7c54af;p=lilypond.git parser.yy et al: make UNSIGNED a Scheme value token --- diff --git a/lily/lexer.ll b/lily/lexer.ll index 01701b63f0..5619eea47f 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -427,7 +427,7 @@ BOM_UTF8 \357\273\277 } {UNSIGNED}/\/ | // backup rule {UNSIGNED} { - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } {E_UNSIGNED} { @@ -467,12 +467,12 @@ BOM_UTF8 \357\273\277 return FRACTION; } {UNSIGNED}/\/[^0-9] { // backup rule - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } {UNSIGNED}/\/ | // backup rule {UNSIGNED} { - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } {NOTECOMMAND} { @@ -512,12 +512,12 @@ BOM_UTF8 \357\273\277 return FRACTION; } {UNSIGNED}/\/[^0-9] { // backup rule - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } {UNSIGNED}/\/ | // backup rule {UNSIGNED} { - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } - { @@ -659,7 +659,7 @@ BOM_UTF8 \357\273\277 } {UNSIGNED} { - yylval.i = String_convert::dec2int (string (YYText ())); + yylval.scm = scm_c_read_string (YYText ()); return UNSIGNED; } diff --git a/lily/parser.yy b/lily/parser.yy index dee6893ce3..67196eec11 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -295,7 +295,7 @@ If we give names, Bison complains. %token E_UNSIGNED -%token UNSIGNED +%token UNSIGNED /* Artificial tokens, for more generic function syntax */ %token EXPECT_MARKUP "markup?" @@ -2170,7 +2170,7 @@ gen_text_def: fingering: UNSIGNED { Music *t = MY_MAKE_MUSIC ("FingeringEvent", @$); - t->set_property ("digit", scm_from_int ($1)); + t->set_property ("digit", $1); $$ = t->unprotect (); } ; @@ -2258,7 +2258,7 @@ multiplied_duration: fraction: FRACTION { $$ = $1; } | UNSIGNED '/' UNSIGNED { - $$ = scm_cons (scm_from_int ($1), scm_from_int ($3)); + $$ = scm_cons ($1, $3); } ; @@ -2283,9 +2283,7 @@ tremolo_type: ; bass_number: - UNSIGNED { - $$ = scm_from_int ($1); - } + UNSIGNED { $$ = $1; } | STRING { $$ = $1; } | full_markup { $$ = $1; } ; @@ -2592,7 +2590,7 @@ number_factor: bare_number: UNSIGNED { - $$ = scm_from_int ($1); + $$ = $1; } | REAL { $$ = $1; @@ -2603,7 +2601,7 @@ bare_number: | REAL NUMBER_IDENTIFIER { $$ = scm_from_double (scm_to_double ($1) *scm_to_double ($2)); } - | UNSIGNED NUMBER_IDENTIFIER { + | bare_unsigned NUMBER_IDENTIFIER { $$ = scm_from_double ($1 *scm_to_double ($2)); } ; @@ -2611,15 +2609,13 @@ bare_number: bare_unsigned: UNSIGNED { - $$ = $1; + $$ = scm_to_int ($1); } ; unsigned_number: - bare_unsigned { $$ = scm_from_int ($1); } - | NUMBER_IDENTIFIER { - $$ = $1; - } + UNSIGNED + | NUMBER_IDENTIFIER ; exclamations: