mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-18 10:47:57 -05:00
Make script numeric matchers match negative numbers as well
This commit is contained in:
@ -38,6 +38,17 @@ namespace menu
|
||||
{
|
||||
const auto& firstToken = tokens[0].get();
|
||||
|
||||
if (firstToken.m_type == SimpleParserValueType::CHARACTER)
|
||||
{
|
||||
const auto& secondToken = tokens[1].get();
|
||||
if (secondToken.m_type == SimpleParserValueType::INTEGER)
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue())));
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << std::noshowpoint << -firstToken.FloatingPointValue();
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str()));
|
||||
}
|
||||
|
||||
if (firstToken.m_type == SimpleParserValueType::INTEGER)
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue())));
|
||||
if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT)
|
||||
@ -73,6 +84,9 @@ namespace menu
|
||||
{
|
||||
const auto& firstToken = tokens[0].get();
|
||||
|
||||
if (firstToken.m_type == SimpleParserValueType::CHARACTER)
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue())));
|
||||
|
||||
if (firstToken.m_type == SimpleParserValueType::INTEGER)
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue())));
|
||||
return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue()));
|
||||
|
Reference in New Issue
Block a user