Fix up some dodgy spacing
This commit is contained in:
@@ -616,7 +616,7 @@ class ASTFormattedValue : public ASTNode {
|
||||
public:
|
||||
static const char* F_STRING_QUOTE;
|
||||
enum ConversionFlag {
|
||||
NONE=0,
|
||||
NONE=0,
|
||||
STR=1,
|
||||
REPR=2,
|
||||
ASCII=3,
|
||||
@@ -628,7 +628,7 @@ public:
|
||||
m_val(std::move(val)),
|
||||
m_conversion(conversion),
|
||||
m_format_spec(std::move(format_spec))
|
||||
{}
|
||||
{}
|
||||
|
||||
PycRef<ASTNode> val() const { return m_val; }
|
||||
ConversionFlag conversion() const { return m_conversion; }
|
||||
|
54
ASTree.cpp
54
ASTree.cpp
@@ -367,16 +367,16 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
|
||||
}
|
||||
break;
|
||||
case Pyc::BUILD_STRING_A:
|
||||
{
|
||||
// Nearly identical logic to BUILD_LIST
|
||||
ASTList::value_t values;
|
||||
for (int i = 0; i < operand; i++) {
|
||||
values.push_front(stack.top());
|
||||
stack.pop();
|
||||
}
|
||||
stack.push(new ASTJoinedStr(values));
|
||||
}
|
||||
break;
|
||||
{
|
||||
// Nearly identical logic to BUILD_LIST
|
||||
ASTList::value_t values;
|
||||
for (int i = 0; i < operand; i++) {
|
||||
values.push_front(stack.top());
|
||||
stack.pop();
|
||||
}
|
||||
stack.push(new ASTJoinedStr(values));
|
||||
}
|
||||
break;
|
||||
case Pyc::BUILD_TUPLE_A:
|
||||
{
|
||||
ASTTuple::value_t values;
|
||||
@@ -794,33 +794,33 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
|
||||
}
|
||||
break;
|
||||
case Pyc::FORMAT_VALUE_A:
|
||||
{
|
||||
{
|
||||
auto conversion_flag = static_cast<ASTFormattedValue::ConversionFlag>(operand);
|
||||
switch (conversion_flag)
|
||||
{
|
||||
switch (conversion_flag)
|
||||
{
|
||||
case ASTFormattedValue::ConversionFlag::NONE:
|
||||
case ASTFormattedValue::ConversionFlag::STR:
|
||||
case ASTFormattedValue::ConversionFlag::REPR:
|
||||
case ASTFormattedValue::ConversionFlag::ASCII:
|
||||
{
|
||||
auto val = stack.top();
|
||||
stack.pop();
|
||||
stack.push(new ASTFormattedValue(val, conversion_flag, nullptr));
|
||||
}
|
||||
{
|
||||
auto val = stack.top();
|
||||
stack.pop();
|
||||
stack.push(new ASTFormattedValue(val, conversion_flag, nullptr));
|
||||
}
|
||||
break;
|
||||
case ASTFormattedValue::ConversionFlag::FMTSPEC:
|
||||
{
|
||||
auto format_spec = stack.top();
|
||||
stack.pop();
|
||||
auto val = stack.top();
|
||||
stack.pop();
|
||||
stack.push(new ASTFormattedValue(val, conversion_flag, format_spec));
|
||||
}
|
||||
{
|
||||
auto format_spec = stack.top();
|
||||
stack.pop();
|
||||
auto val = stack.top();
|
||||
stack.pop();
|
||||
stack.push(new ASTFormattedValue(val, conversion_flag, format_spec));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unsupported FORMAT_VALUE_A conversion flag: %d\n", operand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Pyc::GET_AWAITABLE:
|
||||
{
|
||||
|
@@ -99,7 +99,7 @@ void OutputString(PycRef<PycString> str, char prefix, bool triple, FILE* F, cons
|
||||
|
||||
// Determine preferred quote style (Emulate Python's method)
|
||||
bool useQuotes = false;
|
||||
if (!parent_f_string_quote) {
|
||||
if (!parent_f_string_quote) {
|
||||
while (len--) {
|
||||
if (*ch == '\'') {
|
||||
useQuotes = true;
|
||||
@@ -110,7 +110,7 @@ void OutputString(PycRef<PycString> str, char prefix, bool triple, FILE* F, cons
|
||||
}
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
useQuotes = parent_f_string_quote[0] == '"';
|
||||
}
|
||||
@@ -162,9 +162,9 @@ void OutputString(PycRef<PycString> str, char prefix, bool triple, FILE* F, cons
|
||||
ch++;
|
||||
}
|
||||
if (!parent_f_string_quote) {
|
||||
if (triple)
|
||||
fputs(useQuotes ? "\"\"\"" : "'''", F);
|
||||
else
|
||||
fputc(useQuotes ? '"' : '\'', F);
|
||||
}
|
||||
if (triple)
|
||||
fputs(useQuotes ? "\"\"\"" : "'''", F);
|
||||
else
|
||||
fputc(useQuotes ? '"' : '\'', F);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user