aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlex.l
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-08-13 19:16:49 +0000
committerSteve Chamberlain <sac@cygnus>1992-08-13 19:16:49 +0000
commit6bf2e3a7623a1ac43ba9a26a03963519346ce1c8 (patch)
treea658d749663ac18e42fc2000fafa9dabbbbbd3cb /ld/ldlex.l
parent4e8ea7a6e805d6ae239f396d269d01e01bffc589 (diff)
downloadgdb-6bf2e3a7623a1ac43ba9a26a03963519346ce1c8.zip
gdb-6bf2e3a7623a1ac43ba9a26a03963519346ce1c8.tar.gz
gdb-6bf2e3a7623a1ac43ba9a26a03963519346ce1c8.tar.bz2
* ldlex.l: now parses comment correctly, added ~ to acceptable
chars in filenames * ldexp.c (exp_unop): pass down abs_output_section - now can have unary -ve constants. * ldlang.c (lang_finish): warn when an entry symbol supplied on the command line can't be found.
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r--ld/ldlex.l58
1 files changed, 42 insertions, 16 deletions
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 2c21a58..f98e8fd 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -43,6 +43,37 @@ char *buystring();
unsigned int lineno = 1;
int old;
+comment()
+{
+ int c;
+ while (1)
+ {
+ c = input();
+ while (c !='*' && c != EOF)
+ {
+ if (c == '\n') lineno++;
+ c = input();
+ }
+
+
+ if (c == '*')
+ {
+ c = input();
+ while ( c == '*')
+ c = input();
+ if ( c == '/' )
+ break; /* found the end */
+ }
+
+ if ( c == EOF )
+ {
+ einfo( "%F%P :EOF in comment");
+ break;
+ }
+ }
+}
+
+
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) yy_input(buf, &result, max_size)
#undef YY_FATAL_ERROR
@@ -66,11 +97,11 @@ unsigned int include_stack_ptr = 0;
%a 4000
%o 5000
-CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-]
-CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>]
-FILENAMECHAR1 [_a-zA-Z\/\.\\]
+CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~]
+CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~]
+FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~]
SYMBOLCHARN [_a-zA-Z\/\.\\0-9]
-FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\]
+FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~]
FILENAME {FILENAMECHAR}+
WHITE [ \t\n]+
@@ -83,6 +114,10 @@ WHITE [ \t\n]+
%s MRI
%%
+
+<BOTH,SCRIPT,EXPRESSION,COMMAND>"/*" { comment(); }
+
+
<DEFSYMEXP>"-" { RTOKEN('-');}
<DEFSYMEXP>"+" { RTOKEN('+');}
<DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = buystring(yytext); return NAME; }
@@ -300,7 +335,7 @@ WHITE [ \t\n]+
<MRI>"FORMAT" { RTOKEN(FORMAT); }
<MRI>"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ }
<MRI>"SECT" { RTOKEN(SECT); }
-<MRI>"ABSOLUTE" { RTOKEN(ABSOLUTE); }
+<EXPRESSION,BOTH,SCRIPT,MRI>"ABSOLUTE" { RTOKEN(ABSOLUTE); }
<MRI>"end" { RTOKEN(ENDWORD); }
<MRI>"chip" { RTOKEN(CHIP); }
<MRI>"load" { RTOKEN(LOAD); }
@@ -309,7 +344,7 @@ WHITE [ \t\n]+
<MRI>"format" { RTOKEN(FORMAT); }
<MRI>"list".* { RTOKEN(LIST); /* LIST and ignore to end of line */ }
<MRI>"sect" { RTOKEN(SECT); }
-<MRI>"absolute" { RTOKEN(ABSOLUTE); }
+<EXPRESSION,BOTH,SCRIPT,MRI>"absolute" { RTOKEN(ABSOLUTE); }
<COMMAND>{CMDFILENAMECHAR1}{CMDFILENAMECHAR}* {
yylval.name = buystring(yytext);
@@ -335,16 +370,6 @@ WHITE [ \t\n]+
<BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;}
<MRI,COMMAND,BOTH,SCRIPT,EXPRESSION>[ \t]
-"/*" { old = INITIAL; BEGIN(COMMENT); }
-<COMMAND>"/*" { old = COMMAND; BEGIN(COMMENT); }
-<BOTH>"/*" { old =BOTH; BEGIN(COMMENT); }
-<SCRIPT>"/*" { old = EXPRESSION; BEGIN(COMMENT); }
-<EXPRESSION>"/*" { old = SCRIPT; BEGIN(COMMENT); }
-"/*" { old = INITIAL; BEGIN(COMMENT); }
-<COMMENT>[^*\\n]*
-<COMMENT>"*"+[^*/\\n]*
-<COMMENT>\\n { ++lineno;}
-<COMMENT>"*"+"/" { BEGIN(old); }
<<EOF>> {
include_stack_ptr--;
@@ -501,3 +526,4 @@ int max_size;
YY_FATAL_ERROR( "read() in flex scanner failed" );
}
}
+