Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/ld/ldlex.l

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11%{
    22
    3 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
    4    Free Software Foundation, Inc.
     3/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
     4   2000, 2001, 2002  Free Software Foundation, Inc.
    55
    66This file is part of GLD, the Gnu Linker.
     
    2727
    2828
    29 #include <ansidecl.h>
     29#include "ansidecl.h"
    3030#include <stdio.h>
    31 #include <ctype.h>
    3231
    3332#ifdef MPW
     
    3837#include "bfd.h"
    3938#include "sysdep.h"
     39#include "safe-ctype.h"
     40#include "bfdlink.h"
    4041#include "ld.h"
    41 #include "ldgram.h"
    4242#include "ldmisc.h"
    4343#include "ldexp.h"
    4444#include "ldlang.h"
     45#include <ldgram.h>
    4546#include "ldfile.h"
    4647#include "ldlex.h"
     
    117118
    118119V_TAG [.$_a-zA-Z][._a-zA-Z0-9]*
    119 V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
     120V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
    120121
    121122%s SCRIPT
     
    144145    }
    145146
    146 <BOTH,SCRIPT,EXPRESSION>"/*"    { comment(); }
     147<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>"/*"   { comment(); }
    147148
    148149
     
    154155<MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
    155156                                yylval.integer = bfd_scan_vma (yytext+1, 0,16);
     157                                yylval.bigint.str = (char *) 0;
    156158                                return INT;
    157159                        }
     
    179181                                   yylval.integer = bfd_scan_vma (yytext, 0,
    180182                                                                  ibase);
     183                                   yylval.bigint.str = (char *) 0;
    181184                                   return INT;
    182185                                 }
    183 <SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|"0x")([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
     186<SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|0[xX])([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
    184187                                  char *s = yytext;
     188                                  int ibase = 0;
    185189
    186190                                  if (*s == '$')
    187                                     ++s;
    188                                   yylval.integer = bfd_scan_vma (s, 0, 0);
     191                                    {
     192                                      ++s;
     193                                      ibase = 16;
     194                                    }
     195                                  yylval.integer = bfd_scan_vma (s, 0, ibase);
     196                                  yylval.bigint.str = (char *) 0;
    189197                                  if (yytext[yyleng-1] == 'M'
    190198                                      || yytext[yyleng-1] == 'm')
    191                                     yylval.integer *= 1024 * 1024;
    192                                   if (yytext[yyleng-1] == 'K'
     199                                    {
     200                                      yylval.integer *= 1024 * 1024;
     201                                    }
     202                                  else if (yytext[yyleng-1] == 'K'
    193203                                      || yytext[yyleng-1]=='k')
    194                                     yylval.integer *= 1024;
     204                                    {
     205                                      yylval.integer *= 1024;
     206                                    }
     207                                  else if (yytext[0] == '0'
     208                                           && (yytext[1] == 'x'
     209                                               || yytext[1] == 'X'))
     210                                    {
     211                                      yylval.bigint.str = xstrdup (yytext + 2);
     212                                    }
    195213                                  return INT;
    196214                                }
     
    240258<BOTH,SCRIPT>"LENGTH"           { RTOKEN(LENGTH);}
    241259<EXPRESSION,BOTH,SCRIPT>"ALIGN"                 { RTOKEN(ALIGN_K);}
     260<EXPRESSION,BOTH,SCRIPT>"DATA_SEGMENT_ALIGN"    { RTOKEN(DATA_SEGMENT_ALIGN);}
     261<EXPRESSION,BOTH,SCRIPT>"DATA_SEGMENT_END"      { RTOKEN(DATA_SEGMENT_END);}
    242262<EXPRESSION,BOTH,SCRIPT>"ADDR"                  { RTOKEN(ADDR);}
    243263<EXPRESSION,BOTH,SCRIPT>"LOADADDR"              { RTOKEN(LOADADDR);}
     
    261281<BOTH,SCRIPT>"CONSTRUCTORS"             { RTOKEN( CONSTRUCTORS);}
    262282<BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
     283<BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);}
    263284<BOTH,SCRIPT>"SECTIONS"         { RTOKEN(SECTIONS);}
    264285<BOTH,SCRIPT>"FILL"                     { RTOKEN(FILL);}
     
    418439  {
    419440    yy_switch_to_buffer(include_stack[include_stack_ptr]);
    420 
    421441  }
    422   BEGIN(SCRIPT);
     442
    423443  ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
    424   lineno = lineno_stack[include_stack_ptr - 1];
     444  lineno = lineno_stack[include_stack_ptr];
    425445
    426446  return END;
     
    447467    }
    448468  file_name_stack[include_stack_ptr] = name;
    449   lineno_stack[include_stack_ptr] = 1;
     469  lineno_stack[include_stack_ptr] = lineno;
    450470  include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
    451471
    452472  include_stack_ptr++;
     473  lineno = 1;
    453474  yyin = file;
    454475  yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
    455   BEGIN (SCRIPT);
    456476}
    457477
     
    461481static YY_BUFFER_STATE
    462482yy_create_string_buffer (string, size)
    463      CONST char *string;
     483     const char *string;
    464484     size_t size;
    465485{
     
    503523void
    504524lex_redirect (string)
    505      CONST char *string;
     525     const char *string;
    506526{
    507527  YY_BUFFER_STATE tmp;
     
    513533    }
    514534  file_name_stack[include_stack_ptr] = "redirect";
    515   lineno_stack[include_stack_ptr] = 0;
     535  lineno_stack[include_stack_ptr] = lineno;
    516536  include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
    517537  include_stack_ptr++;
     538  lineno = 1;
    518539  tmp = yy_create_string_buffer (string, strlen (string));
    519540  yy_switch_to_buffer (tmp);
    520   BEGIN (SCRIPT);
    521541}
    522542
     
    595615{
    596616  *result = 0;
    597   if (yy_current_buffer->yy_input_file)
     617  if (YY_CURRENT_BUFFER->yy_input_file)
    598618    {
    599619      if (yyin)
    600620        {
    601           *result = read (fileno (yyin), (char *) buf, max_size);
    602           if (*result < 0)
     621          *result = fread ((char *) buf, 1, max_size, yyin);
     622          if (*result < max_size && ferror (yyin))
    603623            einfo ("%F%P: read in flex scanner failed\n");
    604624        }
     
    662682    }
    663683
    664   if (! isprint ((unsigned char) *what))
     684  if (! ISPRINT (*what))
    665685    {
    666686      sprintf (buf, "\\%03o", (unsigned int) *what);
Note: See TracChangeset for help on using the changeset viewer.