summaryrefslogtreecommitdiff
path: root/tools/d2c/d2c_tok.l
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/d2c_tok.l')
-rw-r--r--tools/d2c/d2c_tok.l40
1 files changed, 8 insertions, 32 deletions
diff --git a/tools/d2c/d2c_tok.l b/tools/d2c/d2c_tok.l
index 08562ce..300508d 100644
--- a/tools/d2c/d2c_tok.l
+++ b/tools/d2c/d2c_tok.l
@@ -33,9 +33,9 @@ void free_flex_memory(void) ;
%x syntax syntax_name syntax_int syntax_ext
-%x conv_begin conv_content conv_arg conv_arg_binval
+%x conv_begin conv_content
-%x arg arg_binval
+%x arg arg_binval arg_hexval
%x hooks_begin hooks_content
@@ -130,12 +130,12 @@ void free_flex_memory(void) ;
}
}
<conv_content>"=" { return EQ; }
-<conv_content>"(" { BEGIN(conv_arg); return OP; }
+<conv_content>"(" { yy_push_state(arg); return OP; }
-<conv_arg>[A-Za-z_][A-Za-z0-9_]* {
+<arg>[A-Za-z_][A-Za-z0-9_]* {
if (strcmp(yytext, "NOT") == 0) return NOT;
else if (strcmp(yytext, "AND") == 0) return AND_LOG;
else if (strcmp(yytext, "EOR") == 0) return EOR;
@@ -145,45 +145,21 @@ void free_flex_memory(void) ;
return NAME;
}
}
-<conv_arg>[0-9][0-9]* { d2c_lval.integer = atoi(yytext); return NUMBER; }
-<conv_arg>"'" { BEGIN(conv_arg_binval); }
-<conv_arg_binval>[01][01]* { d2c_lval.string = strdup(yytext); return BINVAL; }
-<conv_arg_binval>"'" { BEGIN(conv_arg); }
-<conv_arg>"," { return COMMA; }
-<conv_arg>":" { return COLON; }
-<conv_arg>[ ]+ { }
-<conv_arg>")" { BEGIN(conv_content); return CP; }
-
-
-
-
-
-
-
-
-
-<arg>[A-Za-z_][A-Za-z0-9_]* {
- if (strcmp(yytext, "NOT") == 0) return NOT;
- else if (strcmp(yytext, "AND") == 0) return AND_LOG;
- else if (strcmp(yytext, "EOR") == 0) return EOR;
- else
- {
- d2c_lval.string = strdup(yytext);
- return NAME;
- }
- }
<arg>[0-9][0-9]* { d2c_lval.integer = atoi(yytext); return NUMBER; }
<arg>"'" { BEGIN(arg_binval); }
<arg_binval>[01][01]* { d2c_lval.string = strdup(yytext); return BINVAL; }
<arg_binval>"'" { BEGIN(arg); }
+<arg>"0x" { BEGIN(arg_hexval); }
+<arg_hexval>[0-9a-f][0-9a-f]* { d2c_lval.string = strdup(yytext); BEGIN(arg); return HEXVAL; }
<arg>"," { return COMMA; }
<arg>":" { return COLON; }
+<arg>"&" { return AND_LOG; }
<arg>[ ]+ { }
+<arg>"(" { yy_push_state(arg); return OP; }
<arg>")" { yy_pop_state(); return CP; }
-
<encoding_content>"@hooks" { BEGIN(hooks_begin); return HOOKS; }
<hooks_begin>[ ]+ { }
<hooks_begin>"{" { BEGIN(hooks_content); }