Print symbol names in the debug.

Also change the prototype to take a const Expression *, I forgot to change the
code there in the const commit.

Change-Id: Iea7b9d9a450533bbae8d9003482ee7bd5f442cd2
This commit is contained in:
Felix Raimundo
2016-04-22 10:56:17 +02:00
parent 4a340aadb6
commit eee52bd7c0
2 changed files with 5 additions and 4 deletions

View File

@@ -1,8 +1,9 @@
#include <poincare/expression.h>
#include <poincare/context.h>
#include <poincare/expression.h>
#include <poincare/symbol.h>
#include <iostream>
void print_expression(Expression * e, int indentationLevel) {
void print_expression(const Expression * e, int indentationLevel) {
if (indentationLevel>0) {
for (int i=0; i<indentationLevel-1; i++) {
std::cout << " ";
@@ -41,7 +42,7 @@ void print_expression(Expression * e, int indentationLevel) {
std::cout << "Subtraction";
break;
case Expression::Type::Symbol:
std::cout << "Symbol";
std::cout << "Symbol(" << ((Symbol*)e)->name() << ")";
break;
case Expression::Type::Tangent:
std::cout << "Tangent";

View File

@@ -1,3 +1,3 @@
#include <poincare/expression.h>
void print_expression(Expression * e, int indentationLevel = 0);
void print_expression(const Expression * e, int indentationLevel = 0);