Verified Commit 1d5c154c authored by Tobias WEBER's avatar Tobias WEBER
Browse files

bugfixes

parent 7cc8aedc
......@@ -73,7 +73,7 @@ include_directories(
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/ext" "${PROJECT_SOURCE_DIR}/ext/qcp"
"${PROJECT_SOURCE_DIR}/../.." "${PROJECT_SOURCE_DIR}/../../ext" "${PROJECT_SOURCE_DIR}/../../ext/qcp"
"${PROJECT_SOURCE_DIR}/cli"
"${Boost_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}/.."
"${Boost_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}/.." "${FLEX_INCLUDE_DIRS}"
"${PROJECT_BINARY_DIR}/parser"
"${QCP_INCLUDE_DIRS}"
)
......
......@@ -59,7 +59,7 @@ real {uinteger}(\.[0-9]*)?|\.[0-9]+
. {
context.PrintError(std::string("Lexer error: Unknown token: \"") + yytext + std::string("\""));
ctx.PrintError(std::string("Lexer error: Unknown token: \"") + yytext + std::string("\""));
}
......
......@@ -41,7 +41,7 @@ void CliParserContext::PrintErrorString(const std::string &err)
void yy::CliParser::error(const std::string &err)
{
context.PrintError(std::string("Parser error: ") + err + std::string("."));
ctx.PrintError(std::string("Parser error: ") + err + std::string("."));
}
void CliParserContext::SetLexerInput(std::istream &istr)
......@@ -49,8 +49,8 @@ void CliParserContext::SetLexerInput(std::istream &istr)
m_lex.switch_streams(&istr/*, &std::cout*/);
}
extern yy::CliParser::symbol_type yylex(CliParserContext &context)
extern yy::CliParser::symbol_type yylex(CliParserContext &ctx)
{
return context.GetLexer().yylex(context);
return ctx.GetLexer().yylex(ctx);
}
// ----------------------------------------------------------------------------
......@@ -44,7 +44,7 @@ protected:
public:
CliLexer(CliParserContext *ctx = nullptr);
virtual yy::CliParser::symbol_type yylex(CliParserContext &context);
virtual yy::CliParser::symbol_type yylex(CliParserContext &ctx);
};
template<class t_real_cli> t_real_cli str_to_real(const std::string& str);
......@@ -500,8 +500,8 @@ public:
#undef YY_DECL
#define YY_DECL yy::CliParser::symbol_type CliLexer::yylex(CliParserContext &context)
extern yy::CliParser::symbol_type yylex(CliParserContext &context);
#define YY_DECL yy::CliParser::symbol_type CliLexer::yylex(CliParserContext &ctx)
extern yy::CliParser::symbol_type yylex(CliParserContext &ctx);
#define yyterminate() return yy::CliParser::token::yytokentype(YY_NULL);
......
......@@ -14,7 +14,7 @@
%code requires { #include "cliparser_types.h" }
%code { #include "cliparser.h" }
%param { CliParserContext &context }
%param { CliParserContext &ctx }
// terminals
......@@ -51,7 +51,7 @@
commands
: commands command
{ context.AddAST($2); }
{ ctx.AddAST($2); }
| /* eps */
{ $$ = nullptr; }
;
......
......@@ -390,13 +390,13 @@ void convert_spacegroup(std::istream& istr, ptree::ptree& prop, const std::strin
}
void convert_table(const char* pcInFile, const char* pcOutFile)
bool convert_table(const char* pcInFile, const char* pcOutFile)
{
std::ifstream istr(pcInFile);
if(!istr)
{
std::cerr << "Cannot open \"" << pcInFile << "\"." << std::endl;
return;
return false;
}
std::vector<std::tuple<std::string, t_mat>> vecPtOps, vecHexPtOps;
......@@ -427,12 +427,22 @@ void convert_table(const char* pcInFile, const char* pcOutFile)
std::cout << "\n";
/*ptree::write_xml(pcOutFile, prop,
std::locale(),
ptree::xml_writer_make_settings('\t', 1, std::string("utf-8")));*/
ptree::write_info(pcOutFile, prop,
std::locale(),
ptree::info_writer_make_settings('\t', 1));
try
{
/*ptree::write_xml(pcOutFile, prop,
std::locale(),
ptree::xml_writer_make_settings('\t', 1, std::string("utf-8")));*/
ptree::write_info(pcOutFile, prop,
std::locale(),
ptree::info_writer_make_settings('\t', 1));
}
catch(const std::exception& ex)
{
std::cerr << "Error in setup tool: " << ex.what() << std::endl;
return false;
}
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment