* ld-scripts/crossref.exp: Allow foo to have a leading dot.
[deliverable/binutils-gdb.git] / ld / ldlex.l
index b43cfa31874509fe48f4d446c0748993df3fcf34..0b15ca2fab6000023f765f5959fb9ff8e942babe 100644 (file)
@@ -1,7 +1,7 @@
 %{
 
-/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002  Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
 
@@ -418,11 +418,10 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
   else 
   {
     yy_switch_to_buffer(include_stack[include_stack_ptr]);
-
   }
-  BEGIN(SCRIPT);
+
   ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
-  lineno = lineno_stack[include_stack_ptr - 1];
+  lineno = lineno_stack[include_stack_ptr];
 
   return END;
 }
@@ -446,13 +445,13 @@ lex_push_file (file, name)
       einfo("%F:includes nested too deeply\n");
     }
   file_name_stack[include_stack_ptr] = name;
-  lineno_stack[include_stack_ptr] = 1;
+  lineno_stack[include_stack_ptr] = lineno;
   include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
 
   include_stack_ptr++;
+  lineno = 1;
   yyin = file;
   yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
-  BEGIN (SCRIPT);
 }
 
 /* Return a newly created flex input buffer containing STRING,
@@ -512,12 +511,12 @@ lex_redirect (string)
       einfo("%F: macros nested too deeply\n");
     }
   file_name_stack[include_stack_ptr] = "redirect";
-  lineno_stack[include_stack_ptr] = 0;
+  lineno_stack[include_stack_ptr] = lineno;
   include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
   include_stack_ptr++;
+  lineno = 1;
   tmp = yy_create_string_buffer (string, strlen (string));
   yy_switch_to_buffer (tmp);
-  BEGIN (SCRIPT);
 }
 \f
 /* Functions to switch to a different flex start condition,
@@ -596,8 +595,8 @@ yy_input (buf, result, max_size)
     {
       if (yyin)
        {
-         *result = read (fileno (yyin), (char *) buf, max_size);
-         if (*result < 0
+         *result = fread ((char *) buf, 1, max_size, yyin);
+         if (*result < max_size && ferror (yyin)
            einfo ("%F%P: read in flex scanner failed\n");
        }
     }
This page took 0.023473 seconds and 4 git commands to generate.