From: Michael Urman Date: Wed, 30 May 2001 21:39:53 +0000 (-0000) Subject: Add error rule for all instructions. X-Git-Tag: v0.1.0~464 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=792bb9a471eabac66ef6502b5dd15ccb9b60060c;p=yasm Add error rule for all instructions. svn path=/trunk/yasm/; revision=47 --- diff --git a/modules/parsers/nasm/gen_instr.pl b/modules/parsers/nasm/gen_instr.pl index 86d4bb2c..9f9af1c8 100755 --- a/modules/parsers/nasm/gen_instr.pl +++ b/modules/parsers/nasm/gen_instr.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $Id: gen_instr.pl,v 1.6 2001/05/30 07:26:28 mu Exp $ +# $Id: gen_instr.pl,v 1.7 2001/05/30 21:39:53 mu Exp $ # Generates bison.y and token.l from instrs.dat for YASM # # Copyright (C) 2001 Michael Urman @@ -449,6 +449,13 @@ sub output_yacc ($@) print GRAMMAR action (@$EAX, $count++); } + # print error action + # ASSUMES: at least one previous action exists + print GRAMMAR " | \Uins_$instrname\E error {\n"; + print GRAMMAR " Error (ERR_EXP_SYNTAX, (char *)NULL);\n"; + print GRAMMAR " }\n"; + + # terminate the rule print GRAMMAR ";\n"; } } diff --git a/src/gen_instr.pl b/src/gen_instr.pl index 86d4bb2c..9f9af1c8 100755 --- a/src/gen_instr.pl +++ b/src/gen_instr.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $Id: gen_instr.pl,v 1.6 2001/05/30 07:26:28 mu Exp $ +# $Id: gen_instr.pl,v 1.7 2001/05/30 21:39:53 mu Exp $ # Generates bison.y and token.l from instrs.dat for YASM # # Copyright (C) 2001 Michael Urman @@ -449,6 +449,13 @@ sub output_yacc ($@) print GRAMMAR action (@$EAX, $count++); } + # print error action + # ASSUMES: at least one previous action exists + print GRAMMAR " | \Uins_$instrname\E error {\n"; + print GRAMMAR " Error (ERR_EXP_SYNTAX, (char *)NULL);\n"; + print GRAMMAR " }\n"; + + # terminate the rule print GRAMMAR ";\n"; } } diff --git a/src/parsers/nasm/gen_instr.pl b/src/parsers/nasm/gen_instr.pl index 86d4bb2c..9f9af1c8 100755 --- a/src/parsers/nasm/gen_instr.pl +++ b/src/parsers/nasm/gen_instr.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $Id: gen_instr.pl,v 1.6 2001/05/30 07:26:28 mu Exp $ +# $Id: gen_instr.pl,v 1.7 2001/05/30 21:39:53 mu Exp $ # Generates bison.y and token.l from instrs.dat for YASM # # Copyright (C) 2001 Michael Urman @@ -449,6 +449,13 @@ sub output_yacc ($@) print GRAMMAR action (@$EAX, $count++); } + # print error action + # ASSUMES: at least one previous action exists + print GRAMMAR " | \Uins_$instrname\E error {\n"; + print GRAMMAR " Error (ERR_EXP_SYNTAX, (char *)NULL);\n"; + print GRAMMAR " }\n"; + + # terminate the rule print GRAMMAR ";\n"; } }