Changeset 609 for branches/GNU/src/binutils/ld/ldlex.l
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/ld/ldlex.l
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 %{ 2 2 3 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 20004 Free Software Foundation, Inc.3 /* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 2000, 2001, 2002 Free Software Foundation, Inc. 5 5 6 6 This file is part of GLD, the Gnu Linker. … … 27 27 28 28 29 #include <ansidecl.h>29 #include "ansidecl.h" 30 30 #include <stdio.h> 31 #include <ctype.h>32 31 33 32 #ifdef MPW … … 38 37 #include "bfd.h" 39 38 #include "sysdep.h" 39 #include "safe-ctype.h" 40 #include "bfdlink.h" 40 41 #include "ld.h" 41 #include "ldgram.h"42 42 #include "ldmisc.h" 43 43 #include "ldexp.h" 44 44 #include "ldlang.h" 45 #include <ldgram.h> 45 46 #include "ldfile.h" 46 47 #include "ldlex.h" … … 117 118 118 119 V_TAG [.$_a-zA-Z][._a-zA-Z0-9]* 119 V_IDENTIFIER [*?.$_a-zA-Z ]([*?.$_a-zA-Z0-9]|::)*120 V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)* 120 121 121 122 %s SCRIPT … … 144 145 } 145 146 146 <BOTH,SCRIPT,EXPRESSION >"/*" { comment(); }147 <BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>"/*" { comment(); } 147 148 148 149 … … 154 155 <MRI,EXPRESSION>"$"([0-9A-Fa-f])+ { 155 156 yylval.integer = bfd_scan_vma (yytext+1, 0,16); 157 yylval.bigint.str = (char *) 0; 156 158 return INT; 157 159 } … … 179 181 yylval.integer = bfd_scan_vma (yytext, 0, 180 182 ibase); 183 yylval.bigint.str = (char *) 0; 181 184 return INT; 182 185 } 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)? { 184 187 char *s = yytext; 188 int ibase = 0; 185 189 186 190 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; 189 197 if (yytext[yyleng-1] == 'M' 190 198 || 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' 193 203 || 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 } 195 213 return INT; 196 214 } … … 240 258 <BOTH,SCRIPT>"LENGTH" { RTOKEN(LENGTH);} 241 259 <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);} 242 262 <EXPRESSION,BOTH,SCRIPT>"ADDR" { RTOKEN(ADDR);} 243 263 <EXPRESSION,BOTH,SCRIPT>"LOADADDR" { RTOKEN(LOADADDR);} … … 261 281 <BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);} 262 282 <BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);} 283 <BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);} 263 284 <BOTH,SCRIPT>"SECTIONS" { RTOKEN(SECTIONS);} 264 285 <BOTH,SCRIPT>"FILL" { RTOKEN(FILL);} … … 418 439 { 419 440 yy_switch_to_buffer(include_stack[include_stack_ptr]); 420 421 441 } 422 BEGIN(SCRIPT); 442 423 443 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]; 425 445 426 446 return END; … … 447 467 } 448 468 file_name_stack[include_stack_ptr] = name; 449 lineno_stack[include_stack_ptr] = 1;469 lineno_stack[include_stack_ptr] = lineno; 450 470 include_stack[include_stack_ptr] = YY_CURRENT_BUFFER; 451 471 452 472 include_stack_ptr++; 473 lineno = 1; 453 474 yyin = file; 454 475 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 455 BEGIN (SCRIPT);456 476 } 457 477 … … 461 481 static YY_BUFFER_STATE 462 482 yy_create_string_buffer (string, size) 463 CONSTchar *string;483 const char *string; 464 484 size_t size; 465 485 { … … 503 523 void 504 524 lex_redirect (string) 505 CONSTchar *string;525 const char *string; 506 526 { 507 527 YY_BUFFER_STATE tmp; … … 513 533 } 514 534 file_name_stack[include_stack_ptr] = "redirect"; 515 lineno_stack[include_stack_ptr] = 0;535 lineno_stack[include_stack_ptr] = lineno; 516 536 include_stack[include_stack_ptr] = YY_CURRENT_BUFFER; 517 537 include_stack_ptr++; 538 lineno = 1; 518 539 tmp = yy_create_string_buffer (string, strlen (string)); 519 540 yy_switch_to_buffer (tmp); 520 BEGIN (SCRIPT);521 541 } 522 542 … … 595 615 { 596 616 *result = 0; 597 if ( yy_current_buffer->yy_input_file)617 if (YY_CURRENT_BUFFER->yy_input_file) 598 618 { 599 619 if (yyin) 600 620 { 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)) 603 623 einfo ("%F%P: read in flex scanner failed\n"); 604 624 } … … 662 682 } 663 683 664 if (! isprint ((unsigned char)*what))684 if (! ISPRINT (*what)) 665 685 { 666 686 sprintf (buf, "\\%03o", (unsigned int) *what); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.