aboutsummaryrefslogtreecommitdiff
path: root/GnuLdLexer.g4
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-17 18:56:29 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-17 18:56:29 +0200
commitea58b3887a7deba05e3fc85eb536038a547f8871 (patch)
treeb686e8985eb420f343636656711bfc24eab12613 /GnuLdLexer.g4
parentc543a2f713184ccf6a5e9077dbfb985bdc7c5b4b (diff)
downloadelfinfo-ea58b3887a7deba05e3fc85eb536038a547f8871.tar.gz
elfinfo-ea58b3887a7deba05e3fc85eb536038a547f8871.tar.bz2
elfinfo-ea58b3887a7deba05e3fc85eb536038a547f8871.tar.xz
elfinfo-ea58b3887a7deba05e3fc85eb536038a547f8871.zip
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.
Diffstat (limited to 'GnuLdLexer.g4')
-rw-r--r--GnuLdLexer.g418
1 files changed, 3 insertions, 15 deletions
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;