summaryrefslogtreecommitdiff
path: root/tools/d2c/grammar.y
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/grammar.y')
-rw-r--r--tools/d2c/grammar.y13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/d2c/grammar.y b/tools/d2c/grammar.y
index ec7da60..063d22b 100644
--- a/tools/d2c/grammar.y
+++ b/tools/d2c/grammar.y
@@ -138,6 +138,7 @@ YY_DECL;
%token COPYRIGHT
%token TITLE
%token INS_NAME INS_SEP INS_DETAILS
+%token DESC
%token ENCODING
%token TYPE NUMBER
@@ -167,10 +168,12 @@ YY_DECL;
input : name encodings { if (!dump_all_routines_using_coder(coder)) YYABORT; }
+ | name desc encodings { if (!dump_all_routines_using_coder(coder)) YYABORT; }
name : COPYRIGHT TITLE INS_NAME { save_notes_for_coder(coder, $1, $3, '\0', NULL); }
| COPYRIGHT TITLE INS_NAME INS_SEP INS_DETAILS { save_notes_for_coder(coder, $1, $3, $4, $5); }
+desc : DESC RAW_LINE
encodings : /* empty */
| encoding encodings
@@ -273,7 +276,8 @@ static void show_usage(const char *argv0)
printf("\t-a | --arch <string>\t\tDefine the archicture to handle.\n");
printf("\t-H | --header <string>\t\tSet the base of the #ifndef / #define game.\n");
printf("\t-e | --encoding <none|string>\tDefine encoding prefixes for files.\n");
- printf("\t-m | --macro <string>\t\tRegister some conversion functions.\n");
+ printf("\t-M | --macro <string>\t\tRegister some conversion functions.\n");
+ printf("\t-n | --operand <string>\t\tRegister a function producing final operands.\n");
printf("\t-p | --prefix <string>\t\tDefine a prefix to format operand type constants (see -t).\n");
printf("\n");
@@ -375,6 +379,7 @@ int main(int argc, char **argv)
{ "header", required_argument, NULL, 'H' },
{ "encoding", required_argument, NULL, 'e' },
{ "macro", required_argument, NULL, 'M' },
+ { "operand", required_argument, NULL, 'n' },
{ "prefix", required_argument, NULL, 'p' },
{ NULL, 0, NULL, 0 }
@@ -391,7 +396,7 @@ int main(int argc, char **argv)
while (!has_error)
{
- ret = getopt_long(argc, argv, "hi:t:d:a:H:e:M:p:", long_options, &index);
+ ret = getopt_long(argc, argv, "hi:t:d:a:H:e:M:n:p:", long_options, &index);
if (ret == -1) break;
switch (ret)
@@ -456,6 +461,10 @@ int main(int argc, char **argv)
break;
+ case 'n':
+ register_as_operand_producer(get_coder_pre_proc(coder), optarg);
+ break;
+
case 'p':
set_coder_const_prefix(coder, optarg);
break;