diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-11 18:16:35 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-08-11 19:46:43 +0930 |
commit | cc9faa98adc96788e6a560c685bbd8e69c856cb7 (patch) | |
tree | 7fdee9cb10ca0ed1150c0d61278f9179af298793 /ld/ldlex.l | |
parent | 6c93cebf2dd6ed203efe01e2c696fbb2c44ff42d (diff) | |
download | binutils-cc9faa98adc96788e6a560c685bbd8e69c856cb7.zip binutils-cc9faa98adc96788e6a560c685bbd8e69c856cb7.tar.gz binutils-cc9faa98adc96788e6a560c685bbd8e69c856cb7.tar.bz2 |
PR28198, Support # as linker script comment marker
PR 28198
* ldlex.l: Combine rules for handling newline, whitespace and
comments. Extend # comment handling to all states.
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r-- | ld/ldlex.l | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -420,8 +420,13 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* yylval.name[len] = 0; return NAME; } -<BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;} -<MRI,BOTH,SCRIPT,EXPRESSION>[ \t\r]+ { } + +<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>"\n" { + lineno++; } +<MRI,BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[ \t\r]+ { + /* Eat up whitespace */ } +<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>#.* { + /* Eat up comments */ } <VERS_NODE,VERS_SCRIPT>[:,;] { return *yytext; } @@ -450,12 +455,6 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* return *yytext; } -<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[\n] { lineno++; } - -<VERS_START,VERS_NODE,VERS_SCRIPT>#.* { /* Eat up comments */ } - -<VERS_START,VERS_NODE,VERS_SCRIPT,INPUTLIST>[ \t\r]+ { /* Eat up whitespace */ } - <<EOF>> { include_stack_ptr--; if (include_stack_ptr == 0) |