summaryrefslogtreecommitdiff
path: root/dtc-lexer.l
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2012-04-03 20:56:00 -0600
committerJon Loeliger <jdl@jdl.com>2012-04-09 08:42:05 -0500
commit5f0c3b2d6235dec65fff1628a97f45e21680b36d (patch)
tree02879e2ced2df8ebd86fc97219d9fe709f8af332 /dtc-lexer.l
parenteaec1dbc5946d5fd01a9ef7120f8461c74d759a0 (diff)
downloaddtc-5f0c3b2d6235dec65fff1628a97f45e21680b36d.tar.gz
dtc: Basic integer expressions
Written by David Gibson <david@gibson.dropbear.id.au>. Additions by me: * Ported to ToT dtc. * Renamed cell to integer throughout. * Implemented value range checks. * Allow U/L/UL/LL/ULL suffix on literals. * Enabled the commented test. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r--dtc-lexer.l11
1 files changed, 10 insertions, 1 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 73d190c..4715f31 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -110,7 +110,7 @@ static int pop_input_file(void);
return DT_LABEL;
}
-<V1>[0-9]+|0[xX][0-9a-fA-F]+ {
+<V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
yylval.literal = xstrdup(yytext);
DPRINT("Literal: '%s'\n", yylval.literal);
return DT_LITERAL;
@@ -164,6 +164,15 @@ static int pop_input_file(void);
<*>{COMMENT}+ /* eat C-style comments */
<*>{LINECOMMENT}+ /* eat C++-style comments */
+<*>"<<" { return DT_LSHIFT; };
+<*>">>" { return DT_RSHIFT; };
+<*>"<=" { return DT_LE; };
+<*>">=" { return DT_GE; };
+<*>"==" { return DT_EQ; };
+<*>"!=" { return DT_NE; };
+<*>"&&" { return DT_AND; };
+<*>"||" { return DT_OR; };
+
<*>. {
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
(unsigned)yytext[0]);