diff options
Diffstat (limited to 'ld/deffilep.y')
-rw-r--r-- | ld/deffilep.y | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/ld/deffilep.y b/ld/deffilep.y index 5f02727..83872f5 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -103,6 +103,7 @@ static const char *lex_parse_string_end = 0; %union { char *id; int number; + char *digits; }; %token NAME LIBRARY DESCRIPTION STACKSIZE_K HEAPSIZE CODE DATAU DATAL @@ -110,10 +111,12 @@ static const char *lex_parse_string_end = 0; %token PRIVATEU PRIVATEL ALIGNCOMM %token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE %token <id> ID -%token <number> NUMBER +%token <digits> DIGITS +%type <number> NUMBER +%type <digits> opt_digits %type <number> opt_base opt_ordinal %type <number> attr attr_list opt_number exp_opt_list exp_opt -%type <id> opt_name opt_equal_name dot_name +%type <id> opt_name opt_equal_name dot_name anylang_id opt_id %% @@ -135,7 +138,7 @@ command: | VERSIONK NUMBER { def_version ($2, 0);} | VERSIONK NUMBER '.' NUMBER { def_version ($2, $4);} | DIRECTIVE ID { def_directive ($2);} - | ALIGNCOMM ID ',' NUMBER { def_aligncomm ($2, $4);} + | ALIGNCOMM anylang_id ',' NUMBER { def_aligncomm ($2, $4);} ; @@ -245,7 +248,25 @@ dot_name: ID { $$ = $1; } $$ = name; } ; - + +anylang_id: ID { $$ = $1; } + | anylang_id '.' opt_digits opt_id + { + char *id = xmalloc (strlen ($1) + 1 + strlen ($3) + strlen ($4) + 1); + sprintf (id, "%s.%s%s", $1, $3, $4); + $$ = id; + } + ; + +opt_digits: DIGITS { $$ = $1; } + | { $$ = ""; } + ; + +opt_id: ID { $$ = $1; } + | { $$ = ""; } + ; + +NUMBER: DIGITS { $$ = strtoul ($1, 0, 0); } %% @@ -1010,11 +1031,11 @@ def_lex (void) } if (c != EOF) def_ungetc (c); - yylval.number = strtoul (buffer, 0, 0); + yylval.digits = xstrdup (buffer); #if TRACE - printf ("lex: `%s' returns NUMBER %d\n", buffer, yylval.number); + printf ("lex: `%s' returns DIGITS\n", buffer); #endif - return NUMBER; + return DIGITS; } if (ISALPHA (c) || strchr ("$:-_?@", c)) |