OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [binutils/] [defparse.y] - Diff between revs 15 and 166

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 15 Rev 166
Line 26... Line 26...
#include "dlltool.h"
#include "dlltool.h"
%}
%}
 
 
%union {
%union {
  char *id;
  char *id;
 
  const char *id_const;
  int number;
  int number;
};
};
 
 
%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATA
%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATA
%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANT
%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANT
Line 38... Line 39...
%token EQUAL
%token EQUAL
%token  ID
%token  ID
%token  NUMBER
%token  NUMBER
%type   opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
%type   opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
%type   attr attr_list opt_number
%type   attr attr_list opt_number
%type   opt_name opt_equal_name opt_import_name
%type   opt_name opt_name2 opt_equal_name opt_import_name
 
%type   keyword_as_name
 
 
%%
%%
 
 
start: start command
start: start command
        | command
        | command
Line 148... Line 150...
opt_PRIVATE:
opt_PRIVATE:
                PRIVATE { $$ = 1; }
                PRIVATE { $$ = 1; }
        |               { $$ = 0; }
        |               { $$ = 0; }
        ;
        ;
 
 
opt_name: ID            { $$ =$1; }
keyword_as_name: NAME { $$ = "NAME"; }
        | ID '.' ID
/*  Disabled LIBRARY keyword for a quirk in libtool. It places LIBRARY
 
    command after EXPORTS list, which is illegal by specification.
 
    See PR binutils/13710
 
        | LIBRARY { $$ = "LIBRARY"; } */
 
        | DESCRIPTION { $$ = "DESCRIPTION"; }
 
        | STACKSIZE { $$ = "STACKSIZE"; }
 
        | HEAPSIZE { $$ = "HEAPSIZE"; }
 
        | CODE { $$ = "CODE"; }
 
        | DATA { $$ = "DATA"; }
 
        | SECTIONS { $$ = "SECTIONS"; }
 
        | EXPORTS { $$ = "EXPORTS"; }
 
        | IMPORTS { $$ = "IMPORTS"; }
 
        | VERSIONK { $$ = "VERSION"; }
 
        | BASE { $$ = "BASE"; }
 
        | CONSTANT { $$ = "CONSTANT"; }
 
        | NONAME { $$ = "NONAME"; }
 
        | PRIVATE { $$ = "PRIVATE"; }
 
        | READ { $$ = "READ"; }
 
        | WRITE { $$ = "WRITE"; }
 
        | EXECUTE { $$ = "EXECUTE"; }
 
        | SHARED { $$ = "SHARED"; }
 
        | NONSHARED { $$ = "NONSHARED"; }
 
        | SINGLE { $$ = "SINGLE"; }
 
        | MULTIPLE { $$ = "MULTIPLE"; }
 
        | INITINSTANCE { $$ = "INITINSTANCE"; }
 
        | INITGLOBAL { $$ = "INITGLOBAL"; }
 
        | TERMINSTANCE { $$ = "TERMINSTANCE"; }
 
        | TERMGLOBAL { $$ = "TERMGLOBAL"; }
 
        ;
 
 
 
opt_name2: ID { $$ = $1; }
 
        | '.' keyword_as_name
 
          {
 
            char *name = xmalloc (strlen ($2) + 2);
 
            sprintf (name, ".%s", $2);
 
            $$ = name;
 
          }
 
        | '.' opt_name2
 
          {
 
            char *name = xmalloc (strlen ($2) + 2);
 
            sprintf (name, ".%s", $2);
 
            $$ = name;
 
          }
 
        | keyword_as_name '.' opt_name2
          {
          {
            char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
            char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
            sprintf (name, "%s.%s", $1, $3);
            sprintf (name, "%s.%s", $1, $3);
            $$ = name;
            $$ = name;
          }
          }
 
        | ID '.' opt_name2
 
          {
 
            char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
 
            sprintf (name, "%s.%s", $1, $3);
 
            $$ = name;
 
          }
 
        ;
 
opt_name: opt_name2 { $$ =$1; }
        |               { $$=""; }
        |               { $$=""; }
        ;
        ;
 
 
opt_ordinal:
opt_ordinal:
          '@' NUMBER     { $$=$2;}
          '@' NUMBER     { $$=$2;}
        |                { $$=-1;}
        |                { $$=-1;}
        ;
        ;
 
 
opt_import_name:
opt_import_name:
          EQUAL ID      { $$ = $2; }
          EQUAL opt_name2       { $$ = $2; }
        |               { $$ = 0; }
        |               { $$ = 0; }
        ;
        ;
 
 
opt_equal_name:
opt_equal_name:
          '=' ID        { $$ = $2; }
          '=' opt_name2 { $$ = $2; }
        | '=' ID '.' ID
 
          {
 
            char *name = xmalloc (strlen ($2) + 1 + strlen ($4) + 1);
 
            sprintf (name, "%s.%s", $2, $4);
 
            $$ = name;
 
          }
 
        |               { $$ =  0; }
        |               { $$ =  0; }
        ;
        ;
 
 
opt_base: BASE  '=' NUMBER      { $$= $3;}
opt_base: BASE  '=' NUMBER      { $$= $3;}
        |       { $$=-1;}
        |       { $$=-1;}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.