Respect -a flag in mod converter.

This commit is contained in:
lzwdgc 2018-07-08 22:08:08 +03:00
parent c8da06be5c
commit 541c3a0a89
3 changed files with 58 additions and 19 deletions

View file

@ -64,6 +64,7 @@ try
{
args::ArgumentParser parser("mmo extractor");
args::HelpFlag help(parser, "help", "Display this help menu", { 'h', "help" });
args::Flag af(parser, "a", "All formats", { 'a' });
args::Flag mr(parser, "mr", "AIM Racing MOD file", { "mr" });
args::Positional<std::string> file_path(parser, "file or directory", "MOD_ file or directory with MOD_ files");
parser.Prog(argv[0]);
@ -72,6 +73,8 @@ try
if (mr)
gameType = GameType::AimR;
if (af)
all_formats = true;
p = file_path.Get();
if (fs::is_regular_file(p))

View file

@ -1,4 +1,22 @@
%{
/*
* AIM tm_converter
* Copyright (C) 2015 lzwdgc
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <iostream>
#include <string>
@ -28,16 +46,16 @@
%define api.token.constructor // C++ style of handling variants
%define parse.assert // check C++ variant types
%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>
class ParserDriver;
}
// param to yy::parser() constructor
// the parsing context
%param { ParserDriver &driver }
#include <Polygon4/DataManager/Schema/Context.h>
class ParserDriver;
}
// param to yy::parser() constructor
// the parsing context
%param { ParserDriver &driver }
////////////////////////////////////////
@ -310,7 +328,7 @@ integer: INTEGER
%%
void yy::parser::error(const location_type& l, const std::string& m)
{
driver.error(l, m);
}
void yy::parser::error(const location_type& l, const std::string& m)
{
driver.error(l, m);
}

View file

@ -1,4 +1,22 @@
%{
/*
* AIM tm_converter
* Copyright (C) 2015 lzwdgc
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma warning(disable: 4005)
#include <string>
@ -34,11 +52,11 @@ STRING [[:alpha:]_-][[:alnum:]_-]*
%x user_string
%%
%{
// Code run each time yylex is called.
loc.step();
%%
%{
// Code run each time yylex is called.
loc.step();
%}
#.*/\n ; // ignore comments
@ -49,7 +67,7 @@ STRING [[:alpha:]_-][[:alnum:]_-]*
loc.lines(yyleng);
loc.step();
}
";" return MAKE(SEMICOLON);
":" return MAKE(COLON);
"(" return MAKE(L_BRACKET);