[Gllug] Bison question

Pete Ryland pdr at pdr.cx
Wed Dec 4 20:33:43 UTC 2002


On Wed, Dec 04, 2002 at 05:04:40PM +0000, rich at annexia.org wrote:
> filename
>         : STRING
>           {
>             $$ = strdup (mp_string);
>           }
>      '(' props ')'
>           {
>             /* Make sure the file exists. */
>             file_add ($$);
> 
>             /* Add the properties to the file. */
>             file_set_props ($$, $<props>3);
>           }
>       ;
<snip>
> Any ideas why this is?

Why don't you look at the generated .c file? :)

The rule you really want is:

filename: STRING '(' props ')' {
            file_add(strdup($1));
            file_set_props($1, $3);
          }
        ;

Is this your homework or something? ;)

Pete

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list