From 0f57cc9750282ce0284fe69b06f161dea2bfc8cb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 17 Jul 2016 16:03:47 +0200 Subject: parser/lexer: o Support special '/DISCARD/' as NAME. o Add 'SORT' as a token. It is equivalent with SORT_BY_NAME. The new rule sort_by_name coverts both. Ld: o Don't die on unknown sections, they can be referenced before declared. Doesn't matter for this app anyway. --- GnuLdLexer.g4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'GnuLdLexer.g4') diff --git a/GnuLdLexer.g4 b/GnuLdLexer.g4 index 16c4a9e..eb6090f 100644 --- a/GnuLdLexer.g4 +++ b/GnuLdLexer.g4 @@ -131,6 +131,7 @@ SIZEOF_HEADERS : 'SIZEOF_HEADERS'; SIZEOF : 'SIZEOF'; SORT_BY_ALIGNMENT : 'SORT_BY_ALIGNMENT'; SORT_BY_INIT_PRIORITY : 'SORT_BY_INIT_PRIORITY'; +SORT : 'SORT'; SORT_BY_NAME : 'SORT_BY_NAME'; SORT_NONE : 'SORT_NONE'; SPECIAL : 'SPECIAL'; @@ -159,7 +160,7 @@ QUOTE : '"' -> skip, pushMode(STRING); // | NAME # namePlain; //NAME : [\._a-zA-Z][\._a-zA-Z0-9]*; -NAME : [*\._a-zA-Z][*\.\/_a-zA-Z0-9]*; +NAME : [*\._a-zA-Z][*\.\/_a-zA-Z0-9]* | '/DISCARD/'; // TODO: ld supports some really fancy expressions here, like "0101010b", "ffH", "ffx", "$Aa" etc //INT : '0x' [0-9a-fA-F]+ -- cgit v1.2.3