mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
Poincare: Add a LeafExpression class
Parent of Symbol, Integer, Float Change-Id: I866ec888b007ea8e486f5627039f934bddcc9ace
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
SFLAGS += -Ipoincare/include
|
||||
objs += $(addprefix poincare/src/,\
|
||||
addition.o\
|
||||
binary_operation.o\
|
||||
commutative_operation.o\
|
||||
context.o\
|
||||
expression.o\
|
||||
float.o\
|
||||
integer.o\
|
||||
fraction.o\
|
||||
expression_lexer.o\
|
||||
expression_parser.o\
|
||||
subtraction.o\
|
||||
float.o\
|
||||
fraction.o\
|
||||
integer.o\
|
||||
leaf_expression.o\
|
||||
power.o\
|
||||
product.o\
|
||||
subtraction.o\
|
||||
symbol.o\
|
||||
)
|
||||
objs += $(addprefix poincare/src/layout/,\
|
||||
@@ -31,6 +33,7 @@ tests += $(addprefix poincare/test/,\
|
||||
integer.cpp\
|
||||
product.cpp\
|
||||
simplify.cpp\
|
||||
simplify_addition_integer.cpp\
|
||||
subtraction.cpp\
|
||||
)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef POINCARE_FLOAT_H
|
||||
#define POINCARE_FLOAT_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/leaf_expression.h>
|
||||
|
||||
class Float : public Expression {
|
||||
class Float : public LeafExpression {
|
||||
public:
|
||||
Float(float f);
|
||||
~Float();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef POINCARE_INTEGER_H
|
||||
#define POINCARE_INTEGER_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/leaf_expression.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int32_t native_int_t;
|
||||
typedef uint32_t native_uint_t;
|
||||
typedef uint64_t double_native_uint_t;
|
||||
|
||||
class Integer : public Expression {
|
||||
class Integer : public LeafExpression {
|
||||
public:
|
||||
Integer(native_int_t i);
|
||||
Integer(Integer&& other); // C++11 move constructor
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef POINCARE_SYMBOL_H
|
||||
#define POINCARE_SYMBOL_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include <poincare/leaf_expression.h>
|
||||
|
||||
class Symbol : public Expression {
|
||||
class Symbol : public LeafExpression {
|
||||
public:
|
||||
Symbol(char * name);
|
||||
~Symbol();
|
||||
|
||||
14
poincare/src/leaf_expression.cpp
Normal file
14
poincare/src/leaf_expression.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <poincare/leaf_expression.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
|
||||
int LeafExpression::numberOfOperands() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Expression * LeafExpression::operand(int i) {
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user