Update sw script. Rename Context to Emitter.

This commit is contained in:
lzwdgc 2019-05-23 20:04:00 +03:00
parent 57c6947172
commit 1c146ad9e3
2 changed files with 27 additions and 27 deletions

View file

@ -43,7 +43,7 @@
%code requires // forward decl of C++ driver (our parser) in HPP %code requires // forward decl of C++ driver (our parser) in HPP
{ {
#include <Polygon4/DataManager/Schema/Context.h> #include <Polygon4/DataManager/Schema/Emitter.h>
#include <set> #include <set>
} }
@ -52,10 +52,10 @@
{ {
struct MY_PARSER_DRIVER : MY_PARSER struct MY_PARSER_DRIVER : MY_PARSER
{ {
void setContext(Context &&ctx) { context = std::move(ctx); } void setContext(Emitter &&ctx) { context = std::move(ctx); }
const Context &getContext() const { return context; } const Emitter &getContext() const { return context; }
Context context; Emitter context;
std::set<std::string> functions; std::set<std::string> functions;
}; };
} }
@ -82,7 +82,7 @@ struct MY_PARSER_DRIVER : MY_PARSER
conds cond condition_body conds cond condition_body
function_call function_call
%type <Context> condition condition_begin %type <Emitter> condition condition_begin
statements statement statements statement
proc_statements proc_statement proc_statements proc_statement
procedure procedure
@ -114,7 +114,7 @@ global_statements: global_statement
global_statement: function_call global_statement: function_call
{ {
Context ctx; Emitter ctx;
ctx.addLine($1); ctx.addLine($1);
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -123,22 +123,22 @@ global_statement: function_call
| procedure | procedure
{ $$ = std::move($1); } { $$ = std::move($1); }
| R_CURLY_BRACKET | R_CURLY_BRACKET
{ $$ = Context(); } { $$ = Emitter(); }
| END | END
{ $$ = Context(); } { $$ = Emitter(); }
| ERROR_SYMBOL | ERROR_SYMBOL
{ $$ = Context(); } { $$ = Emitter(); }
| POINT | POINT
{ $$ = Context(); } { $$ = Emitter(); }
| STRING | STRING
{ $$ = Context(); } { $$ = Emitter(); }
| R_BRACKET | R_BRACKET
{ $$ = Context(); } { $$ = Emitter(); }
; ;
procedure: procedure_begin proc_statements END procedure: procedure_begin proc_statements END
{ {
Context ctx; Emitter ctx;
ctx.beginBlock($1); ctx.beginBlock($1);
ctx.addWithRelativeIndent($2); ctx.addWithRelativeIndent($2);
ctx.endBlock(); ctx.endBlock();
@ -146,14 +146,14 @@ procedure: procedure_begin proc_statements END
} }
| procedure_begin END | procedure_begin END
{ {
Context ctx; Emitter ctx;
ctx.beginBlock($1); ctx.beginBlock($1);
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }
| procedure_begin L_CURLY_BRACKET statements R_CURLY_BRACKET | procedure_begin L_CURLY_BRACKET statements R_CURLY_BRACKET
{ {
Context ctx; Emitter ctx;
ctx.beginBlock($1); ctx.beginBlock($1);
ctx.addWithRelativeIndent($3); ctx.addWithRelativeIndent($3);
ctx.endBlock(); ctx.endBlock();
@ -177,24 +177,24 @@ proc_statements: proc_statement
; ;
proc_statement: function_call proc_statement: function_call
{ {
Context ctx; Emitter ctx;
ctx.addLine($1); ctx.addLine($1);
$$ = std::move(ctx); $$ = std::move(ctx);
} }
| _PROC function_call | _PROC function_call
{ {
Context ctx; Emitter ctx;
ctx.addLine("_PROC " + $2); ctx.addLine("_PROC " + $2);
$$ = std::move(ctx); $$ = std::move(ctx);
} }
| condition | condition
{ $$ = std::move($1); } { $$ = std::move($1); }
| COLON | COLON
{ $$ = Context(); } { $$ = Emitter(); }
| R_BRACKET | R_BRACKET
{ $$ = Context(); } { $$ = Emitter(); }
| ERROR_SYMBOL | ERROR_SYMBOL
{ $$ = Context(); } { $$ = Emitter(); }
; ;
statements: statement statements: statement
@ -210,7 +210,7 @@ statement: proc_statement
{ $$ = std::move($1); } { $$ = std::move($1); }
| END | END
{ {
Context ctx; Emitter ctx;
ctx.addLine("END"); ctx.addLine("END");
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -251,7 +251,7 @@ condition: condition_begin
; ;
condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statements R_CURLY_BRACKET condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statements R_CURLY_BRACKET
{ {
Context ctx; Emitter ctx;
ctx.beginBlock("if (" + $3 + ")"); ctx.beginBlock("if (" + $3 + ")");
ctx.addWithRelativeIndent($6); ctx.addWithRelativeIndent($6);
ctx.endBlock(); ctx.endBlock();
@ -259,7 +259,7 @@ condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statement
} }
| IF L_BRACKET condition_body L_CURLY_BRACKET statements R_CURLY_BRACKET | IF L_BRACKET condition_body L_CURLY_BRACKET statements R_CURLY_BRACKET
{ {
Context ctx; Emitter ctx;
ctx.beginBlock("if (" + $3 + ")"); ctx.beginBlock("if (" + $3 + ")");
ctx.addWithRelativeIndent($5); ctx.addWithRelativeIndent($5);
ctx.endBlock(); ctx.endBlock();
@ -267,7 +267,7 @@ condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statement
} }
| IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET R_CURLY_BRACKET | IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET R_CURLY_BRACKET
{ {
Context ctx; Emitter ctx;
ctx.beginBlock("if (" + $3 + ")"); ctx.beginBlock("if (" + $3 + ")");
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);

6
sw.cpp
View file

@ -42,7 +42,7 @@ void build(Solution &s)
add_exe_with_common("tm_converter"); add_exe_with_common("tm_converter");
add_exe("name_generator"); add_exe("name_generator");
add_exe_with_common("save_loader"); add_exe_with_common("save_loader");
if (s.Settings.TargetOS.Arch == ArchType::x86) if (common.getSettings().TargetOS.Arch == ArchType::x86)
add_exe("unpaker"); // 32-bit only add_exe("unpaker"); // 32-bit only
// not so simple targets // not so simple targets
@ -67,10 +67,10 @@ void build(Solution &s)
path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0"; path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0";
mod_converter += IncludeDirectory(sdk / "include"); mod_converter += IncludeDirectory(sdk / "include");
String cfg = "release"; String cfg = "release";
if (s.Settings.Native.ConfigurationType == ConfigurationType::Debug) if (mod_converter.getSettings().Native.ConfigurationType == ConfigurationType::Debug)
cfg = "debug"; cfg = "debug";
String arch = "x64"; String arch = "x64";
if (s.Settings.TargetOS.Arch == ArchType::x86) if (mod_converter.getSettings().TargetOS.Arch == ArchType::x86)
arch = "x86"; arch = "x86";
mod_converter += LinkLibrary(sdk / ("lib/vs2015/" + arch + "/" + cfg + "/libfbxsdk-md.lib")); mod_converter += LinkLibrary(sdk / ("lib/vs2015/" + arch + "/" + cfg + "/libfbxsdk-md.lib"));
} }