Modified the syntax of writing real-valued literals with the DSL. Casts are not needed any more: f.ex. 1.0 is implicitly cast to AcReal. The syntax is now more consistent: reals must be explicitly written as a.b, where a and b are some integers. IMPORTANT: Previously the shorthands a. and .b were allowed, not anymore. Using those shorthands will result in a compilation error
This commit is contained in:
@@ -395,16 +395,29 @@ traverse(const ASTNode* node)
|
||||
// Do a regular translation
|
||||
if (translate(node->token))
|
||||
printf("%s ", translate(node->token));
|
||||
if (node->buffer)
|
||||
printf("%s ", node->buffer);
|
||||
if (node->buffer) {
|
||||
if (node->type == NODE_REAL_NUMBER) {
|
||||
printf("%s(%s) ", translate(SCALAR),
|
||||
node->buffer); // Cast to correct precision
|
||||
}
|
||||
else {
|
||||
printf("%s ", node->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Do a regular translation
|
||||
if (translate(node->token))
|
||||
printf("%s ", translate(node->token));
|
||||
if (node->buffer)
|
||||
printf("%s ", node->buffer);
|
||||
if (node->buffer) {
|
||||
if (node->type == NODE_REAL_NUMBER) {
|
||||
printf("%s(%s) ", translate(SCALAR), node->buffer); // Cast to correct precision
|
||||
}
|
||||
else {
|
||||
printf("%s ", node->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user