]> git.donarmstrong.com Git - lilypond.git/commitdiff
parser.yy et al: make UNSIGNED a Scheme value token
authorDavid Kastrup <dak@gnu.org>
Tue, 1 Nov 2011 11:27:56 +0000 (12:27 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 8 Nov 2011 21:56:53 +0000 (22:56 +0100)
lily/lexer.ll
lily/parser.yy

index 01701b63f029d59cd9343225627f38a4a692bf8d..5619eea47fa5101e8ecbd48921cd7c54ec4024be 100644 (file)
@@ -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;
 }
 
index dee6893ce3cdff7c644258793539fa26092fe8a3..67196eec112bfe14777168c9c43e910ad697865a 100644 (file)
@@ -295,7 +295,7 @@ If we give names, Bison complains.
 
 
 %token <i> E_UNSIGNED
-%token <i> UNSIGNED
+%token <scm> UNSIGNED
 
 /* Artificial tokens, for more generic function syntax */
 %token <i> 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: