From ea58b3887a7deba05e3fc85eb536038a547f8871 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 17 Jul 2016 18:56:29 +0200 Subject: lexer/parser: o Renaming the ASSERT_K token to ASSERT. o Fixing a bug in the NAME regex where underscored where not allowed in certain names. o All ASSERT statements use string instead of NAME. o Improving STRING_ANY, allow many non-quote tokens instead of just one. Can probably replace the entire string rule with STRING_ANY now. o Fixing naming of '!', "~" and "?" operators. Ld: o Implement support for multiplication and division operators. o Better error messages. --- GnuLdLexer.g4 | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'GnuLdLexer.g4') diff --git a/GnuLdLexer.g4 b/GnuLdLexer.g4 index 10475d8..4b4b202 100644 --- a/GnuLdLexer.g4 +++ b/GnuLdLexer.g4 @@ -44,7 +44,7 @@ ALIGNMOD : 'ALIGNMOD'; ALIGNOF : 'ALIGNOF'; ALIGN_WITH_INPUT : 'ALIGN_WITH_INPUT'; AS_NEEDED : 'AS_NEEDED'; -ASSERT_K : 'ASSERT'; +ASSERT : 'ASSERT'; AT : 'AT'; BASE : 'BASE'; BEFORE : 'BEFORE'; @@ -146,21 +146,9 @@ VERS_IDENTIFIER : 'VERS_IDENTIFIER'; VERSIONK : 'VERSIONK'; VERS_TAG : 'VERS_TAG'; -/* -Names are very liberal, they can be full strings and start with a dot. -*/ - QUOTE : '"' -> skip, pushMode(STRING); -//SPACE : ' '; -//SPACES : ' '+; - -//name : -// '"' (NAME | SPACE | SPACES)+ '"' # nameQuoted -// | NAME # namePlain; - -//NAME : [\._a-zA-Z][\._a-zA-Z0-9]*; -NAME : [*\._a-zA-Z][*-\.\/_a-zA-Z0-9]* | '/DISCARD/'; +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]+ @@ -228,5 +216,5 @@ WS ; mode STRING; -STRING_ANY : ~'"'; +STRING_ANY : ~'"'+; STRING_END_QUOTE : '"' -> skip, popMode; -- cgit v1.2.3