more FOO_TRAP macros
This commit is contained in:
parent
738410da8c
commit
1ef640a8fe
3 changed files with 79 additions and 8 deletions
|
|
@ -14,6 +14,9 @@ static std::string strip(const char *p, const char *q)
|
|||
return std::string(p,q);
|
||||
}
|
||||
|
||||
bool preambleRequested = true;
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%option noyywrap
|
||||
|
|
@ -26,7 +29,10 @@ static std::string strip(const char *p, const char *q)
|
|||
using token = hp::token;
|
||||
atBOL = false;
|
||||
|
||||
^"#if !defined(_"[A-Za-z0-9_]+_H_")"$ BEGIN(preamble);
|
||||
if(preambleRequested) BEGIN(preamble);
|
||||
preambleRequested = false;
|
||||
|
||||
^"#if !defined(_"[A-Za-z0-9_]+_")"$ BEGIN(preamble);
|
||||
|
||||
<preamble>^"namespace Executor" BEGIN(INITIAL);
|
||||
<preamble>.|\n ;
|
||||
|
|
@ -48,6 +54,7 @@ static std::string strip(const char *p, const char *q)
|
|||
"*" return token::STAR;
|
||||
"=" return token::ASSIGN;
|
||||
":" return token::COLON;
|
||||
"::" return token::DOUBLECOLON;
|
||||
"<<" return token::SHIFTLEFT;
|
||||
">>" return token::SHIFTRIGHT;
|
||||
"==" return token::EQUAL;
|
||||
|
|
@ -79,12 +86,23 @@ static std::string strip(const char *p, const char *q)
|
|||
"GUEST_STRUCT" return token::GUEST_STRUCT;
|
||||
"UPP" return token::UPP;
|
||||
"LowMemGlobal" return token::LOWMEMGLOBAL;
|
||||
"DISPATCHER_TRAP" return token::DISPATCHER_TRAP;
|
||||
"PASCAL_TRAP" return token::PASCAL_TRAP;
|
||||
"PASCAL_SUBTRAP" return token::PASCAL_SUBTRAP;
|
||||
"PASCAL_FUNCTION" return token::PASCAL_FUNCTION;
|
||||
"FOURCC" return token::FOURCC;
|
||||
|
||||
"DISPATCHER_TRAP" return token::DISPATCHER_TRAP;
|
||||
"EXTERN_DISPATCHER_TRAP" return token::EXTERN_DISPATCHER_TRAP;
|
||||
"PASCAL_TRAP" return token::PASCAL_TRAP;
|
||||
"PASCAL_SUBTRAP" return token::PASCAL_SUBTRAP;
|
||||
"PASCAL_FUNCTION" return token::PASCAL_FUNCTION;
|
||||
"REGISTER_TRAP" return token::REGISTER_TRAP;
|
||||
"REGISTER_TRAP2" return token::REGISTER_TRAP2;
|
||||
"REGISTER_FLAG_TRAP" return token::REGISTER_FLAG_TRAP;
|
||||
"REGISTER_2FLAG_TRAP" return token::REGISTER_2FLAG_TRAP;
|
||||
"REGISTER_SUBTRAP" return token::REGISTER_SUBTRAP;
|
||||
"REGISTER_SUBTRAP2" return token::REGISTER_SUBTRAP2;
|
||||
"REGISTER_FUNCTION" return token::REGISTER_FUNCTION;
|
||||
"NOTRAP_FUNCTION" return token::NOTRAP_FUNCTION;
|
||||
"NOTRAP_FUNCTION2" return token::NOTRAP_FUNCTION2;
|
||||
|
||||
|
||||
[[:digit:]]+ return hp::make_INTLIT(yytext);
|
||||
0x[[:xdigit:]]+ return hp::make_INTLIT(yytext);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
%token STAR "*";
|
||||
%token ASSIGN "=";
|
||||
%token COLON ":";
|
||||
%token DOUBLECOLON "::";
|
||||
%token SHIFTLEFT "<<";
|
||||
%token SHIFTRIGHT ">>";
|
||||
%token EQUAL "==";
|
||||
|
|
@ -66,9 +67,19 @@
|
|||
%token LOWMEMGLOBAL "LowMemGlobal";
|
||||
|
||||
%token DISPATCHER_TRAP "DISPATCHER_TRAP";
|
||||
%token EXTERN_DISPATCHER_TRAP "EXTERN_DISPATCHER_TRAP";
|
||||
%token PASCAL_TRAP "PASCAL_TRAP";
|
||||
%token PASCAL_SUBTRAP "PASCAL_SUBTRAP";
|
||||
%token PASCAL_FUNCTION "PASCAL_FUNCTION";
|
||||
%token REGISTER_TRAP "REGISTER_TRAP";
|
||||
%token REGISTER_TRAP2 "REGISTER_TRAP2";
|
||||
%token REGISTER_FLAG_TRAP "REGISTER_FLAG_TRAP";
|
||||
%token REGISTER_2FLAG_TRAP "REGISTER_2FLAG_TRAP";
|
||||
%token REGISTER_SUBTRAP "REGISTER_SUBTRAP";
|
||||
%token REGISTER_SUBTRAP2 "REGISTER_SUBTRAP2";
|
||||
%token REGISTER_FUNCTION "REGISTER_FUNCTION";
|
||||
%token NOTRAP_FUNCTION "NOTRAP_FUNCTION";
|
||||
%token NOTRAP_FUNCTION2 "NOTRAP_FUNCTION2";
|
||||
|
||||
%token FOURCC "FOURCC";
|
||||
|
||||
|
|
@ -492,8 +503,6 @@ typedef:
|
|||
}
|
||||
addComment(things.back(), true, $6);
|
||||
}
|
||||
|
||||
| "using" IDENTIFIER "=" "UPP" "<" type "(" argument_list ")" ">"*/
|
||||
;
|
||||
|
||||
%type <YAML::Node> complex_type;
|
||||
|
|
@ -542,12 +551,15 @@ lowmem:
|
|||
|
||||
trap:
|
||||
"DISPATCHER_TRAP" "(" IDENTIFIER "," INTLIT "," IDENTIFIER ")" ";"
|
||||
| "EXTERN_DISPATCHER_TRAP" "(" IDENTIFIER "," INTLIT "," IDENTIFIER ")" ";"
|
||||
| "PASCAL_TRAP" "(" IDENTIFIER "," INTLIT ")" ";"
|
||||
{
|
||||
renameThing("C_"+$3, $3);
|
||||
thingByName($3).begin()->second["trap"] = $5;
|
||||
}
|
||||
| "PASCAL_FUNCTION" "(" IDENTIFIER ")" ";"
|
||||
| "NOTRAP_FUNCTION" "(" IDENTIFIER ")" ";"
|
||||
| "NOTRAP_FUNCTION2" "(" IDENTIFIER ")" ";"
|
||||
| "PASCAL_SUBTRAP" "(" IDENTIFIER "," INTLIT "," INTLIT "," IDENTIFIER ")" ";"
|
||||
{
|
||||
renameThing("C_"+$3, $3);
|
||||
|
|
@ -556,6 +568,47 @@ trap:
|
|||
fun.begin()->second["trap"] = $5;
|
||||
fun.begin()->second["selector"] = $7;
|
||||
}
|
||||
| "REGISTER_TRAP2" "(" IDENTIFIER "," INTLIT "," regcall_conv regcall_extras ")" ";"
|
||||
| "REGISTER_FLAG_TRAP" "("
|
||||
IDENTIFIER "," IDENTIFIER "," IDENTIFIER ","
|
||||
INTLIT ","
|
||||
type_pre type_op "(" argument_list ")" ","
|
||||
regcall_conv regcall_extras ")" ";"
|
||||
| "REGISTER_2FLAG_TRAP" "("
|
||||
IDENTIFIER ","
|
||||
IDENTIFIER "," IDENTIFIER "," IDENTIFIER "," IDENTIFIER ","
|
||||
INTLIT ","
|
||||
type_pre type_op "(" argument_list ")" ","
|
||||
regcall_conv regcall_extras ")" ";"
|
||||
| "REGISTER_SUBTRAP" "(" IDENTIFIER "," INTLIT "," INTLIT "," IDENTIFIER "," regcall_conv regcall_extras ")" ";"
|
||||
|
||||
;
|
||||
|
||||
regcall_conv:
|
||||
IDENTIFIER "(" regcall_args ")"
|
||||
;
|
||||
|
||||
regcall_args:
|
||||
%empty
|
||||
| regcall_args1
|
||||
;
|
||||
|
||||
regcall_args1:
|
||||
regcall_arg
|
||||
| regcall_args1 "," regcall_arg
|
||||
;
|
||||
|
||||
regcall_arg:
|
||||
IDENTIFIER
|
||||
| IDENTIFIER "<" IDENTIFIER ">"
|
||||
| IDENTIFIER "<" INTLIT ">"
|
||||
| IDENTIFIER "<" IDENTIFIER "," IDENTIFIER ">"
|
||||
;
|
||||
|
||||
regcall_extras:
|
||||
%empty
|
||||
| "," IDENTIFIER "<" IDENTIFIER ">"
|
||||
| "," IDENTIFIER "::" IDENTIFIER "<" IDENTIFIER ">"
|
||||
;
|
||||
|
||||
function:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ extern std::unordered_map<std::string, int> names;
|
|||
int main()
|
||||
{
|
||||
yy::HeaderParser parser;
|
||||
|
||||
|
||||
parser.parse();
|
||||
YAML::Emitter yamlout;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue